问题
I'm new to Serenity and BDD. I've a small demo project based on Serenity-Cucumber and Page Based model. Below is the structure of the project:
The Login and Logout features have around 8 scenarios.
I want to be able to run the feature files in parallel. What is the easiest and most effective way to achieve this?
So far I have
Created separate Runner class for each feature and then used failsafe or surefire plugin - This is something I don't want as I don't want a new runner for each feature file.
Used the "cucumber-vm-parallel-plugin". I copy pasted below code in my pom file. Nothing happened.
<plugin> <groupId>com.github.temyers</groupId> <artifactId>cucumber-jvm-parallel-plugin</artifactId> <version>1.0.1</version> <executions> <execution> <id>generateRunners</id> <phase>validate</phase> <goals> <goal>generateRunners</goal> </goals> <configuration> <glue>com.automationrhapsody.cucumber.parallel.tests</glue> <featuresDirectory>src/test/resources/com</featuresDirectory> <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir> <format>json,html</format> <tags>"~@ignored"</tags> </configuration> </execution> </executions>
Looked into Serenity documentation and ran my program using following parameters, but could not achieve parallel execution.
mvn verify -Dthucydides.batch.count=2 -Dthucydides.batch.number=2
I'm stuck over here. Any help (easy and effective) will be appreciated. Also, please suggest how options 2 and 3 above can be done correctly
Thanks.
回答1:
You also need to add below plugin.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<forkCount>5</forkCount>
<reuseForks>true</reuseForks>
<includes>
<include>**/*IT.class</include>
</includes>
</configuration>
</plugin>
来源:https://stackoverflow.com/questions/39272643/running-serenity-cucumber-test-cases-in-parallel