Class TestNGCitrusSupport

  • All Implemented Interfaces:
    GherkinTestActionRunner, TestActionRunner, org.testng.IHookable, org.testng.ITestNGListener

    public class TestNGCitrusSupport
    extends Object
    implements org.testng.IHookable, GherkinTestActionRunner
    Basic Citrus TestNG support base class automatically handles test case runner creation. Also provides method parameter resolution and resource injection. Users can just extend this class and make use of the action runner methods provided in TestActionRunner and GherkinTestActionRunner.
    Author:
    Christoph Deppisch
    • Field Detail

      • log

        protected final org.slf4j.Logger log
        Logger
      • citrus

        protected Citrus citrus
        Citrus instance
    • Constructor Detail

      • TestNGCitrusSupport

        public TestNGCitrusSupport()
    • Method Detail

      • run

        public void run​(org.testng.IHookCallBack callBack,
                        org.testng.ITestResult testResult)
        Specified by:
        run in interface org.testng.IHookable
      • run

        protected void run​(org.testng.ITestResult testResult,
                           Method method,
                           List<TestLoader> methodTestLoaders,
                           int invocationCount)
        Run method prepares and executes test case.
        Parameters:
        testResult -
        method -
        methodTestLoaders -
        invocationCount -
      • before

        @BeforeClass(alwaysRun=true)
        public final void before()
      • before

        protected void before​(CitrusContext context)
        Subclasses may add before test actions on the provided context.
        Parameters:
        context - the Citrus context.
      • after

        @AfterClass(alwaysRun=true)
        public final void after()
      • after

        protected void after​(CitrusContext context)
        Subclasses may add after test actions on the provided context.
        Parameters:
        context - the Citrus context.
      • beforeSuite

        @BeforeSuite(alwaysRun=true)
        public final void beforeSuite​(org.testng.ITestContext testContext)
      • beforeSuite

        protected void beforeSuite​(CitrusContext context)
        Subclasses may add before suite actions on the provided context.
        Parameters:
        context - the Citrus context.
      • afterSuite

        @AfterSuite(alwaysRun=true)
        public final void afterSuite​(org.testng.ITestContext testContext)
      • afterSuite

        protected void afterSuite​(CitrusContext context)
        Subclasses may add after suite actions on the provided context.
        Parameters:
        context - the Citrus context.
      • prepareTestContext

        protected TestContext prepareTestContext​(TestContext testContext)
        Prepares the test context. Provides a hook for test context modifications before the test gets executed.
        Parameters:
        testContext - the test context.
        Returns:
        the (prepared) test context.
      • createTestLoader

        protected TestLoader createTestLoader​(String testName,
                                              String packageName,
                                              String type)
        Creates new test loader which has TestNG test annotations set for test execution. Only suitable for tests that get created at runtime through factory method. Subclasses may overwrite this in order to provide custom test loader with custom test annotations set.
        Parameters:
        testName -
        packageName -
        Returns:
      • variable

        public <T> T variable​(String name,
                              T value)
      • name

        public void name​(String name)
      • description

        public void description​(String description)
      • author

        public void author​(String author)
      • creationDate

        public void creationDate​(Date date)