简体   繁体   中英

Cucumber Feature Files and scenarios for parallel execution

Using Cucumber we create different feature files that consist of different scenarios. One thing that we keep in mind is that every scenario is independent of all other scenarios.

Question: Can we do parallel execution for all of the feature file or scenarios?

out of the box Cucumber doesn't support parallel testing. You can use Maven to run parallel test. We have a github project check this link. It has some details on parallel testing.

check out these links:

  1. JVM-Parallel Execution Example

  2. Git-Hub Link

Yep, as the two other answers suggest, it is not out of the box.

I work for the company that hosts that Cucumber-JVM post above. Acceptance tests - especially web based ones - are often really slow, and parallel testing is a great way to speed them up. You may also want to consider running web tests in headless browser, such as phantomJS. They're great for overnight runs, but I'd test it on firefox or chrome before releasing. You may have browser specific bugs.

If you're running Selenium tests, you might want to consider also using Selenium Grid. The above methods launch multiple browsers on the same machine - but machines can only run so many browsers. Selenium Grid will balance tests across a number of machines. So you could have, for example, 5 nodes running 5 parallel tests each = 25 tests in parallel!

If running many tests in parallel, remember that tests should be isolated - and ideally have and tear down their own data. Don't assume anything about the order of any other tests ( we use aliasing to get around this ).

Oh, and if you turn it up really high, you'll end up getting a performance test. So be wary of that!

Here's some handy links:

Thanks Everyone for Help!! I have got the answer. Below is step-wise solution Flavor - Cucumber-JVM IDE - Eclipse 1- What?-Remove Your Test Runner File Why? -For parallel testing, JVM automatically creates each runner for each parallel process When?-This Might be the first step before any config 在此输入图像描述

2- What?-Add Below mentioned properties in your POM.xml Why? - Will add this later When?-Before compiling

UTF-8

3- What?-Add Below mentioned plugins in your POM.xml Why? -This will automatically create runner When?-Before compiling

org.apache.maven.plugins maven-surefire-plugin 2.19.1

  <configuration> <additionalClasspathElements> <additionalClasspathElement>resources</additionalClasspathElement> </additionalClasspathElements> <forkCount>5</forkCount> <reuseForks>true</reuseForks> <includes> <include>**/*IT.class</include> </includes> </configuration> 

ParllelExecution

4- What?-Add Below mentioned plugins in your POM.xml Why? -This will create parallel execution on basis of FEATURE or SCENARIO and will create jason,HTML report as well When?-Before compiling

com.github.temyers cucumber-jvm-parallel-plugin 2.2.0 generateRunners validate generateRunners

  <configuration> <glue>russel.StepDefination.Option1.IN451</glue> <featuresDirectory>Login</featuresDirectory> <cucumberOutputDir>target/Parallel-report</cucumberOutputDir> <format>json,html</format> <parallelScheme>SCENARIO</parallelScheme> <!-- <parallelScheme>FEATURE</parallelScheme> --> </configuration> </execution> </executions> 

ParallelExecutionSceanrio特征

5- Goto Console of and run commomd - mvn clean - mvn compile - mvn verify

It is indeed possible.

See this link for all the information and credits: http://shashikantjagtap.net/running-cucumber-features-in-parallel-and-aggregating-reports/

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM