Last updated June 15, 2020

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.