1 package test.listeners; 2 3 import org.testng.*; 4 import org.testng.annotations.ITestAnnotation; 5 6 import java.lang.reflect.Constructor; 7 import java.lang.reflect.Method; 8 import java.util.List; 9 10 public class SuiteListener2 implements IAnnotationTransformer, IInvokedMethodListener, ITestListener, ISuiteListener, IExecutionListener, IMethodInterceptor { 11 public static int start = 0; 12 public static int finish = 0; 13 14 @Override onFinish(ISuite suite)15 public void onFinish(ISuite suite) { 16 finish++; 17 } 18 19 @Override onStart(ISuite suite)20 public void onStart(ISuite suite) { 21 start++; 22 } 23 24 @Override beforeInvocation(IInvokedMethod method, ITestResult testResult)25 public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { 26 27 } 28 29 @Override afterInvocation(IInvokedMethod method, ITestResult testResult)30 public void afterInvocation(IInvokedMethod method, ITestResult testResult) { 31 32 } 33 34 @Override transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod)35 public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) { 36 37 } 38 39 @Override onExecutionStart()40 public void onExecutionStart() { 41 42 } 43 44 @Override onExecutionFinish()45 public void onExecutionFinish() { 46 47 } 48 49 @Override intercept(List<IMethodInstance> methods, ITestContext context)50 public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) { 51 return methods; 52 } 53 54 @Override onTestStart(ITestResult result)55 public void onTestStart(ITestResult result) { 56 57 } 58 59 @Override onTestSuccess(ITestResult result)60 public void onTestSuccess(ITestResult result) { 61 62 } 63 64 @Override onTestFailure(ITestResult result)65 public void onTestFailure(ITestResult result) { 66 67 } 68 69 @Override onTestSkipped(ITestResult result)70 public void onTestSkipped(ITestResult result) { 71 72 } 73 74 @Override onTestFailedButWithinSuccessPercentage(ITestResult result)75 public void onTestFailedButWithinSuccessPercentage(ITestResult result) { 76 77 } 78 79 @Override onStart(ITestContext context)80 public void onStart(ITestContext context) { 81 82 } 83 84 @Override onFinish(ITestContext context)85 public void onFinish(ITestContext context) { 86 87 } 88 } 89