Issue #3465132 by catch, Spokje, nod_: Show test run time by class in run-tests.sh output
parent
1c7a0b50f8
commit
cab9c0a9a8
|
@ -819,12 +819,15 @@ function simpletest_script_execute_batch(TestRunResultsStorageInterface $test_ru
|
|||
*/
|
||||
function simpletest_script_run_phpunit(TestRun $test_run, $class) {
|
||||
$runner = PhpUnitTestRunner::create(\Drupal::getContainer());
|
||||
$start = microtime(TRUE);
|
||||
$results = $runner->execute($test_run, $class, $status);
|
||||
$time = microtime(TRUE) - $start;
|
||||
|
||||
$runner->processPhpUnitResults($test_run, $results);
|
||||
|
||||
$summaries = $runner->summarizeResults($results);
|
||||
foreach ($summaries as $class => $summary) {
|
||||
simpletest_script_reporter_display_summary($class, $summary);
|
||||
simpletest_script_reporter_display_summary($class, $summary, $time);
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
@ -1080,14 +1083,17 @@ function simpletest_script_reporter_init() {
|
|||
* The test class name that was run.
|
||||
* @param array $results
|
||||
* The assertion results using #pass, #fail, #exception, #debug array keys.
|
||||
* @param int|null $duration
|
||||
* The time taken for the test to complete.
|
||||
*/
|
||||
function simpletest_script_reporter_display_summary($class, $results) {
|
||||
function simpletest_script_reporter_display_summary($class, $results, $duration = NULL) {
|
||||
// Output all test results vertically aligned.
|
||||
// Cut off the class name after 60 chars, and pad each group with 3 digits
|
||||
// by default (more than 999 assertions are rare).
|
||||
$output = vsprintf('%-60.60s %10s %9s %14s %12s', [
|
||||
$output = vsprintf('%-60.60s %10s %5s %9s %14s %12s', [
|
||||
$class,
|
||||
$results['#pass'] . ' passes',
|
||||
isset($duration) ? ceil($duration) . 's' : '',
|
||||
!$results['#fail'] ? '' : $results['#fail'] . ' fails',
|
||||
!$results['#exception'] ? '' : $results['#exception'] . ' exceptions',
|
||||
!$results['#debug'] ? '' : $results['#debug'] . ' messages',
|
||||
|
|
Loading…
Reference in New Issue