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 testDisableDiscovery
disables CDI discoveryAddBean
add CDI beansAddExtension
add CDI extensionAddJaxRs
add JAX-RS (Jersey)
The configuration can be customized with the following annotations:
Configuration
global setting for MicroProfile configurationAddConfig
declarative key/value pair configurationAddConfigBlock
declarative fragment configurationAddConfigSource
programmatic 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 TypeMethodDescriptionvoid
afterInvocation
(org.testng.IInvokedMethod im, org.testng.ITestResult tr) void
void
beforeConfiguration
(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) void
beforeInvocation
(org.testng.IInvokedMethod im, org.testng.ITestResult tr) List
<org.testng.IMethodInstance> void
onAfterClass
(org.testng.ITestClass tc) void
onBeforeClass
(org.testng.ITestClass tc) void
onConfigurationFailure
(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) void
onConfigurationSuccess
(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) void
onStart
(org.testng.ISuite suite) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.testng.IConfigurationListener
beforeConfiguration, onConfigurationFailure, onConfigurationSkip, onConfigurationSkip, onConfigurationSuccess
Methods inherited from interface org.testng.IInvokedMethodListener
afterInvocation, beforeInvocation
Methods inherited from interface org.testng.ISuiteListener
onFinish
Methods inherited from interface org.testng.ITestListener
onFinish, onStart, onTestFailedButWithinSuccessPercentage, onTestFailedWithTimeout, onTestFailure, onTestSkipped, onTestStart, onTestSuccess
-
Constructor Details
-
HelidonTestNgListener
public HelidonTestNgListener()
-
-
Method Details
-
alter
- Specified by:
alter
in interfaceorg.testng.IAlterSuiteListener
-
onStart
public void onStart(org.testng.ISuite suite) - Specified by:
onStart
in interfaceorg.testng.ISuiteListener
-
intercept
public List<org.testng.IMethodInstance> intercept(List<org.testng.IMethodInstance> methods, org.testng.ITestContext context) - Specified by:
intercept
in interfaceorg.testng.IMethodInterceptor
-
onConfigurationFailure
public void onConfigurationFailure(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) - Specified by:
onConfigurationFailure
in interfaceorg.testng.IConfigurationListener
-
onConfigurationSuccess
public void onConfigurationSuccess(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) - Specified by:
onConfigurationSuccess
in interfaceorg.testng.IConfigurationListener
-
beforeConfiguration
public void beforeConfiguration(org.testng.ITestResult tr, org.testng.ITestNGMethod tm) - Specified by:
beforeConfiguration
in interfaceorg.testng.IConfigurationListener
-
beforeInvocation
public void beforeInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr) - Specified by:
beforeInvocation
in interfaceorg.testng.IInvokedMethodListener
-
afterInvocation
public void afterInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr) - Specified by:
afterInvocation
in interfaceorg.testng.IInvokedMethodListener
-
onBeforeClass
public void onBeforeClass(org.testng.ITestClass tc) - Specified by:
onBeforeClass
in interfaceorg.testng.IClassListener
-
onAfterClass
public void onAfterClass(org.testng.ITestClass tc) - Specified by:
onAfterClass
in interfaceorg.testng.IClassListener
-