Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
GimmeJob
Sign in
Test automation · Robot Framework · Chapter 01 / 07

Test automation learning path

01 · Getting started

Start here: installation, execution model, file syntax, variables and safe configuration.

Robot Framework: complete learning path

Robot Framework is a generic keyword-driven automation framework. It is actively maintained in 2026; Robot Framework 7.5 was released on September 14, 2026. It remains especially useful where readable keyword-level tests, mixed Python/keyword teams, reusable domain libraries, embedded or system testing, API testing, and heterogeneous automation matter. For a new code-heavy web-only project, native Playwright with pytest or TypeScript may still be the simpler default; this guide teaches Robot Framework deeply so you can make that choice deliberately.

The path starts with the data format and execution model, then moves through variables, user keywords, control flow, failure handling, setup/teardown, project structure, standard libraries, data-driven testing, Browser Library, API testing, Python extensions, tooling, parallel execution, CI and maintainable architecture. Complete suites are runnable locally; short snippets demonstrate individual constructs and may need the imports or context shown in their chapter. Robot Framework cannot honestly execute inside GimmeJob's restricted browser Python sandbox, so Robot, shell and YAML blocks are rendered as static code rather than showing a misleading Run button.

Execution model, installation and the first suite

Understand what Robot executes before learning the syntax details.

Robot Framework reads plain-text test data, resolves keywords, executes them through the core or imported libraries, and produces machine-readable plus human-readable results. A .robot file is usually a suite; directories form higher-level suites. Tests should describe intent, while reusable keywords and libraries hide implementation mechanics.

Install

python -m venv .venv
# Windows PowerShell: .\.venv\Scripts\Activate.ps1
# Linux/macOS: source .venv/bin/activate
python -m pip install robotframework==7.5

Create first.robot:

*** Variables ***
${ENV}    staging

*** Test Cases ***
Environment Is Staging
    Log    Starting smoke test
    Should Be Equal    ${ENV}    staging

Simple Calculation Works
    ${total}=    Evaluate    10 + 15
    Should Be Equal As Integers    ${total}    25

Run it:

python -m robot --outputdir results first.robot

The console should report 2 tests, 2 passed. The result directory contains output.xml, log.html and report.html. output.xml is the canonical result model used by Robot tooling; the HTML files are generated views for humans.

Use python -m robot rather than relying on a globally installed robot executable when you want to guarantee that the active virtual environment is used.

Key points

  • A suite is executable test data; keywords provide behavior
  • output.xml is the primary result data and HTML files are views
  • Pin the framework version in reproducible projects

Common pitfalls

  • Installing Robot globally and then unknowingly running a different interpreter or version

File format, sections, cells, names and documentation

Learn how Robot parses a file so whitespace and sections stop feeling magical.

Robot test data is tabular even though it looks like indented text. A cell boundary is two or more spaces, a tab, or the pipe-separated format. Indentation is for readability and to show bodies of tests, keywords and control structures, but the parser fundamentally works with cells.

The main sections are *** Settings ***, *** Variables ***, *** Test Cases ***, *** Tasks ***, *** Keywords *** and *** Comments ***. Test suites use either Test Cases or Tasks, not both for normal usage.

*** Settings ***
Documentation    Small syntax example
Library          Collections

*** Variables ***
${USER}          Alice
@{ROLES}         reader    editor

*** Test Cases ***
Readable Test Name
    [Documentation]    A test-level setting starts with square brackets.
    [Tags]    smoke    users
    Log    User=${USER}
    Length Should Be    ${ROLES}    2

*** Keywords ***
Log User
    [Arguments]    ${name}
    Log    ${name}

Keyword and variable matching is forgiving about case, spaces and underscores, but you should still use consistent naming. Treat two-space cell separation as syntax, not formatting. Align columns if it helps reading, but do not depend on visual alignment to express meaning.

Comments can start with # in a cell. Use [Documentation] for durable intent, constraints or rationale that should appear in generated logs and documentation. Avoid comments that merely restate the next keyword.

Key points

  • Two or more spaces separate cells
  • Sections define what each table means
  • Prefer documentation that explains intent or constraints

Common pitfalls

  • Using a single visual space where a new Robot cell was intended

Variables, collections, scopes, types and secrets

Use Robot variables deliberately instead of turning them into hidden global state.

Robot has scalar ${x}, list @{items}, dictionary &{config} and environment %{NAME} syntax. The scalar form can hold any Python object; the prefix mostly controls how a value is expanded when passed to a keyword.

*** Variables ***
${BASE_URL}         https://example.org
@{ROLES}            reader    editor
&{USER}             name=Alice    active=${True}
${RETRIES: int}     3

*** Test Cases ***
Collections And Types
    Log    ${USER}[name]
    Log Many    @{ROLES}
    Should Be Equal As Integers    ${RETRIES}    3

Robot 7.x also has the VAR syntax. Local scope is the default; scope=TEST, SUITE, SUITES or GLOBAL widens visibility. Prefer return values and local variables. Wider scopes are useful for lifecycle state, but they make dependencies less obvious.

*** Test Cases ***
Scoped Value
    VAR    ${token}    abc
    VAR    ${suite_mode}    smoke    scope=SUITE
    Should Be Equal    ${token}    abc

Variable priorities matter: command-line variables can override data-file values, which is useful for environment configuration.

Robot Framework 7.4 introduced secret variables, and 7.5 keeps them available. A Secret prevents the normal string representation from exposing the value in Robot logs, but it does not encrypt the value. Create secrets from environment variables rather than literals:

*** Variables ***
${API_TOKEN: Secret}    %{API_TOKEN}

Do not access ${API_TOKEN.value} in test data unless you intentionally want to expose the underlying value.

Key points

  • ${x} can hold any object; @{x} and &{x} control expansion
  • Prefer local scope and return values over global mutation
  • Secret variables reduce log exposure but are not encryption

Common pitfalls

  • Using suite/global variables as a convenient substitute for explicit keyword inputs

Source registry

10 chapter references
Robot Framework User Guide

Core syntax, variables, control structures, suites, execution, output files and extension APIs

Robot Framework Foundation · Official documentation
Source ↗
Robot Framework Guides

Getting started, project structure, libraries, examples and CI guidance

Robot Framework Foundation · Official guides
Source ↗
Robot Framework releases

Current stable releases, maintenance status and release notes

Robot Framework · Official release history
Source ↗
Robot Framework Standard Libraries

BuiltIn, Collections, String, DateTime, OperatingSystem, Process, XML and other bundled libraries

Robot Framework Foundation · Official documentation
Source ↗
Robot Framework Browser

Playwright-backed web automation, locators, assertions, waiting and browser lifecycle

Robot Framework Browser contributors · Official documentation
Source ↗
Robot Framework RequestsLibrary

HTTP API testing with sessionless and session-based requests

MarketSquare / RequestsLibrary contributors · Official library documentation
Source ↗
Robot Framework Python libraries

Creating custom keywords and libraries in Python

Robot Framework Foundation · Official guide
Source ↗
Libdoc

Generating and inspecting library and resource-file documentation

Robot Framework Foundation · Official documentation
Source ↗
Running tests in parallel with Pabot

Parallel suite/test execution, process count, sharding and shared resources

Robot Framework Foundation · Official guide
Source ↗
Robot Framework in GitHub Actions

Running Robot Framework in CI and preserving reports

Robot Framework Foundation · Official guide
Source ↗