Testing in Drupal 7 focuses on functional testing instead of unit testing.
The Testing module (Drupal 7.x and beyond) or SimpleTest module (Drupal 6.x) provides a framework for running automated unit and
This tutorial will take you through the basics of testing in Drupal 7.
Note: The code for this tutorial is maintained in the Examples for Developers module. This means:
Here are some suggestions for organizing your test cases. It is best to put your test cases in files with certain names in certain locations
Selenium is a tool which automates browser testing, and so can be used to test your Drupal website.
SimpleTest has a few non-default requirements.
This document explains how to write tests for the Drupal core upgrade path.
Once you have completed the Setup and configuration (enabled the Testing module) you are ready to run some tests.
Command-line test execution - Linux
Use the new debug()
SimpleTests involving file uploading of any kind result in the test never finishing on Mac OS X covering Leopard and possibly other versions
Performance: improving the speed of SimpleTest during development.
The following resources provide some additional information on testing with Drupal. Please also read the sub-pages with more details.
The internal browser
Up to date documentation or additions may be found at the api.drupal.org reference site (not necessarily formatted for browsing).
You should write SimpleTests for your modules to ensure quality. SimpleTests allow you, the developer, to quickly test your module after
Drupal core now comes with numerous tests for functionality (in the region of 50-70% code coverage as of June 2008).
Sometimes, hooks we want to test are not used in any of the core modules, or core modules do not cover all the use cases of these hooks.
Now it's time to try a browser test. We don't have to change too much in our class, because DrupalWebTestCase class contains tools for both
This is a list of some general tips for writing tests, feel free to pitch in and add your own!