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 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; 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(ListsingleScenario ); 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("-", "_"))