I have a specific build option that is ONLY used for prototyping. I would prefer not to run unit tests against this option (but want to use them for other options). Is there a way to tell gradle to skip unit testing for this particular option?
In my case, I wanted to skip all unit tests from the release version. This can be achieved:
gradle.taskGraph.useFilter { task -> if (task.name.startsWith("test") && task.name.contains("ReleaseUnitTest")) { return false; } return true; }
Gradle allows you to call only those tasks that you specifically want to perform.
Gradle 'test' 'testReleaseVariant' ReleaseVariant. : "testReleaseVariant testFreeVariant" ..
"/" Android Studio, , " ". Gradle → "" "" "testReleaseVariant" , .
, taskGraph:
taskGraph
gradle.taskGraph.useFilter { task -> task.name != "testMock" }
, , , , task.enabled = false , compileJava et al. .
task.enabled = false
compileJava