Skip to content
Tutorials Center
My learning

Topics

Lesson 36 of 36 ยท Projects and Practice

Practice exercises and interview questions

Practice Robot Framework with graded exercises, a debugging checklist, common mistakes and interview questions with answers, plus runnable stand-in drills.

You learn a test tool by using it. This lesson collects graded exercises across the topics of the course, a checklist for debugging a failing test, the mistakes that trip up most beginners, and a set of interview questions with answers. Two small runnable drills in Python let you rehearse the underlying ideas on this site; the Robot exercises themselves need a local install (pip install robotframework).

How to use this page

Read an exercise, try it on your machine before opening the hint, and run it. A passing run is the goal; a failing run that you can explain is nearly as valuable. Use the dry run option (robot --dryrun) to catch typos before you run anything slow.

Practice path

Basics Variables, keywords, templates.
Web and API Locators, waits, sessions.
Structure Resources, layers, tags.
Delivery Reports, CI, parallel.

Do at least one exercise from every group.

1 / 2

Exercises

Level 1: basics

  1. Write a test that creates a list of five numbers with Create List, loops over it with FOR, and uses Should Be True to check every number is positive.
  2. Create a user keyword Greet with an argument ${name} and a default World. Call it with and without an argument and check the returned text with Should Be Equal.
  3. Write three tests tagged smoke, regression and slow. Run only the first two with a tag expression, then everything except slow.
  4. Create a template test that checks Convert To Upper Case on five strings, including an empty one (use ${EMPTY}).

Level 2: libraries and data

  1. Write a Python library Strings.py with is_palindrome and count_vowels, using type hints. Import it and test both with a template.
  2. Store ten users in a CSV file and write a test that reads it with a custom keyword and checks every email contains @. Then try DataDriver so each row becomes its own test.
  3. Generate unique emails using a timestamp. Show in the log that two runs make different ones.
  4. Use a variable file envs/staging.py and envs/test.py, and run the same suite against both with --variablefile.

Level 3: web and API

  1. Open a practice website that allows automation, log in with a test account, and assert the welcome text. Use an explicit wait, not Sleep.
  2. Replace every raw locator in exercise 9 with a variable in a page resource file, then change one locator and notice you edit only one line.
  3. Write an API suite for any public test API that offers fake data: one GET test, one POST test, and a template test for four invalid payloads expecting 400 or 422.
  4. Add a teardown that takes a screenshot (web) or logs the response body (API) when a test fails.

Level 4: architecture and delivery

  1. Restructure exercises 9 and 10 into the layers of Page objects and layered architecture.
  2. Write a listener that counts failed tests and prints them at the end.
  3. Create a GitHub Actions workflow that installs requirements, runs the smoke tests, and uploads results/ even on failure.
  4. Run the suite with pabot --processes 3 and compare the time with a serial run. Which tests clash? Fix them.

A debugging checklist

When a test fails, work through these questions in order:

  1. Read the message in log.html. Which keyword failed, with which arguments?
  2. Reproduce it by running only that test: robot --test "Name" tests/.
  3. Is it the application or the test? Check manually.
  4. Timing? Run it five times. If it passes sometimes, suspect a missing wait or shared data.
  5. Locator? Does the element still exist, and is it unique? Use the browser developer tools to check your selector.
  6. Data? Does the account or record still exist in that state?
  7. Environment? Different URL, version or browser than the one that passed?
  8. Raise the log level (--loglevel DEBUG) and add Log lines.

Use Set Log Level DEBUG and Log Variables temporarily to dump everything the test knows. Remove them afterward.

Common mistakes

Mistake What happens Fix
One space between arguments The line is read as one long keyword name Use two or more spaces (or a tab)
Should Be Equal ${a} 5 with a number Comparing text "5" with the number Should Be Equal As Integers or ${5}
Sleep instead of waits Slow or flaky tests Explicit waits
Tests depend on order Parallel or filtered runs fail Independent tests
Secrets in the repository Leaks Environment variables, CI secrets
Forgetting Close Browser Leftover processes Teardown
Comparing floats exactly 0.1 + 0.2 fails Should Be Equal As Numbers with precision
Using a tab-indented file mixed with spaces Parsing problems Pick one style, use an editor plugin

Drill 1: spacing and argument parsing

Robot splits a row on two or more spaces, which surprises beginners. This stand-in splits lines the same way and shows what a one-space mistake does.

Python Drill: two-space separators

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The second line is a single keyword with no arguments: Robot would report No keyword with name 'Input Text id:username demo' found.

Drill 2: text versus number

Another beginner trap is comparing the string "5" with the number 5. This stand-in shows the difference and the fix.

Python Drill: strings are not numbers

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

In Robot, ${5} is the number and 5 is text; Should Be Equal As Integers converts for you.

Interview questions

1. What is Robot Framework? An open-source, keyword-driven automation framework written in Python, used for acceptance testing and RPA. Tests are written in a tabular, plain-text syntax; extensions come from libraries.

2. What is a keyword? A named, reusable action. Library keywords come from Python (or other languages); user keywords are built from other keywords in a *** Keywords *** section.

3. What are the sections of a .robot file? *** Settings ***, *** Variables ***, *** Test Cases*** (or *** Tasks ***), *** Keywords *** and *** Comments ***.

4. How do you share keywords between files? Resource files imported with Resource; Python libraries with Library.

5. Explain variable types. Scalar ${x}, list @{x}, dictionary &{x}, and environment variables %{NAME}. Variables can be set globally, per suite, per test or locally.

6. How do you run only some tests? --include/--exclude with tags, --test, --suite, or a path. See run options.

7. What are setup and teardown? Keywords run before and after a test or suite. A teardown runs even when the test fails, so it is for cleanup.

8. How does data-driven testing work? [Template] or Test Template run one keyword per row of data; DataDriver loads CSV or Excel. See templates.

9. Selenium or Browser Library? Browser Library uses Playwright, auto-waits and gives faster, less flaky tests; SeleniumLibrary uses WebDriver and suits existing suites and grids.

10. How do you handle dynamic waits? Explicit waits (Wait Until Element Is Visible, Wait Until Keyword Succeeds), never fixed sleeps.

11. What files does a run produce? output.xml, log.html, report.html. rebot regenerates or merges them.

12. How would you run Robot in CI? Install pinned requirements, run headless, save results with if: always(), pass secrets as variables. See CI.

13. How do you speed up a big suite? Independent tests plus pabot, smaller smoke groups for commits, API setup instead of UI setup, and removing sleeps.

14. What are listeners and modifiers? Listeners react to run events; pre-run modifiers change the suite before running. See listeners.

15. How do you deal with flaky tests? Find the cause (timing, data, environment), fix it, and track the rate; retrying only hides the problem.

Final project ideas

  • Automate a to-do web app and its API, and compare the speed of both layers.
  • Build a library that checks CSV exports for column and format rules.
  • Create a dashboard script that reads output.xml files and prints a pass-rate trend.
  • Write BDD scenarios for a bank-transfer rule set (limits, currency, failed transfers).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. How many spaces (at least) separate a keyword from its arguments?

    Two or more spaces (or a tab) separate cells; a single space stays inside a cell.
  2. 2. Why can Should Be Equal ${a} 5 fail when ${a} holds the number 5?

    Arguments written in a test are strings unless converted or written as ${5}.
  3. 3. What is the first step when a test fails?

    The log tells you which keyword failed and why, which is the basis for every other step.
  4. 4. What is the main downside of silently retrying failed tests in CI?

    Hidden retries let unreliable tests stay in the suite and weaken trust in results.

Summary

  • Practice across the groups: basics, libraries and data, web and API, structure and delivery.
  • Debug in order: read the log, reproduce, separate app from test, check timing, locators, data and environment.
  • Most beginner errors are spacing, text versus number, sleeps and shared state.
  • Be ready to explain keywords, resources, variables, templates, waits, results and CI.

Next: return to the Robot Framework track page