Class DefaultTestLoader

java.lang.Object
org.citrusframework.common.DefaultTestLoader
All Implemented Interfaces:
org.citrusframework.common.TestLoader
Direct Known Subclasses:
JavaTestLoader

public class DefaultTestLoader extends Object implements org.citrusframework.common.TestLoader
Default test loader implementation takes case on test names/packages and initializes the test runner if applicable. Also loads the test case and provides it to registered test handlers. This way a test case can be loaded from different sources like Java code, Groovy code, XML, Json, YAML, etc.
  • Field Details

    • citrus

      protected Citrus citrus
    • citrusContext

      protected CitrusContext citrusContext
    • context

      protected org.citrusframework.context.TestContext context
    • runner

      protected org.citrusframework.TestCaseRunner runner
    • testCase

      protected org.citrusframework.TestCase testCase
    • testClass

      protected Class<?> testClass
    • testName

      protected String testName
    • packageName

      protected String packageName
    • configurer

      protected final List<Consumer<org.citrusframework.TestCase>> configurer
    • handler

      protected final List<Consumer<org.citrusframework.TestCase>> handler
  • Constructor Details

    • DefaultTestLoader

      public DefaultTestLoader()
      Default constructor for full control over the loader.
    • DefaultTestLoader

      public DefaultTestLoader(Class<?> testClass, String testName, String packageName, CitrusContext citrusContext)
      Constructor with context file and parent application context field for simple initialisation.
  • Method Details

    • load

      public final void load()
      Specified by:
      load in interface org.citrusframework.common.TestLoader
    • isSkipExceptionType

      protected boolean isSkipExceptionType(Throwable e)
      Return true if the throwable is considered a skip exception that must be passed up to the testing framework in order to report that this test was skipped. Subclasses may override according to the framework
    • doLoad

      protected void doLoad()
      Subclasses are supposed to overwrite this method on order to add logic how to load the test case (e.g. from XML, Json, YAML).
    • initializeTestRunner

      protected void initializeTestRunner()
      Safely initialize default test runner if applicable.
    • setCitrus

      public void setCitrus(Citrus citrus)
    • citrus

      public DefaultTestLoader citrus(Citrus citrus)
    • setCitrusContext

      public void setCitrusContext(CitrusContext citrusContext)
    • citrusContext

      public DefaultTestLoader citrusContext(CitrusContext citrusContext)
    • setContext

      public void setContext(org.citrusframework.context.TestContext context)
    • context

      public DefaultTestLoader context(org.citrusframework.context.TestContext context)
    • setRunner

      public void setRunner(org.citrusframework.TestCaseRunner runner)
    • runner

      public DefaultTestLoader runner(org.citrusframework.TestCaseRunner runner)
    • setTestCase

      public void setTestCase(org.citrusframework.TestCase testCase)
    • testCase

      public DefaultTestLoader testCase(org.citrusframework.TestCase testCase)
    • getTestCase

      public org.citrusframework.TestCase getTestCase()
      Specified by:
      getTestCase in interface org.citrusframework.common.TestLoader
    • setTestClass

      public void setTestClass(Class<?> testClass)
      Specified by:
      setTestClass in interface org.citrusframework.common.TestLoader
    • testClass

      public DefaultTestLoader testClass(Class<?> testClass)
    • setTestName

      public void setTestName(String testName)
      Specified by:
      setTestName in interface org.citrusframework.common.TestLoader
    • testName

      public DefaultTestLoader testName(String testName)
    • setPackageName

      public void setPackageName(String packageName)
      Specified by:
      setPackageName in interface org.citrusframework.common.TestLoader
    • packageName

      public DefaultTestLoader packageName(String packageName)
    • doWithTestCase

      public void doWithTestCase(Consumer<org.citrusframework.TestCase> handler)
      Specified by:
      doWithTestCase in interface org.citrusframework.common.TestLoader
    • configureTestCase

      public void configureTestCase(Consumer<org.citrusframework.TestCase> configurer)
      Specified by:
      configureTestCase in interface org.citrusframework.common.TestLoader