I am trying to reduce the time taken to run tests using gradle. Since there are multiple projects, one of the ways that I can think of doing that is to split tests into Unit and Integration tests. For each project, I have created two different tasks: unitTests task and integrationTests task.
Assume for simplification, that we always run gradle build -x test
before running tests. In such a scenario, I am trying to get to state where I can run the tasks unitTests and integrationTests in parallel.
Currently I have seen failures where one of the tasks starts compiling the project leading to the other task failing with the error : "Cannot read zip file" which is likely because the JAR that the project depends on is now being updated by the other process. This seems to be likely because we have compileJava and compileTestJava as dependent tasks which interfere with dependent projects leading to a failure.
Wondering if there is a way in gradle to do the following :
- Run only tests and not compile anything (to the tune of surefire:test in maven).
- If not, is there settings that can be specified in build.gradle to tell gradle not to modify files but just to run tests.