Index: modules/simpletest/simpletest.api.php
===================================================================
RCS file: modules/simpletest/simpletest.api.php
diff -N modules/simpletest/simpletest.api.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/simpletest.api.php	20 Mar 2009 14:58:53 -0000
@@ -0,0 +1,57 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Hooks provided by the SimpleTest module.
+ */
+
+/**
+ * @addtogroup hooks
+ * @{
+ */
+
+/**
+ * A test run has started.
+ * 
+ * This hook is called just once at the beginning of a test run.
+ *
+ * @return
+ *   None.
+ *
+ */
+function hook_testrun_started() {
+}
+
+/**
+ * A test run has finished.
+ *
+ * This hook is called just once at the end of a test run.
+ * 
+ * @return
+ *   None.
+ *
+ */
+function hook_testrun_finished() {
+}
+
+/**
+ * An individual test has finished.
+ * 
+ * This hook is called when an individual test has finished.
+ *
+ * @param
+ *   $results The results of the test as gathered by DrupalWebTestCase. 
+ *
+ * @return
+ *   None.
+ *
+ * @see DrupalWebTestCase->results
+ */
+function hook_test_finished($results) {
+}
+
+
+/**
+ * @} End of "addtogroup hooks".
+ */
Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v
retrieving revision 1.38
diff -u -p -r1.38 simpletest.module
--- modules/simpletest/simpletest.module	22 Feb 2009 17:55:30 -0000	1.38
+++ modules/simpletest/simpletest.module	20 Mar 2009 14:58:53 -0000
@@ -370,6 +370,9 @@ function simpletest_run_tests($test_list
     'init_message' => t('Processing test @num of @max - %test.', array('%test' => $info['name'], '@num' => '1', '@max' => count($test_list))),
   );
   batch_set($batch);
+  
+  module_invoke_all('testrun_started');
+  
   // Normally, the forms portion of the batch API takes care of calling
   // batch_process(), but in the process it saves the whole $form into the
   // database (which is huge for the test selection form).
@@ -407,6 +410,8 @@ function _simpletest_batch_operation($te
   $size = count($test_list);
   $info = $test->getInfo();
 
+  module_invoke_all('test_finished', $test->results);
+
   // Gather results and compose the report.
   $test_results[$test_class] = $test->results;
   foreach ($test_results[$test_class] as $key => $value) {
@@ -441,6 +446,7 @@ function _simpletest_batch_finished($suc
   else {
     drupal_set_message(t('The tests did not successfully finish.'), 'error');
   }
+  module_invoke_all('testrun_finished');
 }
 
 /**
