This is one of the most popular interview questions for SDET roles: "What type of framework do you use? Explain the difference between data-driven, keyword-driven, and hybrid frameworks." If you cannot answer this clearly, the interviewer assumes you just followed a tutorial without understanding the architecture.
Test logic is hardcoded in Java. Test data comes from external files. The same test method runs multiple times with different data sets. Everything we have built in this chapter so far is data-driven.
// Data-Driven: Logic in code, data in files
@Test(dataProvider = "loginData")
public void testLogin(String user, String pass,
String expected) {
// Logic is HERE — hardcoded steps
loginPage.enterUsername(user); // Step 1
loginPage.enterPassword(pass); // Step 2
loginPage.clickLogin(); // Step 3
// Data comes from external file
}Both test steps AND test data come from external files. The steps are defined as "keywords" — action words like OPEN_BROWSER, CLICK, ENTER_TEXT. A driver engine reads these keywords and executes the corresponding code. Non-technical people can write tests by composing keywords in a spreadsheet.
| Keyword | Locator | Data |
|------------|-------------------|-------------|
| OPEN_URL | | /banking |
| ENTER_TEXT | id=username | testuser |
| ENTER_TEXT | id=password | password123 |
| CLICK | css=button.login | |
| VERIFY | id=welcome-msg | Welcome |// Keyword Engine — reads and executes keywords
public class KeywordEngine {
public void execute(String keyword, String locator,
String data) {
switch (keyword.toUpperCase()) {
case "OPEN_URL":
driver.get(baseUrl + data);
break;
case "ENTER_TEXT":
driver.findElement(
parseLocator(locator)).sendKeys(data);
break;
case "CLICK":
driver.findElement(
parseLocator(locator)).click();
break;
case "VERIFY":
String actual = driver.findElement(
parseLocator(locator)).getText();
Assert.assertTrue(
actual.contains(data));
break;
}
}
private By parseLocator(String locator) {
String[] parts = locator.split("=", 2);
return switch (parts[0]) {
case "id" -> By.id(parts[1]);
case "css" -> By.cssSelector(parts[1]);
case "xpath"-> By.xpath(parts[1]);
default -> throw new RuntimeException(
"Unknown locator type: " + parts[0]);
};
}
}Combines the best of both. Uses POM for page object structure, DataProviders for external test data, and utility methods that act like keywords. Most real-world enterprise frameworks are hybrid even if the team does not call them that.
// Hybrid: POM + Data-Driven + Reusable Utilities
// Page Objects handle locators and actions (like keywords)
// DataProviders handle external data
// BaseTest handles configuration
@Test(dataProvider = "loginData",
dataProviderClass = DataProviders.class)
public void testLogin(String user, String pass,
String expected) {
// POM provides the "keywords" (loginAs = enter + click)
LoginPage loginPage = new LoginPage(driver);
loginPage.loginAs(user, pass);
// Data comes from external files
// Configuration comes from properties
// Reporting comes from Allure/ExtentReports
}| Data-Driven | Keyword-Driven |
|---|---|
| Logic in Java code, data in files | Both steps and data in files |
| Developers/SDETs write tests | Business analysts can write tests |
| Fast to build, easy to maintain | Complex to build, harder to debug |
| Cannot change test flow without code change | Test flow changes need only file edits |
| Most common in small-mid teams | Used in large enterprise BPO/testing teams |
In interviews, when asked "What type of framework do you use?", the strongest answer is: "We use a hybrid framework built on the Page Object Model pattern with data-driven testing. Test data comes from Excel files managed by the QA lead. Configuration comes from properties files with System property overrides for CI/CD. We use TestNG for execution, Maven for build, and Allure for reporting." This one sentence covers 5 framework concepts.
Q: Explain the difference between data-driven, keyword-driven, and hybrid frameworks.
A: In a data-driven framework, test logic is in code and test data comes from external files like CSV, Excel, or JSON. The same test method runs with different data sets. In a keyword-driven framework, even the test steps are externalized as keywords (CLICK, ENTER_TEXT, VERIFY) in a spreadsheet — a driver engine reads and executes them. Non-technical people can write tests. A hybrid framework combines both — it uses POM for structure, external data for test inputs, and reusable utility methods. Most real-world frameworks are hybrid.
Q: Which framework type do you recommend and why?
A: For most teams, I recommend a hybrid framework with POM and data-driven testing. It gives you clean code structure through page objects, flexible test data through external files, and is easy for SDETs to maintain. Pure keyword-driven frameworks are overkill unless you have a large team of non-technical testers who need to write test cases. The overhead of building and maintaining a keyword engine is rarely worth it.
Key Point: Most real-world frameworks are hybrid — POM for structure, external files for data, utilities for reusable actions.