diff --git a/CHANGELOG.md b/CHANGELOG.md index bcc8a9db..c477c5ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Added +- New method `findAttachmentsBy(TestStepFinished)` ([#67](https://github.com/cucumber/query/pull/67)) +- New method `findHookBy(TestStep)` ([#67](https://github.com/cucumber/query/pull/67)) +- New method `findMeta()` ([#67](https://github.com/cucumber/query/pull/67)) + +### Fixed +- [JavaScript] Attachments are not presumed to have a related test step ([#67](https://github.com/cucumber/query/pull/67)) ## [13.0.3] - 2024-12-22 ### Fixed diff --git a/README.md b/README.md index 1475776e..9182d34a 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,10 @@ status of a step, a scenario or an entire file. | `findAllTestCaseStarted(): List` | | | ✓ | | ✓ | | `findAllTestCaseStartedGroupedByFeature(): Map, List>` | | | ✓ | | ✓ | | `findAllTestSteps(): List` | | | ✓ | | ✓ | +| `findAttachmentsBy(TestStepFinished): List` | | | ✓ | | ✓ | | `findFeatureBy(TestCaseStarted): Optional` | | | ✓ | | ✓ | +| `findHookBy(TestStep): Optional` | | | ✓ | | ✓ | +| `findMeta(): Optional` | | | ✓ | | ✓ | | `findMostSevereTestStepResulBy(TestCaseStarted): Optional` | | | ✓ | | ✓ | | `findNameOf(Pickle, NamingStrategy): String` | | | ✓ | | ✓ | | `findPickleBy(TestCaseStarted): Optional` | | | ✓ | | ✓ | diff --git a/java/src/main/java/io/cucumber/query/Query.java b/java/src/main/java/io/cucumber/query/Query.java index bd7a6719..8141cb37 100644 --- a/java/src/main/java/io/cucumber/query/Query.java +++ b/java/src/main/java/io/cucumber/query/Query.java @@ -1,10 +1,13 @@ package io.cucumber.query; import io.cucumber.messages.Convertor; +import io.cucumber.messages.types.Attachment; import io.cucumber.messages.types.Envelope; import io.cucumber.messages.types.Examples; import io.cucumber.messages.types.Feature; import io.cucumber.messages.types.GherkinDocument; +import io.cucumber.messages.types.Hook; +import io.cucumber.messages.types.Meta; import io.cucumber.messages.types.Pickle; import io.cucumber.messages.types.PickleStep; import io.cucumber.messages.types.Rule; @@ -67,7 +70,10 @@ public final class Query { private final Map stepById = new ConcurrentHashMap<>(); private final Map testStepById = new ConcurrentHashMap<>(); private final Map pickleStepById = new ConcurrentHashMap<>(); + private final Map hookById = new ConcurrentHashMap<>(); + private final Map> attachmentsByTestCaseStartedId = new ConcurrentHashMap<>(); private final Map lineageById = new ConcurrentHashMap<>(); + private Meta meta; private TestRunStarted testRunStarted; private TestRunFinished testRunFinished; @@ -135,10 +141,29 @@ public List findAllTestSteps() { .collect(toList()); } + public List findAttachmentsBy(TestStepFinished testStepFinished) { + requireNonNull(testStepFinished); + return attachmentsByTestCaseStartedId.getOrDefault(testStepFinished.getTestCaseStartedId(), emptyList()).stream() + .filter(attachment -> attachment.getTestStepId() + .map(testStepId -> testStepFinished.getTestStepId().equals(testStepId)) + .orElse(false)) + .collect(toList()); + } + public Optional findFeatureBy(TestCaseStarted testCaseStarted) { return findLineageBy(testCaseStarted).flatMap(Lineage::feature); } + public Optional findHookBy(TestStep testStep) { + requireNonNull(testStep); + return testStep.getHookId() + .map(hookById::get); + } + + public Optional findMeta() { + return ofNullable(meta); + } + public Optional findMostSevereTestStepResultBy(TestCaseStarted testCaseStarted) { requireNonNull(testCaseStarted); return findTestStepsFinishedBy(testCaseStarted) @@ -330,6 +355,7 @@ public List> findTestStepFinishedAndTestStepBy } public void update(Envelope envelope) { + envelope.getMeta().ifPresent(this::updateMeta); envelope.getTestRunStarted().ifPresent(this::updateTestRunStarted); envelope.getTestRunFinished().ifPresent(this::updateTestRunFinished); envelope.getTestCaseStarted().ifPresent(this::updateTestCaseStarted); @@ -338,6 +364,8 @@ public void update(Envelope envelope) { envelope.getGherkinDocument().ifPresent(this::updateGherkinDocument); envelope.getPickle().ifPresent(this::updatePickle); envelope.getTestCase().ifPresent(this::updateTestCase); + envelope.getHook().ifPresent(this::updateHook); + envelope.getAttachment().ifPresent(this::updateAttachment); } private Optional findLineageBy(GherkinDocument element) { @@ -382,6 +410,15 @@ private Optional findLineageBy(TestCaseStarted testCaseStarted) { .flatMap(this::findLineageBy); } + private void updateAttachment(Attachment attachment) { + attachment.getTestCaseStartedId() + .ifPresent(testCaseStartedId -> this.attachmentsByTestCaseStartedId.compute(testCaseStartedId, updateList(attachment))); + } + + private void updateHook(Hook hook) { + this.hookById.put(hook.getId(), hook); + } + private void updateTestCaseStarted(TestCaseStarted testCaseStarted) { this.testCaseStarted.add(testCaseStarted); } @@ -437,6 +474,10 @@ private void updateSteps(List steps) { steps.forEach(step -> stepById.put(step.getId(), step)); } + private void updateMeta(Meta event) { + this.meta = event; + } + private BiFunction, List> updateList(E element) { return (key, existing) -> { if (existing != null) { diff --git a/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java b/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java index 367a0660..bd0ed49c 100644 --- a/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java +++ b/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java @@ -5,6 +5,7 @@ import io.cucumber.messages.NdjsonToMessageIterable; import io.cucumber.messages.types.Envelope; import io.cucumber.messages.types.Feature; +import io.cucumber.messages.types.Hook; import io.cucumber.messages.types.Pickle; import io.cucumber.messages.types.PickleStep; import io.cucumber.messages.types.Step; @@ -31,6 +32,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.stream.Stream; import static com.fasterxml.jackson.core.util.DefaultIndenter.SYSTEM_LINEFEED_INSTANCE; @@ -50,7 +52,9 @@ public class QueryAcceptanceTest { static List acceptance() { return Stream.of( + Paths.get("../testdata/attachments.feature.ndjson"), Paths.get("../testdata/empty.feature.ndjson"), + Paths.get("../testdata/hooks.feature.ndjson"), Paths.get("../testdata/minimal.feature.ndjson"), Paths.get("../testdata/rules.feature.ndjson"), Paths.get("../testdata/examples-tables.feature.ndjson") @@ -111,10 +115,29 @@ private static Map createQueryResults(Query query) { .map(entry -> Arrays.asList(entry.getKey().map(Feature::getName), entry.getValue().stream() .map(TestCaseStarted::getId) .collect(toList())))); + results.put("findAttachmentsBy", query.findAllTestCaseStarted().stream() + .map(query::findTestStepFinishedAndTestStepBy) + .flatMap(Collection::stream) + .map(Map.Entry::getKey) + .map(query::findAttachmentsBy) + .flatMap(Collection::stream) + .map(attachment -> Arrays.asList( + attachment.getTestStepId(), + attachment.getTestCaseStartedId(), + attachment.getMediaType(), + attachment.getContentEncoding() + )) + .collect(toList())); results.put("findFeatureBy", query.findAllTestCaseStarted().stream() .map(query::findFeatureBy) .map(feature -> feature.map(Feature::getName)) .collect(toList())); + results.put("findHookBy", query.findAllTestSteps().stream() + .map(query::findHookBy) + .map(hook -> hook.map(Hook::getId)) + .filter(Optional::isPresent) + .collect(toList())); + results.put("findMeta", query.findMeta().map(meta -> meta.getImplementation().getName())); results.put("findMostSevereTestStepResultBy", query.findAllTestCaseStarted().stream() .map(query::findMostSevereTestStepResultBy) .map(testStepResult -> testStepResult.map(TestStepResult::getStatus)) @@ -146,6 +169,7 @@ private static Map createQueryResults(Query query) { results.put("findPickleStepBy", query.findAllTestSteps().stream() .map(query::findPickleStepBy) .map(pickleStep -> pickleStep.map(PickleStep::getText)) + .filter(Optional::isPresent) .collect(toList())); results.put("findStepBy", query.findAllPickleSteps().stream() .map(query::findStepBy) diff --git a/javascript/src/Query.ts b/javascript/src/Query.ts index d2618c8e..d5078d22 100644 --- a/javascript/src/Query.ts +++ b/javascript/src/Query.ts @@ -1,9 +1,12 @@ import * as messages from '@cucumber/messages' import { + Attachment, Duration, Feature, getWorstTestStepResult, GherkinDocument, + Hook, + Meta, Pickle, PickleStep, Rule, @@ -18,7 +21,7 @@ import { TestStepFinished, TestStepResult, TestStepResultStatus, - TimeConversion + TimeConversion, } from '@cucumber/messages' import {ArrayMultimap} from '@teppeis/multimaps' import {Lineage, NamingStrategy} from "./Lineage"; @@ -45,6 +48,7 @@ export default class Query { readonly messages.StepMatchArgumentsList[] >() + private meta: Meta private testRunStarted: TestRunStarted private testRunFinished: TestRunFinished private readonly testCaseStarted: Array = [] @@ -57,8 +61,13 @@ export default class Query { private readonly testCaseFinishedByTestCaseStartedId: Map = new Map() private readonly testStepFinishedByTestCaseStartedId: ArrayMultimap = new ArrayMultimap() + private readonly attachmentsByTestCaseStartedId: ArrayMultimap = + new ArrayMultimap() public update(envelope: messages.Envelope) { + if (envelope.meta) { + this.meta = envelope.meta + } if (envelope.gherkinDocument) { this.updateGherkinDocument(envelope.gherkinDocument) } @@ -78,7 +87,7 @@ export default class Query { this.updateTestCaseStarted(envelope.testCaseStarted) } if (envelope.attachment) { - this.attachmentsByTestStepId.put(envelope.attachment.testStepId, envelope.attachment) + this.updateAttachment(envelope.attachment) } if (envelope.testStepFinished) { this.updateTestStepFinished(envelope.testStepFinished) @@ -201,6 +210,15 @@ export default class Query { } } + private updateAttachment(attachment: Attachment) { + if (attachment.testStepId) { + this.attachmentsByTestStepId.put(attachment.testStepId, attachment) + } + if (attachment.testCaseStartedId) { + this.attachmentsByTestCaseStartedId.put(attachment.testCaseStartedId, attachment) + } + } + private updateTestStepFinished(testStepFinished: TestStepFinished) { this.testStepFinishedByTestCaseStartedId.put( testStepFinished.testCaseStartedId, @@ -420,10 +438,26 @@ export default class Query { return testSteps.sort(comparatorById) } + public findAttachmentsBy(testStepFinished: TestStepFinished): ReadonlyArray { + return this.attachmentsByTestCaseStartedId.get(testStepFinished.testCaseStartedId) + .filter(attachment => attachment.testStepId === testStepFinished.testStepId) + } + public findFeatureBy(testCaseStarted: TestCaseStarted): Feature | undefined { return this.findLineageBy(testCaseStarted)?.feature } + public findHookBy(testStep: TestStep): Hook | undefined { + if (!testStep.hookId){ + return undefined + } + return this.hooksById.get(testStep.hookId) + } + + public findMeta(): Meta | undefined { + return this.meta; + } + public findMostSevereTestStepResultBy(testCaseStarted: TestCaseStarted): TestStepResult | undefined { return this.findTestStepFinishedAndTestStepBy(testCaseStarted) .map(([testStepFinished]) => testStepFinished.testStepResult) @@ -443,7 +477,9 @@ export default class Query { } public findPickleStepBy(testStep: TestStep): PickleStep | undefined { - assert.ok(testStep.pickleStepId, 'Expected TestStep to have a pickleStepId') + if (!testStep.pickleStepId){ + return undefined + } return this.pickleStepById.get(testStep.pickleStepId) } diff --git a/javascript/src/acceptance.spec.ts b/javascript/src/acceptance.spec.ts index c42f388a..5ff1f226 100644 --- a/javascript/src/acceptance.spec.ts +++ b/javascript/src/acceptance.spec.ts @@ -60,9 +60,24 @@ describe('Acceptance Tests', async () => { findAllTestSteps: query.findAllTestSteps().length, findAllTestCaseStartedGroupedByFeature: [...query.findAllTestCaseStartedGroupedByFeature().entries()] .map(([feature, testCaseStarteds]) => [feature.name, testCaseStarteds.map(testCaseStarted => testCaseStarted.id)]), + findAttachmentsBy: query.findAllTestCaseStarted() + .map(testCaseStarted => query.findTestStepsFinishedBy(testCaseStarted)) + .map(testStepFinisheds => testStepFinisheds.map(testStepFinished => query.findAttachmentsBy(testStepFinished))) + .flat(2) + .map(attachment => ([ + attachment.testStepId, + attachment.testCaseStartedId, + attachment.mediaType, + attachment.contentEncoding, + ])), findFeatureBy: query.findAllTestCaseStarted() .map(testCaseStarted => query.findFeatureBy(testCaseStarted)) .map(feature => feature?.name), + findHookBy: query.findAllTestSteps() + .map(testStep => query.findHookBy(testStep)) + .map(hook => hook?.id) + .filter(value => !!value), + findMeta: query.findMeta()?.implementation?.name, findMostSevereTestStepResultBy: query.findAllTestCaseStarted() .map(testCaseStarted => query.findMostSevereTestStepResultBy(testCaseStarted)) .map(testStepResult => testStepResult?.status), @@ -78,7 +93,8 @@ describe('Acceptance Tests', async () => { .map(pickle => pickle?.name), findPickleStepBy: query.findAllTestSteps() .map(testStep => query.findPickleStepBy(testStep)) - .map(pickleStep => pickleStep?.text), + .map(pickleStep => pickleStep?.text) + .filter(value => !!value), findStepBy: query.findAllPickleSteps() .map(pickleStep => query.findStepBy(pickleStep)) .map(step => step?.text), @@ -118,7 +134,9 @@ interface ResultsFixture { findAllTestCaseStarted: number, findAllTestSteps: number, findAllTestCaseStartedGroupedByFeature: Array<[string, string[]]>, + findAttachmentsBy: Array<[string, string, string, string]>, findFeatureBy: Array, + findMeta: string, findMostSevereTestStepResultBy: Array, findNameOf: { long: Array, @@ -127,6 +145,7 @@ interface ResultsFixture { short: Array, shortPickleName: Array }, + findHookBy: Array, findPickleBy: Array, findPickleStepBy: Array, findStepBy: Array, @@ -143,6 +162,7 @@ interface ResultsFixture { const defaults: Partial = { findAllTestCaseStartedGroupedByFeature: [], + findAttachmentsBy: [], findFeatureBy: [], findMostSevereTestStepResultBy: [], findNameOf: { @@ -152,6 +172,7 @@ const defaults: Partial = { short: [], shortPickleName: [] }, + findHookBy: [], findPickleBy: [], findPickleStepBy: [], findStepBy: [], diff --git a/testdata/attachments.feature.query-results.json b/testdata/attachments.feature.query-results.json new file mode 100644 index 00000000..3e9fd7c8 --- /dev/null +++ b/testdata/attachments.feature.query-results.json @@ -0,0 +1,459 @@ +{ + "countMostSevereTestStepResultStatus" : { + "UNKNOWN" : 0, + "PASSED" : 10, + "SKIPPED" : 0, + "PENDING" : 0, + "UNDEFINED" : 0, + "AMBIGUOUS" : 0, + "FAILED" : 0 + }, + "countTestCasesStarted" : 10, + "findAllPickles" : 10, + "findAllPickleSteps" : 10, + "findAllTestCaseStarted" : 10, + "findAllTestSteps" : 20, + "findAllTestCaseStartedGroupedByFeature" : [ + [ + "Attachments", + [ + "81", + "82", + "83", + "84", + "85", + "86", + "87", + "88", + "89", + "90" + ] + ] + ], + "findAttachmentsBy" : [ + [ + "52", + "81", + "application/octet-stream", + "IDENTITY" + ], + [ + "55", + "82", + "text/x.cucumber.log+plain", + "IDENTITY" + ], + [ + "58", + "83", + "text/x.cucumber.log+plain", + "IDENTITY" + ], + [ + "61", + "84", + "application/json", + "IDENTITY" + ], + [ + "64", + "85", + "text/plain", + "BASE64" + ], + [ + "67", + "86", + "image/jpeg", + "BASE64" + ], + [ + "70", + "87", + "image/png", + "BASE64" + ], + [ + "73", + "88", + "image/jpeg", + "BASE64" + ], + [ + "76", + "89", + "image/png", + "BASE64" + ], + [ + "79", + "90", + "application/pdf", + "BASE64" + ] + ], + "findFeatureBy" : [ + "Attachments", + "Attachments", + "Attachments", + "Attachments", + "Attachments", + "Attachments", + "Attachments", + "Attachments", + "Attachments", + "Attachments" + ], + "findHookBy" : [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + "findMeta" : "fake-cucumber", + "findMostSevereTestStepResultBy" : [ + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED" + ], + "findNameOf" : { + "long" : [ + "Attachments - Strings can be attached with a media type", + "Attachments - Log text", + "Attachments - Log ANSI coloured text", + "Attachments - Log JSON", + "Attachments - Byte arrays are base64-encoded regardless of media type", + "Attachments - Attaching JPEG images", + "Attachments - Attaching PNG images", + "Attachments - Attaching images in an examples table - #1.1", + "Attachments - Attaching images in an examples table - #1.2", + "Attachments - Attaching PDFs with a different filename" + ], + "excludeFeatureName" : [ + "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 JPEG images", + "Attaching PNG images", + "Attaching images in an examples table - #1.1", + "Attaching images in an examples table - #1.2", + "Attaching PDFs with a different filename" + ], + "longPickleName" : [ + "Attachments - Strings can be attached with a media type", + "Attachments - Log text", + "Attachments - Log ANSI coloured text", + "Attachments - Log JSON", + "Attachments - Byte arrays are base64-encoded regardless of media type", + "Attachments - Attaching JPEG images", + "Attachments - Attaching PNG images", + "Attachments - Attaching images in an examples table - Attaching images in an examples table", + "Attachments - Attaching images in an examples table - Attaching images in an examples table", + "Attachments - Attaching PDFs with a different filename" + ], + "short" : [ + "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 JPEG images", + "Attaching PNG images", + "#1.1", + "#1.2", + "Attaching PDFs with a different filename" + ], + "shortPickleName" : [ + "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 JPEG images", + "Attaching PNG images", + "Attaching images in an examples table", + "Attaching images in an examples table", + "Attaching PDFs with a different filename" + ] + }, + "findPickleBy" : [ + "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 JPEG images", + "Attaching PNG images", + "Attaching images in an examples table", + "Attaching images in an examples table", + "Attaching PDFs with a different filename" + ], + "findPickleStepBy" : [ + "the string \"hello\" is attached as \"application/octet-stream\"", + "the string \"hello\" is logged", + "text with ANSI escapes is logged", + "the following string is attached as \"application/json\":", + "an array with 10 bytes is attached as \"text/plain\"", + "a JPEG image is attached", + "a PNG image is attached", + "a JPEG image is attached", + "a PNG image is attached", + "a PDF document is attached and renamed" + ], + "findStepBy" : [ + "the string \"hello\" is attached as \"application/octet-stream\"", + "the string \"hello\" is logged", + "text with ANSI escapes is logged", + "the following string is attached as \"application/json\":", + "an array with 10 bytes is attached as \"text/plain\"", + "a JPEG image is attached", + "a PNG image is attached", + "a image is attached", + "a image is attached", + "a PDF document is attached and renamed" + ], + "findTestCaseBy" : [ + "53", + "56", + "59", + "62", + "65", + "68", + "71", + "74", + "77", + "80" + ], + "findTestCaseDurationBy" : [ + { + "seconds" : 0, + "nanos" : 5000000 + }, + { + "seconds" : 0, + "nanos" : 5000000 + }, + { + "seconds" : 0, + "nanos" : 5000000 + }, + { + "seconds" : 0, + "nanos" : 5000000 + }, + { + "seconds" : 0, + "nanos" : 5000000 + }, + { + "seconds" : 0, + "nanos" : 5000000 + }, + { + "seconds" : 0, + "nanos" : 5000000 + }, + { + "seconds" : 0, + "nanos" : 5000000 + }, + { + "seconds" : 0, + "nanos" : 5000000 + }, + { + "seconds" : 0, + "nanos" : 5000000 + } + ], + "findTestCaseFinishedBy" : [ + "81", + "82", + "83", + "84", + "85", + "86", + "87", + "88", + "89", + "90" + ], + "findTestRunDuration" : { + "seconds" : 0, + "nanos" : 61000000 + }, + "findTestRunFinished" : { + "success" : true, + "timestamp" : { + "seconds" : 0, + "nanos" : 61000000 + } + }, + "findTestRunStarted" : { + "timestamp" : { + "seconds" : 0, + "nanos" : 0 + } + }, + "findTestStepBy" : [ + "51", + "52", + "54", + "55", + "57", + "58", + "60", + "61", + "63", + "64", + "66", + "67", + "69", + "70", + "72", + "73", + "75", + "76", + "78", + "79" + ], + "findTestStepsFinishedBy" : [ + [ + "51", + "52" + ], + [ + "54", + "55" + ], + [ + "57", + "58" + ], + [ + "60", + "61" + ], + [ + "63", + "64" + ], + [ + "66", + "67" + ], + [ + "69", + "70" + ], + [ + "72", + "73" + ], + [ + "75", + "76" + ], + [ + "78", + "79" + ] + ], + "findTestStepFinishedAndTestStepBy" : [ + [ + "51", + "51" + ], + [ + "52", + "52" + ], + [ + "54", + "54" + ], + [ + "55", + "55" + ], + [ + "57", + "57" + ], + [ + "58", + "58" + ], + [ + "60", + "60" + ], + [ + "61", + "61" + ], + [ + "63", + "63" + ], + [ + "64", + "64" + ], + [ + "66", + "66" + ], + [ + "67", + "67" + ], + [ + "69", + "69" + ], + [ + "70", + "70" + ], + [ + "72", + "72" + ], + [ + "73", + "73" + ], + [ + "75", + "75" + ], + [ + "76", + "76" + ], + [ + "78", + "78" + ], + [ + "79", + "79" + ] + ] +} \ No newline at end of file diff --git a/testdata/examples-tables.feature.query-results.json b/testdata/examples-tables.feature.query-results.json index a7ed16a0..d758daab 100644 --- a/testdata/examples-tables.feature.query-results.json +++ b/testdata/examples-tables.feature.query-results.json @@ -40,6 +40,7 @@ "Examples Tables", "Examples Tables" ], + "findMeta" : "fake-cucumber", "findMostSevereTestStepResultBy" : [ "PASSED", "PASSED", diff --git a/testdata/hooks.feature.query-results.json b/testdata/hooks.feature.query-results.json new file mode 100644 index 00000000..f00da354 --- /dev/null +++ b/testdata/hooks.feature.query-results.json @@ -0,0 +1,329 @@ +{ + "countMostSevereTestStepResultStatus" : { + "UNKNOWN" : 0, + "PASSED" : 2, + "SKIPPED" : 0, + "PENDING" : 0, + "UNDEFINED" : 1, + "AMBIGUOUS" : 0, + "FAILED" : 2 + }, + "countTestCasesStarted" : 5, + "findAllPickles" : 5, + "findAllPickleSteps" : 5, + "findAllTestCaseStarted" : 5, + "findAllTestSteps" : 22, + "findAllTestCaseStartedGroupedByFeature" : [ + [ + "Hooks", + [ + "56", + "57", + "58", + "59", + "60" + ] + ] + ], + "findAttachmentsBy" : [ + [ + "53", + "60", + "image/svg+xml", + "BASE64" + ] + ], + "findFeatureBy" : [ + "Hooks", + "Hooks", + "Hooks", + "Hooks", + "Hooks" + ], + "findHookBy" : [ + "0", + "1", + "4", + "0", + "1", + "4", + "0", + "1", + "4", + "0", + "1", + "5", + "4", + "0", + "1", + "6", + "4" + ], + "findMeta" : "fake-cucumber", + "findMostSevereTestStepResultBy" : [ + "PASSED", + "FAILED", + "UNDEFINED", + "FAILED", + "PASSED" + ], + "findNameOf" : { + "long" : [ + "Hooks - No tags and a passed step", + "Hooks - No tags and a failed step", + "Hooks - No tags and a undefined step", + "Hooks - With a tag, a failure in the hook and a passed step", + "Hooks - With an tag, an valid attachment in the hook and a passed step" + ], + "excludeFeatureName" : [ + "No tags and a passed step", + "No tags and a failed step", + "No tags and a undefined step", + "With a tag, a failure in the hook and a passed step", + "With an tag, an valid attachment in the hook and a passed step" + ], + "longPickleName" : [ + "Hooks - No tags and a passed step", + "Hooks - No tags and a failed step", + "Hooks - No tags and a undefined step", + "Hooks - With a tag, a failure in the hook and a passed step", + "Hooks - With an tag, an valid attachment in the hook and a passed step" + ], + "short" : [ + "No tags and a passed step", + "No tags and a failed step", + "No tags and a undefined step", + "With a tag, a failure in the hook and a passed step", + "With an tag, an valid attachment in the hook and a passed step" + ], + "shortPickleName" : [ + "No tags and a passed step", + "No tags and a failed step", + "No tags and a undefined step", + "With a tag, a failure in the hook and a passed step", + "With an tag, an valid attachment in the hook and a passed step" + ] + }, + "findPickleBy" : [ + "No tags and a passed step", + "No tags and a failed step", + "No tags and a undefined step", + "With a tag, a failure in the hook and a passed step", + "With an tag, an valid attachment in the hook and a passed step" + ], + "findPickleStepBy" : [ + "a step passes", + "a step fails", + "a step does not exist", + "a step passes", + "a step passes" + ], + "findStepBy" : [ + "a step passes", + "a step fails", + "a step does not exist", + "a step passes", + "a step passes" + ], + "findTestCaseBy" : [ + "33", + "38", + "43", + "49", + "55" + ], + "findTestCaseDurationBy" : [ + { + "seconds" : 0, + "nanos" : 9000000 + }, + { + "seconds" : 0, + "nanos" : 9000000 + }, + { + "seconds" : 0, + "nanos" : 9000000 + }, + { + "seconds" : 0, + "nanos" : 11000000 + }, + { + "seconds" : 0, + "nanos" : 11000000 + } + ], + "findTestCaseFinishedBy" : [ + "56", + "57", + "58", + "59", + "60" + ], + "findTestRunDuration" : { + "seconds" : 0, + "nanos" : 55000000 + }, + "findTestRunFinished" : { + "success" : false, + "timestamp" : { + "seconds" : 0, + "nanos" : 55000000 + } + }, + "findTestRunStarted" : { + "timestamp" : { + "seconds" : 0, + "nanos" : 0 + } + }, + "findTestStepBy" : [ + "29", + "30", + "31", + "32", + "34", + "35", + "36", + "37", + "39", + "40", + "41", + "42", + "44", + "45", + "46", + "47", + "48", + "50", + "51", + "52", + "53", + "54" + ], + "findTestStepsFinishedBy" : [ + [ + "29", + "30", + "31", + "32" + ], + [ + "34", + "35", + "36", + "37" + ], + [ + "39", + "40", + "41", + "42" + ], + [ + "44", + "45", + "46", + "47", + "48" + ], + [ + "50", + "51", + "52", + "53", + "54" + ] + ], + "findTestStepFinishedAndTestStepBy" : [ + [ + "29", + "29" + ], + [ + "30", + "30" + ], + [ + "31", + "31" + ], + [ + "32", + "32" + ], + [ + "34", + "34" + ], + [ + "35", + "35" + ], + [ + "36", + "36" + ], + [ + "37", + "37" + ], + [ + "39", + "39" + ], + [ + "40", + "40" + ], + [ + "41", + "41" + ], + [ + "42", + "42" + ], + [ + "44", + "44" + ], + [ + "45", + "45" + ], + [ + "46", + "46" + ], + [ + "47", + "47" + ], + [ + "48", + "48" + ], + [ + "50", + "50" + ], + [ + "51", + "51" + ], + [ + "52", + "52" + ], + [ + "53", + "53" + ], + [ + "54", + "54" + ] + ] +} \ No newline at end of file diff --git a/testdata/minimal.feature.query-results.json b/testdata/minimal.feature.query-results.json index 6bf98eff..479527fc 100644 --- a/testdata/minimal.feature.query-results.json +++ b/testdata/minimal.feature.query-results.json @@ -24,6 +24,7 @@ "findFeatureBy" : [ "minimal" ], + "findMeta" : "fake-cucumber", "findMostSevereTestStepResultBy" : [ "PASSED" ], diff --git a/testdata/rules.feature.query-results.json b/testdata/rules.feature.query-results.json index dd05d44c..b268bff7 100644 --- a/testdata/rules.feature.query-results.json +++ b/testdata/rules.feature.query-results.json @@ -28,6 +28,7 @@ "Usage of a `Rule`", "Usage of a `Rule`" ], + "findMeta" : "fake-cucumber", "findMostSevereTestStepResultBy" : [ "PASSED", "PASSED",