Which QA frameworks are used in Drupal automated testing? | Attico International

Which QA frameworks are used in Drupal automated testing?

Explore Drupal automated testing tools, from PHPUnit to Playwright, and learn how to choose from numerous QA frameworks the right one for your project.

11 min read
 Which QA frameworks are used in Drupal autotesting?

Introduction

When people talk about automated testing, the conversation often circles around strategy, types of tests, or overall benefits. But what about the tools behind those tests? That’s where the real magic happens, especially in Drupal.

Testing frameworks aren’t just technical tools only developers care about. The framework a team chooses determines how fast automated tests run, as well as the ease of writing. The choice of framework also influences whether developers and testers can rely on the test results before release and how much time the team will spend maintaining the testing infrastructure.

Our in-house expert Aliaksandr Shabanau has spent years building and running automated tests in Drupal environments of all sizes. He explains which frameworks are most commonly used in Drupal testing, why they’re chosen, and what makes them so useful in real projects. We reviewed and updated the information in July 2026 to help teams understand which automated testing tools are currently available for Drupal.

Aliaksandr Shabanau, Senior backend developer at Attico:

The right testing tools don’t just make life easier for developers — they raise the entire standard of delivery.

Aliaksandr Shabanau
Aliaksandr Shabanau Backend Developer

Likes to сreate technical documentation and guides. Good at mentoring Juniors.

Why QA frameworks matter in Drupal

Drupal is a powerful, modular system, which means that testing it isn’t always straightforward. Different features interact in different ways. Some tests only need to check a single function; others simulate full user flows in a live browser.

The good news? Drupal’s testing ecosystem is well-prepared for all of that.

Recent Drupal versions have moved toward widely adopted open-source QA automation frameworks, particularly those built around PHP, because that’s the language Drupal uses under the hood. Teams can create and maintain tests more easily and integrate them more naturally with the platform.

The expert continues:

It used to be that Drupal had its own internal testing framework — SimpleTest. It was deprecated in Drupal 8.8 and removed from Drupal Core with the release of Drupal 9.0.0. A contributed version remained available to help teams run older tests while migrating them, but it currently has no supported stable releases. As the community grew, it made more sense to move toward PHPUnit — a faster, more flexible, and much more widely supported framework.

Testing scales with your project

Automated testing isn’t just for massive enterprise websites. Whether your site serves five users or five million, the right framework helps you grow without losing sleep. That’s especially true in Drupal, where new modules or updates can affect multiple layers of the system.

Reflecting on smaller teams, Aliaksandr notes:

I’ve seen small teams avoid testing because they think it’s overkill. But in reality, that’s where it helps most. One test can prevent hours of rework.

Starting with the right QA frameworks — like PHPUnit — makes your test suite easier to scale. As your product grows, your tests grow with it. And every layer of confidence you build today makes future changes faster and safer.

The core of Drupal automated testing: PHPUnit

If you test Drupal, PHPUnit is still the main tool for PHP-based tests. It has been the standard in Drupal since Drupal 8. Drupal uses PHPUnit for unit, kernel, functional, and Functional JavaScript tests. Each type has a different purpose, and they do not all run at the same speed. Unit tests are usually very fast, while functional and browser tests take more time because they load more parts of Drupal. Here’s how Drupal breaks those out:

Unit tests check a small part of the code, such as one class or method. They do not need a Drupal database or a full Drupal site.

Use case: Testing business logic without loading Drupal.

Aliaksandr puts it:

Unit tests run in milliseconds. If your code has a bug, this is often the first place to catch it.

Nightwatch.js: bringing the frontend into focus

Drupal has used Nightwatch for JavaScript and end-to-end tests for several years. It is still part of the current Drupal testing setup.

While Nightwatch.js was introduced in Drupal core for JS testing, the ecosystem is actively transitioning toward Playwright due to its speed, flakiness reduction, and modern DX. Migration in Core is ongoing, so new projects should prioritize Playwright for modern E2E coverage.

PHPUnit-based tests and Nightwatch tests can run in the same CI/CD pipeline, but they are separate test suites.

Aliaksandr emphasizes:

Nightwatch doesn’t just test JavaScript — it tests what the user actually experiences. From animations to click paths, it helps you spot issues before your users do.

What about other frameworks like Behat?

Behat

Behat is still an option for site-specific behaviour tests. It lets teams describe test scenarios in Gherkin, using simple steps such as Given, When, and Then.

Gherkin

Gherkin is the syntax used to write the scenarios. It is not another testing framework.

For Drupal projects, the Drupal Extension connects Behat, Mink, and Drupal. Version 5.2 and later supports Drupal 10 and 11. However, the project currently has no supported stable release, so teams should check its status before using it in a new project.

Our expert puts it plainly:

Behat is good for some things, but in practice, it’s often more work than it’s worth. PHPUnit just handles more of what we need faster.

Drupal Test Traits (DTT)

Drupal Test Traits (DTT) allows running tests against an existing database (via ExistingSiteBase). This makes it ideal for testing sites with real content and complex configurations without the overhead of reinstalling Drupal from scratch.

DTT is a community project and is not part of Drupal Core. It is not covered by Drupal’s security advisory policy, so teams should check the project carefully before using it. Any known security issues may be publicly visible.

What about Cypress, Playwright, or other testing tools?

Cypress and Playwright are tools for browser and end-to-end testing. They are not part of Drupal’s main PHPUnit testing system, but both can be used with Drupal.

Cypress

Cypress has been used in Drupal projects for several years. Drupal.org has a guide for setting it up, debugging tests in a browser, and running them in CI. It is an external tool and is not part of Drupal Core.

There is also a contributed Cypress module. However, its current releases are unsupported, and the project is not covered by Drupal’s security advisory policy. Teams should check its status before using it in a new project.

Playwright

Playwright is becoming more important in the Drupal ecosystem. Drupal Core has decided to move most of its Nightwatch tests to Playwright, although the migration is not complete yet.

There is also a community Playwright project with fixtures and helper objects for Drupal sites. The project is still new and is not covered by Drupal’s security advisory policy.

Aliaksandr likes to say:

You can think of tests like insurance. You don’t always need them — until you really do.

For a classic Drupal project, PHPUnit is still the main choice for PHP-based tests. Playwright is worth considering for new browser tests, but teams should keep in mind that Drupal Core’s migration from Nightwatch is still in progress. Cypress can still be useful, especially for projects that already use it.

What makes PHPUnit the favorite?

PHPUnit remains the main testing framework for Drupal because:

  • It has been the Drupal standard since Drupal 8.
  • Drupal provides base classes for unit, kernel, functional, and Functional JavaScript tests.
  • It works directly with Drupal services, APIs, entities, and plugins.
  • It is well documented and widely used in the PHP community.
  • It can be included in automated CI/CD pipelines.

Unit tests can give very fast feedback. Kernel and functional tests take longer, but they also check more parts of the system.

Aliaksandr puts it:

In bigger projects, even saving a few seconds per test run makes a difference. PHPUnit is optimized for speed and scale.

And speed matters. When your developers are pushing new features every week or every day, long waits for test results simply aren’t practical. PHPUnit helps keep the feedback loop short and actionable.

How to choose the right testing tool for Drupal

There is no single testing tool that is right for every Drupal project. Before choosing one, ask four simple questions.

Start with the part of the system you want to check.

  • If you need to test one class, method, or piece of business logic, a PHPUnit unit test may be enough.
  • If the code uses Drupal services, plugins, entities, or the database, a kernel test is usually a better choice.
  • If you need to test pages, forms, permissions, or user flows without JavaScript, use a PHPUnit functional test.
  • If the test needs a real browser, JavaScript, or AJAX, you may need a Functional JavaScript test, Playwright, or Cypress. Nightwatch may still appear in existing Drupal projects, but Drupal Core is working on moving most of its Nightwatch tests to Playwright.
     

The right choice also depends on the people who will write and maintain the tests.

A team that works mainly with PHP and Drupal will usually find PHPUnit easier to use. A team with strong JavaScript or TypeScript skills may feel more comfortable with Playwright or Cypress.

If the team wants to describe business scenarios with simple Given, When, and Then steps, Behat and Gherkin may be useful. However, the team should check the current support status of the Drupal Extension before using it in a new project.

Do not choose Drupal testing tools only because they are popular. Choose because they solve a real problem.

  • If developers need fast feedback on small code changes, start with unit tests.
  • If bugs appear when different Drupal services work together, kernel tests can help.
  • If important user flows keep breaking, functional or browser tests may be more useful.
  • If you need to test a Drupal site that already contains real data and content, Drupal Test Traits may help. Because it is a community project, the team should also review its support and security status.
     

Open-source tools may be free to install, but tests still take time to create, run, update, and fix.

A small set of useful and stable tests is often better than a large test suite that nobody can maintain. The team should also think about CI setup, browser infrastructure, test data, and who will update the tests when the Drupal site changes.

For many traditional Drupal projects, PHPUnit is the best place to start. Other tools should be added when there is a clear testing need that PHPUnit does not cover well enough.

What to expect when getting started

Even if you’re not writing the tests yourself, it helps to know how things usually go when integrating automated testing into your Drupal project. Here’s a simplified breakdown:

The expert points out:

You don’t need to be an expert in testing frameworks to see the benefits. All you need to know is this: when tests are in place, fewer things break. And that’s good for business.

Final thoughts

Choosing a testing framework might seem like a developer decision, but it impacts everyone. Faster releases, fewer bugs, smoother onboarding, better experiences. It all starts with using the right tools.

For Drupal teams, PHPUnit remains the main choice for PHP-based testing. Nightwatch is still used in Drupal Core, but it is no longer the long-term direction. Drupal is working on moving most Nightwatch tests to Playwright, although that migration is not complete yet.

Aliaksandr puts it:

The frameworks you choose shape how confidently you ship. And confidence, especially in complex projects, is everything.

If you’re working with a Drupal team or planning to, make sure automated testing is part of the conversation. Not just in theory but in practice. The Drupal testing tools are here. The benefits are clear. And the results speak for themselves.

Article Authors

Aliaksandr Shabanau
Aliaksandr Shabanau Backend Developer

Likes to сreate technical documentation and guides. Good at mentoring Juniors.

Related insights

Let's start with a complimentary consultation

Whether you have a small urgent task, or a large ambitious project, we can help