I have created an integration test task for my java project following this guide.
Omitting some irrelevant details, the task is like follows:
apply plugin: 'java'
task integrationTests (type: Test){
testClassesDir = sourcesets.integrationTests.outputClasesDir
classpath = sourceSets.IntegrationTests.runtimeClasspath
}
sourceSets {
integration {
java {
//integration test sources
}
}
configurations {
integrationTestsCompile.extendsFrom. testCompile
integrationTestsRuntime.extendsFrom testRuntime
}
check.dependsOn integrationTests
This works perfectly except that now I need to split the test in two stages: unit tests in the build machines and integration tests in integration test machines (because they need some setup)
To make thinks more complicated, I cannot recompile code in the integration test machines, so I need to compile, but not executed integration test code in the build machines.
How can I do this? I've seen there's an integrationTestsClasses task that does the compilation, but I would like to call it automatically when building the project.
Thanks in advance