A test automation framework is the set of rules, code structure and tools that decides how automated tests are written, organised, run and reported in a project. In practice it's two things stacked together: a tool framework such as Playwright, Cypress, Jest or pytest, and the design decisions your team makes on top of it, like how tests share code, where test data lives and what a failure report looks like.
There are seven classic framework types: linear, modular, library architecture, data-driven, keyword-driven, hybrid and behaviour-driven (BDD). Suites that have been around for a year or two tend to end up hybrid. The choice that matters more than the type is the layer you're testing, the language your testers can actually write, and how big you let the suite get.
Test automation framework vs tool framework vs test harness
People use "framework" for three different things, and much of the confusion in this topic comes from that.
The first is the tool framework. Jest calls itself "a delightful JavaScript Testing Framework with a focus on simplicity" (jestjs.io, checked 23 Nov 2026). Playwright Test "bundles test runner, assertions, isolation, parallelization and rich tooling" (Playwright docs). These give you the syntax for a test, assertions, hooks and a runner.
The second is the design pattern: linear, modular, data-driven and the rest. That's an architecture decision you make inside whichever tool you pick.
The third is what teams build for themselves. A QA manager at a B2B software vendor described their UI suite to us as Selenium tests inside an in-house framework that is "just a wrapper around Selenium". That wrapper is the framework in the sense this article cares about. Selenium itself is "an umbrella project for a range of tools and libraries that enable and support the automation of web browsers" (Selenium docs). It drives the browser. It has no test runner, so somebody has to pick JUnit, pytest, NUnit or Mocha and build the rest.
Wrap the framework in test data, stubs, an environment and a runner that starts on its own, and you have a test harness. The framework is how a test is written. The harness is how it gets run against something real.
The seven types of test automation framework
1. Linear (record and playback)
Each test is one script, written or recorded top to bottom, with its own data and its own copy of every step. Log in, click, type, assert. Nothing is shared.
It's the fastest way to get a first test, and the reason teams leave it. When the login page changes, you edit every script that logs in. Fine for a spike or a demo. Painful past a few dozen tests.
2. Modular
You split the application into modules (login, search, checkout) and write a reusable script for each. Tests call the modules in sequence. The page object model is the best-known version of this; Playwright documents it as a first-class pattern under page object models.
Change the login page and you fix one module. The cost is that someone has to own the module boundaries, and they drift.
3. Library architecture
Close to modular, but the shared pieces are functions grouped by what they do rather than by screen: createUser(), addToCart(), loginAs(role). Tests import from the library. The in-house Selenium wrapper above is this type. So is the "test utilities" folder that quietly grows to a few thousand lines.
4. Data-driven
The test logic is written once and the inputs and expected outputs come from outside: a CSV, a spreadsheet, a JSON file, a database table. One login test runs against fifty credential rows.
The common tool frameworks have it built in. pytest has parametrize, Playwright has parameterized tests, Jest has test.each. Where it bites is the data itself. A data file nobody reviews turns into rows that test nothing, and the suite count looks bigger than the coverage really is.
5. Keyword-driven
Test steps are written as keywords ("Open Browser", "Input Text", "Click Button") in a table or plain-text file, and each keyword maps to code underneath. The idea is that people who don't write code can compose tests from keywords that engineers maintain.
Robot Framework is the reference tool here. It describes itself as an open source automation framework for test automation and RPA whose syntax "uses keywords and supports extending through libraries in Python, Java, and other languages" (checked 23 Nov 2026). The catch is the same in every keyword-driven setup: someone still writes and maintains the keyword library, and that person becomes the bottleneck.
6. Hybrid
Any mix of the above. A typical one: page objects for structure, a helper library for setup, parametrised data for the edge cases, and a few BDD feature files for the flows product managers care about. If you're not sure which type you run, it's this one.
7. Behaviour-driven development (BDD) framework
Tests are written as scenarios in a structured plain language, usually Gherkin's Given, When, Then, and bound to code through step definitions. Cucumber "reads executable specifications written in plain text and validates that the software does what those specifications say" (checked 23 Nov 2026). Its own docs are careful to say BDD is about "discovery, collaboration and examples (and not testing)".
Take that seriously. BDD pays off when product, QA and engineering write and read the scenarios together. When only QA reads them, the feature files become a translation step: every scenario still needs step definitions in code, and now there are two places to update when the UI moves. We've written about where Given/When/Then helps and where it doesn't.
The seven types side by side
| Type | How tests are built | Example in practice | Where it breaks down |
|---|---|---|---|
| Linear | One script per test, no reuse | Recorded browser scripts | Any UI change means editing many scripts |
| Modular | Reusable script per app module | Page object model | Module boundaries drift as the app changes |
| Library architecture | Shared functions grouped by action | In-house wrapper around Selenium | The library becomes its own codebase |
| Data-driven | One test, many data rows | pytest parametrize, test.each | Data files grow without review |
| Keyword-driven | Steps as keywords mapped to code | Robot Framework | Keyword library owner becomes a bottleneck |
| Hybrid | A mix of the above | Long-lived suites | Hard to explain to a new hire |
| BDD | Given/When/Then scenarios plus step definitions | Cucumber with Gherkin | Scenarios nobody outside QA reads |
Tool frameworks, by the layer they test
The tools below are grouped by layer, in no order of preference. Each tool sits at a layer, and picking across layers ("Jest or Playwright?") is usually the wrong question, because a web product needs one of each. The details come from each project's own docs, read on 23 Nov 2026.
| Tool | Layer | Languages | Browsers or runtime | Bundled runner? |
|---|---|---|---|---|
| Playwright | End-to-end web, API, component | TypeScript/JavaScript, Python, Java, .NET | Chromium, Firefox, WebKit | Yes in Node.js (Playwright Test); Python, Java and .NET pair with pytest, JUnit or NUnit |
| Cypress | End-to-end web, component | JavaScript, TypeScript | Chrome-family (incl. Edge), Firefox, experimental WebKit | Yes |
| Selenium | Browser automation (WebDriver) | Java, Python, C#, Ruby, JavaScript, Kotlin | Chrome, Firefox, Edge, Safari | No, pair it with JUnit, pytest, NUnit etc. |
| Jest | Unit, integration (JavaScript) | JavaScript, TypeScript | Node | Yes |
| Mocha | Unit, integration (JavaScript) | JavaScript | Node.js and the browser | Yes, assertions are bring-your-own |
| pytest | Unit to functional (Python) | Python | Python | Yes |
| Cucumber | BDD layer on top of another tool | Gherkin plus step definitions | Whatever the steps drive | Yes |
| Robot Framework | Keyword-driven acceptance, RPA | Keywords, libraries in Python, Java and others | Whatever the libraries drive | Yes |
A few details the table can't hold:
- Playwright now describes itself as web automation "for testing, scripting, and AI agents", and ships three Playwright Test Agents: a planner that explores the app and writes a Markdown test plan, a generator that turns the plan into Playwright test files, and a healer that runs the suite and repairs failing tests.
- Cypress controls one browser at a time and binds each test to a single superdomain, with
cy.originfor cross-origin navigation (trade-offs). The Cypress App is free and open source; Cypress Cloud is the paid layer for recording, analytics and orchestration. - Selenium is the one to reach for when you need real Safari through WebDriver or a language the others don't cover. The framework decision is yours to make.
- Mocha runs tests serially by default and leaves assertions and spies to you.
If two of these are on your shortlist, we've compared them head to head: Playwright vs Selenium, Playwright vs Cypress and Jest vs Mocha.
How to choose a test automation framework
Start from your constraints. Feature lists are nearly identical at the top of each category, so they won't decide it for you.
What layer are you testing? Unit and integration tests belong in the runner that matches your language: Jest or Vitest for JavaScript, pytest for Python, JUnit for Java. Browser flows need Playwright, Cypress or Selenium. API checks can live in either. Expect to run one framework per layer.
Who will write and maintain the tests? This decides more projects than any benchmark. The founder of a healthcare SaaS startup told us their tester wasn't confident building Playwright tests, nobody else had the time, and so the testing went back to manual, "eyes on the screen". A framework your team can't write in is a framework you don't have. If your testers write Python, a JavaScript-only tool turns your test plan into a hiring plan.
Which browsers and platforms are non-negotiable? Need real Safari? That points to Selenium, or to Playwright's WebKit build if WebKit is close enough. Multi-tab or multi-origin flows? Check the Cypress trade-offs first. Native mobile is a separate stack again (Appium, Espresso, XCUITest).
How will you control test data? This is where code frameworks are strongest. A QA engineer at a B2B SaaS scale-up told us they still run their Playwright tests, and test data was the first reason they gave: "I can create as many users as I want... I can easily clear the data via API." If your tests need precise setup and teardown, that's code, and a code framework is the right home for it.
Migrating is its own case. At one large enterprise, the QA lead told us other teams were "migrating from their traditional selenium Java frameworks to Playwright". The tests themselves port reasonably well. The custom commands, the environment handling and the shared library are the real migration, so price those in.
How big will the suite get? Nobody asks this when choosing, and it's the one that decides whether the suite is still useful in two years. Every scripted framework makes adding a test cheap and deleting one scary. Past a few hundred end-to-end tests, an illustrative 1% per-test flake rate means a red build on nearly every run: at 300 tests, the odds of an all-green run are about 5%. We argue the case in what is regression testing: keep the scheduled regression suite to the handful of flows a release can't ship without.
What changes when an agent tests the running app
AI is entering test automation frameworks in two different ways, and it helps to keep them apart.
The first is agents that write framework code for you. Playwright's generator turns a plan into Playwright test files, and its healer patches failing ones. You still end up with scripts in your repo, and you still own them. Every property of the framework you chose comes along, maintenance included.
The second is an agent that tests the running application directly from a description of the goal. QA.tech builds its tests this way. Each test case is a goal, an optional expected result, and steps the agent generates on the first run; the expected result "defines what the agent should verify at the end of the test" (creating tests). Some framework ideas carry straight over. Shared steps and test dependencies play the role that modules and libraries play in a code framework. Others disappear, like selectors and step definitions.
The trade-offs are real on both sides. Agent-based test cases live in QA.tech as goals and expected results, outside your repo, and the docs note that two reviews of the same change "can pick slightly different tests" (GitHub PR testing). If you need a scripted check of an exact DOM state or exact seeded data in CI, write it in Playwright, Cypress or Jest.
What you get in exchange is a different oracle, and that is the main difference between script-based automation and an agentic QA workflow. One of our co-founders puts it simply: in a scripted test you only catch the bugs you wrote an assertion for. A goal-based test case is judged against an expected result written in user terms (the docs' own example: "A success message appears and the user is redirected to the product list"), so the check describes what the user should see on screen.
What we recommend uses both: a short scheduled regression suite for the flows you'd stop a release for, plus dynamic testing on every pull request, where an agent works out what the change can affect, tests that on the preview build and reports pass, fail or unable to verify. That's the half of AI QA testing that no framework type above was designed to give you, because each of them produces tests someone has to keep alive.
FAQ
What is a test automation framework? A test automation framework is the set of rules, code structure and tools that decides how automated tests are written, organised, run and reported. It usually combines a tool framework such as Playwright, Cypress, Jest or pytest with team decisions about code reuse, test data and reporting.
What are the types of test automation frameworks? The seven common types are linear (record and playback), modular, library architecture, data-driven, keyword-driven, hybrid and behaviour-driven development (BDD). Mature suites tend to be hybrids: page objects for structure, a helper library, parametrised data and sometimes a BDD layer.
Is Selenium a test automation framework? Not on its own. Selenium is a browser automation project built on the W3C WebDriver standard, with bindings for Java, Python, C#, Ruby, JavaScript and Kotlin. It has no test runner, so teams pair it with JUnit, pytest, NUnit or similar and build their framework around that.
Is Cucumber a BDD or a TDD tool? Cucumber is a BDD tool. It reads scenarios written in Gherkin (Given, When, Then) and runs them through step definitions you write in code. You can practise TDD alongside it, but Cucumber's own docs describe BDD as being about discovery, collaboration and examples.
What is the difference between a test framework and a test harness? A test framework is how you write tests: syntax, assertions, hooks and usually a runner. A test harness is everything needed to run those tests against a real system unattended, which includes the framework plus test data, stubs, the environment and reporting.
Which test automation framework should I use? Choose by layer first: a language-native runner (Jest, pytest, JUnit) for unit and integration tests, and Playwright, Cypress or Selenium for browser flows. Then filter on the language your testers write, the browsers you must support and how you'll control test data.
Do AI testing agents replace test automation frameworks? For unit tests, API contracts and exact checks with seeded data, no: code frameworks are still the right tool there. What agents change is end-to-end coverage of new and changed features, which can be tested from a goal against the running app instead of from a script someone has to maintain.
