use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class RuntimeTest method should_add_ambiguous_match_as_failed_result_to_the_summary_counter.
@Test
public void should_add_ambiguous_match_as_failed_result_to_the_summary_counter() throws Throwable {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Reporter reporter = mock(Reporter.class);
Runtime runtime = createRuntimeWithMockedGlueWithAmbiguousMatch("--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 failed)%n")));
}
use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class JUnitReporterTest method forward_calls_to_reporter_interface_methods.
@Test
public void forward_calls_to_reporter_interface_methods() throws Exception {
Match match = mock(Match.class);
Result result = mockResult();
ExecutionUnitRunner executionUnitRunner = mockExecutionUnitRunner();
String mimeType = "mimeType";
byte[] data = new byte[] { 1 };
String text = "text";
Reporter reporter = mock(Reporter.class);
jUnitReporter = new JUnitReporter(reporter, mock(Formatter.class), false, new JUnitOptions(Collections.<String>emptyList()));
jUnitReporter.startExecutionUnit(executionUnitRunner, mock(RunNotifier.class));
jUnitReporter.startOfScenarioLifeCycle(mock(Scenario.class));
jUnitReporter.before(match, result);
jUnitReporter.step(mockStep());
jUnitReporter.match(match);
jUnitReporter.embedding(mimeType, data);
jUnitReporter.write(text);
jUnitReporter.result(result);
jUnitReporter.after(match, result);
verify(reporter).before(match, result);
verify(reporter).match(match);
verify(reporter).embedding(mimeType, data);
verify(reporter).write(text);
verify(reporter).result(result);
verify(reporter).after(match, result);
}
use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class JUnitReporterTest method createReporter.
private void createReporter(boolean strict, boolean allowStartedIgnored) {
Formatter formatter = mock(Formatter.class);
Reporter reporter = mock(Reporter.class);
String allowStartedIgnoredOption = allowStartedIgnored ? "--allow-started-ignored" : "--no-allow-started-ignored";
jUnitReporter = new JUnitReporter(reporter, formatter, strict, new JUnitOptions(asList(allowStartedIgnoredOption)));
}
use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class FeatureResultListenerTest method should_forward_calls_to_reporter_interface_methods.
@Test
public void should_forward_calls_to_reporter_interface_methods() throws Exception {
Match match = mock(Match.class);
Result result = mockPassedResult();
String mimeType = "mimeType";
byte[] data = new byte[] { 1 };
String text = "text";
Reporter reporter = mock(Reporter.class);
FeatureResultListener resultListener = new FeatureResultListener(reporter, false);
resultListener.before(match, result);
resultListener.match(match);
resultListener.embedding(mimeType, data);
resultListener.write(text);
resultListener.result(result);
resultListener.after(match, result);
verify(reporter).before(match, result);
verify(reporter).match(match);
verify(reporter).embedding(mimeType, data);
verify(reporter).write(text);
verify(reporter).result(result);
verify(reporter).after(match, result);
}
use of gherkin.formatter.Reporter in project cucumber-jvm by cucumber.
the class JavaStepDefinitionTest method throws_ambiguous_when_two_matches_are_found.
@Test
public void throws_ambiguous_when_two_matches_are_found() throws Throwable {
backend.addStepDefinition(THREE_DISABLED_MICE.getAnnotation(Given.class), THREE_DISABLED_MICE);
backend.addStepDefinition(THREE_BLIND_ANIMALS.getAnnotation(Given.class), THREE_BLIND_ANIMALS);
Reporter reporter = mock(Reporter.class);
runtime.buildBackendWorlds(reporter, Collections.<Tag>emptySet(), mock(Scenario.class));
Tag tag = new Tag("@foo", 0);
runtime.runBeforeHooks(reporter, asSet(tag));
runtime.runStep("some.feature", new Step(NO_COMMENTS, "Given ", "three blind mice", 1, null, null), reporter, ENGLISH);
ArgumentCaptor<Result> result = ArgumentCaptor.forClass(Result.class);
verify(reporter).result(result.capture());
assertEquals(AmbiguousStepDefinitionsException.class, result.getValue().getError().getClass());
}
Aggregations