Module Development

Run Drupal Tests with the run-tests.sh Script for Drupal 8

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Drupal core comes with a run-tests.sh script to help with running tests. This script has some distinct advantages over running tests directly via PHPUnit. It runs all tests in their own separate process, and can therefore handle PHP fatal errors without killing the test run. It's also the mechanism that the Drupal CI tools use to run tests; so, it can be handy when debugging tests that are failing on Drupal.org.

In this tutorial we'll:

  • Look at the available options for the core run-tests.sh script
  • Go through some examples of running tests using run-tests.sh

By the end of this tutorial you'll know how to run your tests using run-test.sh.