If you don't have to run all your tests in the same build, you can use dependency profiles. Lets say scalaTests
and javaTests
.
And you can group test dependencies like below
dependencies {
....
if (project.hasProperty('scalaTests')) {
//scala test dependencies here
}
else if (project.hasProperty('javaTests'))
//java test dependencies here
}
}
You also have to run only Scala tests when you are using Scala profile(same for java test)
You can run gradle with scalaTests profile like this gradle -PscalaTests ..
(same for java case)
For running specific tests
How to run only one test class on gradle
Gradle run only one test suite
For profile details.
https://gist.github.com/szpak/1499336
Maven profiles equivalent of Gradle