-
-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run scenarios in parallel with Gradle #2827
Comments
I want have similar question i have cucumber bdd, junit, gradle and i want to run test cases parallel |
Parallel execution in Cucumber isn't supported yet. It will be in a future version. |
Thanks wakaleo, currently i am using cucumber-java version: 6.11.0 Please let me know once we have parallel execution for cucumber. Thanks in advance |
Parallel execution is in any case only supported in the most recent versions of Cucumber - I don't think it is supported in Cucumber 6. |
Do you think if we change Gradle to maven will help? i am unable to find proper community discussion on gradle with cucumber parallel execution. |
This is hit and miss. You can try this:
If you are using gitlab ci or jenkins you can split your tests into a batch of scenarios. For example in gitlab ci, you would do something like the following as a script: Finally, if you are adventurous, you can use cucumber cli, and set the number of threads to use. Again, you can setup a task like follows: Here is an example of the Main class you can use:
|
Thanks i will try this and update the status. |
@zzoubian Is there any step by step tutorial or any blog that explains the above solutions in detail? can you please provide the link. Thanks |
@prashantigs The most straitforward way of running features files in parallel is using gradle's test configuration and forks. The above solution using main has a different behavior. This will run the scenario's in parallel rather than the features in parallel. This solution results in a overall faster execution of the tests since all scenarios are distributed among threads. I have a similar solution implemented however it's not fault tolerated. From time to time test are failing. This is probably caused by the class BaseStepListner not being fully threadSafe (fyi @wakaleo ). |
Hello @GianniGiglio thanks for the solution I have tested your project it's working as expected. I have a questions Question1: Suppose if I have 100 package under /search package I have to create 100 runner file? import io.cucumber.junit.CucumberOptions; @RunWith(CucumberWithSerenity.class) |
@GianniGiglio i can able to execute your code parallelly however when I try my project it's still executing test cases in sequential mode. i am suspecting two things 1). my framework structure is wrong - Do i need to maintain the same framework structure as yours? defaultTasks 'clean', 'test', 'aggregate' group 'org.automationserenity' repositories { buildscript {
} sourceCompatibility = 1.8 ext { dependencies {
// implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.0.0-beta-4' } test { tasks.withType(Test) {
} gradle.startParameter.continueOnFailure = true Can some one help me on this? |
Parallel execution of Cucumber scenarios isn't supported yet. |
in the cucumber official website mentioned, we can achieve parallel execution of cucumber scenarios. https://cucumber.io/docs/guides/parallel-execution/ Not sure which one is correct. please let me know if there are any issues with the serenity, cucumber, JUnit, and gradle project so that we can find alternative solutions as we have 500+ test cases automated with serenity. Its night mare for us to execute in sequential order |
Cucumber parallel execution of scenarios with Serenity is not currently supported, though it will work at a feature level. Cucumber parallel execution with Maven and Gradle does not always work as documented, which is a Cucumber issue. |
Hello Wakaleo, is it possible to run test cases parallelly using the below options? with serenity cucumber? 1). Running Serenity tests on a Selenium Grid and 2). Running Serenity tests in parallel batches above 2 options mentioned in serenity official document https://serenity-bdd.github.io/theserenitybook/latest/serenity-parallel-batches.html |
Need help and proper guidance on how to run parallel execution on Gradle and Cucumber with selenium, I have searched number of blogs there are no any proper guidance or exact solution, can any one help me in this? but there are good suggestion with Maven but not with gradle |
I face the same problem so i converted entire project to maven and now i can able to execute my tests in parallel mode |
@prashantrbs any idea how we can achieve this with Gradle and JUnit parallel execution ? for me at least feature file parallel execution also fine. Because in maven I know that we can use plugin section and we can do with Test-NG and Junit both for scenario level and Feature level (Junit) in POM.XML....... but I need it in gradle only....... |
Even i had same issue in gradle so i searched #'s blogs unfortunately that did not help so change entire project to maven |
@wakaleo, Why we have lot of challenges with Selenium cucumber with gradle to execute the parallel execution? but same case is not applicable for Maven with selenium cucumber. At least in maven there are 2 ( Failesafe and Surefire) plugins are available to configure with Junit (feature level ) parallel execution and Test-NG( scenario level) execution. But with gradle there are no any tutorial or community support for the parallel execution even we do not have good blogs or video. Can you please help me here....... we are waiting for this from very long time. |
Serenity BDD is an Open Source project. So if this feature is valuable for your company, you have a few options: |
@prashantigs @Dsilva-Rohan you can find an example using gradle here https://github.com/GianniGiglio/serenity-cucumber-threaded Tobe clear both solutions work but the junit 5 solution will yield the fastest execution since scenarios are run in parallel rather than feature files. |
I have 50 scenarios in my cucumber feature file.
Can I run them in parallel using Gradle? (so that for example 5 browsers will be used)
If yes, is there any doc for this?
If no, is it possible with maven?
The text was updated successfully, but these errors were encountered: