Mid-level QAFrameworks & Design PatternsFree question
What is a hybrid framework? Compare data-driven, keyword-driven and BDD frameworks.
60-second answer
A data-driven framework separates test data from test logic, so the same test runs with many data sets from Excel, CSV or JSON. A keyword-driven framework defines actions as keywords, like click, enterText, verifyText, in a table, so non-programmers can write tests, but it's harder to maintain. BDD uses Gherkin feature files with Given-When-Then, written in business language and linked to step definitions in code, with tools like Cucumber. A hybrid framework combines these, typically Page Object Model plus data-driven plus optional BDD, to get the benefits of each.
Explanation
| Type | Strength | Weakness |
|---|---|---|
| Linear / record-playback | Quick start | Unmaintainable |
| Modular | Reuse | Needs coding |
| Data-driven | Many inputs, one test | Data management |
| Keyword-driven | Non-coders can author | Abstraction overhead, debugging |
| BDD | Shared understanding, living docs | Extra layer; useless if business doesn't read it |
| Hybrid | Pick what fits | Needs design discipline |
Example
Our framework is POM-based, with JSON data providers for data-driven checkout tests, and a small Cucumber layer only for acceptance scenarios the product owner reviews.
Sample code
Feature: Checkout
Scenario Outline: Apply coupons
Given I have a cart worth <total>
When I apply coupon "<code>"
Then I should pay <payable>
Examples:
| total | code | payable |
| 1000 | SAVE10 | 900 |
| 1000 | FLAT200 | 800 |