Index: skeleton/util/profiling/unittest/TestSuite.class.php =================================================================== --- skeleton/util/profiling/unittest/TestSuite.class.php (revision 6271) +++ skeleton/util/profiling/unittest/TestSuite.class.php (working copy) @@ -114,7 +114,7 @@ } try(); { - $test->run(); + $times= $test->run(); } if (catch('Exception', $e)) { $test->tearDown(); $timer->stop(); @@ -122,7 +122,7 @@ return FALSE; } $timer->stop(); - $result->setSucceeded($test, $timer->elapsedTime()); + $result->setSucceeded($test, $timer->elapsedTime(), $times); $test->tearDown(); return TRUE; } Index: skeleton/util/profiling/unittest/TestCase.class.php =================================================================== --- skeleton/util/profiling/unittest/TestCase.class.php (revision 6271) +++ skeleton/util/profiling/unittest/TestCase.class.php (working copy) @@ -368,7 +368,7 @@ * Run this test case. * * @access public - * @return bool success + * @return int how many times this test was run * @throws lang.MethodNotImplementedException */ function run() { @@ -380,7 +380,7 @@ 'Method does not exist', $this->name )); } - + $expected= NULL; if ($method->hasAnnotation('expect')) { try(); { @@ -389,28 +389,32 @@ return throw($e); } } - - try(); { - $method->invoke($this, NULL); - } if (catch('Exception', $e)) { - - // Was that an expected exception? - if ($expected && $expected->isInstance($e)) { - xp::gc(); - return TRUE; + + // Figure out how many times to run a test + $times= $method->hasAnnotation('times') ? (int)$method->getAnnotation('times') : 1; + for ($i= 0; $i < $times; $i++) { + try(); { + $method->invoke($this, NULL); + } if (catch('Exception', $e)) { + + // Was that an expected exception? + if ($expected && $expected->isInstance($e)) { + xp::gc(); + continue; + } + + return throw($e); } - - return throw($e); + + if ($expected) return $this->fail( + 'Expected exception not caught', + 'failedexpect', + $expected->getClassName(), + NULL + ); + } - - if ($expected) return $this->fail( - 'Expected exception not caught', - 'failedexpect', - $expected->getClassName(), - NULL - ); - - return TRUE; + return $times; } } ?>