StepCollector.java

  1. package org.jbehave.core.steps;

  2. import java.util.List;
  3. import java.util.Map;

  4. import org.jbehave.core.annotations.Scope;
  5. import org.jbehave.core.model.Lifecycle;
  6. import org.jbehave.core.model.Meta;
  7. import org.jbehave.core.model.Scenario;

  8. /**
  9.  * Represents the strategy for the collection of executable {@link Step}s from a story or scenario matching a list of
  10.  * {@link StepCandidate}s. It also collects the steps to run at before/after stages.
  11.  */
  12. public interface StepCollector {

  13.     enum Stage {
  14.         BEFORE, AFTER
  15.     }

  16.     /**
  17.      * Creates steps to be executed either before or after stories.
  18.      *
  19.      * @param beforeOrAfterStoriesSteps the {@link BeforeOrAfterStep}s
  20.      * @return A List of the executable {@link Step}s
  21.      */
  22.     List<Step> collectBeforeOrAfterStoriesSteps(List<BeforeOrAfterStep> beforeOrAfterStoriesSteps);

  23.     /**
  24.      * Creates steps to be executed either before or after story.
  25.      *
  26.      * @param beforeOrAfterStorySteps the {@link BeforeOrAfterStep}s
  27.      * @param storyMeta the story {@link Meta} parameters
  28.      * @return A List of the executable {@link Step}s
  29.      */
  30.     List<Step> collectBeforeOrAfterStorySteps(List<BeforeOrAfterStep> beforeOrAfterStorySteps, Meta storyMeta);

  31.     /**
  32.      * Creates steps to be executed before scenario.
  33.      *
  34.      * @param beforeScenarioSteps the {@link BeforeOrAfterStep}s
  35.      * @param storyAndScenarioMeta the story and scenario {@link Meta} parameters
  36.      * @return A List of the executable {@link Step}s
  37.      */
  38.     List<Step> collectBeforeScenarioSteps(List<BeforeOrAfterStep> beforeScenarioSteps, Meta storyAndScenarioMeta);

  39.     /**
  40.      * Creates steps to be executed after scenario.
  41.      * @param afterScenarioSteps the {@link BeforeOrAfterStep}s
  42.      * @param storyAndScenarioMeta the story and scenario {@link Meta} parameters
  43.      * @return A List of the executable {@link Step}s
  44.      */
  45.     List<Step> collectAfterScenarioSteps(List<BeforeOrAfterStep> afterScenarioSteps, Meta storyAndScenarioMeta);

  46.     /**
  47.      * Collects all lifecycle steps to execute per {@link Stage} of execution
  48.      *
  49.      * @param stepCandidates the {@link StepCandidate}s
  50.      * @param lifecycle the {@link Lifecycle}
  51.      * @param storyAndScenarioMeta the story and scenario {@link Meta} parameters
  52.      * @param scope the {@link Scope} of the lifecycle steps
  53.      * @param parameters the parameters
  54.      * @param stepMonitor the {@link StepMonitor}
  55.      * @return A List of executable {@link Step}s
  56.      */
  57.     Map<Stage, List<Step>> collectLifecycleSteps(List<StepCandidate> stepCandidates, Lifecycle lifecycle,
  58.             Meta storyAndScenarioMeta, Scope scope, Map<String, String> parameters, StepMonitor stepMonitor);

  59.     /**
  60.      * Collects all of the {@link Step}s to execute for a scenario.
  61.      *
  62.      * @param stepCandidates the {@link StepCandidate}
  63.      * @param scenario the {@link Scenario}
  64.      * @param parameters the parameters
  65.      * @param stepMonitor the {@link StepMonitor}
  66.      * @return A List of executable {@link Step}s
  67.      */
  68.     List<Step> collectScenarioSteps(List<StepCandidate> stepCandidates, Scenario scenario,
  69.             Map<String, String> parameters, StepMonitor stepMonitor);
  70. }