How to run unit test in parallel by modules using Maven? - maven

Are there any form to run unit test with surefire in parallel but by module? For example, we are using build in parallel by defining number of threads. Can we apply this techniques by defining number of threads to execute test in parallel by module. For example, firstly, the project is compiled. Secondly, we can use compiled project for run our tests by following form: mvn -T 4 test?

There is a different between running the build parallelized and the tests parallelized. The first one is done by using the -T option but the test can be configured in maven-surefire-plugin.

Related

How pass Gradle command parameters to execute a task through Buildship

I know that if in Gradle I use: build -x test it builds and the test are not executed.
In STS with Buildship for support with Gradle, for example for Spring Integration
It has the following two tasks of my interest (build and test):
I can build with the following:
Because some test fails (randomly) I want skip the tests, so I tried
it fails with:
So I tried with:
And fails with
And with:
Nothing happens, only shows the following and stopping:
So how represent build -x test correctly with Buildship?
You must supply -x test as Program Arguments like this:
Or you just run assemble instead of build. assemble is a lifecycle task that aggregates all archive tasks in the project and, besides other tasks, does not execute check tasks, such as test.

Running a particular test among multiple tests with same name

I have multiple tests with same name but under different packages
com.private.db.dao.pf.ent.DAOBaseFuncTest
com.private.db.dao.internal.pf.ent.DAOBaseFuncTest
com.private.db.dao.core.ent.DAOBaseFuncTest
I wanted to run com.private.db.dao.pf.ent.DAOBaseFuncTest. Usually I run a test with this command,
mvn -Prun-tests -pl test/func -Dit.test=DAOBaseFuncTest verify
But I was surprised to see 3 test suites running one after another. Is it possible to run a particular test suite instead of running all the three?
Never mind. I tried giving the specific test suite and it worked.
mvn -Prun-tests -pl test/func -Dit.test=com.private.db.dao.pf.ent.DAOBaseFuncTest verify

Pass parallel and forkCount paramters to testng through maven command line

How can you pass "parallel" and "forkCount" properties to testNG using the maven command line?
According to the documentation:
parallel
(TestNG provider) When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution.
User property is: parallel.
forkCount
User property is: forkCount.
So you can use them like:
mvn test -Dparallel=<value> -DforkCount=<value>

How reorder parallel builds in chain

We are using TeamCity 9 and we have defined build configuration looks like:
--> unit tests ---------|
^ ˇ
compile ->+-> integration tests ->+--> deploy
ˇ ^
--> acceptance tests ---|
Dependencies between build are defined as Snapshot dependency (documentation). All tests builds are running in parallel, but I need to define order because integration test needs more time than others so it'll be good to run this test build first.
It's possible to define order or priorities for each build in chain?
Order of builds (waiting mechanism) can be managed by using the build feature named shared resources.
See page # Jetbrains :::
https://confluence.jetbrains.com/display/TCD9/Shared+Resources

How to run more than one test but not all the tests in GEB using Gradle?

I am running gradle to run the tests from Windows command line. What I do to run a single test is:
gradlew.bat chromeTest -DchromeTest.single=test1Spec
or for all the tests:
gradlew.bat chromeTest
If I try to run only two test classes like this:
gradlew.bat chromeTest -DchromeTest=test1Spec,test2Spec--info
then gradle starts to run all the tests.
What I need: is to run only 2 or 3 Groovy classes. To be specific, neither one nor all. Any help would be really beneficial! Sorry, for reposting this question again.
-DtestTaskName supports wildcards such as Test*Spec or foo.bar.*Spec, but is limited to a single pattern. If you need support for multiple patterns, you'll have to implement your own command line parameter (which in the simplest case means reading a system property) and use that to configure Test#include or Test#getFilter. (See Test in the Gradle Build Language Reference for details.)
Gradle 1.10 introduced --tests as a replacement for -DtestTaskName, but again, only one pattern is supported.

Resources