Class JUnit4CitrusSpringSupport

  • All Implemented Interfaces:
    com.consol.citrus.GherkinTestActionRunner, CitrusFrameworkMethod.Runner, com.consol.citrus.TestActionRunner, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

    @ContextConfiguration(classes=com.consol.citrus.config.CitrusSpringConfig.class)
    public class JUnit4CitrusSpringSupport
    extends org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests
    implements com.consol.citrus.GherkinTestActionRunner, CitrusFrameworkMethod.Runner
    Base test implementation for test cases that use JUnit testing framework. Class also provides test listener support and loads the Spring root application context files for Citrus.
    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
      • Fields inherited from class org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests

        applicationContext, logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends com.consol.citrus.TestAction>
      com.consol.citrus.TestActionBuilder<T>
      applyBehavior​(com.consol.citrus.TestBehavior behavior)  
      void author​(String author)  
      protected com.consol.citrus.common.TestLoader createTestLoader​(String testName, String packageName)
      Creates new test loader which has TestNG test annotations set for test execution.
      void creationDate​(Date date)  
      void description​(String description)  
      protected com.consol.citrus.TestCase getTestCase()
      Constructs the test case to execute.
      void name​(String name)  
      protected com.consol.citrus.context.TestContext prepareTestContext​(com.consol.citrus.context.TestContext testContext)
      Prepares the test context.
      void run​(CitrusFrameworkMethod frameworkMethod)
      Reads Citrus test annotation from framework method and executes test case.
      <T extends com.consol.citrus.TestAction>
      T
      run​(com.consol.citrus.TestActionBuilder<T> builder)  
      void status​(com.consol.citrus.TestCaseMetaInfo.Status status)  
      <T> T variable​(String name, T value)  
      • Methods inherited from class org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests

        setApplicationContext
      • 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

      • JUnit4CitrusSpringSupport

        public JUnit4CitrusSpringSupport()
    • Method Detail

      • 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.
      • createTestLoader

        protected com.consol.citrus.common.TestLoader createTestLoader​(String testName,
                                                                       String packageName)
        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:
      • getTestCase

        protected com.consol.citrus.TestCase getTestCase()
        Constructs the test case to execute.
        Returns:
      • 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)