Skip to content

Commit

Permalink
renamed files that are generated by the rerun plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bischoffdev committed Apr 3, 2020
1 parent 3935c2d commit d1aa4e8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

Back to [Readme](README.md).

## [1.7.1] - 2020-04-03

### Changed

* Runner and feature file names generated from Cucumber feature text files are now postfixed with `_rerun_IT`

## [1.7.0] - 2020-03-30

### Added
Expand Down
6 changes: 3 additions & 3 deletions example-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

<groupId>com.trivago.rta</groupId>
<artifactId>cucable-test-project</artifactId>
<version>1.7.0</version>
<version>1.7.1</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.failsafe.plugin.version>3.0.0-M3</maven.failsafe.plugin.version>
<maven.build.helper.plugin.version>3.0.0</maven.build.helper.plugin.version>
<cucumber.version>5.5.0</cucumber.version>
<cucumber.version>5.6.0</cucumber.version>
<maven.compiler.plugin.version>3.7.0</maven.compiler.plugin.version>
<maven.jar.plugin.version>3.1.2</maven.jar.plugin.version>

Expand Down Expand Up @@ -70,7 +70,7 @@
<!--</sourceFeatures>-->

<!-- process a text file containing paths to features and line numbers (as it is written by the Cucumber rerun formatter) -->
<!-- <sourceFeatures>@src/test/resources/cucumber-feature-list.txt</sourceFeatures> -->
<!-- <sourceFeatures>@src/test/resources/cucumber-feature-list.txt</sourceFeatures>-->

<!-- process a specific feature file and specific line numbers in the given directory -->
<!--<sourceFeatures>src/test/resources/features/testfeature/MyTest1.feature:8:19</sourceFeatures>-->
Expand Down
4 changes: 3 additions & 1 deletion plugin-code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ This directory contains the complete Cucable source code.

## Build

To build, use `mvn clean install`. This will create the Cucable jar file in Maven's `target` folder.
To build, use `mvn clean install`. This will create the Cucable jar file in Maven's `target` folder.

Requires Maven >= 3.3.9 and Java >= 8.
2 changes: 1 addition & 1 deletion plugin-code/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.trivago.rta</groupId>
<artifactId>cucable-plugin</artifactId>
<version>1.7.0</version>
<version>1.7.1</version>
<url>https://github.com/trivago/cucable-plugin</url>

<name>Cucable Maven Plugin</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class FeatureFileConverter {
private static final String INTEGRATION_TEST_POSTFIX = "_IT";
private static final String PATH_SEPARATOR = "/";
private static final String TEST_RUNS_COUNTER_FORMAT = "_run%03d";
private static final String TEST_RERUNS_FORMAT = "_rerun";
private static final String FEATURE_COUNTER_FORMAT = "_feature%03d";
private static final String SCENARIO_COUNTER_FORMAT = "_scenario%03d";

Expand Down Expand Up @@ -224,12 +225,16 @@ private List<String> generateFeatureFiles(
featureCounter++;
String scenarioCounterFilenamePart = String.format(SCENARIO_COUNTER_FORMAT, featureCounter);
for (int testRuns = 1; testRuns <= propertyManager.getNumberOfTestRuns(); testRuns++) {
String testRunsCounterFilenamePart = String.format(TEST_RUNS_COUNTER_FORMAT, testRuns);
String generatedFileName =
featureFileName
.concat(scenarioCounterFilenamePart)
.concat(testRunsCounterFilenamePart)
.concat(INTEGRATION_TEST_POSTFIX);
.concat(scenarioCounterFilenamePart);

String testRunsCounterFilenamePart = String.format(TEST_RUNS_COUNTER_FORMAT, testRuns);
generatedFileName = generatedFileName.concat(testRunsCounterFilenamePart);
if (propertyManager.isCucumberFeatureListFileSource()) {
generatedFileName = generatedFileName.concat(TEST_RERUNS_FORMAT);
}
generatedFileName = generatedFileName.concat(INTEGRATION_TEST_POSTFIX);
saveFeature(
generatedFileName,
featureFileContentRenderer.getRenderedFeatureFileContent(singleScenario)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class PropertyManager {
private int desiredNumberOfRunners;
private int desiredNumberOfFeaturesPerRunner;
private List<String> scenarioNames = new ArrayList<>();
private boolean isCucumberFeatureListFileSource;

@Inject
public PropertyManager(final CucableLogger logger, final FileIO fileIO) {
Expand Down Expand Up @@ -86,8 +87,9 @@ public List<CucableFeature> getSourceFeatures() {
public void setSourceFeatures(final String sourceFeatures) throws MissingFileException {
String featuresToProcess;
if (sourceFeatures.startsWith("@")) {
isCucumberFeatureListFileSource = true;
featuresToProcess = fileIO.readContentFromFile(sourceFeatures.substring(1))
.replace("\n", ",");
.replace(System.lineSeparator(), ",");
} else {
featuresToProcess = sourceFeatures;
}
Expand Down Expand Up @@ -316,6 +318,10 @@ private void saveMissingProperty(
}
}

public boolean isCucumberFeatureListFileSource() {
return isCucumberFeatureListFileSource;
}

public enum ParallelizationMode {
SCENARIOS, FEATURES
}
Expand Down

0 comments on commit d1aa4e8

Please sign in to comment.