Running Serenity -Cucumber Test cases in parallel

做~自己de王妃 提交于 2020-01-01 07:06:10

问题


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

  1. 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.

  2. 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>
    

  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!