Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run junit test classes in parallel but list a few exceptions gradle

Tags:

junit4

gradle

I would like to run all junit test classes in parallel(due to setup in each test, I DO NOT want tests in a single class running in parallel or they would step on each other with mock changes of state)

I however have some selenium tests that must be run in series but can be run while the other tests are running.

  1. Can gradle run test classes in parallel without running tests within a class in parallel(again due to shared state)
  2. Can we exclude some tests that need to be run in sequence

thanks, Dean

like image 319
Dean Hiller Avatar asked May 02 '17 04:05

Dean Hiller


2 Answers

I'm more Maven oriented, but shouldn't creating a new task for gradle and setting values to properties maxParallelForks and forkEvery (probably this property should be set to 1) do the job?

Something like example

like image 136
nick79 Avatar answered Oct 14 '22 07:10

nick79


As per their documentation and some of their forum threads, if you are running test in parallel then it spawns new processes based on your maxParallelForks property mentioned and in that spawned processes it will run forkEvery no. of test classes. You can run some of the tasks in sequence by mentioning them as dependent on one other.

like image 21
rakesh Avatar answered Oct 14 '22 06:10

rakesh