Search GimmeJob

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

Test automation learning path

07 · Architecture & capstone

Design a maintainable framework and implement an independent, executable example end to end.

Offline example

The sample in examples/robot-framework/ runs offline on Robot Framework core and standard Python. Its execution path is test → resource keyword → Python library → result artifacts.

Framework architecture, maintainability and the complete mental model

Combine the mechanics into a layered Robot project that remains understandable as it grows.

A maintainable Robot project separates intent, reusable domain actions, technical adapters and environment data.

robot-project/
├── tests/
│   ├── api/
│   └── ui/
├── resources/
│   ├── domain/
│   │   ├── users.resource
│   │   └── orders.resource
│   └── pages/
│       └── login.resource
├── libraries/
│   └── OrderLibrary.py
├── variables/
│   ├── staging.py
│   └── production.py
├── requirements.txt
└── .github/workflows/robot.yml

A test should read roughly as business intent:

*** Test Cases ***
Registered User Can See Order
    [Tags]    smoke    ui
    Given User Exists    Alice
    When User Opens Order    1001
    Then Order Total Should Be    1001    42.50

Do not force BDD words everywhere; the important property is that the test describes behavior while details live below it. Domain resource keywords may call Browser/Requests keywords or Python libraries. Python libraries should encapsulate technical logic, not business stories.

Use suite/test setup for lifecycle, return values/local variables for data flow, tags for selection, metadata for descriptive pairs, listeners for observation, Rebot for result post-processing, and Pabot for parallelism after isolation.

The strongest Robot Framework design is not the one with the most keywords. It is the one where a reader can move from a failing test to the relevant domain keyword and then to the technical implementation without guessing where behavior is hidden.

Key points

  • Keep tests at intent level and technical mechanics below them
  • Give every concern one clear home in the architecture
  • Optimize for traceability from failure to implementation

Common pitfalls

  • Building a keyword layer for every single underlying library call and creating indirection without abstraction

Offline capstone: build and run a layered suite

Exercise end-to-end architecture using a test-owned in-memory inventory.

The runnable reference under examples/robot-framework/ deliberately uses no browser, server or credentials. Its layers are: tests (behavior/oracles), resource keywords (domain API), Python library (state and typed business rules), plus CLI-produced results.

Run from repository root

python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\Activate.ps1
python -m pip install -r examples/robot-framework/requirements.txt
python -m robot --outputdir results examples/robot-framework/tests

Read the suite first

*** Settings ***
Resource    ../resources/inventory.resource
Test Setup    Start With Inventory
Test Teardown    Clean Up Inventory

*** Test Cases ***
Reserve Item Reduces Available Stock
    Reserve Product    notebook    2
    Remaining Stock Should Be    notebook    3

Then read resources/inventory.resource and libraries/Inventory.py. Break the expected stock number or remove Reset Inventory and observe the first informative failure in log.html. Run python -m robot --test 'Rejects Reservation Beyond Stock' --outputdir results examples/robot-framework/tests/inventory.robot to confirm selection.

Definition of done: all tests pass locally, reruns are deterministic, intentional failures fail, teardown clears state, and CI retains output.xml plus HTML reports.

Key points

  • Follow test → keyword → adapter → evidence
  • Use intentional failures to verify test sensitivity

Common pitfalls

  • Calling a reference example complete without running it or examining its failure mode

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 ↗