Chapter 15Lesson 05240–300 min

Checkpoint Lab — Command-Line Selection, Tag Expressions, Reruns, and Execution Profiles

Build and verify three deterministic execution slices, perform a controlled failed-only rerun and merge, and document the command/profile precedence and evidence policy as a production-ready checkpoint.

CheckpointSelection matrixRerun evidenceProfilesCI contract

Checkpoint objectives

  • Predict and verify exact smoke, regression, and environment-variant selection counts.
  • Use one committed core argument file and document its cwd/precedence contract.
  • Create one controlled first failure, preserve it, rerun only the failed test, and merge into a separate derived output.
  • Diagnose one intentionally broken selection expression and one configuration-precedence mistake.
  • Produce a compact evidence packet suitable for CI/release review and bridge to browser integration.

Current compatibility baseline. Verified 2026-08-31: Robot Framework 7.4.2 is the current stable release and requires Python 3.8+; 7.5b1 is a pre-release and is not required. Core examples use python -m robot and python -m robot.rebot so the interpreter is explicit. RobotCode is not Robot Framework core; where shown as an optional profile layer, the pinned example is RobotCode 2.7.0, which requires Python 3.10+ and Robot Framework 5.0+. Mandatory labs do not require RobotCode, Pabot, browsers, containers, CI accounts, or paid services.

1. Checkpoint scenario

You are defining a small release-quality execution interface for the synthetic five-test project from Lesson 2. The team needs three slices: smoke, regression-without-slow, and a qa environment variant. One regression test will fail only when a synthetic flag is enabled. Your job is to prove selection before execution, preserve the failure, perform a controlled failed-only rerun, and document exactly which configuration source wins.

2. Preflight

python --version
python -m robot --version
python -m robot.rebot --version
# Optional only if you choose the RobotCode extension exercise:
robotcode --version
  • Required: Robot Framework 7.4.2 stable for the pinned walkthrough; Python 3.8+.
  • Optional RobotCode exercise: RobotCode 2.7.0, Python 3.10+.
  • No browser, API, database, SSH, Pabot, container, or CI service is required.
  • Use only synthetic TARGET_ENV/FORCE_FAILURE values.

3. Build the disposable project

Recreate the two files from Lesson 2 exactly: tests/service.robot with four tests and tests/environment.robot with one test. Before running, write down these predictions:

Prediction Expected
Total population 5 tests
Smoke slice 2 tests
Regression excluding slow 3 tests
QA environment slice 1 test
Controlled first-failure run 5 selected; exactly 1 FAIL when FORCE_FAILURE=yes
Failed-only rerun Exactly 1 selected; PASS when FORCE_FAILURE=no

4. Create a committed core selection contract

# config/smoke.args
--include smoke
--exclude slow
--variable TARGET_ENV:local
--variable EXPECTED_ENV:local
--outputdir results/smoke
tests

State the precedence contract in a README note: “Run from the project root. Argument-file contents are inserted at -A; explicit later CLI options can override applicable earlier single-valued settings. This file contains no secrets.”

5. Slice A — smoke

python -m robot -A config/smoke.args

Verify: exactly two tests selected and both pass. Capture the console summary and results/smoke/output.xml. If count differs, stop and diagnose before continuing.

6. Slice B — regression without slow

python -m robot --include regression --exclude slow \
  --outputdir results/regression-fast tests

Verify: exactly three tests selected: Health Is Smoke, Invoice Is Regression, and Controlled Failure. All pass with default FORCE_FAILURE=no.

7. Slice C — environment variant

python -m robot --include env \
  --variable TARGET_ENV:qa \
  --variable EXPECTED_ENV:qa \
  --outputdir results/env-qa tests

Verify: one PASS. Record separately that env chose the test while CLI variables configured its synthetic state.

8. Inject and repair a selection defect

# Intentionally wrong for this project.
python -m robot --include smokeANDslow --outputdir results/broken-select tests

Predict zero selected tests, observe the diagnostic, and preserve the command. Repair it to the intended semantics—either smokeNOTslow or --include smoke --exclude slow. Do not add --runemptysuite just to silence the failure.

9. Produce the controlled first failure

python -m robot --variable FORCE_FAILURE:yes \
  --outputdir results/initial --output original.xml tests

Prediction: 5 selected, 4 PASS, 1 FAIL. Verify the failing long name and the message. Record the process return code if your shell/workflow exposes it. Do not overwrite this directory.

10. Failed-only rerun

python -m robot --rerunfailed results/initial/original.xml \
  --variable FORCE_FAILURE:no \
  --outputdir results/rerun --output rerun.xml tests

Prediction: exactly one test selected and it passes. Verify its long name matches the original failure. If more than one test runs, stop and inspect the original output/selection identity.

11. Merge without destroying provenance

python -m robot.rebot --merge \
  --outputdir results/final \
  --output merged.xml \
  --log merged-log.html \
  --report merged-report.html \
  results/initial/original.xml results/rerun/rerun.xml

Prediction: merged result contains five tests and final status PASS. Verification must also assert that results/initial/original.xml and results/rerun/rerun.xml still exist. The merged file is derivative evidence.

12. Precedence exercise

Add --outputdir results/from-args to a small argument file and then invoke Robot with a later --outputdir results/from-cli. Predict which one wins based on insertion order, then verify the created directory. Record the resolved command contract. This is a pure filesystem/output test; no external system changes.

# config/precedence.args
--outputdir results/from-args
--test Health Is Smoke

python -m robot -A config/precedence.args \
  --outputdir results/from-cli tests

13. Optional external RobotCode profile exercise

# robot.toml -- optional; do not confuse with core Robot Framework
paths = ["tests"]
output-dir = "results/robotcode"

[profiles.smoke]
extend-includes = ["smoke"]
variables = { TARGET_ENV = "local", EXPECTED_ENV = "local" }
robotcode profiles show smoke
robotcode -p smoke run

If you perform this optional step, your evidence packet must state RobotCode 2.7.0, Python 3.10+, selected profile, resolved output directory, and whether .robot.toml exists. If RobotCode is absent, skip the exercise; the mandatory course objective is already satisfied by core argument files.

14. Evidence packet

Evidence Required content
Resolved command list Exact commands for smoke, regression, env, first run, rerun, merge
Selection matrix Predicted vs observed counts and names
Configuration sources CLI flags, smoke.args, and optional RobotCode profile
Original failure Path, long name, message, non-zero execution status
Rerun Path, selected failed test identity, PASS result
Merged result Five final tests plus proof both input outputs still exist
Policy note Pass-after-rerun is distinguishable from first-pass success
Security note No credentials/PII in commands, args, logs, or profiles

15. Verification checklist

  • Smoke = 2 PASS.
  • Regression without slow = 3 PASS.
  • QA environment = 1 PASS.
  • Broken smokeANDslow is diagnosed rather than suppressed.
  • Original = 5 selected with exactly 1 FAIL.
  • Rerun = exactly 1 selected and PASS.
  • Merged = 5 final tests and PASS.
  • Original/rerun/merged outputs are three distinct retained artifacts.
  • Argument-file precedence experiment matches the predicted later override.
  • Any RobotCode usage is labeled external and versioned.

16. Cleanup / rollback

Only delete the disposable directory after the evidence packet has been inspected. In a real CI system, retention is governed separately and first-failure artifacts should not be deleted merely because a rerun passed.

cd ..
# PowerShell: Remove-Item -Recurse -Force .\rf-cli-lab
# Bash:       rm -rf ./rf-cli-lab

Knowledge check

The smoke argument file runs three tests in CI but two locally. What should you compare first?

Why is a passing merged result not enough evidence by itself?

A teammate proposes storing ENV=qa as a tag and API_TOKEN as an argument-file variable. What is wrong?

What is the key difference between --exclude slow and --skip slow?

A renamed suite causes --rerunfailed not to find the expected test. What is the safest response?

17. What Chapter 15 adds to the operating model

Your Robot Framework platform now has an explicit execution contract: source root, selectors, variables, argument/profile provenance, output directories, rerun identity, and merge policy. That is the foundation needed before adding browser state. Chapter 16 will introduce SeleniumLibrary and the Playwright-powered Browser library, where selection still matters but each selected test now owns browser/session/context lifecycle and richer evidence.

Next lesson

SeleniumLibrary and Browser Automation Integration: Core Concepts and Mental Model

Continue with SeleniumLibrary and Browser Automation Integration: Core Concepts and Mental Model. It builds directly on the state, evidence, and operating assumptions established here, so carry those constraints forward rather than treating the next page as an isolated topic.

References and version anchors

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.