java.lang.Object
io.helidon.microprofile.testing.testng.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

public class HelidonTestNgListener extends Object implements org.testng.ITestListener, org.testng.ISuiteListener, org.testng.IAlterSuiteListener, org.testng.IMethodInterceptor
A TestNG listener that integrates CDI with TestNG to support Helidon MP.

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:

The configuration can be customized with the following annotations:

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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr)
     
    void
    alter(List<org.testng.xml.XmlSuite> suites)
     
    void
    beforeConfiguration(org.testng.ITestResult tr, org.testng.ITestNGMethod tm)
     
    void
    beforeInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr)
     
    List<org.testng.IMethodInstance>
    intercept(List<org.testng.IMethodInstance> methods, org.testng.ITestContext context)
     
    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

      public void alter(List<org.testng.xml.XmlSuite> suites)
      Specified by:
      alter in interface org.testng.IAlterSuiteListener
    • onStart

      public void onStart(org.testng.ISuite suite)
      Specified by:
      onStart in interface org.testng.ISuiteListener
    • intercept

      public List<org.testng.IMethodInstance> intercept(List<org.testng.IMethodInstance> methods, org.testng.ITestContext context)
      Specified by:
      intercept in interface org.testng.IMethodInterceptor
    • onConfigurationFailure

      public void onConfigurationFailure(org.testng.ITestResult tr, org.testng.ITestNGMethod tm)
      Specified by:
      onConfigurationFailure in interface org.testng.IConfigurationListener
    • onConfigurationSuccess

      public void onConfigurationSuccess(org.testng.ITestResult tr, org.testng.ITestNGMethod tm)
      Specified by:
      onConfigurationSuccess in interface org.testng.IConfigurationListener
    • beforeConfiguration

      public void beforeConfiguration(org.testng.ITestResult tr, org.testng.ITestNGMethod tm)
      Specified by:
      beforeConfiguration in interface org.testng.IConfigurationListener
    • beforeInvocation

      public void beforeInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr)
      Specified by:
      beforeInvocation in interface org.testng.IInvokedMethodListener
    • afterInvocation

      public void afterInvocation(org.testng.IInvokedMethod im, org.testng.ITestResult tr)
      Specified by:
      afterInvocation in interface org.testng.IInvokedMethodListener
    • onBeforeClass

      public void onBeforeClass(org.testng.ITestClass tc)
      Specified by:
      onBeforeClass in interface org.testng.IClassListener
    • onAfterClass

      public void onAfterClass(org.testng.ITestClass tc)
      Specified by:
      onAfterClass in interface org.testng.IClassListener