use of gherkin.formatter.model.Scenario in project cucumber-jvm by cucumber.
the class CucumberScenarioOutline method createExampleScenario.
CucumberScenario createExampleScenario(ExamplesTableRow header, ExamplesTableRow example, List<Tag> examplesTags, String examplesDescription) {
// Make sure we replace the tokens in the name of the scenario
String exampleScenarioName = replaceTokens(new HashSet<Integer>(), header.getCells(), example.getCells(), getGherkinModel().getName());
String exampleScenarioDescription = createExampleScenarioDescription(getGherkinModel().getDescription(), examplesDescription);
Scenario exampleScenario = new Scenario(example.getComments(), examplesTags, getGherkinModel().getKeyword(), exampleScenarioName, exampleScenarioDescription, example.getLine(), example.getId());
CucumberScenario cucumberScenario = new CucumberScenario(cucumberFeature, cucumberBackground, exampleScenario, example);
for (Step step : getSteps()) {
cucumberScenario.step(createExampleStep(step, header, example));
}
return cucumberScenario;
}
use of gherkin.formatter.model.Scenario in project cucumber-jvm by cucumber.
the class HTMLFormatterTest method runFeaturesWithFormatter.
private void runFeaturesWithFormatter(URL outputDir) throws IOException {
final HTMLFormatter f = new HTMLFormatter(outputDir);
f.uri("some\\windows\\path\\some.feature");
f.scenario(new Scenario(Collections.<Comment>emptyList(), Collections.<Tag>emptyList(), "Scenario", "some cukes", "", 10, "id"));
f.embedding("image/png", "fakedata".getBytes("US-ASCII"));
f.embedding("text/plain", "dodgy stack trace here".getBytes("US-ASCII"));
f.done();
f.close();
}
use of gherkin.formatter.model.Scenario in project cucumber-jvm by cucumber.
the class JUnitFormatterTest method scenario.
private Scenario scenario(String keyword, String scenarioName) {
Scenario scenario = mock(Scenario.class);
when(scenario.getName()).thenReturn(scenarioName);
when(scenario.getKeyword()).thenReturn(keyword);
return scenario;
}
use of gherkin.formatter.model.Scenario in project cucumber-jvm by cucumber.
the class JUnitReporterTest method throws_exception_when_runner_step_name_do_no_match_scenario_step_name.
@Test
public void throws_exception_when_runner_step_name_do_no_match_scenario_step_name() throws Exception {
Step runnerStep = mockStep("Runner Step Name");
ExecutionUnitRunner executionUnitRunner = mockExecutionUnitRunner(runnerSteps(runnerStep));
jUnitReporter = new JUnitReporter(mock(Reporter.class), mock(Formatter.class), false, new JUnitOptions(Collections.<String>emptyList()));
jUnitReporter.startExecutionUnit(executionUnitRunner, mock(RunNotifier.class));
jUnitReporter.startOfScenarioLifeCycle(mock(Scenario.class));
jUnitReporter.step(mockStep("Scenario Step Name"));
try {
jUnitReporter.match(mock(Match.class));
fail("CucumberException not thrown");
} catch (CucumberException e) {
assertEquals("Expected step: \"Scenario Step Name\" got step: \"Runner Step Name\"", e.getMessage());
} catch (Exception e) {
fail("CucumberException not thrown");
}
}
use of gherkin.formatter.model.Scenario in project cucumber-jvm by cucumber.
the class JUnitReporterTest method forward_calls_to_formatter_interface_methods.
@Test
public void forward_calls_to_formatter_interface_methods() throws Exception {
String uri = "uri";
Feature feature = mock(Feature.class);
Background background = mock(Background.class);
ScenarioOutline scenarioOutline = mock(ScenarioOutline.class);
Examples examples = mock(Examples.class);
Scenario scenario = mock(Scenario.class);
Step step = mock(Step.class);
Formatter formatter = mock(Formatter.class);
jUnitReporter = new JUnitReporter(mock(Reporter.class), formatter, false, new JUnitOptions(Collections.<String>emptyList()));
jUnitReporter.uri(uri);
jUnitReporter.feature(feature);
jUnitReporter.scenarioOutline(scenarioOutline);
jUnitReporter.examples(examples);
jUnitReporter.startOfScenarioLifeCycle(scenario);
jUnitReporter.background(background);
jUnitReporter.scenario(scenario);
jUnitReporter.step(step);
jUnitReporter.endOfScenarioLifeCycle(scenario);
jUnitReporter.eof();
jUnitReporter.done();
jUnitReporter.close();
verify(formatter).uri(uri);
verify(formatter).feature(feature);
verify(formatter).scenarioOutline(scenarioOutline);
verify(formatter).examples(examples);
verify(formatter).startOfScenarioLifeCycle(scenario);
;
verify(formatter).background(background);
verify(formatter).scenario(scenario);
verify(formatter).step(step);
verify(formatter).endOfScenarioLifeCycle(scenario);
verify(formatter).eof();
verify(formatter).done();
verify(formatter).close();
}
Aggregations