Package com.shaft.listeners
Class TestNGListener
java.lang.Object
com.shaft.listeners.TestNGListener
- All Implemented Interfaces:
org.testng.IAlterSuiteListener
,org.testng.IAnnotationTransformer
,org.testng.IConfigurationListener
,org.testng.IExecutionListener
,org.testng.IInvokedMethodListener
,org.testng.internal.IResultListener
,org.testng.internal.IResultListener2
,org.testng.ISuiteListener
,org.testng.ITestListener
,org.testng.ITestNGListener
public class TestNGListener
extends Object
implements org.testng.IAlterSuiteListener, org.testng.IAnnotationTransformer, org.testng.IExecutionListener, org.testng.ISuiteListener, org.testng.IInvokedMethodListener, org.testng.ITestListener, org.testng.internal.IResultListener2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Supplier
<com.epam.reportportal.testng.ITestNGService> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterInvocation
(org.testng.IInvokedMethod iInvokedMethod, org.testng.ITestResult iTestResult, org.testng.ITestContext iTestContext) A listener that gets invoked after a method is invoked by TestNG.void
Implementations of this interface will gain access to theXmlSuite
object and thus let users be able to alter a suite or a test based on their own needs.void
beforeConfiguration
(org.testng.ITestResult testResult) void
beforeInvocation
(org.testng.IInvokedMethod method, org.testng.ITestResult iTestResult, org.testng.ITestContext iTestContext) A listener that gets invoked before a method is invoked by TestNG.static void
void
onConfigurationFailure
(org.testng.ITestResult testResult) void
onConfigurationSkip
(org.testng.ITestResult testResult) void
onConfigurationSuccess
(org.testng.ITestResult testResult) void
gets invoked at the very last (after attachTestArtifacts generation phase), before TestNG exits the JVM.void
gets invoked before TestNG proceeds with invoking any other listener.void
onFinish
(org.testng.ISuite suite) void
onFinish
(org.testng.ITestContext testContext) void
onStart
(org.testng.ISuite suite) This method is invoked before the SuiteRunner starts.void
onStart
(org.testng.ITestContext testContext) void
onTestFailedButWithinSuccessPercentage
(org.testng.ITestResult result) void
onTestFailure
(org.testng.ITestResult testResult) void
onTestSkipped
(org.testng.ITestResult testResult) void
onTestStart
(org.testng.ITestResult testResult) void
onTestSuccess
(org.testng.ITestResult testResult) void
transform
(org.testng.annotations.ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) This method will be invoked by TestNG to give you a chance to modify a TestNG annotation read from your test classes.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.testng.IAnnotationTransformer
transform, transform, transform, transform
Methods inherited from interface org.testng.IConfigurationListener
beforeConfiguration, onConfigurationFailure, onConfigurationSkip, onConfigurationSuccess
Methods inherited from interface org.testng.IInvokedMethodListener
afterInvocation, beforeInvocation
Methods inherited from interface org.testng.ITestListener
onTestFailedWithTimeout
Methods inherited from interface org.testng.ITestNGListener
isEnabled
-
Field Details
-
REPORT_PORTAL_SERVICE
-
-
Constructor Details
-
TestNGListener
public TestNGListener()
-
-
Method Details
-
identifyRunType
-
engineSetup
-
onExecutionStart
public void onExecutionStart()gets invoked before TestNG proceeds with invoking any other listener.- Specified by:
onExecutionStart
in interfaceorg.testng.IExecutionListener
-
alter
Implementations of this interface will gain access to theXmlSuite
object and thus let users be able to alter a suite or a test based on their own needs.- Specified by:
alter
in interfaceorg.testng.IAlterSuiteListener
- Parameters:
suites
- - The list ofXmlSuite
s that are part of the current execution.
-
onStart
public void onStart(org.testng.ISuite suite) This method is invoked before the SuiteRunner starts.- Specified by:
onStart
in interfaceorg.testng.ISuiteListener
- Parameters:
suite
- The suite
-
onFinish
public void onFinish(org.testng.ISuite suite) - Specified by:
onFinish
in interfaceorg.testng.ISuiteListener
-
onStart
public void onStart(org.testng.ITestContext testContext) - Specified by:
onStart
in interfaceorg.testng.ITestListener
-
onFinish
public void onFinish(org.testng.ITestContext testContext) - Specified by:
onFinish
in interfaceorg.testng.ITestListener
-
beforeConfiguration
public void beforeConfiguration(org.testng.ITestResult testResult) - Specified by:
beforeConfiguration
in interfaceorg.testng.IConfigurationListener
-
onConfigurationFailure
public void onConfigurationFailure(org.testng.ITestResult testResult) - Specified by:
onConfigurationFailure
in interfaceorg.testng.IConfigurationListener
-
onConfigurationSuccess
public void onConfigurationSuccess(org.testng.ITestResult testResult) - Specified by:
onConfigurationSuccess
in interfaceorg.testng.IConfigurationListener
-
onConfigurationSkip
public void onConfigurationSkip(org.testng.ITestResult testResult) - Specified by:
onConfigurationSkip
in interfaceorg.testng.IConfigurationListener
-
onTestFailedButWithinSuccessPercentage
public void onTestFailedButWithinSuccessPercentage(org.testng.ITestResult result) - Specified by:
onTestFailedButWithinSuccessPercentage
in interfaceorg.testng.ITestListener
-
transform
public void transform(org.testng.annotations.ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) This method will be invoked by TestNG to give you a chance to modify a TestNG annotation read from your test classes. You can change the values you need by calling any of the setters on the ITest interface.Note that only one of the three parameters testClass, testConstructor and testMethod will be non-null.
- Specified by:
transform
in interfaceorg.testng.IAnnotationTransformer
- Parameters:
annotation
- The annotation that was read from your test class.testClass
- If the annotation was found on a class, this parameter represents this class (null otherwise).testConstructor
- If the annotation was found on a constructor, this parameter represents this constructor (null otherwise).testMethod
- If the annotation was found on a method, this parameter represents this method (null otherwise).
-
beforeInvocation
public void beforeInvocation(org.testng.IInvokedMethod method, org.testng.ITestResult iTestResult, org.testng.ITestContext iTestContext) A listener that gets invoked before a method is invoked by TestNG. This listener will be invoked for configuration and test methods irrespective of whether they pass/fail or get skipped. This listener invocation can be disabled for SKIPPED tests through one of the below mechanisms:- Command line parameter
alwaysRunListeners
- Build tool
- Via
TestNG.alwaysRunListeners(false)
- Specified by:
beforeInvocation
in interfaceorg.testng.IInvokedMethodListener
- Command line parameter
-
afterInvocation
public void afterInvocation(org.testng.IInvokedMethod iInvokedMethod, org.testng.ITestResult iTestResult, org.testng.ITestContext iTestContext) A listener that gets invoked after a method is invoked by TestNG. This listener will be invoked for configuration and test methods irrespective of whether they pass/fail or get skipped. This listener invocation can be disabled for SKIPPED tests through one of the below mechanisms:- Command line parameter
alwaysRunListeners
- Build tool
- Via
TestNG.alwaysRunListeners(false)
- Specified by:
afterInvocation
in interfaceorg.testng.IInvokedMethodListener
- Command line parameter
-
onExecutionFinish
public void onExecutionFinish()gets invoked at the very last (after attachTestArtifacts generation phase), before TestNG exits the JVM.- Specified by:
onExecutionFinish
in interfaceorg.testng.IExecutionListener
-
onTestStart
public void onTestStart(org.testng.ITestResult testResult) - Specified by:
onTestStart
in interfaceorg.testng.ITestListener
-
onTestSuccess
public void onTestSuccess(org.testng.ITestResult testResult) - Specified by:
onTestSuccess
in interfaceorg.testng.ITestListener
-
onTestFailure
public void onTestFailure(org.testng.ITestResult testResult) - Specified by:
onTestFailure
in interfaceorg.testng.ITestListener
-
onTestSkipped
public void onTestSkipped(org.testng.ITestResult testResult) - Specified by:
onTestSkipped
in interfaceorg.testng.ITestListener
-