diff --git a/java/src/main/java/io/cucumber/query/Query.java b/java/src/main/java/io/cucumber/query/Query.java index 33c42098..3b036a49 100644 --- a/java/src/main/java/io/cucumber/query/Query.java +++ b/java/src/main/java/io/cucumber/query/Query.java @@ -39,8 +39,8 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Objects; import java.util.Optional; +import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiFunction; import java.util.function.Supplier; @@ -129,6 +129,10 @@ public List findAllTestCaseStarted() { .collect(toList()); } + /** + * @deprecated {@link #findLineageBy} is public, this method can be inlined. + */ + @Deprecated public Map, List> findAllTestCaseStartedGroupedByFeature() { return findAllTestCaseStarted() .stream() @@ -170,6 +174,10 @@ public List findAttachmentsBy(TestStepFinished testStepFinished) { .collect(toList()); } + /** + * @deprecated {@link #findLineageBy} is public, this method can be inlined. + */ + @Deprecated public Optional findFeatureBy(TestCaseStarted testCaseStarted) { return findLineageBy(testCaseStarted).flatMap(Lineage::feature); } @@ -192,6 +200,10 @@ public Optional findMostSevereTestStepResultBy(TestCaseStarted t .max(testStepResultComparator); } + /** + * @deprecated {@link #findLineageBy} is public, this method can be inlined. + */ + @Deprecated public String findNameOf(GherkinDocument element, NamingStrategy namingStrategy) { requireNonNull(element); requireNonNull(namingStrategy); @@ -200,6 +212,10 @@ public String findNameOf(GherkinDocument element, NamingStrategy namingStrategy) .orElseThrow(createElementWasNotPartOfThisQueryObject()); } + /** + * @deprecated {@link #findLineageBy} is public, this method can be inlined. + */ + @Deprecated public String findNameOf(Feature element, NamingStrategy namingStrategy) { requireNonNull(element); requireNonNull(namingStrategy); @@ -208,6 +224,10 @@ public String findNameOf(Feature element, NamingStrategy namingStrategy) { .orElseThrow(createElementWasNotPartOfThisQueryObject()); } + /** + * @deprecated {@link #findLineageBy} is public, this method can be inlined. + */ + @Deprecated public String findNameOf(Rule element, NamingStrategy namingStrategy) { requireNonNull(element); requireNonNull(namingStrategy); @@ -216,6 +236,10 @@ public String findNameOf(Rule element, NamingStrategy namingStrategy) { .orElseThrow(createElementWasNotPartOfThisQueryObject()); } + /** + * @deprecated {@link #findLineageBy} is public, this method can be inlined. + */ + @Deprecated public String findNameOf(Scenario element, NamingStrategy namingStrategy) { requireNonNull(element); requireNonNull(namingStrategy); @@ -224,6 +248,10 @@ public String findNameOf(Scenario element, NamingStrategy namingStrategy) { .orElseThrow(createElementWasNotPartOfThisQueryObject()); } + /** + * @deprecated {@link #findLineageBy} is public, this method can be inlined. + */ + @Deprecated public String findNameOf(Examples element, NamingStrategy namingStrategy) { requireNonNull(element); requireNonNull(namingStrategy); @@ -232,6 +260,10 @@ public String findNameOf(Examples element, NamingStrategy namingStrategy) { .orElseThrow(createElementWasNotPartOfThisQueryObject()); } + /** + * @deprecated {@link #findLineageBy} is public, this method can be inlined. + */ + @Deprecated public String findNameOf(TableRow element, NamingStrategy namingStrategy) { requireNonNull(element); requireNonNull(namingStrategy); @@ -240,6 +272,10 @@ public String findNameOf(TableRow element, NamingStrategy namingStrategy) { .orElseThrow(createElementWasNotPartOfThisQueryObject()); } + /** + * @deprecated {@link #findLineageBy} is public, this method can be inlined. + */ + @Deprecated public String findNameOf(Pickle element, NamingStrategy namingStrategy) { requireNonNull(element); requireNonNull(namingStrategy); diff --git a/java/src/test/java/io/cucumber/query/NamingStrategyAcceptanceTest.java b/java/src/test/java/io/cucumber/query/NamingStrategyAcceptanceTest.java new file mode 100644 index 00000000..b4253afa --- /dev/null +++ b/java/src/test/java/io/cucumber/query/NamingStrategyAcceptanceTest.java @@ -0,0 +1,128 @@ +package io.cucumber.query; + +import io.cucumber.messages.NdjsonToMessageIterable; +import io.cucumber.messages.types.Envelope; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import static io.cucumber.query.Jackson.OBJECT_MAPPER; +import static io.cucumber.query.NamingStrategy.ExampleName.NUMBER_AND_PICKLE_IF_PARAMETERIZED; +import static io.cucumber.query.NamingStrategy.ExampleName.PICKLE; +import static io.cucumber.query.NamingStrategy.FeatureName.EXCLUDE; +import static io.cucumber.query.NamingStrategy.Strategy.LONG; +import static io.cucumber.query.NamingStrategy.Strategy.SHORT; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.nio.file.Files.newOutputStream; +import static java.nio.file.Files.readAllBytes; +import static org.assertj.core.api.Assertions.assertThat; + +public class NamingStrategyAcceptanceTest { + private static final NdjsonToMessageIterable.Deserializer deserializer = (json) -> OBJECT_MAPPER.readValue(json, Envelope.class); + + static List acceptance() { + Map strategies = new LinkedHashMap<>(); + strategies.put("long", NamingStrategy.strategy(LONG).build()); + strategies.put("long-exclude-feature-name", NamingStrategy.strategy(LONG).featureName(EXCLUDE).build()); + strategies.put("long-with-pickle-name", NamingStrategy.strategy(LONG).exampleName(PICKLE).build()); + strategies.put("long-with-pickle-name-if-parameterized", NamingStrategy.strategy(LONG).exampleName(NUMBER_AND_PICKLE_IF_PARAMETERIZED).build()); + strategies.put("short", NamingStrategy.strategy(SHORT).build()); + + List sources = Arrays.asList( + Paths.get("../testdata/minimal.feature.ndjson"), + Paths.get("../testdata/rules.feature.ndjson"), + Paths.get("../testdata/examples-tables.feature.ndjson") + ); + + List testCases = new ArrayList<>(); + sources.forEach(path -> + strategies.forEach((strategyName, strategy) -> + testCases.add(new TestCase(path, strategyName, strategy)))); + + return testCases; + } + + private static String writeResults(TestCase testCase, NamingStrategy strategy) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + writeResults(strategy, testCase, out); + return new String(out.toByteArray(), UTF_8); + } + + private static void writeResults(NamingStrategy strategy, TestCase testCase, OutputStream out) throws IOException { + try (InputStream in = Files.newInputStream(testCase.source)) { + try (NdjsonToMessageIterable envelopes = new NdjsonToMessageIterable(in, deserializer)) { + try (PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out)))) { + Query query = new Query(); + for (Envelope envelope : envelopes) { + query.update(envelope); + } + query.findAllPickles().forEach(pickle -> { + query.findLineageBy(pickle) + .map(lineage -> strategy.reduce(lineage, pickle)) + .ifPresent(writer::println); + }); + } + + } + } + } + + @ParameterizedTest + @MethodSource("acceptance") + void test(TestCase testCase) throws IOException { + String actual = writeResults(testCase, testCase.strategy); + String expected = new String(readAllBytes(testCase.expected), UTF_8); + assertThat(actual).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("acceptance") + @Disabled + void updateExpectedQueryResultFiles(TestCase testCase) throws IOException { + try (OutputStream out = newOutputStream(testCase.expected)) { + writeResults(testCase.strategy, testCase, out); + } + } + + static class TestCase { + private final Path source; + private final NamingStrategy strategy; + private final Path expected; + + private final String name; + private final String strategyName; + + TestCase(Path source, String strategyName, NamingStrategy strategy) { + this.source = source; + this.strategy = strategy; + this.strategyName = strategyName; + String fileName = source.getFileName().toString(); + this.name = fileName.substring(0, fileName.lastIndexOf(".ndjson")); + this.expected = source.getParent().resolve(name + ".naming-strategy." + strategyName + ".txt"); + } + + @Override + public String toString() { + return name + " -> " + strategyName; + } + + } + +} diff --git a/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java b/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java index d4195fea..ec641453 100644 --- a/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java +++ b/java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java @@ -110,12 +110,6 @@ private static Map createQueryResults(Query query) { results.put("findAllPickleSteps", query.findAllPickleSteps().size()); results.put("findAllTestCaseStarted", query.findAllTestCaseStarted().size()); results.put("findAllTestSteps", query.findAllTestSteps().size()); - results.put("findAllTestCaseStartedGroupedByFeature", 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.findAllTestCaseStarted().stream() .map(query::findTestStepFinishedAndTestStepBy) .flatMap(Collection::stream) @@ -129,10 +123,6 @@ private static Map createQueryResults(Query query) { 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)) @@ -148,25 +138,6 @@ private static Map createQueryResults(Query query) { .map(testStepResult -> testStepResult.map(TestStepResult::getStatus)) .collect(toList())); - Map names = new LinkedHashMap<>(); - names.put("long", query.findAllPickles().stream() - .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(LONG).build())) - .collect(toList())); - names.put("excludeFeatureName", query.findAllPickles().stream() - .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(LONG).featureName(EXCLUDE).build())) - .collect(toList())); - names.put("longPickleName", query.findAllPickles().stream() - .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(LONG).exampleName(PICKLE).build())) - .collect(toList())); - names.put("short", query.findAllPickles().stream() - .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(SHORT).build())) - .collect(toList())); - names.put("shortPickleName", query.findAllPickles().stream() - .map(pickle -> query.findNameOf(pickle, NamingStrategy.strategy(SHORT).exampleName(PICKLE).build())) - .collect(toList())); - - results.put("findNameOf", names); - results.put("findPickleBy", query.findAllTestCaseStarted().stream() .map(query::findPickleBy) .map(pickle -> pickle.map(Pickle::getName)) @@ -249,18 +220,6 @@ public String toString() { return name; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - TestCase testCase = (TestCase) o; - return source.equals(testCase.source); - } - - @Override - public int hashCode() { - return Objects.hash(source); - } } } diff --git a/testdata/attachments.feature.query-results.json b/testdata/attachments.feature.query-results.json index f4243a62..0f6ecfe9 100644 --- a/testdata/attachments.feature.query-results.json +++ b/testdata/attachments.feature.query-results.json @@ -13,22 +13,6 @@ "findAllPickleSteps" : 9, "findAllTestCaseStarted" : 9, "findAllTestSteps" : 9, - "findAllTestCaseStartedGroupedByFeature" : [ - [ - "Attachments", - [ - "64", - "65", - "66", - "67", - "68", - "69", - "70", - "71", - "72" - ] - ] - ], "findAttachmentsBy" : [ [ "46", @@ -85,17 +69,6 @@ "IDENTITY" ] ], - "findFeatureBy" : [ - "Attachments", - "Attachments", - "Attachments", - "Attachments", - "Attachments", - "Attachments", - "Attachments", - "Attachments", - "Attachments" - ], "findLocationOf" : [ { "line" : 12, @@ -146,63 +119,6 @@ "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 PDFs with a different filename", - "Attachments - Attaching URIs" - ], - "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 PDFs with a different filename", - "Attaching URIs" - ], - "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 PDFs with a different filename", - "Attachments - Attaching URIs" - ], - "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", - "Attaching PDFs with a different filename", - "Attaching URIs" - ], - "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 PDFs with a different filename", - "Attaching URIs" - ] - }, "findPickleBy" : [ "Strings can be attached with a media type", "Log text", diff --git a/testdata/empty.feature.query-results.json b/testdata/empty.feature.query-results.json index 163c360e..3feb4a7d 100644 --- a/testdata/empty.feature.query-results.json +++ b/testdata/empty.feature.query-results.json @@ -13,17 +13,6 @@ "findAllPickleSteps" : 0, "findAllTestCaseStarted" : 1, "findAllTestSteps" : 0, - "findAllTestCaseStartedGroupedByFeature" : [ - [ - "Empty Scenarios", - [ - "4" - ] - ] - ], - "findFeatureBy" : [ - "Empty Scenarios" - ], "findLocationOf" : [ { "line" : 7, @@ -34,23 +23,6 @@ "findMostSevereTestStepResultBy" : [ null ], - "findNameOf" : { - "long" : [ - "Empty Scenarios - Blank Scenario" - ], - "excludeFeatureName" : [ - "Blank Scenario" - ], - "longPickleName" : [ - "Empty Scenarios - Blank Scenario" - ], - "short" : [ - "Blank Scenario" - ], - "shortPickleName" : [ - "Blank Scenario" - ] - }, "findPickleBy" : [ "Blank Scenario" ], diff --git a/testdata/examples-tables.feature.naming-strategy.long-exclude-feature-name.txt b/testdata/examples-tables.feature.naming-strategy.long-exclude-feature-name.txt new file mode 100644 index 00000000..3c3df319 --- /dev/null +++ b/testdata/examples-tables.feature.naming-strategy.long-exclude-feature-name.txt @@ -0,0 +1,9 @@ +Eating cucumbers - These are passing - #1.1 +Eating cucumbers - These are passing - #1.2 +Eating cucumbers - These are failing - #2.1 +Eating cucumbers - These are failing - #2.2 +Eating cucumbers - These are undefined because the value is not an {int} - #3.1 +Eating cucumbers - These are undefined because the value is not an {int} - #3.2 +Eating cucumbers with friends - #1.1: Eating cucumbers with 11 friends +Eating cucumbers with friends - #1.2: Eating cucumbers with 1 friends +Eating cucumbers with friends - #1.3: Eating cucumbers with 0 friends diff --git a/testdata/examples-tables.feature.naming-strategy.long-with-pickle-name-if-parameterized.txt b/testdata/examples-tables.feature.naming-strategy.long-with-pickle-name-if-parameterized.txt new file mode 100644 index 00000000..9a84f697 --- /dev/null +++ b/testdata/examples-tables.feature.naming-strategy.long-with-pickle-name-if-parameterized.txt @@ -0,0 +1,9 @@ +Examples Tables - Eating cucumbers - These are passing - #1.1 +Examples Tables - Eating cucumbers - These are passing - #1.2 +Examples Tables - Eating cucumbers - These are failing - #2.1 +Examples Tables - Eating cucumbers - These are failing - #2.2 +Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - #3.1 +Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - #3.2 +Examples Tables - Eating cucumbers with friends - #1.1: Eating cucumbers with 11 friends +Examples Tables - Eating cucumbers with friends - #1.2: Eating cucumbers with 1 friends +Examples Tables - Eating cucumbers with friends - #1.3: Eating cucumbers with 0 friends diff --git a/testdata/examples-tables.feature.naming-strategy.long-with-pickle-name.txt b/testdata/examples-tables.feature.naming-strategy.long-with-pickle-name.txt new file mode 100644 index 00000000..91803a32 --- /dev/null +++ b/testdata/examples-tables.feature.naming-strategy.long-with-pickle-name.txt @@ -0,0 +1,9 @@ +Examples Tables - Eating cucumbers - These are passing - Eating cucumbers +Examples Tables - Eating cucumbers - These are passing - Eating cucumbers +Examples Tables - Eating cucumbers - These are failing - Eating cucumbers +Examples Tables - Eating cucumbers - These are failing - Eating cucumbers +Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - Eating cucumbers +Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - Eating cucumbers +Examples Tables - Eating cucumbers with friends - Eating cucumbers with 11 friends +Examples Tables - Eating cucumbers with friends - Eating cucumbers with 1 friends +Examples Tables - Eating cucumbers with friends - Eating cucumbers with 0 friends diff --git a/testdata/examples-tables.feature.naming-strategy.long.txt b/testdata/examples-tables.feature.naming-strategy.long.txt new file mode 100644 index 00000000..9a84f697 --- /dev/null +++ b/testdata/examples-tables.feature.naming-strategy.long.txt @@ -0,0 +1,9 @@ +Examples Tables - Eating cucumbers - These are passing - #1.1 +Examples Tables - Eating cucumbers - These are passing - #1.2 +Examples Tables - Eating cucumbers - These are failing - #2.1 +Examples Tables - Eating cucumbers - These are failing - #2.2 +Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - #3.1 +Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - #3.2 +Examples Tables - Eating cucumbers with friends - #1.1: Eating cucumbers with 11 friends +Examples Tables - Eating cucumbers with friends - #1.2: Eating cucumbers with 1 friends +Examples Tables - Eating cucumbers with friends - #1.3: Eating cucumbers with 0 friends diff --git a/testdata/examples-tables.feature.naming-strategy.short.txt b/testdata/examples-tables.feature.naming-strategy.short.txt new file mode 100644 index 00000000..88c1ded6 --- /dev/null +++ b/testdata/examples-tables.feature.naming-strategy.short.txt @@ -0,0 +1,9 @@ +#1.1 +#1.2 +#2.1 +#2.2 +#3.1 +#3.2 +#1.1: Eating cucumbers with 11 friends +#1.2: Eating cucumbers with 1 friends +#1.3: Eating cucumbers with 0 friends diff --git a/testdata/examples-tables.feature.query-results.json b/testdata/examples-tables.feature.query-results.json index 2e68faf7..e5830f30 100644 --- a/testdata/examples-tables.feature.query-results.json +++ b/testdata/examples-tables.feature.query-results.json @@ -13,33 +13,6 @@ "findAllPickleSteps" : 27, "findAllTestCaseStarted" : 9, "findAllTestSteps" : 27, - "findAllTestCaseStartedGroupedByFeature" : [ - [ - "Examples Tables", - [ - "106", - "107", - "108", - "109", - "110", - "111", - "112", - "113", - "114" - ] - ] - ], - "findFeatureBy" : [ - "Examples Tables", - "Examples Tables", - "Examples Tables", - "Examples Tables", - "Examples Tables", - "Examples Tables", - "Examples Tables", - "Examples Tables", - "Examples Tables" - ], "findLocationOf" : [ { "line" : 19, @@ -90,63 +63,6 @@ "PASSED", "PASSED" ], - "findNameOf" : { - "long" : [ - "Examples Tables - Eating cucumbers - These are passing - #1.1", - "Examples Tables - Eating cucumbers - These are passing - #1.2", - "Examples Tables - Eating cucumbers - These are failing - #2.1", - "Examples Tables - Eating cucumbers - These are failing - #2.2", - "Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - #3.1", - "Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - #3.2", - "Examples Tables - Eating cucumbers with friends - #1.1: Eating cucumbers with 11 friends", - "Examples Tables - Eating cucumbers with friends - #1.2: Eating cucumbers with 1 friends", - "Examples Tables - Eating cucumbers with friends - #1.3: Eating cucumbers with 0 friends" - ], - "excludeFeatureName" : [ - "Eating cucumbers - These are passing - #1.1", - "Eating cucumbers - These are passing - #1.2", - "Eating cucumbers - These are failing - #2.1", - "Eating cucumbers - These are failing - #2.2", - "Eating cucumbers - These are undefined because the value is not an {int} - #3.1", - "Eating cucumbers - These are undefined because the value is not an {int} - #3.2", - "Eating cucumbers with friends - #1.1: Eating cucumbers with 11 friends", - "Eating cucumbers with friends - #1.2: Eating cucumbers with 1 friends", - "Eating cucumbers with friends - #1.3: Eating cucumbers with 0 friends" - ], - "longPickleName" : [ - "Examples Tables - Eating cucumbers - These are passing - Eating cucumbers", - "Examples Tables - Eating cucumbers - These are passing - Eating cucumbers", - "Examples Tables - Eating cucumbers - These are failing - Eating cucumbers", - "Examples Tables - Eating cucumbers - These are failing - Eating cucumbers", - "Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - Eating cucumbers", - "Examples Tables - Eating cucumbers - These are undefined because the value is not an {int} - Eating cucumbers", - "Examples Tables - Eating cucumbers with friends - Eating cucumbers with 11 friends", - "Examples Tables - Eating cucumbers with friends - Eating cucumbers with 1 friends", - "Examples Tables - Eating cucumbers with friends - Eating cucumbers with 0 friends" - ], - "short" : [ - "#1.1", - "#1.2", - "#2.1", - "#2.2", - "#3.1", - "#3.2", - "#1.1: Eating cucumbers with 11 friends", - "#1.2: Eating cucumbers with 1 friends", - "#1.3: Eating cucumbers with 0 friends" - ], - "shortPickleName" : [ - "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" - ] - }, "findPickleBy" : [ "Eating cucumbers", "Eating cucumbers", diff --git a/testdata/hooks.feature.query-results.json b/testdata/hooks.feature.query-results.json index 0ad8e247..02585913 100644 --- a/testdata/hooks.feature.query-results.json +++ b/testdata/hooks.feature.query-results.json @@ -13,21 +13,6 @@ "findAllPickleSteps" : 3, "findAllTestCaseStarted" : 3, "findAllTestSteps" : 9, - "findAllTestCaseStartedGroupedByFeature" : [ - [ - "Hooks", - [ - "29", - "30", - "31" - ] - ] - ], - "findFeatureBy" : [ - "Hooks", - "Hooks", - "Hooks" - ], "findHookBy" : [ "0", "3", @@ -56,33 +41,6 @@ "FAILED", "UNDEFINED" ], - "findNameOf" : { - "long" : [ - "Hooks - No tags and a passed step", - "Hooks - No tags and a failed step", - "Hooks - No tags and a undefined step" - ], - "excludeFeatureName" : [ - "No tags and a passed step", - "No tags and a failed step", - "No tags and a undefined step" - ], - "longPickleName" : [ - "Hooks - No tags and a passed step", - "Hooks - No tags and a failed step", - "Hooks - No tags and a undefined step" - ], - "short" : [ - "No tags and a passed step", - "No tags and a failed step", - "No tags and a undefined step" - ], - "shortPickleName" : [ - "No tags and a passed step", - "No tags and a failed step", - "No tags and a undefined step" - ] - }, "findPickleBy" : [ "No tags and a passed step", "No tags and a failed step", diff --git a/testdata/minimal.feature.naming-strategy.long-exclude-feature-name.txt b/testdata/minimal.feature.naming-strategy.long-exclude-feature-name.txt new file mode 100644 index 00000000..f15fafb5 --- /dev/null +++ b/testdata/minimal.feature.naming-strategy.long-exclude-feature-name.txt @@ -0,0 +1 @@ +cukes diff --git a/testdata/minimal.feature.naming-strategy.long-with-pickle-name-if-parameterized.txt b/testdata/minimal.feature.naming-strategy.long-with-pickle-name-if-parameterized.txt new file mode 100644 index 00000000..94a83382 --- /dev/null +++ b/testdata/minimal.feature.naming-strategy.long-with-pickle-name-if-parameterized.txt @@ -0,0 +1 @@ +minimal - cukes diff --git a/testdata/minimal.feature.naming-strategy.long-with-pickle-name.txt b/testdata/minimal.feature.naming-strategy.long-with-pickle-name.txt new file mode 100644 index 00000000..94a83382 --- /dev/null +++ b/testdata/minimal.feature.naming-strategy.long-with-pickle-name.txt @@ -0,0 +1 @@ +minimal - cukes diff --git a/testdata/minimal.feature.naming-strategy.long.txt b/testdata/minimal.feature.naming-strategy.long.txt new file mode 100644 index 00000000..94a83382 --- /dev/null +++ b/testdata/minimal.feature.naming-strategy.long.txt @@ -0,0 +1 @@ +minimal - cukes diff --git a/testdata/minimal.feature.naming-strategy.short.txt b/testdata/minimal.feature.naming-strategy.short.txt new file mode 100644 index 00000000..f15fafb5 --- /dev/null +++ b/testdata/minimal.feature.naming-strategy.short.txt @@ -0,0 +1 @@ +cukes diff --git a/testdata/minimal.feature.query-results.json b/testdata/minimal.feature.query-results.json index 1c8b186e..f9048105 100644 --- a/testdata/minimal.feature.query-results.json +++ b/testdata/minimal.feature.query-results.json @@ -13,17 +13,6 @@ "findAllPickleSteps" : 1, "findAllTestCaseStarted" : 1, "findAllTestSteps" : 1, - "findAllTestCaseStartedGroupedByFeature" : [ - [ - "minimal", - [ - "8" - ] - ] - ], - "findFeatureBy" : [ - "minimal" - ], "findLocationOf" : [ { "line" : 9, @@ -34,23 +23,6 @@ "findMostSevereTestStepResultBy" : [ "PASSED" ], - "findNameOf" : { - "long" : [ - "minimal - cukes" - ], - "excludeFeatureName" : [ - "cukes" - ], - "longPickleName" : [ - "minimal - cukes" - ], - "short" : [ - "cukes" - ], - "shortPickleName" : [ - "cukes" - ] - }, "findPickleBy" : [ "cukes" ], diff --git a/testdata/rules.feature.naming-strategy.long-exclude-feature-name.txt b/testdata/rules.feature.naming-strategy.long-exclude-feature-name.txt new file mode 100644 index 00000000..bb113836 --- /dev/null +++ b/testdata/rules.feature.naming-strategy.long-exclude-feature-name.txt @@ -0,0 +1,3 @@ +A sale cannot happen if the customer does not have enough money - Not enough money +A sale cannot happen if the customer does not have enough money - Enough money +a sale cannot happen if there is no stock - No chocolates left diff --git a/testdata/rules.feature.naming-strategy.long-with-pickle-name-if-parameterized.txt b/testdata/rules.feature.naming-strategy.long-with-pickle-name-if-parameterized.txt new file mode 100644 index 00000000..2bf577f8 --- /dev/null +++ b/testdata/rules.feature.naming-strategy.long-with-pickle-name-if-parameterized.txt @@ -0,0 +1,3 @@ +Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Not enough money +Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Enough money +Usage of a `Rule` - a sale cannot happen if there is no stock - No chocolates left diff --git a/testdata/rules.feature.naming-strategy.long-with-pickle-name.txt b/testdata/rules.feature.naming-strategy.long-with-pickle-name.txt new file mode 100644 index 00000000..2bf577f8 --- /dev/null +++ b/testdata/rules.feature.naming-strategy.long-with-pickle-name.txt @@ -0,0 +1,3 @@ +Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Not enough money +Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Enough money +Usage of a `Rule` - a sale cannot happen if there is no stock - No chocolates left diff --git a/testdata/rules.feature.naming-strategy.long.txt b/testdata/rules.feature.naming-strategy.long.txt new file mode 100644 index 00000000..2bf577f8 --- /dev/null +++ b/testdata/rules.feature.naming-strategy.long.txt @@ -0,0 +1,3 @@ +Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Not enough money +Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Enough money +Usage of a `Rule` - a sale cannot happen if there is no stock - No chocolates left diff --git a/testdata/rules.feature.naming-strategy.short.txt b/testdata/rules.feature.naming-strategy.short.txt new file mode 100644 index 00000000..80c4e7fd --- /dev/null +++ b/testdata/rules.feature.naming-strategy.short.txt @@ -0,0 +1,3 @@ +Not enough money +Enough money +No chocolates left diff --git a/testdata/rules.feature.query-results.json b/testdata/rules.feature.query-results.json index 39113a00..dad7a91c 100644 --- a/testdata/rules.feature.query-results.json +++ b/testdata/rules.feature.query-results.json @@ -13,21 +13,6 @@ "findAllPickleSteps" : 12, "findAllTestCaseStarted" : 3, "findAllTestSteps" : 12, - "findAllTestCaseStartedGroupedByFeature" : [ - [ - "Usage of a `Rule`", - [ - "55", - "56", - "57" - ] - ] - ], - "findFeatureBy" : [ - "Usage of a `Rule`", - "Usage of a `Rule`", - "Usage of a `Rule`" - ], "findLocationOf" : [ { "line" : 9, @@ -48,33 +33,6 @@ "PASSED", "PASSED" ], - "findNameOf" : { - "long" : [ - "Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Not enough money", - "Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Enough money", - "Usage of a `Rule` - a sale cannot happen if there is no stock - No chocolates left" - ], - "excludeFeatureName" : [ - "A sale cannot happen if the customer does not have enough money - Not enough money", - "A sale cannot happen if the customer does not have enough money - Enough money", - "a sale cannot happen if there is no stock - No chocolates left" - ], - "longPickleName" : [ - "Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Not enough money", - "Usage of a `Rule` - A sale cannot happen if the customer does not have enough money - Enough money", - "Usage of a `Rule` - a sale cannot happen if there is no stock - No chocolates left" - ], - "short" : [ - "Not enough money", - "Enough money", - "No chocolates left" - ], - "shortPickleName" : [ - "Not enough money", - "Enough money", - "No chocolates left" - ] - }, "findPickleBy" : [ "Not enough money", "Enough money",