Syntax rules
Lesson lab: Syntax rules
This lesson starts from a fresh lab — download it even if you already have the chapter lab.
Download ch02-first-suite--syntax-rules.zip
Or fetch and unpack it from a terminal in VS Code:
curl -fsSLO https://manykarim.github.io/robotframework-essentials-web/labs/ch02-first-suite--syntax-rules.zip && unzip -q ch02-first-suite--syntax-rules.zip && rm ch02-first-suite--syntax-rules.zipInvoke-WebRequest https://manykarim.github.io/robotframework-essentials-web/labs/ch02-first-suite--syntax-rules.zip -OutFile ch02-first-suite--syntax-rules.zip; Expand-Archive ch02-first-suite--syntax-rules.zip -DestinationPath .; Remove-Item ch02-first-suite--syntax-rules.zipOpen the folder in VS Code with code rfe-ch02-first-suite--syntax-rules (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-ch02-first-suite--syntax-rules/
Directory.vscode/
- extensions.json
Directorychecks/
- first_suite.robot
- .gitignore
- .python-version
- LAB.md
- pyproject.toml
- README.md
- requirements.txt
- uv.lock
Robot Framework’s syntax has a few rules that trip up newcomers, and all of them are about spacing and lines:
- Separation — two or more spaces (or a tab) separate cells. A single space is part of the text.
- Continuation —
...at the start of a line continues the previous line. - Comments —
#starts a comment to end of line. - Escaping —
\escapes a special character;${SPACE}is a deliberate single space.
This chapter’s workspace has a broken suite at checks/first_suite.robot: its
cells are separated by a single space, so Robot Framework reads each line as one
long keyword name and cannot find it. Download this lesson’s lab, then repair it.
Task 1 — Fix the cell separation in the broken suite
Section titled “Task 1 — Fix the cell separation in the broken suite”Open checks/first_suite.robot. Each line uses single spaces. Widen the gap
between every keyword and its arguments to two or more spaces:
*** Test Cases ***Greeting Reads Clean Log Robot Framework is running Should Be Equal apples applesDone when
the suite now calls the Log and Should Be Equal keywords.
Task 2 — Run the repaired suite green
Section titled “Task 2 — Run the repaired suite green”Run it:
uv run robot checksrobot checkspoetry run robot checksDone when
the test Greeting Reads Clean passes.
Check your understanding
Quick recall. Your first answer stays in this browser; the quiz never blocks your progress.
How does Robot Framework separate a keyword from its arguments?
Cells are separated by two or more spaces. A single space is part of the text, so
Log Hellois read as one keyword name.Show the answer
Answer: Two or more spaces (or a tab) — Cells are separated by two or more spaces. A single space is part of the text, so
Log Hellois read as one keyword name.How do you continue a long value onto the next line?
The continuation marker
...begins a line that continues the previous one.Show the answer
Answer:
...at the start of the line — The continuation marker...begins a line that continues the previous one.
Key terms
- cell separationconcept
- Two or more spaces (or a tab) separate cells; a single space is literal text.
- ... (continuation)concept
- Continues the previous line's value onto a new line.