Class TestListenerAdapter
java.lang.Object
org.testng.TestListenerAdapter
- All Implemented Interfaces:
IConfigurationListener, IResultListener, IResultListener2, ITestListener, ITestNGListener
A simple ITestListener adapter that stores all the tests that were run. You can retrieve these
results with the following methods: getPassedTests() getFailedTests() getSkippedTests()
If you extend this class in order to override any of these methods, remember to call their super equivalent if you want this list of tests to be maintained.
- Author:
- Cedric Beust, Aug 6, 2004, Alexandru Popescu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ITestNGMethod[]voidInvoked whenever a configuration method failed.voidInvoked whenever a configuration method was skipped.voidInvoked whenever a configuration method succeeded.voidonStart(ITestContext testContext) Invoked before running all the test methods belonging to the classes inside the <test> tag and calling all their Configuration methods.voidInvoked each time a method fails but has been annotated with successPercentage and this failure still keeps it within the success percentage requested.voidInvoked each time a test fails due to a timeout.voidInvoked each time a test fails.voidInvoked each time a test is skipped.voidInvoked each time a test succeeds.voidsetAllTestMethods(List<ITestNGMethod> allTestMethods) voidsetFailedButWithinSuccessPercentageTests(List<ITestResult> failedButWithinSuccessPercentageTests) voidsetFailedTests(List<ITestResult> failedTests) voidsetPassedTests(List<ITestResult> passedTests) voidsetSkippedTests(List<ITestResult> skippedTests) toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IConfigurationListener
beforeConfiguration, beforeConfiguration, onConfigurationFailure, onConfigurationSkip, onConfigurationSuccessMethods inherited from interface ITestListener
onFinish, onTestStartMethods inherited from interface ITestNGListener
isEnabled
-
Constructor Details
-
TestListenerAdapter
public TestListenerAdapter()
-
-
Method Details
-
onTestSuccess
Description copied from interface:ITestListenerInvoked each time a test succeeds.- Specified by:
onTestSuccessin interfaceITestListener- Parameters:
tr-ITestResultcontaining information about the run test- See Also:
-
onTestFailure
Description copied from interface:ITestListenerInvoked each time a test fails.- Specified by:
onTestFailurein interfaceITestListener- Parameters:
tr-ITestResultcontaining information about the run test- See Also:
-
onTestSkipped
Description copied from interface:ITestListenerInvoked each time a test is skipped.- Specified by:
onTestSkippedin interfaceITestListener- Parameters:
tr-ITestResultcontaining information about the run test- See Also:
-
onTestFailedWithTimeout
Description copied from interface:ITestListenerInvoked each time a test fails due to a timeout.- Specified by:
onTestFailedWithTimeoutin interfaceITestListener- Parameters:
tr-ITestResultcontaining information about the run test
-
onTestFailedButWithinSuccessPercentage
Description copied from interface:ITestListenerInvoked each time a method fails but has been annotated with successPercentage and this failure still keeps it within the success percentage requested.- Specified by:
onTestFailedButWithinSuccessPercentagein interfaceITestListener- Parameters:
tr-ITestResultcontaining information about the run test- See Also:
-
getAllTestMethods
-
onStart
Description copied from interface:ITestListenerInvoked before running all the test methods belonging to the classes inside the <test> tag and calling all their Configuration methods.- Specified by:
onStartin interfaceITestListener- Parameters:
testContext- The test context
-
getFailedButWithinSuccessPercentageTests
- Returns:
- Returns the failedButWithinSuccessPercentageTests.
-
getFailedTests
- Returns:
- Returns the failedTests.
-
getPassedTests
- Returns:
- Returns the passedTests.
-
getSkippedTests
- Returns:
- Returns the skippedTests.
-
getTimedoutTests
- Returns:
- Returns the tests that failed due to a timeout
-
setAllTestMethods
- Parameters:
allTestMethods- The allTestMethods to set.
-
setFailedButWithinSuccessPercentageTests
public void setFailedButWithinSuccessPercentageTests(List<ITestResult> failedButWithinSuccessPercentageTests) - Parameters:
failedButWithinSuccessPercentageTests- The failedButWithinSuccessPercentageTests to set.
-
setFailedTests
- Parameters:
failedTests- The failedTests to set.
-
setPassedTests
- Parameters:
passedTests- The passedTests to set.
-
setSkippedTests
- Parameters:
skippedTests- The skippedTests to set.
-
getTestContexts
-
getConfigurationFailures
-
onConfigurationFailure
Description copied from interface:IConfigurationListenerInvoked whenever a configuration method failed.- Specified by:
onConfigurationFailurein interfaceIConfigurationListener- Parameters:
itr- The test result- See Also:
-
getConfigurationSkips
-
onConfigurationSkip
Description copied from interface:IConfigurationListenerInvoked whenever a configuration method was skipped.- Specified by:
onConfigurationSkipin interfaceIConfigurationListener- Parameters:
itr- The test result- See Also:
-
onConfigurationSuccess
Description copied from interface:IConfigurationListenerInvoked whenever a configuration method succeeded.- Specified by:
onConfigurationSuccessin interfaceIConfigurationListener- Parameters:
itr- The test result- See Also:
-
toString
-