Data-Driven vs Keyword-Driven Testing
Data-driven testing keeps one test procedure and runs it once per row of external data: same steps, different inputs and expected results. Keyword-driven testing composes each test from named actions, such as Open Browser or Input Text, so the steps vary while the implementation of each keyword is shared. Most real frameworks combine both; that is a hybrid framework.
- Data-driven testing
- One test procedure executed many times, once per row of external data, so the logic is fixed and the inputs and expected results vary.
- Keyword-driven testing
- Tests written as sequences of named actions, or keywords, with arguments, so the steps themselves are composed from a vocabulary rather than coded.
How do Data-driven testing and Keyword-driven testing compare?
| Dimension | Data-driven testing | Keyword-driven testing |
|---|---|---|
| What varies between tests | Data-driven testingThe data: inputs and expected results | Keyword-driven testingThe steps: which keywords run, in what order, with what arguments |
| Where the test lives | Data-driven testingIn code, with the rows in a spreadsheet, CSV, JSON, database or provider method | Keyword-driven testingIn a table or plain-text file listing keywords and arguments |
| Who writes the tests | Data-driven testingEngineers write the procedure; anyone can add rows | Keyword-driven testingEngineers implement keywords; testers and analysts compose tests from them |
| Typical tooling | Data-driven testingTestNG @DataProvider, JUnit parameterised tests, pytest parametrize, Cucumber Scenario Outline | Keyword-driven testingRobot Framework, Cucumber step definitions, custom keyword engines |
| Best fit | Data-driven testingValidation rules, calculations, form fields, API contracts: one logic path, many cases | Keyword-driven testingLong end-to-end flows assembled from reusable actions across many features |
| Main risk | Data-driven testingBloated data sets that run for hours and hide which row actually matters | Keyword-driven testingKeyword sprawl and a home-grown interpreter nobody wants to maintain |
| Maintenance cost | Data-driven testingLow while the procedure is stable; a step change touches one place | Keyword-driven testingLow per test, but the keyword library becomes the product to maintain |
| Interview framing | Data-driven testingShow a parameterised test and explain how a failing row is reported | Keyword-driven testingShow a keyword you implemented and a test that reuses it |
When should you choose Data-driven testing, and when Keyword-driven testing?
Choose Data-driven testing when
- The same flow must be verified against many input combinations, such as boundary values or locale-specific formats.
- Test data changes more often than test logic and non-engineers need to add cases.
- Failures should point at a specific row so the report names the input that broke.
- You are testing an API or a calculation rather than a long user journey.
Choose Keyword-driven testing when
- Non-programmers on the team need to write end-to-end tests without touching code.
- Many tests share the same actions and a keyword library will stop copy-paste.
- The team already uses Robot Framework or a step-definition style with Cucumber.
- Business analysts want to read the tests as a sequence of actions.
How does Data-driven testing vs Keyword-driven testing come up in QA interviews?
This question checks whether you have built a framework or only used one. Interviewers want the trade-off, then a concrete example: a data provider you wrote, a keyword you implemented, and what went wrong when the approach was pushed too far.
- 01Explain the difference between a data-driven and a keyword-driven framework, and give one example of each from a project you worked on.
- 02How does a hybrid framework combine the two, and where does the data live in yours?
- 03A data-driven test with 400 rows takes 45 minutes and fails on row 212. How would the report tell you which input failed, and how would you shorten the run?
- 04What is the maintenance cost of a keyword-driven framework, and who ends up paying it?
No account needed · Scored in under a minute against a senior rubric
Common questions about Data-Driven vs Keyword-Driven Testing
What is a hybrid framework?
A framework that composes tests from keywords and feeds those tests from external data. Robot Framework is a clear example: a test template turns a keyword into a data-driven test where each row supplies the arguments. Most mature Selenium and Playwright frameworks are hybrid in practice even if nobody calls them that.
Is BDD a keyword-driven approach?
Closely related. Gherkin steps such as Given I am logged in map to step definitions the way keywords map to implementations, and a Scenario Outline with an Examples table is data-driven. Cucumber therefore gives you both patterns; the difference is that BDD steps are written as behaviour rather than as actions.
Which is better for automation frameworks?
Neither on its own. Data-driven testing suits logic with many inputs; keyword-driven testing suits long flows composed by non-programmers. Choose based on who writes the tests and what varies between them, and expect to combine the two as the suite grows.
How do I explain this in an interview without sounding theoretical?
Name the tool and the artefact. For example: TestNG DataProvider returning rows from a CSV for a pricing calculator, or Robot Framework keywords wrapping Playwright calls so analysts could write checkout tests. Then say what broke and how you fixed it.
Ready to be asked about Data-driven testing or Keyword-driven testing?
Practice explaining the trade-off to an interviewer who knows both.
Join 500+ QA engineers already practicing with AssertHired.
A test passes locally but fails in CI about one run in five. Walk me through what you check first, and why.
Scored on the same four dimensions as the real thing: Technical accuracy · Coverage · Clarity · Best practices.
Rather skip ahead? Create a free account