@@ -259,8 +259,11 @@ public function testError(FailEvent $failEvent)
259
259
*/
260
260
public function testEnd (TestEvent $ testEvent )
261
261
{
262
+ $ test = $ this ->getLifecycle ()->getTestCaseStorage ()->get ();
263
+ // update testClass label to consolidate re-try reporting
264
+ $ this ->formatAllureTestClassName ($ test );
262
265
// Peek top of testCaseStorage to check of failure
263
- $ testFailed = $ this -> getLifecycle ()-> getTestCaseStorage ()-> get () ->getFailure ();
266
+ $ testFailed = $ test ->getFailure ();
264
267
// Pops top of stepStorage, need to add it back in after processing
265
268
$ rootStep = $ this ->getLifecycle ()->getStepStorage ()->pollLast ();
266
269
$ formattedSteps = [];
@@ -402,4 +405,43 @@ private function removeAttachments($step, $testFailed)
402
405
}
403
406
}
404
407
}
408
+
409
+ /**
410
+ * Format testClass label to consolidate re-try reporting for groups split for parallel execution
411
+ * @param TestCase $test
412
+ * @return void
413
+ */
414
+ private function formatAllureTestClassName ($ test )
415
+ {
416
+ if ($ this ->getGroup () !== null ) {
417
+ foreach ($ test ->getLabels () as $ name => $ label ) {
418
+ if ($ label ->getName () == 'testClass ' ) {
419
+ $ originalTestClass = $ this ->sanitizeTestClassLabel ($ label ->getValue ());
420
+ call_user_func (\Closure::bind (
421
+ function () use ($ label , $ originalTestClass ) {
422
+ $ label ->value = $ originalTestClass ;
423
+ },
424
+ null ,
425
+ $ label
426
+ ));
427
+ break ;
428
+ }
429
+ }
430
+ }
431
+ }
432
+
433
+ /**
434
+ * Function which sanitizes testClass label for split group runs
435
+ * @param string $testClass
436
+ * @return string
437
+ */
438
+ private function sanitizeTestClassLabel ($ testClass )
439
+ {
440
+ $ originalTestClass = $ testClass ;
441
+ $ originalGroupName = $ this ->sanitizeGroupName ($ this ->getGroup ());
442
+ if ($ originalGroupName !== $ this ->getGroup ()) {
443
+ $ originalTestClass = str_replace ($ this ->getGroup (), $ originalGroupName , $ testClass );
444
+ }
445
+ return $ originalTestClass ;
446
+ }
405
447
}
0 commit comments