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 TypeMethodDescriptionvoidafterInvocation(org.testng.IInvokedMethod iInvokedMethod, org.testng.ITestResult iTestResult, org.testng.ITestContext iTestContext) A listener that gets invoked after a method is invoked by TestNG.voidImplementations of this interface will gain access to theXmlSuiteobject and thus let users be able to alter a suite or a test based on their own needs.voidbeforeConfiguration(org.testng.ITestResult testResult) voidbeforeInvocation(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 voidvoidonConfigurationFailure(org.testng.ITestResult testResult) voidonConfigurationSkip(org.testng.ITestResult testResult) voidonConfigurationSuccess(org.testng.ITestResult testResult) voidgets invoked at the very last (after attachTestArtifacts generation phase), before TestNG exits the JVM.voidgets invoked before TestNG proceeds with invoking any other listener.voidonFinish(org.testng.ISuite suite) voidonFinish(org.testng.ITestContext testContext) voidonStart(org.testng.ISuite suite) This method is invoked before the SuiteRunner starts.voidonStart(org.testng.ITestContext testContext) voidonTestFailedButWithinSuccessPercentage(org.testng.ITestResult result) voidonTestFailure(org.testng.ITestResult testResult) voidonTestSkipped(org.testng.ITestResult testResult) voidonTestStart(org.testng.ITestResult testResult) voidonTestSuccess(org.testng.ITestResult testResult) voidtransform(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, waitMethods inherited from interface org.testng.IAnnotationTransformer
transform, transform, transform, transformMethods inherited from interface org.testng.IConfigurationListener
beforeConfiguration, onConfigurationFailure, onConfigurationSkip, onConfigurationSuccessMethods inherited from interface org.testng.IInvokedMethodListener
afterInvocation, beforeInvocationMethods inherited from interface org.testng.ITestListener
onTestFailedWithTimeoutMethods 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:
onExecutionStartin interfaceorg.testng.IExecutionListener
-
alter
Implementations of this interface will gain access to theXmlSuiteobject and thus let users be able to alter a suite or a test based on their own needs.- Specified by:
alterin interfaceorg.testng.IAlterSuiteListener- Parameters:
suites- - The list ofXmlSuites 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:
onStartin interfaceorg.testng.ISuiteListener- Parameters:
suite- The suite
-
onFinish
public void onFinish(org.testng.ISuite suite) - Specified by:
onFinishin interfaceorg.testng.ISuiteListener
-
onStart
public void onStart(org.testng.ITestContext testContext) - Specified by:
onStartin interfaceorg.testng.ITestListener
-
onFinish
public void onFinish(org.testng.ITestContext testContext) - Specified by:
onFinishin interfaceorg.testng.ITestListener
-
beforeConfiguration
public void beforeConfiguration(org.testng.ITestResult testResult) - Specified by:
beforeConfigurationin interfaceorg.testng.IConfigurationListener
-
onConfigurationFailure
public void onConfigurationFailure(org.testng.ITestResult testResult) - Specified by:
onConfigurationFailurein interfaceorg.testng.IConfigurationListener
-
onConfigurationSuccess
public void onConfigurationSuccess(org.testng.ITestResult testResult) - Specified by:
onConfigurationSuccessin interfaceorg.testng.IConfigurationListener
-
onConfigurationSkip
public void onConfigurationSkip(org.testng.ITestResult testResult) - Specified by:
onConfigurationSkipin interfaceorg.testng.IConfigurationListener
-
onTestFailedButWithinSuccessPercentage
public void onTestFailedButWithinSuccessPercentage(org.testng.ITestResult result) - Specified by:
onTestFailedButWithinSuccessPercentagein 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:
transformin 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:
beforeInvocationin 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:
afterInvocationin 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:
onExecutionFinishin interfaceorg.testng.IExecutionListener
-
onTestStart
public void onTestStart(org.testng.ITestResult testResult) - Specified by:
onTestStartin interfaceorg.testng.ITestListener
-
onTestSuccess
public void onTestSuccess(org.testng.ITestResult testResult) - Specified by:
onTestSuccessin interfaceorg.testng.ITestListener
-
onTestFailure
public void onTestFailure(org.testng.ITestResult testResult) - Specified by:
onTestFailurein interfaceorg.testng.ITestListener
-
onTestSkipped
public void onTestSkipped(org.testng.ITestResult testResult) - Specified by:
onTestSkippedin interfaceorg.testng.ITestListener
-