Class TestNGCitrusSupport

  • All Implemented Interfaces:
    com.consol.citrus.GherkinTestActionRunner, com.consol.citrus.TestActionRunner, TestNGSuiteListener, org.testng.IHookable, org.testng.ITestNGListener

    public class TestNGCitrusSupport
    extends Object
    implements org.testng.IHookable, TestNGSuiteListener, com.consol.citrus.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 Summary

      Fields 
      Modifier and Type Field Description
      protected com.consol.citrus.Citrus citrus
      Citrus instance
      protected org.slf4j.Logger log
      Logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void afterSuite​(com.consol.citrus.CitrusContext context)
      Subclasses may add after suite actions on the provided context.
      void afterSuite​(org.testng.ITestContext testContext)
      Runs tasks after test suite.
      <T extends com.consol.citrus.TestAction>
      com.consol.citrus.TestActionBuilder<T>
      applyBehavior​(com.consol.citrus.TestBehavior behavior)  
      void author​(String author)  
      protected void beforeSuite​(com.consol.citrus.CitrusContext context)
      Subclasses may add before suite actions on the provided context.
      void beforeSuite​(org.testng.ITestContext testContext)
      Runs tasks before test suite.
      void creationDate​(Date date)  
      void description​(String description)  
      void name​(String name)  
      protected com.consol.citrus.context.TestContext prepareTestContext​(com.consol.citrus.context.TestContext testContext)
      Prepares the test context.
      <T extends com.consol.citrus.TestAction>
      T
      run​(com.consol.citrus.TestActionBuilder<T> builder)  
      void run​(org.testng.IHookCallBack callBack, org.testng.ITestResult testResult)  
      protected void run​(org.testng.ITestResult testResult, Method method, int invocationCount)
      Run method prepares and executes test case.
      void status​(com.consol.citrus.TestCaseMetaInfo.Status status)  
      <T> T variable​(String name, T value)  
      • Methods inherited from interface com.consol.citrus.GherkinTestActionRunner

        and, and, given, given, then, then, when, when
      • Methods inherited from interface com.consol.citrus.TestActionRunner

        $, $, run
    • Field Detail

      • log

        protected final org.slf4j.Logger log
        Logger
      • citrus

        protected com.consol.citrus.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,
                           int invocationCount)
        Run method prepares and executes test case.
        Parameters:
        testResult -
        method -
        invocationCount -
      • beforeSuite

        public void beforeSuite​(org.testng.ITestContext testContext)
        Description copied from interface: TestNGSuiteListener
        Runs tasks before test suite.
        Specified by:
        beforeSuite in interface TestNGSuiteListener
        Parameters:
        testContext - the test context.
      • beforeSuite

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

        public void afterSuite​(org.testng.ITestContext testContext)
        Description copied from interface: TestNGSuiteListener
        Runs tasks after test suite.
        Specified by:
        afterSuite in interface TestNGSuiteListener
        Parameters:
        testContext - the test context.
      • afterSuite

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

        protected com.consol.citrus.context.TestContext prepareTestContext​(com.consol.citrus.context.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.
      • run

        public <T extends com.consol.citrus.TestAction> T run​(com.consol.citrus.TestActionBuilder<T> builder)
        Specified by:
        run in interface com.consol.citrus.TestActionRunner
      • applyBehavior

        public <T extends com.consol.citrus.TestAction> com.consol.citrus.TestActionBuilder<T> applyBehavior​(com.consol.citrus.TestBehavior behavior)
        Specified by:
        applyBehavior in interface com.consol.citrus.TestActionRunner
      • 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)
      • status

        public void status​(com.consol.citrus.TestCaseMetaInfo.Status status)
      • creationDate

        public void creationDate​(Date date)