- Revision
- 1281
- Author
- mauro
- Date
- 2009-09-26 08:55:00 -0500 (Sat, 26 Sep 2009)
Log Message
Cleanup of private impl.
Modified Paths
Diff
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/ScenarioRunner.java (1280 => 1281)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/ScenarioRunner.java 2009-09-26 12:43:37 UTC (rev 1280) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/ScenarioRunner.java 2009-09-26 13:55:00 UTC (rev 1281) @@ -16,8 +16,7 @@ import org.jbehave.scenario.steps.StepResult; /** - * Runs the steps of each scenario in a story - * and describes the results to the {...@link ScenarioReporter}. + * Runs the steps of each scenario in a story and describes the results to the {...@link ScenarioReporter}. * * @author Elizabeth Keogh * @author Mauro Talevi @@ -52,8 +51,8 @@ reporter.beforeStory(story.getBlurb()); for (ScenarioDefinition scenario : story.getScenarios()) { runGivenScenarios(configuration, scenario, candidateSteps); // first run any given scenarios, if any - if ( isTemplateScenario(scenario) ){ // run template scenario - runTemplateScenario(configuration, scenario, scenario.getTable(), candidateSteps); + if ( isExamplesTableScenario(scenario) ){ // run examples table scenario + runExamplesTableScenario(configuration, scenario, scenario.getTable(), candidateSteps); } else { // run plain old scenario runScenario(configuration, scenario, new HashMap<String, String>(), candidateSteps); } @@ -62,12 +61,24 @@ currentStrategy.handleError(throwable); } - private boolean isTemplateScenario(ScenarioDefinition scenario) { + private void runGivenScenarios(Configuration configuration, + ScenarioDefinition scenario, CandidateSteps... candidateSteps) + throws Throwable { + List<String> givenScenarios = scenario.getGivenScenarios(); + if ( givenScenarios.size() > 0 ){ + reporter.givenScenarios(givenScenarios); + for ( String scenarioPath : givenScenarios ){ + run(scenarioPath, configuration, candidateSteps); + } + } + } + + private boolean isExamplesTableScenario(ScenarioDefinition scenario) { ExamplesTable table = scenario.getTable(); return table != null && table.getRowCount() > 0; } - private void runTemplateScenario(Configuration configuration, + private void runExamplesTableScenario(Configuration configuration, ScenarioDefinition scenario, ExamplesTable table, CandidateSteps... candidateSteps) { reporter.examplesTable(table); @@ -77,18 +88,6 @@ } } - private void runGivenScenarios(Configuration configuration, - ScenarioDefinition scenario, CandidateSteps... candidateSteps) - throws Throwable { - List<String> givenScenarios = scenario.getGivenScenarios(); - if ( givenScenarios.size() > 0 ){ - reporter.givenScenarios(givenScenarios); - for ( String scenarioPath : givenScenarios ){ - run(scenarioPath, configuration, candidateSteps); - } - } - } - private void runScenario(Configuration configuration, ScenarioDefinition scenario, Map<String, String> tableRow, CandidateSteps... candidateSteps) { Step[] steps = configuration.forCreatingSteps().createStepsFrom(scenario, tableRow, candidateSteps);
To unsubscribe from this list please visit: