Skip to content

Tests and tasks

Chapter lab: Tests, tasks, and reportsch24-tests-tasks-and-reports.zip · 15 KB

This chapter works in a prepared project. Download it before the first task; it unpacks into its own folder.

Download ch24-tests-tasks-and-reports.zip

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

Terminal window
curl -fsSLO https://manykarim.github.io/robotframework-essentials-web/labs/ch24-tests-tasks-and-reports.zip && unzip -q ch24-tests-tasks-and-reports.zip && rm ch24-tests-tasks-and-reports.zip

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

Robot Framework has two identities. Everything so far has been test automation — verifying that software behaves. But the same engine also does RPA (robotic process automation) — automating a process: fulfilling an order, onboarding a user, moving files between systems.

The only difference is intent, and one keyword. A *** Tasks *** section holds tasks instead of test cases — identical syntax, but they do work rather than verify it. Run with --rpa (or just use the *** Tasks *** header), and the console and reports say “task” instead of “test”.

Edit

Goal: create checks/fulfil.robot with a *** Tasks *** section defining a task that automates the steps of fulfilling an order.

Here is the same shape for a different process. Adapt it to order fulfilment.

Worked example — adapt it, don’t copy it

*** Tasks ***
Onboard A User
Log Creating account
Log Sending welcome email
Log Adding to directory

Done when

checks/fulfil.robot defines the task Fulfil The Order.

Hint 1

Use a *** Tasks *** section header (not *** Test Cases ***) — everything else is the same syntax.

Hint 2

Give the task a few steps, e.g. Log Picking items, Log Printing label, Log Marking shipped.

Solution
*** Tasks ***
Fulfil The Order
Log Picking items
Log Printing label
Log Marking shipped
Run

Run it as a task:

Terminal window
uv run robot --rpa checks/fulfil.robot
Terminal window
robot --rpa checks/fulfil.robot
Terminal window
poetry run robot --rpa checks/fulfil.robot

Notice the wording — the tally counts a task, not a test:

uv run robot --rpa checks/fulfil.robotrobot --rpa checks/fulfil.robotpoetry run robot --rpa checks/fulfil.robot
==============================================================================
Fulfil
==============================================================================
Fulfil The Order | PASS |
------------------------------------------------------------------------------
1 task, 1 passed, 0 failed
==============================================================================

Same engine, RPA intent.

Done when

the task Fulfil The Order runs and passes.

Check your understanding

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

  1. A *** Tasks *** section is for…

    Show the answer

    Answer: RPA — automating a process rather than verifying software — Same engine and syntax as tests, but the intent is to do work (RPA) rather than verify it.

  2. How do you run in generic/RPA mode?

    Show the answer

    Answer: robot --rpa — --rpa (or a *** Tasks *** header) runs tasks; reports then say "task" instead of "test".

Key terms

* Tasks *concept
RPA counterpart to *** Test Cases *** — automate a process.
--rpacommand
Run in generic automation (RPA) mode.

All terms in the glossary →