Robot Framework interview questions and answers for automation testers
Robot Framework interview questions check whether you can build readable keyword-driven tests that stay maintainable: how a .robot file is organized, how variables and their scopes behave, when to write a keyword in Robot syntax versus Python, and how to run, tag and report a large suite. Expect a test file to read or fix, a question on SeleniumLibrary or Browser library, and scenarios about flaky waits and slow runs.
By Evin JohnPublished 7 min read
Where Robot Framework questions come up
Robot Framework is common in test automation roles at telecom, embedded, banking and enterprise IT teams, and in some RPA work, because the same engine can run tasks instead of tests. Interviewers want to know whether you can design keywords that a manual tester or business analyst can read, and whether you know Python well enough to write the libraries underneath. General browser automation questions, such as locator strategy and waits in WebDriver, are on Selenium interview questions, and framework-level design on automation testing interview questions.
- Syntax and structureSections, keywords, arguments, variables, setups, teardowns and tags.
- Read or fix a suiteA .robot file with a bug: wrong variable syntax, state leaking between tests, or a hard sleep.
- Extend it in PythonWrite a keyword library, choose its scope, and explain how arguments arrive.
- Run at scaleTag selection, parallel runs, merged reports and how the suite fits into CI.
Robot Framework fundamentals questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| What sections can a .robot file have? | File structure | Settings, Variables, Test Cases (or Tasks for automation work), Keywords and Comments. A suite file has tests; a resource file has no tests, only keywords and variables. |
| What is a keyword? | Core idea | A named step. Library keywords are written in Python (or another supported language), user keywords are written in Robot syntax from other keywords. Tests are just sequences of keywords. |
| What do the dollar, at and ampersand prefixes mean? | Variables | ${name} is a scalar, @{items} expands a list into separate arguments, &{opts} expands a dictionary into named arguments. %{HOME} reads an environment variable. |
| How are cells separated? | Syntax | By two or more spaces (or a pipe format). A single space is part of the value, which is the source of many beginner bugs. |
| Suite Setup, Test Setup and the per-test setting? | Fixtures | Suite Setup runs once before the suite, Test Setup before each test, and a test's own setup setting overrides the default for that test. Teardowns run even when the test fails. |
| How do you mark a test so CI can pick a subset? | Tags | Add tags in the test or with Test Tags in Settings, then run with --include smoke or --exclude slow. |
| What files does a run produce? | Results | output.xml with every keyword and message, log.html for step-by-step debugging, and report.html as a summary. Both HTML files are generated from output.xml. |
| Which libraries are built in? | Standard library | BuiltIn is always available; others such as Collections, String, OperatingSystem, DateTime and Process are imported by name. Browser, API and database libraries are installed separately. |
Keywords, libraries and data-driven questions
A frequent hands-on task is to write a small Python library and call it from a data-driven test. Every public method of the class becomes a keyword, with underscores turned into spaces.
# Each public method becomes a keyword, so "Total Should Be" calls total_should_be.
class OrderLibrary:
ROBOT_LIBRARY_SCOPE = "TEST" # a fresh instance for every test
def __init__(self):
self._lines = []
def add_line(self, sku, quantity, price):
# Arguments arrive from .robot files as strings unless typed or converted.
self._lines.append((sku, int(quantity), float(price)))
def total_should_be(self, expected):
total = round(sum(q * p for _, q, p in self._lines), 2)
if total != float(expected):
raise AssertionError(f"Total was {total}, expected {expected}")
if __name__ == "__main__":
lib = OrderLibrary()
lib.add_line("A-1", "2", "4.50")
lib.add_line("B-7", "1", "10")
lib.total_should_be("19")
try:
lib.total_should_be("20")
except AssertionError as e:
print("failed as expected:", e)*** Settings ***
Library OrderLibrary.py
Test Template Order Total Should Match
*** Test Cases *** SKU QTY PRICE TOTAL
Single item A-1 2 4.50 9
Bulk item B-7 10 1.25 12.5
*** Keywords ***
Order Total Should Match
[Arguments] ${sku} ${qty} ${price} ${total}
Add Line ${sku} ${qty} ${price}
Total Should Be ${total}- What goes wrong if the library scope is SUITE here? One instance serves every test, so the second test still holds the first test's line and its total is wrong. Library scope (global, suite or test) decides how long state lives, and stateful libraries usually want test scope or an explicit reset keyword.
- Resource file or Python library? Use resource files for readable flows built from existing keywords. Move logic into Python when it needs loops, parsing, calculations or calls to other systems, because complex logic in Robot syntax is hard to read and test.
- How do arguments get their types? They arrive as strings by default. Python type hints on the keyword let the framework convert them, or the library converts them itself as above.
- How do you pass a value from one test to another? Ideally you do not, since tests should be independent. If unavoidable, Set Suite Variable shares it within the suite, but that creates order dependence.
- What are the variable scopes? Local to a keyword or test, test, suite and global. Command-line variables set with
--variableare global and override values in files. - How do you write loops and conditions? Recent versions have native FOR, IF and ELSE, WHILE and TRY blocks. Older suites use Run Keyword If and similar BuiltIn keywords, which you may need to read and migrate.
- How do you check that a keyword fails with a given message? Run Keyword And Expect Error with the expected message pattern, which keeps negative tests readable.
- What is Libdoc for? It generates keyword documentation from a library or resource file, so testers can browse what is available instead of reading source.
- How do you pass environment-specific values such as base URLs? Use variable files (Python or YAML) selected with --variablefile, or single values with --variable, so the same suite runs against each environment.
- How do you rerun only the failed tests? Run again with --rerunfailed pointing at the previous output.xml, then merge both outputs with rebot so the report shows the final status.
Browser and API automation questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| SeleniumLibrary or Browser library? | Tool choice | SeleniumLibrary drives browsers through WebDriver and is long established. Browser library is built on Playwright, with auto-waiting and browser contexts. The choice depends on the existing suite and the browsers you must support. |
| Why avoid Sleep in a UI test? | Waiting | A fixed sleep is either too short on a slow day or wastes time on a fast one. Wait for a condition, such as an element being visible, or rely on a library that waits automatically. |
| What does Wait Until Keyword Succeeds do and when is it a smell? | Retries | It retries a keyword until a timeout. Fine for eventual consistency in a backend, a smell when it hides a missing explicit wait in the UI. |
| How do you test a REST API in Robot Framework? | API testing | With a library such as RequestsLibrary: create a session, send the call, and assert status and JSON fields with Collections or custom keywords. |
| How do you keep locators maintainable? | Page structure | Keep locators in variables or resource files per page, and expose page-level keywords like Submit Login Form rather than raw clicks in tests. |
| How do you take a screenshot only on failure? | Diagnostics | Most browser libraries register a keyword to run on failure, or you add a test teardown that captures the page when the test status is FAIL. |
Senior Robot Framework questions and scenarios
| Scenario | Likely cause | What to say you would check |
|---|---|---|
| The suite takes three hours. | Serial UI-heavy runs | Split smoke from regression with tags, move setup to API calls, and run suites in parallel with pabot, checking that tests do not share data. |
| Tests pass alone but fail in a full run. | Shared state | Suite or global variables, a library with suite scope holding data, or test data reused by another test. Make each test create its own data. |
| Business analysts cannot read the tests. | Keyword design | Tests are full of locators and clicks. Rewrite them in domain keywords at one level of abstraction and push detail down into resources. |
| You need results from three parallel jobs in one report. | Reporting | Collect each job's output.xml and combine them with rebot, which can merge or combine outputs into one log and report. |
| The team wants test results pushed to a dashboard. | Extensibility | Write a listener, which receives events as suites, tests and keywords start and end, and send the results from there. |
| A keyword file has grown to two thousand lines. | Maintainability | Split by domain into resource files, delete unused keywords (Libdoc and a usage search help), and move logic-heavy keywords into tested Python. |
Fictional example
- Interviewer
- The test opens the browser, types credentials, clicks Login, sleeps five seconds and checks the dashboard title. It fails about once a day. What would you change?
- Candidate
- First the sleep. I would replace it with a wait for something that proves login finished, such as the dashboard header being visible, with a timeout set once in the suite settings. Second, I would check what the failure looks like in log.html, because a once-a-day failure might be test data, for example the account getting locked by another test that uses the same user. Third, I would lift the steps into a Log In As keyword in a resource file, so the test reads as intent and the locators live in one place. Last, if login is only a precondition for most tests, I would get a session through the API in the suite setup and keep one UI login test, which removes most of the exposure to the flaky step.
Robot Framework practice plan
- Day 1: write a suite with all main sections, tags, a suite setup and a teardown, and read through log.html for one failure.
- Day 2: build the Python library above, switch its scope to suite on purpose, and watch the second template row fail.
- Day 3: automate a public practice site with a browser library using page-level keywords and no sleeps.
- Day 4: add API tests with RequestsLibrary, run everything with pabot, and merge outputs with rebot.
- Day 5: practise explaining variable types, scopes and resource files versus libraries aloud.
Many Robot Framework roles also test APIs in a GUI first, covered in Postman interview questions. The same engine runs automation tasks, so RPA interview questions is a natural next read, and Python-heavy data teams that adopt it for pipeline checks often ask PySpark interview questions too.
When you explain a suite design out loud, it is easy to jump between keywords, data and reports without a thread. Natively, an AI interview assistant for Mac and Windows, transcribes a mock automation round on your computer so you can see where the explanation wandered. It can read a .robot file or a failing log from a screenshot and suggest causes to check, and with Pro or the free trial it uses the résumé and job description you upload to frame its suggestions. Transcripts and notes are saved for you.
Questions people ask
What Robot Framework questions are asked in interviews?
File sections, keywords versus libraries, the scalar, list and dictionary variable syntax, variable and library scopes, setups and teardowns, test templates, tags, SeleniumLibrary or Browser library, and running suites in parallel with pabot.
What is the difference between a resource file and a library in Robot Framework?
A resource file holds user keywords and variables written in Robot syntax. A library holds keywords implemented in Python or another supported language, which suits logic, parsing and calls to other systems.
How do you run Robot Framework tests in parallel?
Usually with pabot, which splits suites or tests across processes. Tests must not share data or state, and the separate outputs are combined into one report.
Do I need Python for Robot Framework interviews?
For most automation roles, yes. You are often asked to write a small keyword library, handle argument types and choose a library scope.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
