diff --git a/CHANGELOG.md b/CHANGELOG.md index 14f33e0b..41622627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Added +- Added more queries to find messages by `TestCaseFinished` and `TestStepFinished` ([#77](https://github.com/cucumber/query/pull/77)) ## [13.6.0] - 2025-08-11 ### Changed diff --git a/java/.gitignore b/java/.gitignore index 68ca47c9..565e05b3 100644 --- a/java/.gitignore +++ b/java/.gitignore @@ -1,2 +1,2 @@ target/ -pom.xml.versionsBackup \ No newline at end of file +pom.xml.versionsBackup diff --git a/java/src/main/java/io/cucumber/query/Query.java b/java/src/main/java/io/cucumber/query/Query.java index a0f4ccb9..7d1ba091 100644 --- a/java/src/main/java/io/cucumber/query/Query.java +++ b/java/src/main/java/io/cucumber/query/Query.java @@ -32,6 +32,7 @@ import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.EnumMap; @@ -74,11 +75,11 @@ public final class Query { .collect(Collectors.toMap(identity(), (s) -> 0L)); private final Comparator testStepResultComparator = nullsFirst(comparing(o -> o.getStatus().ordinal())); private final Map testCaseStartedById = new LinkedHashMap<>(); - private final Map testCaseFinishedByTestCaseStartedId = new HashMap<>(); - private final Map> testStepsFinishedByTestCaseStartedId = new HashMap<>(); - private final Map> testStepsStartedByTestCaseStartedId = new HashMap<>(); + private final Map testCaseFinishedByTestCaseStartedId = new LinkedHashMap<>(); + private final Map> testStepsFinishedByTestCaseStartedId = new LinkedHashMap<>(); + private final Map> testStepsStartedByTestCaseStartedId = new LinkedHashMap<>(); private final Map pickleById = new LinkedHashMap<>(); - private final Map testCaseById = new HashMap<>(); + private final Map testCaseById = new LinkedHashMap<>(); private final Map stepById = new LinkedHashMap<>(); private final Map testStepById = new LinkedHashMap<>(); private final Map pickleStepById = new LinkedHashMap<>(); @@ -121,6 +122,12 @@ public List findAllTestCaseStarted() { .collect(toList()); } + public List findAllTestCaseFinished() { + return this.testCaseFinishedByTestCaseStartedId.values().stream() + .filter(testCaseFinished -> !testCaseFinished.getWillBeRetried()) + .collect(toList()); + } + public Map, List> findAllTestCaseStartedGroupedByFeature() { return findAllTestCaseStarted() .stream() @@ -144,6 +151,22 @@ public List findAllTestSteps() { return new ArrayList<>(testStepById.values()); } + public List findAllTestCases() { + return new ArrayList<>(testCaseById.values()); + } + + public List findAllTestStepsStarted() { + return testStepsStartedByTestCaseStartedId.values().stream() + .flatMap(Collection::stream) + .collect(toList()); + } + + public List findAllTestStepsFinished() { + return testStepsFinishedByTestCaseStartedId.values().stream() + .flatMap(Collection::stream) + .collect(toList()); + } + public List findAttachmentsBy(TestStepFinished testStepFinished) { requireNonNull(testStepFinished); return attachmentsByTestCaseStartedId.getOrDefault(testStepFinished.getTestCaseStartedId(), emptyList()).stream() @@ -173,6 +196,12 @@ public Optional findMostSevereTestStepResultBy(TestCaseStarted t .stream() .map(TestStepFinished::getTestStepResult) .max(testStepResultComparator); + } + + public Optional findMostSevereTestStepResultBy(TestCaseFinished testCaseFinished) { + requireNonNull(testCaseFinished); + return findTestCaseStartedBy(testCaseFinished) + .flatMap(this::findMostSevereTestStepResultBy); } public String findNameOf(GherkinDocument element, NamingStrategy namingStrategy) { @@ -247,8 +276,18 @@ public Optional findLocationOf(Pickle pickle) { public Optional findPickleBy(TestCaseStarted testCaseStarted) { requireNonNull(testCaseStarted); return findTestCaseBy(testCaseStarted) - .map(TestCase::getPickleId) - .map(pickleById::get); + .flatMap(this::findPickleBy); + } + + public Optional findPickleBy(TestCaseFinished testCaseFinished) { + requireNonNull(testCaseFinished); + return findTestCaseStartedBy(testCaseFinished) + .flatMap(this::findPickleBy); + } + + public Optional findPickleBy(TestCase testCase) { + requireNonNull(testCase); + return ofNullable(pickleById.get(testCase.getPickleId())); } public Optional findPickleBy(TestStepStarted testStepStarted) { @@ -290,6 +329,12 @@ public Optional findTestCaseBy(TestCaseStarted testCaseStarted) { requireNonNull(testCaseStarted); return ofNullable(testCaseById.get(testCaseStarted.getTestCaseId())); } + + public Optional findTestCaseBy(TestCaseFinished testCaseFinished) { + requireNonNull(testCaseFinished); + return findTestCaseStartedBy(testCaseFinished) + .flatMap(this::findTestCaseBy); + } public Optional findTestCaseBy(TestStepStarted testStepStarted) { requireNonNull(testStepStarted); @@ -297,6 +342,12 @@ public Optional findTestCaseBy(TestStepStarted testStepStarted) { .flatMap(this::findTestCaseBy); } + public Optional findTestCaseBy(TestStepFinished testStepFinished) { + requireNonNull(testStepFinished); + return findTestCaseStartedBy(testStepFinished) + .flatMap(this::findTestCaseBy); + } + public Optional findTestCaseDurationBy(TestCaseStarted testCaseStarted) { requireNonNull(testCaseStarted); Timestamp started = testCaseStarted.getTimestamp(); @@ -307,6 +358,12 @@ public Optional findTestCaseDurationBy(TestCaseStarted testCaseStarted Convertor.toInstant(finished) )); } + + public Optional findTestCaseDurationBy(TestCaseFinished testCaseFinished) { + requireNonNull(testCaseFinished); + return findTestCaseStartedBy(testCaseFinished) + .flatMap(this::findTestCaseDurationBy); + } public Optional findTestCaseStartedBy(TestStepStarted testStepStarted) { requireNonNull(testStepStarted); @@ -314,6 +371,18 @@ public Optional findTestCaseStartedBy(TestStepStarted testStepS return ofNullable(testCaseStartedById.get(testCaseStartedId)); } + private Optional findTestCaseStartedBy(TestCaseFinished testCaseFinished) { + requireNonNull(testCaseFinished); + String testCaseStartedId = testCaseFinished.getTestCaseStartedId(); + return ofNullable(testCaseStartedById.get(testCaseStartedId)); + } + + public Optional findTestCaseStartedBy(TestStepFinished testStepFinished) { + requireNonNull(testStepFinished); + String testCaseStartedId = testStepFinished.getTestCaseStartedId(); + return ofNullable(testCaseStartedById.get(testCaseStartedId)); + } + public Optional findTestCaseFinishedBy(TestCaseStarted testCaseStarted) { requireNonNull(testCaseStarted); return ofNullable(testCaseFinishedByTestCaseStartedId.get(testCaseStarted.getId())); @@ -364,6 +433,13 @@ public List findTestStepsFinishedBy(TestCaseStarted testCaseSt return new ArrayList<>(testStepsFinished); } + public List findTestStepsFinishedBy(TestCaseFinished testCaseFinished) { + requireNonNull(testCaseFinished); + return findTestCaseStartedBy(testCaseFinished) + .map(this::findTestStepsFinishedBy) + .orElseGet(ArrayList::new); + } + public List> findTestStepFinishedAndTestStepBy(TestCaseStarted testCaseStarted) { return findTestStepsFinishedBy(testCaseStarted).stream() .map(testStepFinished -> findTestStepBy(testStepFinished).map(testStep -> new SimpleEntry<>(testStepFinished, testStep))) diff --git a/java/src/test/java/io/cucumber/query/Jackson.java b/java/src/test/java/io/cucumber/query/Jackson.java index 15322366..43135fe3 100644 --- a/java/src/test/java/io/cucumber/query/Jackson.java +++ b/java/src/test/java/io/cucumber/query/Jackson.java @@ -1,7 +1,6 @@ package io.cucumber.query; import com.fasterxml.jackson.annotation.JsonCreator.Mode; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -11,11 +10,14 @@ import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.module.paramnames.ParameterNamesModule; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_ABSENT; +import static com.fasterxml.jackson.annotation.JsonInclude.Value.construct; + final class Jackson { public static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder() .addModule(new Jdk8Module()) .addModule(new ParameterNamesModule(Mode.PROPERTIES)) - .serializationInclusion(Include.NON_EMPTY) + .defaultPropertyInclusion(construct(NON_ABSENT, NON_ABSENT)) .constructorDetector(ConstructorDetector.USE_PROPERTIES_BASED) .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) diff --git a/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java b/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java index 6dc44660..dd77a3f0 100644 --- a/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java +++ b/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java @@ -10,6 +10,7 @@ import io.cucumber.messages.types.PickleStep; import io.cucumber.messages.types.Step; import io.cucumber.messages.types.StepDefinition; +import io.cucumber.messages.types.TestCase; import io.cucumber.messages.types.TestCaseFinished; import io.cucumber.messages.types.TestCaseStarted; import io.cucumber.messages.types.TestStep; @@ -49,15 +50,15 @@ public class QueryAcceptanceTest { private static final NdjsonToMessageIterable.Deserializer deserializer = (json) -> OBJECT_MAPPER.readValue(json, Envelope.class); - static List acceptance() { - List testCases = new ArrayList<>(); + static List acceptance() { + List testCases = new ArrayList<>(); List sources = getSources(); Map> queries = createQueries(); sources.forEach(source -> queries.forEach((methodName, query) -> - testCases.add(new TestCase(methodName, source, query)))); + testCases.add(new QueryTestCase(methodName, source, query)))); return testCases; } @@ -75,7 +76,7 @@ private static List getSources() { @ParameterizedTest @MethodSource("acceptance") - void test(TestCase testCase) throws IOException { + void test(QueryTestCase testCase) throws IOException { ByteArrayOutputStream bytes = writeQueryResults(testCase, new ByteArrayOutputStream()); String expected = new String(Files.readAllBytes(testCase.expected), UTF_8); String actual = new String(bytes.toByteArray(), UTF_8); @@ -85,13 +86,13 @@ void test(TestCase testCase) throws IOException { @ParameterizedTest @MethodSource("acceptance") @Disabled - void updateExpectedQueryResultFiles(TestCase testCase) throws IOException { + void updateExpectedQueryResultFiles(QueryTestCase testCase) throws IOException { try (OutputStream out = Files.newOutputStream(testCase.expected)) { writeQueryResults(testCase, out); } } - private static T writeQueryResults(TestCase testCase, T out) throws IOException { + private static T writeQueryResults(QueryTestCase testCase, T out) throws IOException { try (InputStream in = Files.newInputStream(testCase.source)) { try (NdjsonToMessageIterable envelopes = new NdjsonToMessageIterable(in, deserializer)) { Query query = new Query(); @@ -109,21 +110,25 @@ private static T writeQueryResults(TestCase testCase, T static Map> createQueries() { - Map> results = new LinkedHashMap<>(); + Map> queries = new LinkedHashMap<>(); - results.put("countMostSevereTestStepResultStatus", Query::countMostSevereTestStepResultStatus); - results.put("countTestCasesStarted", Query::countTestCasesStarted); - results.put("findAllPickles", (query) -> query.findAllPickles().size()); - results.put("findAllPickleSteps", (query) -> query.findAllPickleSteps().size()); - results.put("findAllTestCaseStarted", (query) -> query.findAllTestCaseStarted().size()); - results.put("findAllTestSteps", (query) -> query.findAllTestSteps().size()); - results.put("findAllTestCaseStartedGroupedByFeature", (query) -> query.findAllTestCaseStartedGroupedByFeature() + queries.put("countMostSevereTestStepResultStatus", Query::countMostSevereTestStepResultStatus); + queries.put("countTestCasesStarted", Query::countTestCasesStarted); + queries.put("findAllPickles", (query) -> query.findAllPickles().size()); + queries.put("findAllPickleSteps", (query) -> query.findAllPickleSteps().size()); + queries.put("findAllTestCaseStarted", (query) -> query.findAllTestCaseStarted().size()); + queries.put("findAllTestCaseFinished", (query) -> query.findAllTestCaseFinished().size()); + queries.put("findAllTestSteps", (query) -> query.findAllTestSteps().size()); + queries.put("findAllTestStepsStarted", (query) -> query.findAllTestStepsStarted().size()); + queries.put("findAllTestStepsFinished", (query) -> query.findAllTestStepsFinished().size()); + queries.put("findAllTestCaseStartedGroupedByFeature", (query) -> query.findAllTestCaseStartedGroupedByFeature() .entrySet() .stream() .map(entry -> Arrays.asList(entry.getKey().map(Feature::getName), entry.getValue().stream() .map(TestCaseStarted::getId) .collect(toList())))); - results.put("findAttachmentsBy", (query) -> query.findAllTestCaseStarted().stream() + queries.put("findAllTestCases", (query) -> query.findAllTestCases().size()); + queries.put("findAttachmentsBy", (query) -> query.findAllTestCaseStarted().stream() .map(query::findTestStepFinishedAndTestStepBy) .flatMap(Collection::stream) .map(Map.Entry::getKey) @@ -136,118 +141,194 @@ static Map> createQueries() { attachment.getContentEncoding() )) .collect(toList())); - results.put("findFeatureBy", (query) -> query.findAllTestCaseStarted().stream() + queries.put("findFeatureBy", (query) -> query.findAllTestCaseStarted().stream() .map(query::findFeatureBy) .map(feature -> feature.map(Feature::getName)) .collect(toList())); - results.put("findHookBy", (query) -> query.findAllTestSteps().stream() + queries.put("findHookBy", (query) -> query.findAllTestSteps().stream() .map(query::findHookBy) .map(hook -> hook.map(Hook::getId)) .filter(Optional::isPresent) .collect(toList())); - results.put("findLocationOf", (query) -> query.findAllPickles().stream() + queries.put("findLocationOf", (query) -> query.findAllPickles().stream() .map(query::findLocationOf) .filter(Optional::isPresent) .collect(toList())); - results.put("findMeta", (query) -> query.findMeta().map(meta -> meta.getImplementation().getName())); - results.put("findMostSevereTestStepResultBy", (query) -> query.findAllTestCaseStarted().stream() - .map(query::findMostSevereTestStepResultBy) - .map(testStepResult -> testStepResult.map(TestStepResult::getStatus)) - .collect(toList())); + queries.put("findMeta", (query) -> query.findMeta().map(meta -> meta.getImplementation().getName())); + + queries.put("findMostSevereTestStepResultBy", (query) -> { + Map results = new LinkedHashMap<>(); + results.put("testCaseStarted", query.findAllTestCaseStarted().stream() + .map(query::findMostSevereTestStepResultBy) + .map(testStepResult -> testStepResult.map(TestStepResult::getStatus)) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(toList())); + results.put("testCaseFinished", query.findAllTestCaseFinished().stream() + .map(query::findMostSevereTestStepResultBy) + .map(testStepResult -> testStepResult.map(TestStepResult::getStatus)) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(toList())); + return results; + }); - results.put("findNameOf", (query) -> { - Map names = new LinkedHashMap<>(); - names.put("long", query.findAllPickles().stream() + queries.put("findNameOf", (query) -> { + Map results = new LinkedHashMap<>(); + results.put("long", query.findAllPickles().stream() .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(LONG).build())) .collect(toList())); - names.put("excludeFeatureName", query.findAllPickles().stream() + results.put("excludeFeatureName", query.findAllPickles().stream() .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(LONG).featureName(EXCLUDE).build())) .collect(toList())); - names.put("longPickleName", query.findAllPickles().stream() + results.put("longPickleName", query.findAllPickles().stream() .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(LONG).exampleName(PICKLE).build())) .collect(toList())); - names.put("short", query.findAllPickles().stream() + results.put("short", query.findAllPickles().stream() .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(SHORT).build())) .collect(toList())); - names.put("shortPickleName", query.findAllPickles().stream() + results.put("shortPickleName", query.findAllPickles().stream() .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(SHORT).exampleName(PICKLE).build())) .collect(toList())); - return names; + return results; }); - results.put("findPickleBy", (query) -> query.findAllTestCaseStarted().stream() - .map(query::findPickleBy) - .map(pickle -> pickle.map(Pickle::getName)) - .collect(toList())); - results.put("findPickleStepBy", (query) -> query.findAllTestSteps().stream() + queries.put("findPickleBy", (query) -> { + Map results = new LinkedHashMap<>(); + results.put("testCaseStarted", query.findAllTestCaseStarted().stream() + .map(query::findPickleBy) + .map(pickle -> pickle.map(Pickle::getName)) + .collect(toList())); + results.put("testCaseFinished", query.findAllTestCaseFinished().stream() + .map(query::findPickleBy) + .map(pickle -> pickle.map(Pickle::getName)) + .collect(toList())); + return results; + }); + + queries.put("findPickleStepBy", (query) -> query.findAllTestSteps().stream() .map(query::findPickleStepBy) .map(pickleStep -> pickleStep.map(PickleStep::getText)) .filter(Optional::isPresent) .collect(toList())); - results.put("findStepBy", (query) -> query.findAllPickleSteps().stream() + queries.put("findStepBy", (query) -> query.findAllPickleSteps().stream() .map(query::findStepBy) .map(step -> step.map(Step::getText)) .collect(toList())); - results.put("findStepDefinitionsBy", (query) -> query.findAllTestSteps().stream() + queries.put("findStepDefinitionsBy", (query) -> query.findAllTestSteps().stream() .map(query::findStepDefinitionsBy) .map(stepDefinitions -> stepDefinitions.stream().map(StepDefinition::getId) .collect(toList())) .collect(toList())); - results.put("findUnambiguousStepDefinitionBy", (query) -> query.findAllTestSteps().stream() + queries.put("findUnambiguousStepDefinitionBy", (query) -> query.findAllTestSteps().stream() .map(query::findUnambiguousStepDefinitionBy) .filter(Optional::isPresent) .map(Optional::get) .map(StepDefinition::getId)); - results.put("findTestCaseBy", (query) -> query.findAllTestCaseStarted().stream() - .map(query::findTestCaseBy) - .map(testCase -> testCase.map(io.cucumber.messages.types.TestCase::getId)) - .collect(toList())); - results.put("findTestCaseDurationBy", (query) -> query.findAllTestCaseStarted().stream() - .map(query::findTestCaseDurationBy) - .map(duration -> duration.map(Convertor::toMessage)) - .collect(toList())); - results.put("findTestCaseFinishedBy", (query) -> query.findAllTestCaseStarted().stream() + + queries.put("findTestCaseStartedBy", (query) -> { + Map results = new LinkedHashMap<>(); + results.put("testStepStarted", query.findAllTestStepsStarted().stream() + .map(query::findTestCaseStartedBy) + .map(testCase -> testCase.map(TestCaseStarted::getId)) + .collect(toList())); + results.put("testStepFinished", query.findAllTestStepsFinished().stream() + .map(query::findTestCaseStartedBy) + .map(testCase -> testCase.map(TestCaseStarted::getId)) + .collect(toList())); + return results; + }); + + queries.put("findTestCaseBy", (query) -> { + Map results = new LinkedHashMap<>(); + results.put("testCaseStarted", query.findAllTestCaseStarted().stream() + .map(query::findTestCaseBy) + .map(testCase -> testCase.map(TestCase::getId)) + .collect(toList())); + results.put("testCaseFinished", query.findAllTestCaseFinished().stream() + .map(query::findTestCaseBy) + .map(testCase -> testCase.map(TestCase::getId)) + .collect(toList())); + results.put("testStepStarted", query.findAllTestStepsStarted().stream() + .map(query::findTestCaseBy) + .map(testCase -> testCase.map(TestCase::getId)) + .collect(toList())); + results.put("testStepFinished", query.findAllTestStepsFinished().stream() + .map(query::findTestCaseBy) + .map(testCase -> testCase.map(TestCase::getId)) + .collect(toList())); + return results; + }); + + queries.put("findTestCaseDurationBy", (query) -> { + Map results = new LinkedHashMap<>(); + results.put("testCaseStarted", query.findAllTestCaseStarted().stream() + .map(query::findTestCaseDurationBy) + .map(duration -> duration.map(Convertor::toMessage)) + .collect(toList())); + results.put("testCaseFinished", query.findAllTestCaseFinished().stream() + .map(query::findTestCaseDurationBy) + .map(duration -> duration.map(Convertor::toMessage)) + .collect(toList())); + return results; + }); + + queries.put("findTestCaseFinishedBy", (query) -> query.findAllTestCaseStarted().stream() .map(query::findTestCaseFinishedBy) .map(testCaseFinished -> testCaseFinished.map(TestCaseFinished::getTestCaseStartedId)) .collect(toList())); - results.put("findTestRunDuration", (query) -> query.findTestRunDuration() + queries.put("findTestRunDuration", (query) -> query.findTestRunDuration() .map(Convertor::toMessage)); - results.put("findTestRunFinished", Query::findTestRunFinished); - results.put("findTestRunStarted", Query::findTestRunStarted); - results.put("findTestStepByTestStepStarted", (query) -> query.findAllTestCaseStarted().stream() + queries.put("findTestRunFinished", Query::findTestRunFinished); + queries.put("findTestRunStarted", Query::findTestRunStarted); + queries.put("findTestStepByTestStepStarted", (query) -> query.findAllTestCaseStarted().stream() .map(query::findTestStepsStartedBy) .flatMap(Collection::stream) .map(query::findTestStepBy) .map(testStep -> testStep.map(TestStep::getId)) .collect(toList())); - results.put("findTestStepByTestStepFinished", (query) -> query.findAllTestCaseStarted().stream() - .map(query::findTestStepsFinishedBy) - .flatMap(Collection::stream) - .map(query::findTestStepBy) - .map(testStep -> testStep.map(TestStep::getId)) - .collect(toList())); - results.put("findTestStepsFinishedBy", (query) -> query.findAllTestCaseStarted().stream() + + queries.put("findTestStepByTestStepFinished", (query) -> { + Map results = new LinkedHashMap<>(); + + results.put("testCaseStarted", query.findAllTestCaseStarted().stream() + .map(query::findTestStepsFinishedBy) + .flatMap(Collection::stream) + .map(query::findTestStepBy) + .map(testStep -> testStep.map(TestStep::getId)) + .collect(toList())); + results.put("testCaseFinished", query.findAllTestCaseFinished().stream() + .map(query::findTestStepsFinishedBy) + .flatMap(Collection::stream) + .map(query::findTestStepBy) + .map(testStep -> testStep.map(TestStep::getId)) + .collect(toList())); + + return results; + }); + + queries.put("findTestStepsFinishedBy", (query) -> query.findAllTestCaseStarted().stream() .map(query::findTestStepsFinishedBy) .map(testStepFinisheds -> testStepFinisheds.stream().map(TestStepFinished::getTestStepId).collect(toList())) .collect(toList())); - results.put("findTestStepFinishedAndTestStepBy", (query) -> query.findAllTestCaseStarted().stream() + queries.put("findTestStepFinishedAndTestStepBy", (query) -> query.findAllTestCaseStarted().stream() .map(query::findTestStepFinishedAndTestStepBy) .flatMap(Collection::stream) .map(entry -> asList(entry.getKey().getTestStepId(), entry.getValue().getId())) .collect(toList())); - return results; + return queries; } - static class TestCase { + static class QueryTestCase { private final String methodName; private final String name; private final Path source; private final Path expected; private final Function query; - TestCase(String methodName, Path source, Function query) { + QueryTestCase(String methodName, Path source, Function query) { this.methodName = methodName; this.source = source; this.query = query; diff --git a/javascript/src/Query.ts b/javascript/src/Query.ts index 706380ce..f2e887ab 100644 --- a/javascript/src/Query.ts +++ b/javascript/src/Query.ts @@ -450,6 +450,20 @@ export default class Query { ) } + public findAllTestCaseFinished(): ReadonlyArray { + return sortBy( + [...this.testCaseFinishedByTestCaseStartedId.values()].filter((testCaseFinished) => { + // only include if not yet finished OR won't be retried + return !testCaseFinished?.willBeRetried + }), + [ + (testCaseFinished) => + TimeConversion.timestampToMillisecondsSinceEpoch(testCaseFinished.timestamp), + 'id', + ] + ) + } + public findAllTestCaseStartedGroupedByFeature(): Map< Feature | undefined, ReadonlyArray @@ -470,6 +484,14 @@ export default class Query { return [...this.testStepById.values()] } + public findAllTestStepStarted(): ReadonlyArray { + return [...this.testStepStartedByTestCaseStartedId.values()] + } + + public findAllTestStepFinished(): ReadonlyArray { + return [...this.testStepFinishedByTestCaseStartedId.values()] + } + public findAttachmentsBy(testStepFinished: TestStepFinished): ReadonlyArray { return this.attachmentsByTestCaseStartedId .get(testStepFinished.testCaseStartedId) @@ -492,8 +514,10 @@ export default class Query { } public findMostSevereTestStepResultBy( - testCaseStarted: TestCaseStarted + element: TestCaseStarted | TestCaseFinished ): TestStepResult | undefined { + const testCaseStarted = + 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element return sortBy( this.findTestStepFinishedAndTestStepBy(testCaseStarted).map( ([testStepFinished]) => testStepFinished.testStepResult @@ -515,7 +539,9 @@ export default class Query { return lineage?.scenario?.location } - public findPickleBy(element: TestCaseStarted | TestStepStarted): Pickle | undefined { + public findPickleBy( + element: TestCaseStarted | TestCaseFinished | TestStepStarted + ): Pickle | undefined { const testCase = this.findTestCaseBy(element) assert.ok(testCase, 'Expected to find TestCase from TestCaseStarted') return this.pickleById.get(testCase.pickleId) @@ -545,15 +571,25 @@ export default class Query { return undefined } - public findTestCaseBy(element: TestCaseStarted | TestStepStarted): TestCase | undefined { + public findTestCaseBy( + element: TestCaseStarted | TestCaseFinished | TestStepStarted | TestStepFinished + ): TestCase | undefined { const testCaseStarted = 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element assert.ok(testCaseStarted, 'Expected to find TestCaseStarted by TestStepStarted') return this.testCaseById.get(testCaseStarted.testCaseId) } - public findTestCaseDurationBy(testCaseStarted: TestCaseStarted): Duration | undefined { - const testCaseFinished = this.findTestCaseFinishedBy(testCaseStarted) + public findTestCaseDurationBy(element: TestCaseStarted | TestCaseFinished): Duration | undefined { + let testCaseStarted: TestCaseStarted + let testCaseFinished: TestCaseFinished + if ('testCaseStartedId' in element) { + testCaseStarted = this.findTestCaseStartedBy(element) + testCaseFinished = element + } else { + testCaseStarted = element + testCaseFinished = this.findTestCaseFinishedBy(element) + } if (!testCaseFinished) { return undefined } @@ -563,8 +599,10 @@ export default class Query { ) } - public findTestCaseStartedBy(testStepStarted: TestStepStarted): TestCaseStarted | undefined { - return this.testCaseStartedById.get(testStepStarted.testCaseStartedId) + public findTestCaseStartedBy( + element: TestCaseFinished | TestStepStarted | TestStepFinished + ): TestCaseStarted | undefined { + return this.testCaseStartedById.get(element.testCaseStartedId) } public findTestCaseFinishedBy(testCaseStarted: TestCaseStarted): TestCaseFinished | undefined { @@ -599,8 +637,10 @@ export default class Query { } public findTestStepsFinishedBy( - testCaseStarted: TestCaseStarted + element: TestCaseStarted | TestCaseFinished ): ReadonlyArray { + const testCaseStarted = + 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element // multimaps `get` implements `getOrDefault([])` behaviour internally return [...this.testStepFinishedByTestCaseStartedId.get(testCaseStarted.id)] } diff --git a/javascript/src/acceptance.spec.ts b/javascript/src/acceptance.spec.ts index 42ce2b7b..31d7943b 100644 --- a/javascript/src/acceptance.spec.ts +++ b/javascript/src/acceptance.spec.ts @@ -68,11 +68,20 @@ describe('Acceptance Tests', async () => { .map((hook) => hook?.id) .filter((value) => !!value), findMeta: (query: Query) => query.findMeta()?.implementation?.name, - findMostSevereTestStepResultBy: (query: Query) => - query - .findAllTestCaseStarted() - .map((testCaseStarted) => query.findMostSevereTestStepResultBy(testCaseStarted)) - .map((testStepResult) => testStepResult?.status), + findMostSevereTestStepResultBy: (query: Query) => { + return { + testCaseStarted: query + .findAllTestCaseStarted() + .map((testCaseStarted) => query.findMostSevereTestStepResultBy(testCaseStarted)) + .map((testStepResult) => testStepResult?.status) + .filter((value) => value), + testCaseFinished: query + .findAllTestCaseFinished() + .map((testCaseStarted) => query.findMostSevereTestStepResultBy(testCaseStarted)) + .map((testStepResult) => testStepResult?.status) + .filter((value) => value), + } + }, findNameOf: (query: Query) => { return { long: query @@ -117,11 +126,18 @@ describe('Acceptance Tests', async () => { }, findLocationOf: (query: Query) => query.findAllPickles().map((pickle) => query.findLocationOf(pickle)), - findPickleBy: (query: Query) => - query - .findAllTestCaseStarted() - .map((testCaseStarted) => query.findPickleBy(testCaseStarted)) - .map((pickle) => pickle?.name), + findPickleBy: (query: Query) => { + return { + testCaseStarted: query + .findAllTestCaseStarted() + .map((testCaseStarted) => query.findPickleBy(testCaseStarted)) + .map((pickle) => pickle?.name), + testCaseFinished: query + .findAllTestCaseFinished() + .map((testCaseFinished) => query.findPickleBy(testCaseFinished)) + .map((pickle) => pickle?.name), + } + }, findPickleStepBy: (query: Query) => query .findAllTestSteps() @@ -145,15 +161,36 @@ describe('Acceptance Tests', async () => { .map((pickleStep) => query.findUnambiguousStepDefinitionBy(pickleStep)) .filter((stepDefinition) => !!stepDefinition) .map((stepDefinition) => stepDefinition.id), - findTestCaseBy: (query: Query) => - query - .findAllTestCaseStarted() - .map((testCaseStarted) => query.findTestCaseBy(testCaseStarted)) - .map((testCase) => testCase?.id), - findTestCaseDurationBy: (query: Query) => - query - .findAllTestCaseStarted() - .map((testCaseStarted) => query.findTestCaseDurationBy(testCaseStarted)), + findTestCaseBy: (query: Query) => { + return { + testCaseStarted: query + .findAllTestCaseStarted() + .map((testCaseStarted) => query.findTestCaseBy(testCaseStarted)) + .map((testCase) => testCase?.id), + testCaseFinished: query + .findAllTestCaseFinished() + .map((testCaseFinished) => query.findTestCaseBy(testCaseFinished)) + .map((testCase) => testCase?.id), + testStepStarted: query + .findAllTestStepStarted() + .map((testStepStarted) => query.findTestCaseBy(testStepStarted)) + .map((testCase) => testCase?.id), + testStepFinished: query + .findAllTestStepFinished() + .map((testStepFinished) => query.findTestCaseBy(testStepFinished)) + .map((testCase) => testCase?.id), + } + }, + findTestCaseDurationBy: (query: Query) => { + return { + testCaseStarted: query + .findAllTestCaseStarted() + .map((testCaseStarted) => query.findTestCaseDurationBy(testCaseStarted)), + testCaseFinished: query + .findAllTestCaseFinished() + .map((testCaseFinished) => query.findTestCaseDurationBy(testCaseFinished)), + } + }, findTestCaseFinishedBy: (query: Query) => query .findAllTestCaseStarted() @@ -168,12 +205,20 @@ describe('Acceptance Tests', async () => { .flatMap((testCaseStarted) => query.findTestStepsStartedBy(testCaseStarted)) .map((testStepStarted) => query.findTestStepBy(testStepStarted)) .map((testStep) => testStep?.id), - findTestStepByTestStepFinished: (query: Query) => - query - .findAllTestCaseStarted() - .flatMap((testCaseStarted) => query.findTestStepsFinishedBy(testCaseStarted)) - .map((testStepFinished) => query.findTestStepBy(testStepFinished)) - .map((testStep) => testStep?.id), + findTestStepByTestStepFinished: (query: Query) => { + return { + testCaseStarted: query + .findAllTestCaseStarted() + .flatMap((testCaseStarted) => query.findTestStepsFinishedBy(testCaseStarted)) + .map((testStepFinished) => query.findTestStepBy(testStepFinished)) + .map((testStep) => testStep?.id), + testCaseFinished: query + .findAllTestCaseFinished() + .flatMap((testCaseFinished) => query.findTestStepsFinishedBy(testCaseFinished)) + .map((testStepFinished) => query.findTestStepBy(testStepFinished)) + .map((testStep) => testStep?.id), + } + }, findTestStepsFinishedBy: (query: Query) => query .findAllTestCaseStarted() diff --git a/testdata/attachments.findAllTestCaseFinished.results.json b/testdata/attachments.findAllTestCaseFinished.results.json new file mode 100644 index 00000000..c7930257 --- /dev/null +++ b/testdata/attachments.findAllTestCaseFinished.results.json @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/testdata/attachments.findAllTestCases.results.json b/testdata/attachments.findAllTestCases.results.json new file mode 100644 index 00000000..c7930257 --- /dev/null +++ b/testdata/attachments.findAllTestCases.results.json @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/testdata/attachments.findAllTestStepsFinished.results.json b/testdata/attachments.findAllTestStepsFinished.results.json new file mode 100644 index 00000000..c7930257 --- /dev/null +++ b/testdata/attachments.findAllTestStepsFinished.results.json @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/testdata/attachments.findAllTestStepsStarted.results.json b/testdata/attachments.findAllTestStepsStarted.results.json new file mode 100644 index 00000000..c7930257 --- /dev/null +++ b/testdata/attachments.findAllTestStepsStarted.results.json @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/testdata/attachments.findMostSevereTestStepResultBy.results.json b/testdata/attachments.findMostSevereTestStepResultBy.results.json index 9d83fd54..3f2910ed 100644 --- a/testdata/attachments.findMostSevereTestStepResultBy.results.json +++ b/testdata/attachments.findMostSevereTestStepResultBy.results.json @@ -1,9 +1,20 @@ -[ - "PASSED", - "PASSED", - "PASSED", - "PASSED", - "PASSED", - "PASSED", - "PASSED" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED" + ], + "testCaseFinished" : [ + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED" + ] +} \ No newline at end of file diff --git a/testdata/attachments.findPickleBy.results.json b/testdata/attachments.findPickleBy.results.json index b69fc4ac..dc5507ac 100644 --- a/testdata/attachments.findPickleBy.results.json +++ b/testdata/attachments.findPickleBy.results.json @@ -1,9 +1,20 @@ -[ - "Strings can be attached with a media type", - "Log text", - "Log ANSI coloured text", - "Log JSON", - "Byte arrays are base64-encoded regardless of media type", - "Attaching PDFs with a different filename", - "Attaching URIs" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "Strings can be attached with a media type", + "Log text", + "Log ANSI coloured text", + "Log JSON", + "Byte arrays are base64-encoded regardless of media type", + "Attaching PDFs with a different filename", + "Attaching URIs" + ], + "testCaseFinished" : [ + "Strings can be attached with a media type", + "Log text", + "Log ANSI coloured text", + "Log JSON", + "Byte arrays are base64-encoded regardless of media type", + "Attaching PDFs with a different filename", + "Attaching URIs" + ] +} \ No newline at end of file diff --git a/testdata/attachments.findTestCaseBy.results.json b/testdata/attachments.findTestCaseBy.results.json index fc6e9f93..298a33f9 100644 --- a/testdata/attachments.findTestCaseBy.results.json +++ b/testdata/attachments.findTestCaseBy.results.json @@ -1,9 +1,38 @@ -[ - "36", - "38", - "40", - "42", - "44", - "46", - "48" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "36", + "38", + "40", + "42", + "44", + "46", + "48" + ], + "testCaseFinished" : [ + "36", + "38", + "40", + "42", + "44", + "46", + "48" + ], + "testStepStarted" : [ + "36", + "38", + "40", + "42", + "44", + "46", + "48" + ], + "testStepFinished" : [ + "36", + "38", + "40", + "42", + "44", + "46", + "48" + ] +} \ No newline at end of file diff --git a/testdata/attachments.findTestCaseDurationBy.results.json b/testdata/attachments.findTestCaseDurationBy.results.json index f8429d4c..16b40ede 100644 --- a/testdata/attachments.findTestCaseDurationBy.results.json +++ b/testdata/attachments.findTestCaseDurationBy.results.json @@ -1,30 +1,62 @@ -[ - { - "seconds" : 0, - "nanos" : 3000000 - }, - { - "seconds" : 0, - "nanos" : 3000000 - }, - { - "seconds" : 0, - "nanos" : 3000000 - }, - { - "seconds" : 0, - "nanos" : 3000000 - }, - { - "seconds" : 0, - "nanos" : 3000000 - }, - { - "seconds" : 0, - "nanos" : 3000000 - }, - { - "seconds" : 0, - "nanos" : 3000000 - } -] \ No newline at end of file +{ + "testCaseStarted" : [ + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + } + ], + "testCaseFinished" : [ + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + }, + { + "seconds" : 0, + "nanos" : 3000000 + } + ] +} \ No newline at end of file diff --git a/testdata/attachments.findTestCaseStartedBy.results.json b/testdata/attachments.findTestCaseStartedBy.results.json new file mode 100644 index 00000000..4e62ac7b --- /dev/null +++ b/testdata/attachments.findTestCaseStartedBy.results.json @@ -0,0 +1,20 @@ +{ + "testStepStarted" : [ + "50", + "51", + "52", + "53", + "54", + "55", + "56" + ], + "testStepFinished" : [ + "50", + "51", + "52", + "53", + "54", + "55", + "56" + ] +} \ No newline at end of file diff --git a/testdata/attachments.findTestStepByTestStepFinished.results.json b/testdata/attachments.findTestStepByTestStepFinished.results.json index 9066fc95..99ca62ae 100644 --- a/testdata/attachments.findTestStepByTestStepFinished.results.json +++ b/testdata/attachments.findTestStepByTestStepFinished.results.json @@ -1,9 +1,20 @@ -[ - "37", - "39", - "41", - "43", - "45", - "47", - "49" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "37", + "39", + "41", + "43", + "45", + "47", + "49" + ], + "testCaseFinished" : [ + "37", + "39", + "41", + "43", + "45", + "47", + "49" + ] +} \ No newline at end of file diff --git a/testdata/empty.findAllTestCaseFinished.results.json b/testdata/empty.findAllTestCaseFinished.results.json new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/testdata/empty.findAllTestCaseFinished.results.json @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/testdata/empty.findAllTestCases.results.json b/testdata/empty.findAllTestCases.results.json new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/testdata/empty.findAllTestCases.results.json @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/testdata/empty.findAllTestStepsFinished.results.json b/testdata/empty.findAllTestStepsFinished.results.json new file mode 100644 index 00000000..c2270834 --- /dev/null +++ b/testdata/empty.findAllTestStepsFinished.results.json @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/empty.findAllTestStepsStarted.results.json b/testdata/empty.findAllTestStepsStarted.results.json new file mode 100644 index 00000000..c2270834 --- /dev/null +++ b/testdata/empty.findAllTestStepsStarted.results.json @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/empty.findMostSevereTestStepResultBy.results.json b/testdata/empty.findMostSevereTestStepResultBy.results.json index acb2cca4..211c0e6c 100644 --- a/testdata/empty.findMostSevereTestStepResultBy.results.json +++ b/testdata/empty.findMostSevereTestStepResultBy.results.json @@ -1,3 +1,4 @@ -[ - null -] \ No newline at end of file +{ + "testCaseStarted" : [ ], + "testCaseFinished" : [ ] +} \ No newline at end of file diff --git a/testdata/empty.findPickleBy.results.json b/testdata/empty.findPickleBy.results.json index b1941d19..5f5b6e69 100644 --- a/testdata/empty.findPickleBy.results.json +++ b/testdata/empty.findPickleBy.results.json @@ -1,3 +1,8 @@ -[ - "Blank Scenario" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "Blank Scenario" + ], + "testCaseFinished" : [ + "Blank Scenario" + ] +} \ No newline at end of file diff --git a/testdata/empty.findTestCaseBy.results.json b/testdata/empty.findTestCaseBy.results.json index f52e6e6b..5a7775b3 100644 --- a/testdata/empty.findTestCaseBy.results.json +++ b/testdata/empty.findTestCaseBy.results.json @@ -1,3 +1,10 @@ -[ - "3" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "3" + ], + "testCaseFinished" : [ + "3" + ], + "testStepStarted" : [ ], + "testStepFinished" : [ ] +} \ No newline at end of file diff --git a/testdata/empty.findTestCaseDurationBy.results.json b/testdata/empty.findTestCaseDurationBy.results.json index f58ef1a4..ccdcb10a 100644 --- a/testdata/empty.findTestCaseDurationBy.results.json +++ b/testdata/empty.findTestCaseDurationBy.results.json @@ -1,6 +1,14 @@ -[ - { - "seconds" : 0, - "nanos" : 1000000 - } -] \ No newline at end of file +{ + "testCaseStarted" : [ + { + "seconds" : 0, + "nanos" : 1000000 + } + ], + "testCaseFinished" : [ + { + "seconds" : 0, + "nanos" : 1000000 + } + ] +} \ No newline at end of file diff --git a/testdata/empty.findTestCaseStartedBy.results.json b/testdata/empty.findTestCaseStartedBy.results.json new file mode 100644 index 00000000..4e9754c3 --- /dev/null +++ b/testdata/empty.findTestCaseStartedBy.results.json @@ -0,0 +1,4 @@ +{ + "testStepStarted" : [ ], + "testStepFinished" : [ ] +} \ No newline at end of file diff --git a/testdata/empty.findTestStepByTestStepFinished.results.json b/testdata/empty.findTestStepByTestStepFinished.results.json index 8878e547..211c0e6c 100644 --- a/testdata/empty.findTestStepByTestStepFinished.results.json +++ b/testdata/empty.findTestStepByTestStepFinished.results.json @@ -1 +1,4 @@ -[ ] \ No newline at end of file +{ + "testCaseStarted" : [ ], + "testCaseFinished" : [ ] +} \ No newline at end of file diff --git a/testdata/examples-tables.findAllTestCaseFinished.results.json b/testdata/examples-tables.findAllTestCaseFinished.results.json new file mode 100644 index 00000000..f11c82a4 --- /dev/null +++ b/testdata/examples-tables.findAllTestCaseFinished.results.json @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/testdata/examples-tables.findAllTestCases.results.json b/testdata/examples-tables.findAllTestCases.results.json new file mode 100644 index 00000000..f11c82a4 --- /dev/null +++ b/testdata/examples-tables.findAllTestCases.results.json @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/testdata/examples-tables.findAllTestStepsFinished.results.json b/testdata/examples-tables.findAllTestStepsFinished.results.json new file mode 100644 index 00000000..a5c750fe --- /dev/null +++ b/testdata/examples-tables.findAllTestStepsFinished.results.json @@ -0,0 +1 @@ +27 \ No newline at end of file diff --git a/testdata/examples-tables.findAllTestStepsStarted.results.json b/testdata/examples-tables.findAllTestStepsStarted.results.json new file mode 100644 index 00000000..a5c750fe --- /dev/null +++ b/testdata/examples-tables.findAllTestStepsStarted.results.json @@ -0,0 +1 @@ +27 \ No newline at end of file diff --git a/testdata/examples-tables.findMostSevereTestStepResultBy.results.json b/testdata/examples-tables.findMostSevereTestStepResultBy.results.json index 83dcef4d..eacfd2a6 100644 --- a/testdata/examples-tables.findMostSevereTestStepResultBy.results.json +++ b/testdata/examples-tables.findMostSevereTestStepResultBy.results.json @@ -1,11 +1,24 @@ -[ - "PASSED", - "PASSED", - "FAILED", - "FAILED", - "UNDEFINED", - "UNDEFINED", - "PASSED", - "PASSED", - "PASSED" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "PASSED", + "PASSED", + "FAILED", + "FAILED", + "UNDEFINED", + "UNDEFINED", + "PASSED", + "PASSED", + "PASSED" + ], + "testCaseFinished" : [ + "PASSED", + "PASSED", + "FAILED", + "FAILED", + "UNDEFINED", + "UNDEFINED", + "PASSED", + "PASSED", + "PASSED" + ] +} \ No newline at end of file diff --git a/testdata/examples-tables.findPickleBy.results.json b/testdata/examples-tables.findPickleBy.results.json index 4298ed27..8092f950 100644 --- a/testdata/examples-tables.findPickleBy.results.json +++ b/testdata/examples-tables.findPickleBy.results.json @@ -1,11 +1,24 @@ -[ - "Eating cucumbers", - "Eating cucumbers", - "Eating cucumbers", - "Eating cucumbers", - "Eating cucumbers", - "Eating cucumbers", - "Eating cucumbers with 11 friends", - "Eating cucumbers with 1 friends", - "Eating cucumbers with 0 friends" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers with 11 friends", + "Eating cucumbers with 1 friends", + "Eating cucumbers with 0 friends" + ], + "testCaseFinished" : [ + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers", + "Eating cucumbers with 11 friends", + "Eating cucumbers with 1 friends", + "Eating cucumbers with 0 friends" + ] +} \ No newline at end of file diff --git a/testdata/examples-tables.findTestCaseBy.results.json b/testdata/examples-tables.findTestCaseBy.results.json index 09d288b5..5837f5e2 100644 --- a/testdata/examples-tables.findTestCaseBy.results.json +++ b/testdata/examples-tables.findTestCaseBy.results.json @@ -1,11 +1,82 @@ -[ - "70", - "74", - "78", - "82", - "86", - "90", - "94", - "98", - "102" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "70", + "74", + "78", + "82", + "86", + "90", + "94", + "98", + "102" + ], + "testCaseFinished" : [ + "70", + "74", + "78", + "82", + "86", + "90", + "94", + "98", + "102" + ], + "testStepStarted" : [ + "70", + "70", + "70", + "74", + "74", + "74", + "78", + "78", + "78", + "82", + "82", + "82", + "86", + "86", + "86", + "90", + "90", + "90", + "94", + "94", + "94", + "98", + "98", + "98", + "102", + "102", + "102" + ], + "testStepFinished" : [ + "70", + "70", + "70", + "74", + "74", + "74", + "78", + "78", + "78", + "82", + "82", + "82", + "86", + "86", + "86", + "90", + "90", + "90", + "94", + "94", + "94", + "98", + "98", + "98", + "102", + "102", + "102" + ] +} \ No newline at end of file diff --git a/testdata/examples-tables.findTestCaseDurationBy.results.json b/testdata/examples-tables.findTestCaseDurationBy.results.json index 47c66877..8e60c8a2 100644 --- a/testdata/examples-tables.findTestCaseDurationBy.results.json +++ b/testdata/examples-tables.findTestCaseDurationBy.results.json @@ -1,38 +1,78 @@ -[ - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - } -] \ No newline at end of file +{ + "testCaseStarted" : [ + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + } + ], + "testCaseFinished" : [ + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + } + ] +} \ No newline at end of file diff --git a/testdata/examples-tables.findTestCaseStartedBy.results.json b/testdata/examples-tables.findTestCaseStartedBy.results.json new file mode 100644 index 00000000..1bc89545 --- /dev/null +++ b/testdata/examples-tables.findTestCaseStartedBy.results.json @@ -0,0 +1,60 @@ +{ + "testStepStarted" : [ + "106", + "106", + "106", + "107", + "107", + "107", + "108", + "108", + "108", + "109", + "109", + "109", + "110", + "110", + "110", + "111", + "111", + "111", + "112", + "112", + "112", + "113", + "113", + "113", + "114", + "114", + "114" + ], + "testStepFinished" : [ + "106", + "106", + "106", + "107", + "107", + "107", + "108", + "108", + "108", + "109", + "109", + "109", + "110", + "110", + "110", + "111", + "111", + "111", + "112", + "112", + "112", + "113", + "113", + "113", + "114", + "114", + "114" + ] +} \ No newline at end of file diff --git a/testdata/examples-tables.findTestStepByTestStepFinished.results.json b/testdata/examples-tables.findTestStepByTestStepFinished.results.json index d4508aa3..71263466 100644 --- a/testdata/examples-tables.findTestStepByTestStepFinished.results.json +++ b/testdata/examples-tables.findTestStepByTestStepFinished.results.json @@ -1,29 +1,60 @@ -[ - "71", - "72", - "73", - "75", - "76", - "77", - "79", - "80", - "81", - "83", - "84", - "85", - "87", - "88", - "89", - "91", - "92", - "93", - "95", - "96", - "97", - "99", - "100", - "101", - "103", - "104", - "105" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "71", + "72", + "73", + "75", + "76", + "77", + "79", + "80", + "81", + "83", + "84", + "85", + "87", + "88", + "89", + "91", + "92", + "93", + "95", + "96", + "97", + "99", + "100", + "101", + "103", + "104", + "105" + ], + "testCaseFinished" : [ + "71", + "72", + "73", + "75", + "76", + "77", + "79", + "80", + "81", + "83", + "84", + "85", + "87", + "88", + "89", + "91", + "92", + "93", + "95", + "96", + "97", + "99", + "100", + "101", + "103", + "104", + "105" + ] +} \ No newline at end of file diff --git a/testdata/hooks.findAllTestCaseFinished.results.json b/testdata/hooks.findAllTestCaseFinished.results.json new file mode 100644 index 00000000..e440e5c8 --- /dev/null +++ b/testdata/hooks.findAllTestCaseFinished.results.json @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/testdata/hooks.findAllTestCases.results.json b/testdata/hooks.findAllTestCases.results.json new file mode 100644 index 00000000..e440e5c8 --- /dev/null +++ b/testdata/hooks.findAllTestCases.results.json @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/testdata/hooks.findAllTestStepsFinished.results.json b/testdata/hooks.findAllTestStepsFinished.results.json new file mode 100644 index 00000000..f11c82a4 --- /dev/null +++ b/testdata/hooks.findAllTestStepsFinished.results.json @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/testdata/hooks.findAllTestStepsStarted.results.json b/testdata/hooks.findAllTestStepsStarted.results.json new file mode 100644 index 00000000..f11c82a4 --- /dev/null +++ b/testdata/hooks.findAllTestStepsStarted.results.json @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/testdata/hooks.findMostSevereTestStepResultBy.results.json b/testdata/hooks.findMostSevereTestStepResultBy.results.json index bb8d4c94..64380b06 100644 --- a/testdata/hooks.findMostSevereTestStepResultBy.results.json +++ b/testdata/hooks.findMostSevereTestStepResultBy.results.json @@ -1,5 +1,12 @@ -[ - "PASSED", - "FAILED", - "UNDEFINED" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "PASSED", + "FAILED", + "UNDEFINED" + ], + "testCaseFinished" : [ + "PASSED", + "FAILED", + "UNDEFINED" + ] +} \ No newline at end of file diff --git a/testdata/hooks.findPickleBy.results.json b/testdata/hooks.findPickleBy.results.json index 934ebf0a..2d47e3b1 100644 --- a/testdata/hooks.findPickleBy.results.json +++ b/testdata/hooks.findPickleBy.results.json @@ -1,5 +1,12 @@ -[ - "No tags and a passed step", - "No tags and a failed step", - "No tags and a undefined step" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "No tags and a passed step", + "No tags and a failed step", + "No tags and a undefined step" + ], + "testCaseFinished" : [ + "No tags and a passed step", + "No tags and a failed step", + "No tags and a undefined step" + ] +} \ No newline at end of file diff --git a/testdata/hooks.findTestCaseBy.results.json b/testdata/hooks.findTestCaseBy.results.json index 1382d763..db0fa33d 100644 --- a/testdata/hooks.findTestCaseBy.results.json +++ b/testdata/hooks.findTestCaseBy.results.json @@ -1,5 +1,34 @@ -[ - "17", - "21", - "25" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "17", + "21", + "25" + ], + "testCaseFinished" : [ + "17", + "21", + "25" + ], + "testStepStarted" : [ + "17", + "17", + "17", + "21", + "21", + "21", + "25", + "25", + "25" + ], + "testStepFinished" : [ + "17", + "17", + "17", + "21", + "21", + "21", + "25", + "25", + "25" + ] +} \ No newline at end of file diff --git a/testdata/hooks.findTestCaseDurationBy.results.json b/testdata/hooks.findTestCaseDurationBy.results.json index 8f910c08..4e1a8e5b 100644 --- a/testdata/hooks.findTestCaseDurationBy.results.json +++ b/testdata/hooks.findTestCaseDurationBy.results.json @@ -1,14 +1,30 @@ -[ - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - }, - { - "seconds" : 0, - "nanos" : 7000000 - } -] \ No newline at end of file +{ + "testCaseStarted" : [ + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + } + ], + "testCaseFinished" : [ + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + }, + { + "seconds" : 0, + "nanos" : 7000000 + } + ] +} \ No newline at end of file diff --git a/testdata/hooks.findTestCaseStartedBy.results.json b/testdata/hooks.findTestCaseStartedBy.results.json new file mode 100644 index 00000000..4fc3af21 --- /dev/null +++ b/testdata/hooks.findTestCaseStartedBy.results.json @@ -0,0 +1,24 @@ +{ + "testStepStarted" : [ + "29", + "29", + "29", + "30", + "30", + "30", + "31", + "31", + "31" + ], + "testStepFinished" : [ + "29", + "29", + "29", + "30", + "30", + "30", + "31", + "31", + "31" + ] +} \ No newline at end of file diff --git a/testdata/hooks.findTestStepByTestStepFinished.results.json b/testdata/hooks.findTestStepByTestStepFinished.results.json index c9f356f1..e4c00182 100644 --- a/testdata/hooks.findTestStepByTestStepFinished.results.json +++ b/testdata/hooks.findTestStepByTestStepFinished.results.json @@ -1,11 +1,24 @@ -[ - "18", - "19", - "20", - "22", - "23", - "24", - "26", - "27", - "28" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "18", + "19", + "20", + "22", + "23", + "24", + "26", + "27", + "28" + ], + "testCaseFinished" : [ + "18", + "19", + "20", + "22", + "23", + "24", + "26", + "27", + "28" + ] +} \ No newline at end of file diff --git a/testdata/minimal.findAllTestCaseFinished.results.json b/testdata/minimal.findAllTestCaseFinished.results.json new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/testdata/minimal.findAllTestCaseFinished.results.json @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/testdata/minimal.findAllTestCases.results.json b/testdata/minimal.findAllTestCases.results.json new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/testdata/minimal.findAllTestCases.results.json @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/testdata/minimal.findAllTestStepsFinished.results.json b/testdata/minimal.findAllTestStepsFinished.results.json new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/testdata/minimal.findAllTestStepsFinished.results.json @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/testdata/minimal.findAllTestStepsStarted.results.json b/testdata/minimal.findAllTestStepsStarted.results.json new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/testdata/minimal.findAllTestStepsStarted.results.json @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/testdata/minimal.findMostSevereTestStepResultBy.results.json b/testdata/minimal.findMostSevereTestStepResultBy.results.json index 9b4b9ba0..447dc6a0 100644 --- a/testdata/minimal.findMostSevereTestStepResultBy.results.json +++ b/testdata/minimal.findMostSevereTestStepResultBy.results.json @@ -1,3 +1,8 @@ -[ - "PASSED" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "PASSED" + ], + "testCaseFinished" : [ + "PASSED" + ] +} \ No newline at end of file diff --git a/testdata/minimal.findPickleBy.results.json b/testdata/minimal.findPickleBy.results.json index b6f3193d..95454308 100644 --- a/testdata/minimal.findPickleBy.results.json +++ b/testdata/minimal.findPickleBy.results.json @@ -1,3 +1,8 @@ -[ - "cukes" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "cukes" + ], + "testCaseFinished" : [ + "cukes" + ] +} \ No newline at end of file diff --git a/testdata/minimal.findTestCaseBy.results.json b/testdata/minimal.findTestCaseBy.results.json index de3e82ea..e5c7e2f6 100644 --- a/testdata/minimal.findTestCaseBy.results.json +++ b/testdata/minimal.findTestCaseBy.results.json @@ -1,3 +1,14 @@ -[ - "6" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "6" + ], + "testCaseFinished" : [ + "6" + ], + "testStepStarted" : [ + "6" + ], + "testStepFinished" : [ + "6" + ] +} \ No newline at end of file diff --git a/testdata/minimal.findTestCaseDurationBy.results.json b/testdata/minimal.findTestCaseDurationBy.results.json index e2345a76..83da84d5 100644 --- a/testdata/minimal.findTestCaseDurationBy.results.json +++ b/testdata/minimal.findTestCaseDurationBy.results.json @@ -1,6 +1,14 @@ -[ - { - "seconds" : 0, - "nanos" : 3000000 - } -] \ No newline at end of file +{ + "testCaseStarted" : [ + { + "seconds" : 0, + "nanos" : 3000000 + } + ], + "testCaseFinished" : [ + { + "seconds" : 0, + "nanos" : 3000000 + } + ] +} \ No newline at end of file diff --git a/testdata/minimal.findTestCaseStartedBy.results.json b/testdata/minimal.findTestCaseStartedBy.results.json new file mode 100644 index 00000000..9272ea88 --- /dev/null +++ b/testdata/minimal.findTestCaseStartedBy.results.json @@ -0,0 +1,8 @@ +{ + "testStepStarted" : [ + "8" + ], + "testStepFinished" : [ + "8" + ] +} \ No newline at end of file diff --git a/testdata/minimal.findTestStepByTestStepFinished.results.json b/testdata/minimal.findTestStepByTestStepFinished.results.json index b7a71813..c4a2eb0e 100644 --- a/testdata/minimal.findTestStepByTestStepFinished.results.json +++ b/testdata/minimal.findTestStepByTestStepFinished.results.json @@ -1,3 +1,8 @@ -[ - "7" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "7" + ], + "testCaseFinished" : [ + "7" + ] +} \ No newline at end of file diff --git a/testdata/rules.findAllTestCaseFinished.results.json b/testdata/rules.findAllTestCaseFinished.results.json new file mode 100644 index 00000000..e440e5c8 --- /dev/null +++ b/testdata/rules.findAllTestCaseFinished.results.json @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/testdata/rules.findAllTestCases.results.json b/testdata/rules.findAllTestCases.results.json new file mode 100644 index 00000000..e440e5c8 --- /dev/null +++ b/testdata/rules.findAllTestCases.results.json @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/testdata/rules.findAllTestStepsFinished.results.json b/testdata/rules.findAllTestStepsFinished.results.json new file mode 100644 index 00000000..3cacc0b9 --- /dev/null +++ b/testdata/rules.findAllTestStepsFinished.results.json @@ -0,0 +1 @@ +12 \ No newline at end of file diff --git a/testdata/rules.findAllTestStepsStarted.results.json b/testdata/rules.findAllTestStepsStarted.results.json new file mode 100644 index 00000000..3cacc0b9 --- /dev/null +++ b/testdata/rules.findAllTestStepsStarted.results.json @@ -0,0 +1 @@ +12 \ No newline at end of file diff --git a/testdata/rules.findMostSevereTestStepResultBy.results.json b/testdata/rules.findMostSevereTestStepResultBy.results.json index 1905031f..7b4d8b82 100644 --- a/testdata/rules.findMostSevereTestStepResultBy.results.json +++ b/testdata/rules.findMostSevereTestStepResultBy.results.json @@ -1,5 +1,12 @@ -[ - "PASSED", - "PASSED", - "PASSED" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "PASSED", + "PASSED", + "PASSED" + ], + "testCaseFinished" : [ + "PASSED", + "PASSED", + "PASSED" + ] +} \ No newline at end of file diff --git a/testdata/rules.findPickleBy.results.json b/testdata/rules.findPickleBy.results.json index 523e8960..097a5ac9 100644 --- a/testdata/rules.findPickleBy.results.json +++ b/testdata/rules.findPickleBy.results.json @@ -1,5 +1,12 @@ -[ - "Not enough money", - "Enough money", - "No chocolates left" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "Not enough money", + "Enough money", + "No chocolates left" + ], + "testCaseFinished" : [ + "Not enough money", + "Enough money", + "No chocolates left" + ] +} \ No newline at end of file diff --git a/testdata/rules.findTestCaseBy.results.json b/testdata/rules.findTestCaseBy.results.json index 44580a60..06e9bbc1 100644 --- a/testdata/rules.findTestCaseBy.results.json +++ b/testdata/rules.findTestCaseBy.results.json @@ -1,5 +1,40 @@ -[ - "40", - "45", - "50" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "40", + "45", + "50" + ], + "testCaseFinished" : [ + "40", + "45", + "50" + ], + "testStepStarted" : [ + "40", + "40", + "40", + "40", + "45", + "45", + "45", + "45", + "50", + "50", + "50", + "50" + ], + "testStepFinished" : [ + "40", + "40", + "40", + "40", + "45", + "45", + "45", + "45", + "50", + "50", + "50", + "50" + ] +} \ No newline at end of file diff --git a/testdata/rules.findTestCaseDurationBy.results.json b/testdata/rules.findTestCaseDurationBy.results.json index 21ad1665..57dbb058 100644 --- a/testdata/rules.findTestCaseDurationBy.results.json +++ b/testdata/rules.findTestCaseDurationBy.results.json @@ -1,14 +1,30 @@ -[ - { - "seconds" : 0, - "nanos" : 9000000 - }, - { - "seconds" : 0, - "nanos" : 9000000 - }, - { - "seconds" : 0, - "nanos" : 9000000 - } -] \ No newline at end of file +{ + "testCaseStarted" : [ + { + "seconds" : 0, + "nanos" : 9000000 + }, + { + "seconds" : 0, + "nanos" : 9000000 + }, + { + "seconds" : 0, + "nanos" : 9000000 + } + ], + "testCaseFinished" : [ + { + "seconds" : 0, + "nanos" : 9000000 + }, + { + "seconds" : 0, + "nanos" : 9000000 + }, + { + "seconds" : 0, + "nanos" : 9000000 + } + ] +} \ No newline at end of file diff --git a/testdata/rules.findTestCaseStartedBy.results.json b/testdata/rules.findTestCaseStartedBy.results.json new file mode 100644 index 00000000..c9cec4ad --- /dev/null +++ b/testdata/rules.findTestCaseStartedBy.results.json @@ -0,0 +1,30 @@ +{ + "testStepStarted" : [ + "55", + "55", + "55", + "55", + "56", + "56", + "56", + "56", + "57", + "57", + "57", + "57" + ], + "testStepFinished" : [ + "55", + "55", + "55", + "55", + "56", + "56", + "56", + "56", + "57", + "57", + "57", + "57" + ] +} \ No newline at end of file diff --git a/testdata/rules.findTestStepByTestStepFinished.results.json b/testdata/rules.findTestStepByTestStepFinished.results.json index 96f7fb49..9c8098cc 100644 --- a/testdata/rules.findTestStepByTestStepFinished.results.json +++ b/testdata/rules.findTestStepByTestStepFinished.results.json @@ -1,14 +1,30 @@ -[ - "41", - "42", - "43", - "44", - "46", - "47", - "48", - "49", - "51", - "52", - "53", - "54" -] \ No newline at end of file +{ + "testCaseStarted" : [ + "41", + "42", + "43", + "44", + "46", + "47", + "48", + "49", + "51", + "52", + "53", + "54" + ], + "testCaseFinished" : [ + "41", + "42", + "43", + "44", + "46", + "47", + "48", + "49", + "51", + "52", + "53", + "54" + ] +} \ No newline at end of file