Class HelidonTestNgListener
- All Implemented Interfaces:
org.testng.IAlterSuiteListener,org.testng.IClassListener,org.testng.IConfigurationListener,org.testng.IInvokedMethodListener,org.testng.IMethodInterceptor,org.testng.ISuiteListener,org.testng.ITestListener,org.testng.ITestNGListener
This extension starts a CDI container and adds the test class as a bean with support for injection.
The container is started lazily during test execution to ensure that it is started after all other extensions.
The container can be customized with the following annotations:
HelidonTest.resetPerTest()force a new CDI container per testDisableDiscoverydisables CDI discoveryAddBeanadd CDI beansAddExtensionadd CDI extensionAddJaxRsadd JAX-RS (Jersey)
The configuration can be customized with the following annotations:
Configurationglobal setting for MicroProfile configurationAddConfigdeclarative key/value pair configurationAddConfigBlockdeclarative fragment configurationAddConfigSourceprogrammatic configuration
See also Socket, a CDI qualifier to inject JAX-RS client or URI.
The container is created per test class by default, unless
HelidonTest.resetPerTest() is true, in
which case the container is created per test method.
The container and the configuration can be customized per method regardless of the value of
HelidonTest.resetPerTest(). The container will be reset accordingly.
It is not recommended to provide a beans.xml along the test classes, as it would combine beans from all tests.
Instead, you should use AddBean to specify the beans per test or method.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr) voidvoidbeforeConfiguration(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) voidbeforeInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr) List<org.testng.IMethodInstance> voidonAfterClass(org.testng.ITestClass tc) voidonBeforeClass(org.testng.ITestClass tc) voidonConfigurationFailure(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) voidonConfigurationSuccess(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) voidonStart(org.testng.ISuite suite) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.testng.IConfigurationListener
beforeConfiguration, onConfigurationFailure, onConfigurationSkip, onConfigurationSkip, onConfigurationSuccessMethods inherited from interface org.testng.IInvokedMethodListener
afterInvocation, beforeInvocationMethods inherited from interface org.testng.ISuiteListener
onFinishMethods inherited from interface org.testng.ITestListener
onFinish, onStart, onTestFailedButWithinSuccessPercentage, onTestFailedWithTimeout, onTestFailure, onTestSkipped, onTestStart, onTestSuccess
-
Constructor Details
-
HelidonTestNgListener
public HelidonTestNgListener()
-
-
Method Details
-
alter
- Specified by:
alterin interfaceorg.testng.IAlterSuiteListener
-
onStart
public void onStart(org.testng.ISuite suite) - Specified by:
onStartin interfaceorg.testng.ISuiteListener
-
intercept
public List<org.testng.IMethodInstance> intercept(List<org.testng.IMethodInstance> methods, org.testng.ITestContext context) - Specified by:
interceptin interfaceorg.testng.IMethodInterceptor
-
onConfigurationFailure
public void onConfigurationFailure(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) - Specified by:
onConfigurationFailurein interfaceorg.testng.IConfigurationListener
-
onConfigurationSuccess
public void onConfigurationSuccess(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) - Specified by:
onConfigurationSuccessin interfaceorg.testng.IConfigurationListener
-
beforeConfiguration
public void beforeConfiguration(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) - Specified by:
beforeConfigurationin interfaceorg.testng.IConfigurationListener
-
beforeInvocation
public void beforeInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr) - Specified by:
beforeInvocationin interfaceorg.testng.IInvokedMethodListener
-
afterInvocation
public void afterInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr) - Specified by:
afterInvocationin interfaceorg.testng.IInvokedMethodListener
-
onBeforeClass
public void onBeforeClass(org.testng.ITestClass tc) - Specified by:
onBeforeClassin interfaceorg.testng.IClassListener
-
onAfterClass
public void onAfterClass(org.testng.ITestClass tc) - Specified by:
onAfterClassin interfaceorg.testng.IClassListener
-