Search in sources :

Example 6 with TestStep

use of io.cucumber.plugin.event.TestStep in project cucumber-jvm by cucumber.

the class UsageFormatterTest method resultWithZeroDuration.

@Test
void resultWithZeroDuration() {
    OutputStream out = new ByteArrayOutputStream();
    UsageFormatter usageFormatter = new UsageFormatter(out);
    TestStep testStep = mockTestStep();
    Result result = new Result(Status.PASSED, Duration.ZERO, null);
    usageFormatter.handleTestStepFinished(new TestStepFinished(Instant.EPOCH, mock(TestCase.class), testStep, result));
    Map<String, List<UsageFormatter.StepContainer>> usageMap = usageFormatter.usageMap;
    assertThat(usageMap.size(), is(equalTo(1)));
    List<UsageFormatter.StepContainer> durationEntries = usageMap.get("stepDef");
    assertThat(durationEntries.size(), is(equalTo(1)));
    assertThat(durationEntries.get(0).getName(), is(equalTo("step")));
    assertThat(durationEntries.get(0).getDurations().size(), is(equalTo(1)));
    assertThat(durationEntries.get(0).getDurations().get(0).getDuration(), is(equalTo(0.0)));
}
Also used : TestStep(io.cucumber.plugin.event.TestStep) PickleStepTestStep(io.cucumber.plugin.event.PickleStepTestStep) TestStepFinished(io.cucumber.plugin.event.TestStepFinished) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) Collections.singletonList(java.util.Collections.singletonList) Arrays.asList(java.util.Arrays.asList) List(java.util.List) ByteArrayOutputStream(java.io.ByteArrayOutputStream) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Result(io.cucumber.plugin.event.Result) Test(org.junit.jupiter.api.Test)

Aggregations

TestStep (io.cucumber.plugin.event.TestStep)6 PickleStepTestStep (io.cucumber.plugin.event.PickleStepTestStep)5 Result (io.cucumber.plugin.event.Result)3 TestStepFinished (io.cucumber.plugin.event.TestStepFinished)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 OutputStream (java.io.OutputStream)3 Arrays.asList (java.util.Arrays.asList)3 Collections.singletonList (java.util.Collections.singletonList)3 List (java.util.List)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 Test (org.junit.jupiter.api.Test)3 Step (io.cucumber.messages.types.Step)1 DataTableArgument (io.cucumber.plugin.event.DataTableArgument)1 DocStringArgument (io.cucumber.plugin.event.DocStringArgument)1 HookTestStep (io.cucumber.plugin.event.HookTestStep)1 StepArgument (io.cucumber.plugin.event.StepArgument)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Description (org.junit.runner.Description)1