Class ScenarioExecutor

java.lang.Object
com.tngtech.jgiven.impl.ScenarioExecutor

public class ScenarioExecutor extends Object
Main class of JGiven for executing scenarios.
  • Field Details

    • stages

      protected final Map<Class<?>,com.tngtech.jgiven.impl.ScenarioExecutor.StageState> stages
    • stageTransitionHandler

      protected final StageTransitionHandler stageTransitionHandler
    • methodInterceptor

      protected final StepInterceptorImpl methodInterceptor
  • Constructor Details

    • ScenarioExecutor

      public ScenarioExecutor()
      Create a new ScenarioExecutor instance.
  • Method Details

    • addIntroWord

      public void addIntroWord(String word)
    • readScenarioState

      public void readScenarioState(Object object)
    • wireSteps

      public void wireSteps(CanWire canWire)
      Used for DI frameworks to inject values into stages.
    • finished

      public void finished() throws Throwable
      Has to be called when the scenario is finished in order to execute after methods.
      Throws:
      Throwable
    • injectStages

      public void injectStages(Object stage)
      Initialize the fields annotated with ScenarioStage in the test class.
    • hasFailed

      public boolean hasFailed()
    • hasAborted

      public boolean hasAborted()
    • getFailedException

      public Throwable getFailedException()
    • setFailedException

      public void setFailedException(Exception e)
    • getAbortedException

      public Throwable getAbortedException()
    • setAbortedException

      public void setAbortedException(Exception e)
    • failed

      public void failed(Throwable e)
      Handle ocurred exception and continue.
    • aborted

      public void aborted(Throwable e)
    • startScenario

      public void startScenario(String description)
      Starts a scenario with the given description.
      Parameters:
      description - the description of the scenario
    • startScenario

      public void startScenario(Class<?> testClass, Method method, List<NamedArgument> arguments)
      Starts the scenario with the given method and arguments. Derives the description from the method name.
      Parameters:
      method - the method that started the scenario
      arguments - the test arguments with their parameter names
    • setListener

      public void setListener(ScenarioListener listener)
    • failIfPass

      public void failIfPass()
    • setSuppressStepExceptions

      public void setSuppressStepExceptions(boolean suppressStepExceptions)
    • setSuppressExceptions

      public void setSuppressExceptions(boolean suppressExceptions)
    • addSection

      public void addSection(String sectionTitle)
    • setStageCreator

      public void setStageCreator(StageCreator stageCreator)
    • setStageClassCreator

      public void setStageClassCreator(StageClassCreator stageClassCreator)