55 * Email: [email protected] ; Skype: roman.iovlev 66 */
77
8- import com .jdiai .tools .Safe ;
98import org .testng .IInvokedMethod ;
109import org .testng .IInvokedMethodListener ;
1110import org .testng .ITestNGMethod ;
2221import static java .lang .System .currentTimeMillis ;
2322
2423public class TestNGListener implements IInvokedMethodListener {
25- private Safe < Long > start = new Safe <>( 0L );
24+ private Long start = currentTimeMillis ( );
2625
2726 @ Override
2827 public void beforeInvocation (IInvokedMethod m , ITestResult tr ) {
@@ -32,7 +31,7 @@ public void beforeInvocation(IInvokedMethod m, ITestResult tr) {
3231 String testName = last (testMethod .getTestClass ().getName ().split ("\\ ." )) +
3332 "." + testMethod .getMethodName ();
3433 TEST_NAME .set (testName );
35- start . set ( currentTimeMillis () );
34+ start = currentTimeMillis ();
3635 logger .step ("== Test '%s' START ==" , testName );
3736 }
3837 }
@@ -44,7 +43,7 @@ public void afterInvocation(IInvokedMethod method, ITestResult tr) {
4443 String result = getTestResult (tr );
4544 logger .step ("=== Test '%s' %s [%s] ===" , TEST_NAME .get (), result ,
4645 new SimpleDateFormat ("mm:ss.SS" )
47- .format (new Date (currentTimeMillis () - start . get () )));
46+ .format (new Date (currentTimeMillis () - start )));
4847 if ("FAILED" .equals (result )) {
4948 try {
5049 screenshotStep ("On Fail Screenshot" );
0 commit comments