Class ScenarioBase

java.lang.Object
com.tngtech.jgiven.impl.ScenarioBase
Direct Known Subclasses:
Scenario

public class ScenarioBase extends Object
Base class for a Scenario.

Before a Scenario can be used it must be properly configured. After the configuration phase startScenario(java.lang.Class<?>, java.lang.reflect.Method, java.util.List<com.tngtech.jgiven.report.model.NamedArgument>) must be called in order to execute the scenario. Once started a scenario cannot be reconfigured.

initialize() should be overridden by subclasses to apply their own configuration to the scenario.

  • Field Details

  • Constructor Details

    • ScenarioBase

      public ScenarioBase()
  • Method Details

    • setModel

      public void setModel(ReportModel reportModel)
    • getScenarioModel

      public ScenarioModel getScenarioModel()
    • getScenarioCaseModel

      public ScenarioCaseModel getScenarioCaseModel()
    • getModel

      public ReportModel getModel()
    • addStage

      public <T> T addStage(Class<T> stepsClass)
    • finished

      public void finished() throws Throwable
      Finishes the scenario.
      Throws:
      Throwable - in case some exception has been thrown during the execution of the scenario
    • aborted

      public void aborted(Throwable e)
    • getExecutor

      public ScenarioExecutor getExecutor()
    • setExecutor

      public void setExecutor(ScenarioExecutor executor)
    • wireSteps

      public void wireSteps(CanWire canWire)
    • startScenario

      public ScenarioBase startScenario(Class<?> testClass, Method method, List<NamedArgument> arguments)
    • startScenario

      public ScenarioBase startScenario(String description)
    • initialize

      protected void initialize()
    • assertNotInitialized

      protected void assertNotInitialized()
    • section

      public void section(String sectionTitle)
      Adds a new section to the scenario

      EXPERIMENTAL FEATURE

      This is an experimental feature. It might change in the future. If you have any feedback regarding this feature, please let us know by creating an issue at https://github.com/TNG/JGiven/issues
      Parameters:
      sectionTitle - the title of the section
      Since:
      0.11.0
    • setStageCreator

      public void setStageCreator(StageCreator stageCreator)
    • setStageClassCreator

      public void setStageClassCreator(StageClassCreator stageClassCreator)