Skip to content

Keyword-Driven Testing Explained (With Robot Framework)

29-07-2026 Roy de Kleijn
Keyword-Driven Testing Explained (With Robot Framework)

Keyword-driven testing is the idea behind Robot Framework. Once you understand it, the readable syntax and the reusable keywords follow from one design choice rather than being separate features.

The core idea

In keyword-driven testing, every action in a test is a named keyword. A keyword is a small, reusable unit of behaviour with a clear name, like Open The Login Page or Log In As. A test is a list of those keywords, read top to bottom.

Instead of a long script full of low-level commands, you describe the test as a sequence of meaningful actions. The names carry the intent, and the detail sits inside the keywords.

Compare a low-level script:

Go To          https://demo.example.com/login
Input Text     id=username    standard_user
Input Text     id=password    secret
Click Button   id=login

with a keyword-driven version:

Open The Login Page
Log In As    standard_user

Both do the same thing. The second reads as a description of behaviour, and it hides the detail inside keywords you define once and reuse everywhere.

Two kinds of keyword

Robot Framework gives you two sources of keywords, and combining them is what the approach is built on.

Library keywords come from libraries you import. Click, Input Text and GET are library keywords that know how to drive a browser or call an API. You do not write these. You use them.

User keywords are the ones you build yourself, by combining library keywords and other user keywords. This is how you climb from low-level actions to readable, business-level steps:

*** Keywords ***
Open The Login Page
    New Page    https://demo.example.com/login

Log In As
    [Arguments]    ${username}
    Fill Text      id=username    ${username}
    Fill Secret    id=password    ${default_password}
    Click          id=login

With those defined, your tests read in plain language, and the detail sits in one place. Change how login works, and you edit one keyword rather than every test.

Why teams use it

The benefits all follow from that one idea.

  • Readability. Tests read as behaviour, so testers, developers and business stakeholders can all follow them. The suite doubles as documentation that cannot drift out of date, because it is executable.
  • Reuse. A keyword written once is used across dozens of tests. Less duplication means less to write and less to maintain.
  • Maintainability. When the application changes, you update the keyword, not every test that used it. This is the single biggest reason keyword-driven suites age well.
  • Separation of concerns. The what (the test) is separated from the how (the keyword implementation). People can work at the level that suits them, whether that is writing readable tests or building the keywords underneath.
  • A gentle on-ramp. Someone can contribute useful tests using existing keywords long before they can write code, which widens who can help.

How it relates to other approaches

Keyword-driven testing sits close to data-driven testing and behaviour-driven testing, and Robot Framework supports all three comfortably.

Data-driven testing runs the same keyword-driven test with many sets of input data, which is ideal for checking a rule across lots of examples. Behaviour-driven testing uses "Given, When, Then" phrasing, which in Robot Framework is simply a style of naming your keywords. You are never locked into one. They layer on top of the same keyword model. For the wider comparison, see Robot Framework vs pytest vs Cucumber.

Putting it into practice

The skill that separates a tidy keyword-driven suite from a messy one is knowing where to draw the line between keywords: high-level enough to read well, low-level enough to reuse. That judgement comes with practice, and it is a large part of what a structured course teaches.

Our Robot Framework Certified Professional course covers keyword design alongside variables, libraries, control structures and reporting, and prepares you for the RFCP exam.

Frequently asked questions

Is keyword-driven testing the same as Robot Framework? No. Keyword-driven testing is the approach. Robot Framework is one tool that implements it, and a popular one.

Do I need to code to do keyword-driven testing? Not to start. You can build readable tests from existing library keywords. You only write code when you create a custom keyword library for something no existing library covers.

What is the difference between a library keyword and a user keyword? A library keyword comes from an imported library and does low-level work. A user keyword is one you define by combining other keywords, usually to create a readable, higher-level step.


Related reading: What is Robot Framework? and Robot Framework vs pytest vs Cucumber.

Delen:
Roy de Kleijn

Test Automation Expert

Met meer dan 15 jaar ervaring in software testing en test automation helpt Roy teams om hun testprocessen te verbeteren.

Get Robot Framework certified

Go from the basics to exam-ready at your own pace with the online RFCP course.