use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class Runtime method run.
/**
* This is the main entry point. Used from CLI, but not from JUnit.
*/
public void run() throws IOException {
// Make sure all features parse before initialising any reporters/formatters
List<CucumberFeature> features = runtimeOptions.cucumberFeatures(resourceLoader);
// TODO: This is duplicated in cucumber.api.android.CucumberInstrumentationCore - refactor or keep uptodate
Formatter formatter = runtimeOptions.formatter(classLoader);
Reporter reporter = runtimeOptions.reporter(classLoader);
StepDefinitionReporter stepDefinitionReporter = runtimeOptions.stepDefinitionReporter(classLoader);
glue.reportStepDefinitions(stepDefinitionReporter);
for (CucumberFeature cucumberFeature : features) {
cucumberFeature.run(formatter, reporter, this);
}
formatter.done();
formatter.close();
printSummary();
}
use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class RuntimeTest method should_fail_the_scenario_if_before_fails.
@Test
public void should_fail_the_scenario_if_before_fails() throws Throwable {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Reporter reporter = mock(Reporter.class);
StepDefinitionMatch match = mock(StepDefinitionMatch.class);
HookDefinition hook = createExceptionThrowingHook();
Runtime runtime = createRuntimeWithMockedGlue(match, hook, true, "--monochrome");
runScenario(reporter, runtime, stepCount(1));
runtime.printStats(new PrintStream(baos));
assertThat(baos.toString(), containsString(String.format("" + "1 Scenarios (1 failed)%n" + "1 Steps (1 skipped)%n")));
}
use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class RuntimeTest method should_fail_the_scenario_if_after_fails.
@Test
public void should_fail_the_scenario_if_after_fails() throws Throwable {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Reporter reporter = mock(Reporter.class);
StepDefinitionMatch match = mock(StepDefinitionMatch.class);
HookDefinition hook = createExceptionThrowingHook();
Runtime runtime = createRuntimeWithMockedGlue(match, hook, false, "--monochrome");
runScenario(reporter, runtime, stepCount(1));
runtime.printStats(new PrintStream(baos));
assertThat(baos.toString(), containsString(String.format("" + "1 Scenarios (1 failed)%n" + "1 Steps (1 passed)%n")));
}
use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class RuntimeTest method should_add_pending_result_to_the_summary_counter.
@Test
public void should_add_pending_result_to_the_summary_counter() throws Throwable {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Reporter reporter = mock(Reporter.class);
StepDefinitionMatch match = createExceptionThrowingMatch(new PendingException());
Runtime runtime = createRuntimeWithMockedGlue(match, "--monochrome");
runScenario(reporter, runtime, stepCount(1));
runtime.printStats(new PrintStream(baos));
assertThat(baos.toString(), containsString(String.format("" + "1 Scenarios (1 pending)%n" + "1 Steps (1 pending)%n")));
}
use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class RuntimeTest method should_add_undefined_result_to_the_summary_counter.
@Test
public void should_add_undefined_result_to_the_summary_counter() throws Throwable {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Reporter reporter = mock(Reporter.class);
Runtime runtime = createRuntimeWithMockedGlue(null, "--monochrome");
runScenario(reporter, runtime, stepCount(1));
runtime.printStats(new PrintStream(baos));
assertThat(baos.toString(), containsString(String.format("" + "1 Scenarios (1 undefined)%n" + "1 Steps (1 undefined)%n")));
}
Aggregations