Q16 of 17 · Framework design
What is a keyword-driven framework and when is it worth the overhead?
Framework designMidframework-designkeyword-drivenrobot-frameworkno-code
Short answer
Short answer: A keyword-driven framework maps English action words (Navigate, Click, EnterText, Verify) to code implementations. Non-technical users write test scripts by composing keywords in a spreadsheet or table. The overhead is high — only worth it when business analysts or manual testers must create test cases without writing code.
Detail
How it works:
Test script (Excel/CSV):
| Keyword | Target | Value |
|--------------|---------------------|--------------------|
| Navigate | https://example.com | |
| EnterText | #email | user@example.com |
| EnterText | #password | secret |
| Click | #login-btn | |
| VerifyText | .welcome-message | Hello, Alice |
The keyword engine reads each row, looks up the keyword in a registry, and executes the mapped function:
Map<String, KeywordAction> keywords = new HashMap<>();
keywords.put("Navigate", (target, value) -> driver.get(target));
keywords.put("EnterText", (target, value) -> driver.findElement(By.cssSelector(target)).sendKeys(value));
keywords.put("Click", (target, value) -> driver.findElement(By.cssSelector(target)).click());
keywords.put("VerifyText", (target, value) -> assertThat(driver.findElement(...).getText()).isEqualTo(value));
// Keyword engine loop
for (Row row : testScript) {
keywords.get(row.getKeyword()).execute(row.getTarget(), row.getValue());
}
When it's worth the overhead:
- Business analysts or manual QA with no coding background must create test cases independently
- The application has highly repetitive form-filling flows that map naturally to generic keywords
- A test management tool (Robot Framework) already provides this abstraction
When it adds cost without value:
- All test authors are engineers — data-driven or POM achieves the same reusability with less ceremony
- Keywords become too domain-specific to be reusable (defeating the purpose)
- Debugging failures is harder — you trace through a keyword dispatch layer before reaching the actual test logic
Robot Framework is the most mature open-source keyword-driven framework — it has a rich built-in keyword library and avoids building the engine from scratch.
// WHAT INTERVIEWERS LOOK FOR
The keyword → code mapping pattern. The specific condition where it's justified (non-technical authors). Mention of Robot Framework. Honest trade-off assessment.
// COMMON PITFALL
Implementing a keyword-driven framework for an all-engineer team because 'it sounds sophisticated.' The overhead rarely pays off when everyone can write code.