Command-Line Selection, Tag Expressions, Reruns, and Execution Profiles: Configuration, Design Patterns, and Trade-Offs
Choose deliberately among CLI flags, argument files, tags, name selection, reruns, and optional RobotCode profiles by tracing precedence, identity, evidence, portability, and CI trade-offs.
Learning objectives
- Choose CLI flags, argument files, tags, name selection, or external profiles based on observable ownership and precedence.
- Explain include/exclude versus skip and failed-only rerun versus full rerun as evidence decisions.
- Design project-root command contracts that avoid cwd-sensitive surprises.
- Evaluate RobotCode profiles without mislabeling them as Robot Framework core.
- Connect selection design to parallelism, CI reproducibility, privacy, and runtime cost.
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. The design principle: minimize invisible configuration
The cheapest command is not always the shortest command. A short wrapper with hidden defaults can be harder to diagnose than a longer explicit invocation. A good execution interface answers five questions quickly: what source is parsed, what selectors apply, what configuration values differ, where outputs go, and what layer supplied each option.
2. Decision table
| Choice | Prefer when | Avoid when | Primary risk |
|---|---|---|---|
| Direct CLI flags | Ad-hoc debugging or a small, visible command | The same long option set is copied everywhere | Drift between copies |
| Argument file | Team needs a pure-core repeatable Robot command | Wrapper-specific features are needed | cwd-sensitive paths and precedence |
| Tag selection | Capability/risk/execution class cuts across directories | Tags are being used as mutable environment values | Semantic tag sprawl |
| Directory/suite selection | Ownership aligns with project structure | One slice spans many suites | Reorganizing files changes operational slices |
--skip |
Review needs explicit SKIP evidence | You merely want to shrink the execution set | Skip counts mistaken for coverage |
--exclude |
The slice intentionally omits a class | Auditors expect to see non-run items | Omitted tests become invisible |
--rerunfailed |
A controlled follow-up to a retained failed run | Source identity changed or failure cause is unknown | False-green normalization |
| RobotCode profile | Team already standardizes on RobotCode and wants layered profiles | Only Robot Framework is guaranteed installed | External precedence/tool dependency |
3. CLI flags versus argument files
Direct CLI is ideal while exploring because every option is visible
in shell history. An argument file becomes valuable when the same
options are a named team contract. Robot Framework inserts the file
contents exactly where --argumentfile appears, so
precedence still has an order.
# defaults.args
--outputdir results/default
--variable TARGET_ENV:local
tests
# Later CLI value overrides the earlier single-valued outputdir.
python -m robot -A defaults.args --outputdir results/incident
Because an argument file can also contain the data source, decide
whether your team treats “project root” as part of the contract. If
yes, document it and enforce it in launch scripts. If not, use
normalized paths rather than a brittle chain of ../../.
5. Include/exclude versus skip semantics
Use include/exclude to define the execution population. Use skip to preserve an explicit non-execution status. In CI, the policy question is whether skipped tests count as acceptable unavailable coverage, debt, or a gate failure. Robot records status; your release governance interprets it.
Anti-pattern: turning failing tests into
--skip or --skiponfailure merely to make
the pipeline green. That changes truth semantics, not reliability.
6. Failed-only rerun versus full rerun
| Question | Failed-only rerun | Full rerun |
|---|---|---|
| Cost | Low when few tests fail | Re-executes full slice |
| Identity dependence | Strong: prior failed test names must map to current source | Less dependent on prior output identity |
| Diagnostic value | Good for confirming a specific fix/transient condition | Good when shared fixture/environment invalidated the whole run |
| Risk | Pass-after-rerun can normalize flakiness | Can hide which original failure triggered rerun if evidence is discarded |
| Evidence rule | Retain original + rerun + merged derivative | Retain both full runs and reason for rerun |
A rerun is never a generic retry loop. It is a second execution with provenance. If the failure is caused by a shared environment outage, a full rerun after documented recovery may be more honest than selecting only failures. If one deterministic defect is fixed, failed-only rerun may be appropriate.
7. Many environment flags versus one documented command
Variables belong to configuration, but a forest of
--variable flags can become unreviewable. Prefer a
small set of explicit high-level inputs and derive implementation
details in a variable file/resource/library at the right boundary.
Never encode real secrets in argument files. CI should inject secret
values through its secret system into a Secret-aware or otherwise
protected runtime path, with logging reviewed separately.
8. Optional RobotCode profile layer, clearly separated
RobotCode 2.7.0 provides robot.toml and profiles. It is
useful when a team wants structured profile inheritance and a single
tool across editor and CLI, but it changes the dependency contract:
Python 3.10+ and RobotCode runner support are now required.
# robot.toml -- optional external layer
paths = ["tests"]
output-dir = "results/default"
[profiles.smoke]
description = "Fast local smoke slice"
extend-includes = ["smoke"]
[profiles.regression]
description = "Regression without slow"
extend-includes = ["regression"]
extend-excludes = ["slow"]
robotcode profiles list
robotcode profiles show smoke
robotcode -p smoke run
RobotCode configuration loading is layered: global user
configuration, project pyproject.toml, project
robot.toml, then project-local
.robot.toml. Profiles are then resolved by their
precedence/order rules. Therefore “works on my machine” can come
from a local override. Team CI should either forbid unexpected local
config or explicitly display resolved configuration.
9. Committed profile versus local override
| File | Recommended ownership | Typical role |
|---|---|---|
robot.toml |
Committed team configuration | Named repeatable profiles and shared defaults |
.robot.toml |
Ignored local override | Developer-specific paths/preferences; never CI truth by accident |
~/.robot.toml |
User machine | Global personal defaults |
*.args |
Committed if it defines a core contract | Pure Robot Framework repeatable options |
Do not place required CI behavior only in .robot.toml.
Do not put credentials in any of these committed/plain-text files.
For a production incident, capture the resolved RobotCode profile
and the exact command, not merely the profile name.
10. Runtime and parallelism trade-offs
Selection can reduce Robot keyword/external-system time, but it does not necessarily reduce parse/import cost unless file parsing itself is narrowed. A smoke tag still requires Robot to discover relevant source. Later, Pabot will add worker scheduling and resource contention; do not confuse “selected 50 tests” with “50 tests are safe to run concurrently.” Outputs from different workers/profiles also need distinct directories before merging.
11. Worked scenario: choose a release contract
A team has 900 tests in 30 suites. Pull requests need about 40 smoke
tests, nightlies need 500 regression tests but not 80 slow ones, and
developers need one-test debugging. A robust design is: tags for
smoke/regression/slow; direct --test for one-off
debugging; committed core argument files for CI if no extra tool is
desired; or committed RobotCode profiles if RobotCode is an explicit
team dependency. Environment is supplied via variables, outputs use
unique directories, and failed-only reruns are a separately governed
follow-up.
Knowledge check
Why can a committed argument file be preferable to a shell alias?
It is Robot Framework core, reviewable in the repository, and its exact options can be reproduced across shells without relying on a developer-specific alias.
Why might a full rerun be more truthful than --rerunfailed after a shared test environment outage?
Because the environment outage may have invalidated all results or fixtures, not only the tests that happened to fail. A full rerun preserves a coherent population after recovery.
A developer has a local .robot.toml that changes output-dir. Why can CI evidence differ even when both say profile smoke?
RobotCode configuration is layered. A local override can change resolved settings; CI may not have that file. Capture/show resolved configuration and keep CI-critical behavior in committed config.
Do tags isolate external state for parallel tests?
No. Tags are metadata/selection. Isolation belongs to the underlying test/library/external resource design and later Pabot/CI worker contracts.
Summary and bridge
The design goal is not maximum configuration sophistication; it is minimum ambiguity. Lesson 4 deliberately breaks selection, rerun identity, cwd assumptions, and profile precedence so you can diagnose the layer that failed without hiding evidence.
References and version anchors
- Robot Framework 7.4.2 User Guide — CLI option syntax, name/tag selection, argument files, reruns, skip/exclude semantics, and result post-processing.
- Robot Framework 7.4.2 on PyPI — stable release and Python compatibility anchor.
- RobotCode configuration, RobotCode CLI reference, and RobotCode 2.7.0 package metadata — optional external layer.
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.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0
Send only Ethereum/ERC-20 compatible assets to this
address.