Reputation: 31
Context of my application structure:
task integrationTest(type: Test) {
......
}
Now when I do gradle build (or gradlew build) on root project I expect all projects to compile, and all unit tests to run that are under src/test of each subproject. But it is also calling this integrationTest task, and making integration tests run as well. And more surprisingly it happens sporadically, not consistently. I even tried gradle build -x integrationTest, but it still runs.
So question is:
Thanks.
Upvotes: 3
Views: 2825
Reputation: 529
If you have for example the java plugin applied and run the Gradle task test than yes, all test tasks will be executed. Your integrationtest running while specificaly excluding it has probably to do with the Gradle build lifcycle. You might have your code directely in the configuration block rather than in a execution block. So for example:
task integrationTest(type: Test) {
println 'This will print while in the configuration fase.'
doLast {
println 'This will print while the task is beeing executed.'
}
}
If no configuration is required you can also do:
task integrationTest(type: Test) << {
println 'This will print while the task is beeing executed.'
}
This all can be found in the Build Scripting Basics chapter of the Gradle User Guide which is extremely useful if using Gradle.
So if I understand your question and situation correctly this is probably not a bug in Gradle.
Upvotes: 1