Rethinking Drupal Testing: Kernel HTTP Requests Reduce Need for Browser Tests

PHPUnit

Drupal’s testing framework now allows Kernel tests to make HTTP requests, enabling developers to replace some Browser tests with faster alternatives. In a blog post, Joachim Noreiko argues that this shift can significantly reduce test execution time by avoiding full browser simulation where it is not required.

Browser tests validate rendered HTML and user interactions through an internal browser, making them slower and resource-intensive. Kernel tests operate closer to the application layer and, with HTTP request support, can now cover some of these scenarios with less overhead. This makes them suitable for cases where full browser behaviour is not essential.

The approach comes with limitations. Kernel tests do not support sessions, cannot submit forms, and require manual setup for schemas and configuration. Not all Browser tests can be replaced, particularly those involving user interaction. The post does not provide benchmarks or implementation examples, and remains a conceptual guide rather than a detailed migration reference.

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related People

Upcoming Events