Tags, filtering, and SKIP
Lesson lab: Initialization files
This lesson continues in the same lab as the lesson before it. If you don’t have it yet, download it here.
Download ch06-structure-control--initialization-files.zip
Or fetch and unpack it from a terminal in VS Code:
curl -fsSLO https://manykarim.github.io/robotframework-essentials-web/labs/ch06-structure-control--initialization-files.zip && unzip -q ch06-structure-control--initialization-files.zip && rm ch06-structure-control--initialization-files.zipInvoke-WebRequest https://manykarim.github.io/robotframework-essentials-web/labs/ch06-structure-control--initialization-files.zip -OutFile ch06-structure-control--initialization-files.zip; Expand-Archive ch06-structure-control--initialization-files.zip -DestinationPath .; Remove-Item ch06-structure-control--initialization-files.zipOpen the folder in VS Code with code rfe-ch06-structure-control--initialization-files (or File → Open Folder…) and accept the recommended RobotCode and Python extensions. Then set it up:
uv syncpython3 -m venv .venvsource .venv/bin/activatepip install -r requirements.txtpython -m venv .venv.venv\Scripts\Activate.ps1pip install -r requirements.txtKeep the environment active in every terminal where you run lesson commands.
poetry install --no-rootPython 3.13 or newer is required; uv installs it when it is missing.
Open in browserNo setup? Try the lab right here: its files, an editor and a terminal, running in your browser.
What's inside
Directoryrfe-ch06-structure-control--initialization-files/
Directory.vscode/
- extensions.json
Directorychecks/
Directorycatalog/
- catalog.robot
Directorysmoke/
- smoke.robot
- .gitignore
- .python-version
- LAB.md
- pyproject.toml
- README.md
- requirements.txt
- uv.lock
Tags label tests so you can select them at run time. [Tags] smoke
marks a test; robot --include smoke runs only tagged tests, --exclude drops
them, and patterns like smokeANDfast combine tags. Some tags are reserved
(e.g. robot:skip).
SKIP records a verdict that is neither pass nor fail. The Skip keyword
skips from inside a test; --skiponfailure turns failures of chosen tags into
skips.
Task 1 — Tag your tests and skip one
Section titled “Task 1 — Tag your tests and skip one”Goal: create checks/tagged.robot with a smoke-tagged test, a slow-tagged
test, and a third that skips itself.
Here is the same idea over different tests. Adapt the names and tags.
Worked example — adapt it, don’t copy it
*** Test Cases ***Fast Login [Tags] smoke Log quick
Full Report [Tags] slow Log thorough
Pending Feature Skip Not built yetDone when
Smoke Check carries the smoke tag and the suite uses Skip.
Hint 1
Give each test a [Tags] setting as its first line, e.g. [Tags] smoke.
Hint 2
Add a third test whose body is Skip Not implemented yet — it records a skip,
not a failure.
Solution
*** Test Cases ***Smoke Check [Tags] smoke Log fast check
Slow Check [Tags] slow Log slower check
Not Ready Yet Skip Not implemented yetTask 2 — Run only the smoke tests with –include
Section titled “Task 2 — Run only the smoke tests with –include”Filter the run to the smoke tag:
uv run robot --include smoke checksrobot --include smoke checkspoetry run robot --include smoke checksOnly the smoke-tagged test runs — the others are filtered out before execution:
Done when
the last command filtered with --include.
Check your understanding
Quick recall. Your first answer stays in this browser; the quiz never blocks your progress.
How do you run only tests tagged
smoke?--include smokeselects tagged tests;--excludedrops them. Patterns likesmokeANDfastcombine tags.Show the answer
Answer:
robot --include smoke—--include smokeselects tagged tests;--excludedrops them. Patterns likesmokeANDfastcombine tags.The
Skipkeyword…Skip(or--skiponfailure) records a SKIP verdict — the test is neither passed nor failed.Show the answer
Answer: marks the test skipped, neither pass nor fail —
Skip(or--skiponfailure) records a SKIP verdict — the test is neither passed nor failed.
Key terms
- [Tags]concept
- Label a test; filter runs with
--include/--excludeand tag patterns. - Skipkeyword
- Marks a test skipped (not pass, not fail); also
--skiponfailureand[Tags] robot:skip.