use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class PluginFactoryTest method plugin_does_not_buffer_its_output.
@Test
public void plugin_does_not_buffer_its_output() throws IOException {
PrintStream previousSystemOut = System.out;
OutputStream mockSystemOut = new ByteArrayOutputStream();
try {
System.setOut(new PrintStream(mockSystemOut));
// Need to create a new plugin factory here since we need it to pick up the new value of System.out
fc = new PluginFactory();
ProgressFormatter plugin = (ProgressFormatter) fc.create("progress");
plugin.result(new Result("passed", null, null));
assertThat(mockSystemOut.toString(), is(not("")));
} finally {
System.setOut(previousSystemOut);
}
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class RerunFormatterTest method should_one_entry_for_feature_with_many_failing_scenarios.
@Test
public void should_one_entry_for_feature_with_many_failing_scenarios() throws Throwable {
CucumberFeature feature = TestHelper.feature("path/test.feature", "" + "Feature: feature name\n" + " Scenario: scenario 1 name\n" + " When first step\n" + " Then second step\n" + " Scenario: scenario 2 name\n" + " When third step\n" + " Then forth step\n");
Map<String, Result> stepsToResult = new HashMap<String, Result>();
stepsToResult.put("first step", result("passed"));
stepsToResult.put("second step", result("failed"));
stepsToResult.put("third step", result("failed"));
stepsToResult.put("forth step", result("passed"));
String formatterOutput = runFeatureWithRerunFormatter(feature, stepsToResult);
assertEquals("path/test.feature:2:5", formatterOutput);
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class RerunFormatterTest method should_use_example_row_location_when_scenario_outline_fails.
@Test
public void should_use_example_row_location_when_scenario_outline_fails() throws Throwable {
CucumberFeature feature = TestHelper.feature("path/test.feature", "" + "Feature: feature name\n" + " Scenario Outline: scenario name\n" + " When executing <row> row\n" + " Then everything is ok\n" + " Examples:\n" + " | row |\n" + " | first |\n" + " | second |");
Map<String, Result> stepsToResult = new HashMap<String, Result>();
stepsToResult.put("executing first row", result("passed"));
stepsToResult.put("executing second row", result("failed"));
stepsToResult.put("everything is ok", result("passed"));
String formatterOutput = runFeatureWithRerunFormatter(feature, stepsToResult);
assertEquals("path/test.feature:8", formatterOutput);
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class RerunFormatterTest method should_one_entry_for_each_failing_feature.
@Test
public void should_one_entry_for_each_failing_feature() throws Throwable {
CucumberFeature feature1 = TestHelper.feature("path/first.feature", "" + "Feature: feature 1 name\n" + " Scenario: scenario 1 name\n" + " When first step\n" + " Then second step\n");
CucumberFeature feature2 = TestHelper.feature("path/second.feature", "" + "Feature: feature 2 name\n" + " Scenario: scenario 2 name\n" + " When third step\n" + " Then forth step\n");
Map<String, Result> stepsToResult = new HashMap<String, Result>();
stepsToResult.put("first step", result("passed"));
stepsToResult.put("second step", result("failed"));
stepsToResult.put("third step", result("failed"));
stepsToResult.put("forth step", result("passed"));
String formatterOutput = runFeaturesWithRerunFormatter(Arrays.asList(feature1, feature2), stepsToResult);
assertEquals("path/second.feature:2 path/first.feature:2", formatterOutput);
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class StatsTest method should_print_minutes_seconds_and_milliseconds.
@Test
public void should_print_minutes_seconds_and_milliseconds() {
Stats counter = createMonochromeSummaryCounter();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
counter.addStep(new Result(Result.PASSED, Stats.ONE_MINUTE, null));
counter.addStep(new Result(Result.PASSED, Stats.ONE_SECOND, null));
counter.addStep(new Result(Result.PASSED, ONE_MILLI_SECOND, null));
counter.printStats(new PrintStream(baos), isStrict(false));
assertThat(baos.toString(), endsWith(String.format("1m1.001s%n")));
}
Aggregations