How to run Cucumber tests in parallel at feature or scenario level using cucumber jvm 4.4.0 and without com.github.temyers? - maven

I want to run scenarios/features in parallel, what maven config do i need for this.
Right now i am using com.github.temyers maven dependency but i don't want to use it any further.
I should be able to run tests in parallel at scenario or feature level.

You can use the built-in parallel execution, as mentioned by #Grasshoper. For more information, see the Cucumber docs on parallel execution.

Related

Forked execution of SpringBootTest's with maven failsafe plugin - does it work out of the box?

Consider you have a Spring-Boot Application and within this application also a bunch of Integration-Tests, which are annotated with #SpringBootTest and run with the SpringRunner class.
They are invoked by the maven failsafe plugin, which by default does not parallelise tests in any way. The tests all run fine without any issues.
What changes if you use failsafe's feature of forkCount - can you expect the test execution to work out of the box? Do you need to adjust some code? What do you need to look out for that could potentially not allow these integration tests to run in a forked, "parallel" environment via this plugin?
From my understanding, the failsafe plugin will create forkCount-many JVMs and in each some of the integration tests are executed. That sounds like there is nothing to do, you don't need to make anything threadsafe, you don't need to make Singleton-beans into ThreadScoped beans or anything - as the process of having multiple JVM's should already create multiple of these beans.
Sorry if the question appears weird, I tried researching this question but I could not find an answer.
From Maven doc:
The parameter forkCount defines the maximum number of JVM processes
This means that the tests will run in it's own process and therefore you will have separate Spring Boot instances. So you really don't have to care about thread safety.
But you have to care about memory consumption.

maven-surefire-plugin converted to gradle for Geb/Spock parallel test execution

I found this page that explains how to run Geb/Spock tests at the method level which is what I would like to do with my tests, but I am using gradle. Is there a way to convert this to gradle or is it strictly a maven plugin? I can import the maven-surefire-plugin with gradle just fine, however I can't figure out how to convert the configuration block, or if it is even possible.
I've tried something like below but it doesn't work.
tests {
options {
parallel = "methods"
forkCount = 4
}
}
I can execute the tests at the class (spec) level by using gradle maxParallelForks property, but I'd like to run parallel at the test level.
If you are able to run tests in parallel on the method level depends on what test framework you are using.
As far as I know, only TestNG supports it out of the box.
See here: https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/testng/TestNGOptions.html#setParallel-java.lang.String-
There is way to make it work independently of the test framework, using only Gradle, but this way you can only do it on the class level.
In your Gradle test task, set the maxParallelForks property.
See manual: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:maxParallelForks`

How to order unit test execution from Gradle?

Is there any way to specify the order of the unit tests classes run by a Gradle Test task?
I'd like to get some known longer-running tests at either the front or the back of the list, but don't know if it's possible without splitting my tests' execution between multiple tasks.
Running JUnit 4.12 and Gradle 4.5.
Gradle simply delegates execution to the JUnit runner.
So if you want specific test class ordering, you will need to create a Suite and specify the test classes in the order you want, see the JUnit documentation for this.
Now, given the flexibility of Gradle in terms of having different source roots, I would strongly recommend doing the separation at the Gradle level, by create extra test source roots, test task and the like. This will allow you to effectively control when these long running tests are run in a standard build execution, but also to skip them or run these only when desired. The ordering at the JUnit level will not give that flexibility without much more tweaking. See the Gradle documentation on adding source sets.

Running tagged ScalaTest tests in Gradle

ScalaTest has such a feature as tagging different tests. It would be great somehow to instruct gradle about what type of tests it should run while executing test task(as it done in scalatest maven-plugin). How this can be achieved?
As Gradle doesn't have any specific ScalaTest support, the question is if ScalaTest exposes this feature in a JUnit-compatible way. Alternatively, you could leverage Gradle's support for JUnit categories (see "23.12.5. Test grouping" in the Gradle User Guide).

Parallel testing a Jenkins with specific tests from a maven project

I currently have a maven project with ~500 tests. These are webdriver test with the Thucydides framework. There are several types of tests such as swiping tests, article link tests, sharing tests, etc.
Details of the current setup:
* Selenium
* Thucydides
* Jenkins
I would like to run parallel tests in Jenkins but I want each jenkins job to only run a specific type of test. Is there anyway of using the "Goals and options" in the Build section in jenkins job configuration page to only run a specific type of test i.e. run only the swiping tests? or are there other options available?
Ideally I Would like to run separate jobs for each type of tests and run in parallel all those jobs together.
Not sure how to achieve it purely in Jenkins, but the first option coming to my mind is that you could create separate maven profiles for each test type and create one jenkins job per profile.
For more info on maven profiles, see official docs: http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Resources