From 266002af1b3b43c01ca274aac3c04274314187fa Mon Sep 17 00:00:00 2001 From: bbischoff Date: Sat, 15 Aug 2020 16:46:44 +0200 Subject: [PATCH 1/3] fixed invalid runner class name --- .../src/test/resources/features/testfeature/123feature.feature | 3 +++ .../java/com/trivago/features/FeatureFileContentRenderer.java | 1 - .../main/java/com/trivago/features/FeatureFileConverter.java | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 example-project/src/test/resources/features/testfeature/123feature.feature diff --git a/example-project/src/test/resources/features/testfeature/123feature.feature b/example-project/src/test/resources/features/testfeature/123feature.feature new file mode 100644 index 0000000..16bada9 --- /dev/null +++ b/example-project/src/test/resources/features/testfeature/123feature.feature @@ -0,0 +1,3 @@ +Feature: A feature starting with a number + + Scenario: Scenario 1 \ No newline at end of file diff --git a/plugin-code/src/main/java/com/trivago/features/FeatureFileContentRenderer.java b/plugin-code/src/main/java/com/trivago/features/FeatureFileContentRenderer.java index c12bc95..1c50fae 100644 --- a/plugin-code/src/main/java/com/trivago/features/FeatureFileContentRenderer.java +++ b/plugin-code/src/main/java/com/trivago/features/FeatureFileContentRenderer.java @@ -63,7 +63,6 @@ private String getRenderedFeatureFileContent(List singleScenario ); addSteps(renderedContent, singleScenario.getBackgroundSteps()); addSteps(renderedContent, singleScenario.getSteps()); - } addComments(renderedContent, firstScenario.getFeatureFilePath()); diff --git a/plugin-code/src/main/java/com/trivago/features/FeatureFileConverter.java b/plugin-code/src/main/java/com/trivago/features/FeatureFileConverter.java index 747bd88..97ea721 100644 --- a/plugin-code/src/main/java/com/trivago/features/FeatureFileConverter.java +++ b/plugin-code/src/main/java/com/trivago/features/FeatureFileConverter.java @@ -417,7 +417,7 @@ private void generateRunnerClass(final List generatedFeatureFileNames) t // Otherwise, a generated runner class name is used. String runnerClassName; if (generatedFeatureFileNames.size() == 1) { - runnerClassName = generatedFeatureFileNames.get(0); + runnerClassName = "Runner_" + generatedFeatureFileNames.get(0); } else { runnerClassName = "CucableMultiRunner_" .concat(UUID.randomUUID().toString().replace("-", "_")) From f21e5b35beb932fe430b4f410e576ac1ff55ff63 Mon Sep 17 00:00:00 2001 From: bbischoff Date: Sat, 15 Aug 2020 16:50:01 +0200 Subject: [PATCH 2/3] updated readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 550ac76..4e6c1a3 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ All changes are documented in the [full changelog](CHANGELOG.md). The `[CUCABLE:RUNNER]` template placeholder is automatically replaced with the class name of the generated runner class. -If the generated runner runs only one "single scenario" feature, its name will be the same as the generated feature (e.g. `MyFeature_scenario001_run001_IT`). +If the generated runner runs only one "single scenario" feature, its name will be the same as the generated feature (e.g. `Runner_MyFeature_scenario001_run001_IT`). In case the runner runs multiple "single scenario" features, its name will be auto-generated (e.g. `CucableMultiRunner_1da810a2_c4c6_4edb_b078_d81329593950_IT`). @@ -624,7 +624,7 @@ The generated runners point to each one of the generated feature files (unless y This is an example for one of the generated runners - note how the placeholders are now replaced with the name of the feature to run: -*MyFeature_scenario001_run001_IT.java* +*Runner_MyFeature_scenario001_run001_IT.java*
 import cucumber.api.CucumberOptions;

From 4f42584507f205cefd36c0fc58b80e18d7f790fe Mon Sep 17 00:00:00 2001
From: bbischoff 
Date: Sat, 15 Aug 2020 16:50:46 +0200
Subject: [PATCH 3/3] updated changelog

---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7123c47..5ac4c05 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ Back to [Readme](README.md).
 ### Fixed
 
 * Correct handling of feature tags in combination with multiple tagged example tables (#168)
+* Invalid runner class name for features beginning with numbers (#156)
 
 ## [1.7.2] - 2020-04-03