1 package org.testng; 2 3 /** 4 * A listener for test running. 5 * 6 * @author Cedric Beust 7 * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a> 8 * @author Hani Suleiman 9 */ 10 public interface ITestListener extends ITestNGListener { 11 /** 12 * Invoked each time before a test will be invoked. 13 * The <code>ITestResult</code> is only partially filled with the references to 14 * class, method, start millis and status. 15 * 16 * @param result the partially filled <code>ITestResult</code> 17 * @see ITestResult#STARTED 18 */ onTestStart(ITestResult result)19 void onTestStart(ITestResult result); 20 21 /** 22 * Invoked each time a test succeeds. 23 * 24 * @param result <code>ITestResult</code> containing information about the run test 25 * @see ITestResult#SUCCESS 26 */ onTestSuccess(ITestResult result)27 public void onTestSuccess(ITestResult result); 28 29 /** 30 * Invoked each time a test fails. 31 * 32 * @param result <code>ITestResult</code> containing information about the run test 33 * @see ITestResult#FAILURE 34 */ onTestFailure(ITestResult result)35 public void onTestFailure(ITestResult result); 36 37 /** 38 * Invoked each time a test is skipped. 39 * 40 * @param result <code>ITestResult</code> containing information about the run test 41 * @see ITestResult#SKIP 42 */ onTestSkipped(ITestResult result)43 public void onTestSkipped(ITestResult result); 44 45 /** 46 * Invoked each time a method fails but has been annotated with 47 * successPercentage and this failure still keeps it within the 48 * success percentage requested. 49 * 50 * @param result <code>ITestResult</code> containing information about the run test 51 * @see ITestResult#SUCCESS_PERCENTAGE_FAILURE 52 */ onTestFailedButWithinSuccessPercentage(ITestResult result)53 public void onTestFailedButWithinSuccessPercentage(ITestResult result); 54 55 /** 56 * Invoked after the test class is instantiated and before 57 * any configuration method is called. 58 */ onStart(ITestContext context)59 public void onStart(ITestContext context); 60 61 /** 62 * Invoked after all the tests have run and all their 63 * Configuration methods have been called. 64 */ onFinish(ITestContext context)65 public void onFinish(ITestContext context); 66 67 } 68