SimpleTest is a custom contributed module in Drupal 6. Now in Drupal 7 SimpleTest/Testing module is added to the
Drupal core. Purpose of this module is to provide a custom testing framework for running automated unit and functional tests in Drupal.
Important features of SimpleTest:
1. SimpleTest allows the Drupal developers to write test cases for their own custom modules.
2. It can be used to verify a working state of Drupal before and after any code changes during module development
3. It provides a Virtual Environment in which all test cases will be executed. Say for example it will create separate tables in the Drupal Database with the prefix simpletest for running the Test cases. It can create a virtual user, make him to login to the system and perform the user operations like creating node,comment etc. All these processes will not interfere/affect the Drupal site.
4. After Executing the required test cases the test environment can be cleaned. i.e the temporary tables will be deleted from the database.
Steps to configure SimpleTest:
1. Enable the SimpleTest Module in the modules section of Drupal Admin
2. Navigate to admin/config/development/testing.
Now Select the required tests to run and Click Runtests button. A Progress bar will be displayed showing the execution status and then the test case results will be displayed.
I’ll post a simple example on writing test cases for Drupal custom module in my next post.