Skip to content

Continue on failure

Chapter lab: Running with confidencech23-running-with-confidence.zip · 15 KB

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

Download ch23-running-with-confidence.zip

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

Terminal window
curl -fsSLO https://manykarim.github.io/robotframework-essentials-web/labs/ch23-running-with-confidence.zip && unzip -q ch23-running-with-confidence.zip && rm ch23-running-with-confidence.zip

Open the folder in VS Code with code rfe-ch23-running-with-confidence (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-ch23-running-with-confidence/
    • Directory.vscode/
      • extensions.json
    • Directorychecks/
      • alpha.robot
      • beta.robot
      • unformatted.robot
    • .gitignore
    • .python-version
    • LAB.md
    • pyproject.toml
    • README.md
    • requirements.txt
    • uv.lock

By default a test stops at its first failed keyword — everything after it is skipped. Often that is what you want. But sometimes you want to check several things and see every problem in one run: a form with many fields, a config with many settings, a page with many elements.

The robot:continue-on-failure tag keeps a test running past failures and reports them all together. (The Run Keyword And Continue On Failure keyword does the same for a single step.)

Edit

Goal: create checks/audit.robot with a test tagged robot:continue-on-failure that makes several assertions — more than one of them failing — so the run reports all the failures, not just the first.

Here is the same idea with different assertions. Adapt it so at least two checks fail.

Worked example — adapt it, don’t copy it

*** Test Cases ***
Config Check Reports All
[Tags] robot:continue-on-failure
Should Be Equal on on
Should Be Equal yes no
Should Be Equal 1 2

Done when

the test Audit Reports Every Problem reports more than one failure.

Hint 1

Tag the test so it keeps going: [Tags] robot:continue-on-failure.

Hint 2

Make several assertions with more than one wrong, e.g. Should Be Equal left right and Should Be Equal up down — both are reported, not just the first.

Solution
*** Test Cases ***
Audit Reports Every Problem
[Tags] robot:continue-on-failure
Should Be Equal ${1} ${1}
Should Be Equal left right
Should Be Equal up down

Task 2 — Run it and read the combined failure

Section titled “Task 2 — Run it and read the combined failure”
Run

Run it:

Terminal window
uv run robot checks/audit.robot
Terminal window
robot checks/audit.robot
Terminal window
poetry run robot checks/audit.robot

The test fails once, but the message collects every failed check:

uv run robot checks/audit.robotrobot checks/audit.robotpoetry run robot checks/audit.robot
==============================================================================
Audit
==============================================================================
Audit Reports Every Problem | FAIL |
Several failures occurred:
 
1) left != right
 
2) up != down
------------------------------------------------------------------------------
1 test, 0 passed, 1 failed
==============================================================================

You fix them all in one pass instead of one run per failure.

Done when

the run reports all the failures together.

Check your understanding

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

  1. By default, a test stops…

    Show the answer

    Answer: at the first failed keyword — Execution halts at the first failure; the robot:continue-on-failure tag makes it keep going.

  2. Why continue on failure?

    Show the answer

    Answer: to see every problem in one run (e.g. a multi-field validation) — It collects all failures together so you can fix them in one pass.

Key terms

robot:continue-on-failureconcept
Tag that keeps a test running past failures and reports them all.
Run Keyword And Continue On Failurekeyword
Continue past a single failing step.

All terms in the glossary →