1717package org .springframework .test .context .testng ;
1818
1919import java .util .ArrayList ;
20+ import java .util .Collections ;
2021import java .util .List ;
2122import java .util .concurrent .atomic .AtomicInteger ;
2223
3334 */
3435public class TrackingTestNGTestListener implements ITestListener {
3536
36- public final List <Throwable > throwables = new ArrayList <>();
37-
3837 public final AtomicInteger testStartCount = new AtomicInteger ();
3938
4039 public final AtomicInteger testSuccessCount = new AtomicInteger ();
4140
4241 public final AtomicInteger testFailureCount = new AtomicInteger ();
4342
44- public final AtomicInteger failedConfigurationsCount = new AtomicInteger ( );
43+ public final List < Throwable > throwables = Collections . synchronizedList ( new ArrayList <>() );
4544
45+ public final AtomicInteger failedConfigurationsCount = new AtomicInteger ();
4646
47- @ Override
48- public void onFinish (ITestContext testContext ) {
49- this .failedConfigurationsCount .addAndGet (testContext .getFailedConfigurations ().size ());
50- }
5147
5248 @ Override
53- public void onStart (ITestContext testContext ) {
49+ public void onTestStart (ITestResult testResult ) {
50+ this .testStartCount .incrementAndGet ();
5451 }
5552
5653 @ Override
57- public void onTestFailedButWithinSuccessPercentage (ITestResult testResult ) {
54+ public void onTestSuccess (ITestResult testResult ) {
55+ this .testSuccessCount .incrementAndGet ();
5856 }
5957
6058 @ Override
@@ -68,17 +66,8 @@ public void onTestFailure(ITestResult testResult) {
6866 }
6967
7068 @ Override
71- public void onTestSkipped (ITestResult testResult ) {
72- }
73-
74- @ Override
75- public void onTestStart (ITestResult testResult ) {
76- this .testStartCount .incrementAndGet ();
77- }
78-
79- @ Override
80- public void onTestSuccess (ITestResult testResult ) {
81- this .testSuccessCount .incrementAndGet ();
69+ public void onFinish (ITestContext testContext ) {
70+ this .failedConfigurationsCount .addAndGet (testContext .getFailedConfigurations ().size ());
8271 }
8372
8473}
0 commit comments