Automated testing for Drupal 7
- Testing overview
- Testing module
- Testing tutorial
- Unit Testing with SimpleTest
- Organizing your test cases
- Selenium testing
- Testing setup and configuration
- Writing upgrade path tests
- Run tests
- Running tests through command-line
- Troubleshooting tests
- SimpleTest upload tests hanging
- SimpleTest [Browser] on Vista
- Improving SimpleTest performance
- Testing Reference
- API functions
- Assertions
- Why test
- Core tests
- Hidden modules and themes
- Comprehensive example
- Miscellaneous SimpleTest tips
Testing module
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
The Testing module (Drupal 7.x and beyond) or SimpleTest module (Drupal 6.x) provides a framework for running automated unit and functional tests in Drupal. It can be used to verify a working state of Drupal before and after any code changes, or as a means for developers to write and execute tests for their modules. The original module was based on the SimpleTest PHP library.
Visit Administration >> Configuration >> Development >> Testing (Drupal 7.x or 8.x dev) or Administer >> Site building >> SimpleTest (Drupal 6.x) to display a list of available tests. For comprehensive testing, select all tests, or individually select tests for more targeted testing. (Note: Selecting all tests may take several minutes to complete in Drupal 7.x or below, and if you select too many, they may fail to complete. In Drupal 8.x you may need to increase your max_input_vars setting to 2000 in your php.ini file for the Testing admin page to load. There are far too many tests to run all locally. For a full coverage test, use testbot. Once you have identified the test or group that is failing, run those tests locally.)
After the tests have run, a message will be displayed next to each test group indicating whether tests within it passed, failed, or had exceptions. A pass means that a test returned the expected results, while fail means that it did not. An exception normally indicates an error outside of the test, such as a PHP warning or notice. If there were fails or exceptions, the results are expanded, and the tests that had issues will be indicated in red or pink rows. Use these results to refine your code and tests until all tests return a pass.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion