Search in sources :

Example 31 with Result

use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.

the class ScenarioResultTest method passed_pending_undefined_skipped_is_pending.

@Test
public void passed_pending_undefined_skipped_is_pending() throws Exception {
    s.add(new Result("passed", 0L, null, null));
    s.add(new Result("undefined", 0L, null, null));
    s.add(new Result("pending", 0L, null, null));
    s.add(new Result("skipped", 0L, null, null));
    assertEquals("undefined", s.getStatus());
}
Also used : Result(gherkin.formatter.model.Result) Test(org.junit.Test)

Example 32 with Result

use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.

the class StatsTest method should_use_locale_for_decimal_separator.

@Test
public void should_use_locale_for_decimal_separator() {
    Stats counter = new Stats(true, Locale.GERMANY);
    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")));
}
Also used : PrintStream(java.io.PrintStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Result(gherkin.formatter.model.Result) Test(org.junit.Test)

Example 33 with Result

use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.

the class StatsTest method should_only_print_sub_counts_if_not_zero.

@Test
public void should_only_print_sub_counts_if_not_zero() {
    Stats counter = createMonochromeSummaryCounter();
    Result passedResult = createResultWithStatus(Result.PASSED);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    counter.addStep(passedResult);
    counter.addStep(passedResult);
    counter.addStep(passedResult);
    counter.addScenario(Result.PASSED);
    counter.printStats(new PrintStream(baos), isStrict(false));
    assertThat(baos.toString(), startsWith(String.format("1 Scenarios (1 passed)%n" + "3 Steps (3 passed)%n")));
}
Also used : PrintStream(java.io.PrintStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Result(gherkin.formatter.model.Result) Test(org.junit.Test)

Example 34 with Result

use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.

the class StatsTest method should_include_hook_time_and_step_time_has_executed.

@Test
public void should_include_hook_time_and_step_time_has_executed() {
    Stats counter = createMonochromeSummaryCounter();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    counter.addHookTime(ONE_MILLI_SECOND);
    counter.addStep(new Result(Result.PASSED, ONE_MILLI_SECOND, null));
    counter.addStep(new Result(Result.PASSED, ONE_MILLI_SECOND, null));
    counter.addHookTime(ONE_MILLI_SECOND);
    counter.printStats(new PrintStream(baos), isStrict(false));
    assertThat(baos.toString(), endsWith(String.format("0m0.004s%n")));
}
Also used : PrintStream(java.io.PrintStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Result(gherkin.formatter.model.Result) Test(org.junit.Test)

Example 35 with Result

use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.

the class StatsTest method should_print_minutes_instead_of_hours.

@Test
public void should_print_minutes_instead_of_hours() {
    Stats counter = createMonochromeSummaryCounter();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    counter.addStep(new Result(Result.PASSED, ONE_HOUR, null));
    counter.addStep(new Result(Result.PASSED, Stats.ONE_MINUTE, null));
    counter.printStats(new PrintStream(baos), isStrict(false));
    assertThat(baos.toString(), endsWith(String.format("61m0.000s%n")));
}
Also used : PrintStream(java.io.PrintStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Result(gherkin.formatter.model.Result) Test(org.junit.Test)

Aggregations

Result (gherkin.formatter.model.Result)75 Test (org.junit.Test)58 CucumberFeature (cucumber.runtime.model.CucumberFeature)32 HashMap (java.util.HashMap)32 Reporter (gherkin.formatter.Reporter)11 SimpleEntry (java.util.AbstractMap.SimpleEntry)10 ArrayList (java.util.ArrayList)10 Match (gherkin.formatter.model.Match)9 EachTestNotifier (org.junit.internal.runners.model.EachTestNotifier)8 Test (org.testng.annotations.Test)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 PrintStream (java.io.PrintStream)6 PendingException (cucumber.api.PendingException)5 Matchers.anyString (org.mockito.Matchers.anyString)4 StepDefinitionMatch (cucumber.runtime.StepDefinitionMatch)3 Scenario (gherkin.formatter.model.Scenario)3 List (java.util.List)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 Given (cucumber.api.java.en.Given)2 DocString (gherkin.formatter.model.DocString)2