use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class ScenarioResultTest method passed_and_skipped_is_skipped_although_we_cant_have_skipped_without_undefined_or_pending.
@Test
public void passed_and_skipped_is_skipped_although_we_cant_have_skipped_without_undefined_or_pending() throws Exception {
s.add(new Result("passed", 0L, null, null));
s.add(new Result("skipped", 0L, null, null));
assertEquals("skipped", s.getStatus());
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class ScenarioResultTest method passed_undefined_skipped_is_undefined.
@Test
public void passed_undefined_skipped_is_undefined() throws Exception {
s.add(new Result("passed", 0L, null, null));
s.add(new Result("undefined", 0L, null, null));
s.add(new Result("skipped", 0L, null, null));
assertEquals("undefined", s.getStatus());
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class Runtime method runHookIfTagsMatch.
private void runHookIfTagsMatch(HookDefinition hook, Reporter reporter, Set<Tag> tags, boolean isBefore) {
if (hook.matches(tags)) {
String status = Result.PASSED;
Throwable error = null;
Match match = new Match(Collections.<Argument>emptyList(), hook.getLocation(false));
stopWatch.start();
try {
hook.execute(scenarioResult);
} catch (Throwable t) {
error = t;
status = isPending(t) ? "pending" : Result.FAILED;
addError(t);
skipNextStep = true;
} finally {
long duration = stopWatch.stop();
Result result = new Result(status, duration, error, DUMMY_ARG);
addHookToCounterAndResult(result);
if (isBefore) {
reporter.before(match, result);
} else {
reporter.after(match, result);
}
}
}
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class JUnitReporterTest method after_with_pending_exception_non_strict.
@Test
public void after_with_pending_exception_non_strict() {
createNonStrictReporter();
createDefaultRunNotifier();
Result result = mock(Result.class);
Match match = mock(Match.class);
when(result.getStatus()).thenReturn("Pending");
when(result.getError()).thenReturn(new PendingException());
EachTestNotifier executionUnitNotifier = mock(EachTestNotifier.class);
jUnitReporter.executionUnitNotifier = executionUnitNotifier;
jUnitReporter.after(match, result);
jUnitReporter.finishExecutionUnit();
verify(executionUnitNotifier).fireTestIgnored();
}
use of gherkin.formatter.model.Result 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);
}
Aggregations