Package com.tngtech.jgiven.impl
Class ScenarioExecutor
java.lang.Object
com.tngtech.jgiven.impl.ScenarioExecutor
Main class of JGiven for executing scenarios.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StepInterceptorImplprotected final StageTransitionHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddIntroWord(String word) voidaddSection(String sectionTitle) voidHandle ocurred exception and continue.voidvoidfinished()Has to be called when the scenario is finished in order to execute after methods.booleanbooleanvoidinjectStages(Object stage) Initialize the fields annotated withScenarioStagein the test class.voidreadScenarioState(Object object) voidvoidvoidsetListener(ScenarioListener listener) voidsetStageClassCreator(StageClassCreator stageClassCreator) voidsetStageCreator(StageCreator stageCreator) voidsetSuppressExceptions(boolean suppressExceptions) voidsetSuppressStepExceptions(boolean suppressStepExceptions) voidstartScenario(Class<?> testClass, Method method, List<NamedArgument> arguments) Starts the scenario with the given method and arguments.voidstartScenario(String description) Starts a scenario with the given description.voidUsed for DI frameworks to inject values into stages.
-
Field Details
-
stages
-
stageTransitionHandler
-
methodInterceptor
-
-
Constructor Details
-
ScenarioExecutor
public ScenarioExecutor()Create a new ScenarioExecutor instance.
-
-
Method Details
-
addIntroWord
-
readScenarioState
-
wireSteps
Used for DI frameworks to inject values into stages. -
finished
Has to be called when the scenario is finished in order to execute after methods.- Throws:
Throwable
-
injectStages
Initialize the fields annotated withScenarioStagein the test class. -
hasFailed
public boolean hasFailed() -
hasAborted
public boolean hasAborted() -
getFailedException
-
setFailedException
-
getAbortedException
-
setAbortedException
-
failed
Handle ocurred exception and continue. -
aborted
-
startScenario
Starts a scenario with the given description.- Parameters:
description- the description of the scenario
-
startScenario
Starts the scenario with the given method and arguments. Derives the description from the method name.- Parameters:
method- the method that started the scenarioarguments- the test arguments with their parameter names
-
setListener
-
failIfPass
public void failIfPass() -
setSuppressStepExceptions
public void setSuppressStepExceptions(boolean suppressStepExceptions) -
setSuppressExceptions
public void setSuppressExceptions(boolean suppressExceptions) -
addSection
-
setStageCreator
-
setStageClassCreator
-