Skip to content

A tagged smoke suite

Chapter lab: Robustnessch10-web-robustness.zip · 27 KB

This lesson continues in the same lab as the lesson before it. If you don’t have it yet, download it here.

Download ch10-web-robustness.zip

Or fetch and unpack it from a terminal in VS Code:

Terminal window
curl -fsSLO https://manykarim.github.io/robotframework-essentials-web/labs/ch10-web-robustness.zip && unzip -q ch10-web-robustness.zip && rm ch10-web-robustness.zip

Open the folder in VS Code with code rfe-ch10-web-robustness (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.

Also needed for this lab

Install Node.js (an LTS release), then run once — it downloads a browser engine (large):

Terminal window
uv run rfbrowser init chromium
Terminal window
rfbrowser init chromium
Terminal window
poetry run rfbrowser init chromium

Start the RF Demo Shop in its own terminal and keep it running while you work:

Terminal window
uv run python demo_app/serve.py
Terminal window
python demo_app/serve.py
Terminal window
poetry run python demo_app/serve.py
What's inside
  • Directoryrfe-ch10-web-robustness/
    • Directory.vscode/
      • extensions.json
    • Directorychecks/
      • smoke.robot
    • Directorydemo_app/
      • api.py
      • serve.py
      • store.py
      • web.py
    • Directoryresources/
      • shop.resource
    • .gitignore
    • .python-version
    • LAB.md
    • pyproject.toml
    • README.md
    • requirements.txt
    • uv.lock

A smoke test is the fast, critical check you run first: is the app up, and does the core journey work? Tag it smoke so you can run only those tests with robot --include smoke before committing to the full suite.

Close Part 2 by writing a tagged reachability check.

Task 1 — Tag a reachability test as smoke

Section titled “Task 1 — Tag a reachability test as smoke”
Edit

Goal: create checks/shop_smoke.robot with one smoke-tagged test that signs primary_user in and confirms the catalog is reachable.

Here is the same tagged reachability check as a different user. Adapt it to primary_user.

Worked example — adapt it, don’t copy it

*** Settings ***
Library Browser
Resource ../resources/shop.resource
*** Test Cases ***
Reviewer Can Reach The Shop
[Tags] smoke
New Browser chromium headless=True
New Context
New Page ${BASE_URL}/login
Fill Text data-testid=login-username reviewer_user
Fill Text data-testid=login-password learning-password
Click data-testid=login-submit
Get Text data-testid=catalog-title contains Catalog
Close Browser

Done when

Shop Is Reachable carries the smoke tag.

Hint 1

Give the test a [Tags] smoke line first so --include smoke selects it.

Hint 2

Sign in as primary_user and confirm you arrived with Get Text data-testid=catalog-title contains Catalog.

Solution
*** Settings ***
Library Browser
Resource ../resources/shop.resource
*** Test Cases ***
Shop Is Reachable
[Tags] smoke
New Browser chromium headless=True
New Context
New Page ${BASE_URL}/login
Fill Text data-testid=login-username primary_user
Fill Text data-testid=login-password learning-password
Click data-testid=login-submit
Get Text data-testid=catalog-title contains Catalog
Close Browser
Run

Run only the smoke tests:

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

Done when

the smoke test passes — the shop is up and the core journey works.

That closes Part 2. Part 3 steps away from the browser to test an API directly — the same Robot Framework, with faster feedback and no page to render.

Check your understanding

Quick recall. Your first answer stays in this browser; the quiz never blocks your progress.

  1. Why tag a test smoke?

    Show the answer

    Answer: so you can run just the fast, critical checks with --include smoke — A smoke tag lets you run the critical few quickly — robot --include smoke — before the full suite.

  2. A web smoke test should verify…

    Show the answer

    Answer: the shop is reachable and a signed-in user lands on the catalog — Smoke = the critical path works: the app is up and the core journey (sign in → catalog) succeeds.

Key terms

web smoke testconcept
A fast, tagged check that the app is up and the core journey works.

All terms in the glossary →