Tests and tasks
Chapter lab: Tests, tasks, and reports
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:
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.zipInvoke-WebRequest https://manykarim.github.io/robotframework-essentials-web/labs/ch24-tests-tasks-and-reports.zip -OutFile ch24-tests-tasks-and-reports.zip; Expand-Archive ch24-tests-tasks-and-reports.zip -DestinationPath .; Remove-Item ch24-tests-tasks-and-reports.zipOpen 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:
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-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”.
Task 1 — Write a task
Section titled “Task 1 — Write a task”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 directoryDone 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 shippedTask 2 — Run it in RPA mode
Section titled “Task 2 — Run it in RPA mode”Run it as a task:
uv run robot --rpa checks/fulfil.robotrobot --rpa checks/fulfil.robotpoetry run robot --rpa checks/fulfil.robotNotice the wording — the tally counts a task, not a test:
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.
A
*** Tasks ***section is for…Same engine and syntax as tests, but the intent is to do work (RPA) rather than verify it.
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.
How do you run in generic/RPA mode?
--rpa(or a*** Tasks ***header) runs tasks; reports then say "task" instead of "test".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.