Skip to content

Tags, filtering, and SKIP

Lesson lab: Initialization filesch06-structure-control--initialization-files.zip · 4 KB

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:

Terminal window
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.zip

Open 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:

Terminal window
uv sync
Terminal window
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Keep the environment active in every terminal where you run lesson commands.

Terminal window
poetry install --no-root

Python 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.

Edit

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 yet

Done 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 yet

Task 2 — Run only the smoke tests with –include

Section titled “Task 2 — Run only the smoke tests with –include”
Run

Filter the run to the smoke tag:

Terminal window
uv run robot --include smoke checks
Terminal window
robot --include smoke checks
Terminal window
poetry run robot --include smoke checks

Only the smoke-tagged test runs — the others are filtered out before execution:

uv run robot --include smoke checksrobot --include smoke checkspoetry run robot --include smoke checks
==============================================================================
Checks
==============================================================================
Smoke Check | PASS |
------------------------------------------------------------------------------
Checks | PASS |
==============================================================================
1 test, 1 passed, 0 failed
==============================================================================

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.

  1. How do you run only tests tagged smoke?

    Show the answer

    Answer: robot --include smoke — --include smoke selects tagged tests; --exclude drops them. Patterns like smokeANDfast combine tags.

  2. The Skip keyword…

    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 / --exclude and tag patterns.
Skipkeyword
Marks a test skipped (not pass, not fail); also --skiponfailure and [Tags] robot:skip.

All terms in the glossary →