Class Citrus

java.lang.Object
org.citrusframework.Citrus
All Implemented Interfaces:
MessageListenerAware, TestListenerAware, TestReporterAware, TestSuiteListenerAware

Citrus main class initializes a new Citrus runtime environment with a Citrus context. Provides before/after suite action execution and test execution methods.
Since:
2.1
  • Method Details

    • newInstance

      public static Citrus newInstance()
      Initializing method creating a Citrus instance with new default CitrusContext and its components such as test listeners and test context factory.
      Returns:
    • newInstance

      public static Citrus newInstance(CitrusContextProvider contextProvider)
      Initializing method creating a Citrus instance with given Citrus context provider. Provider creates new CitrusContext and its components such as test listeners and test context factory.
      Returns:
    • beforeSuite

      public void beforeSuite(String suiteName, String... testGroups)
      Performs before suite test actions.
      Parameters:
      suiteName -
      testGroups -
    • afterSuite

      public void afterSuite(String suiteName, String... testGroups)
      Performs after suite test actions.
      Parameters:
      suiteName -
      testGroups -
    • run

      public void run(TestAction action)
      Runs a test action which can also be a whole test case.
    • run

      public void run(TestAction action, TestContext testContext)
      Runs test action with given test context. Test action can also be a whole test case.
      Parameters:
      action -
      testContext -
    • getVersion

      public static String getVersion()
      Gets the Citrus version from classpath resource properties.
      Returns:
    • addTestSuiteListener

      public void addTestSuiteListener(TestSuiteListener suiteListener)
      Specified by:
      addTestSuiteListener in interface TestSuiteListenerAware
    • addTestListener

      public void addTestListener(TestListener testListener)
      Specified by:
      addTestListener in interface TestListenerAware
    • addTestReporter

      public void addTestReporter(TestReporter testReporter)
      Specified by:
      addTestReporter in interface TestReporterAware
    • addMessageListener

      public void addMessageListener(MessageListener listener)
      Specified by:
      addMessageListener in interface MessageListenerAware
    • getCitrusContext

      public CitrusContext getCitrusContext()
      Obtains the citrusContext.
      Returns:
    • close

      public void close()
      Closing Citrus and its context.