I have been at this for a few days now, let’s say I have a build.gradle as follows:
ext.createRunIntegrationTestsTask = { String taskName , String buildPlatform ->
return project.tasks.create(taskName, Test.class) {
dependsOn buildPlatform
[...]
}
}
def Platforms = ["A", "B"]
for (platform in Platforms) {
println "Creating task: runIntegrationTestsPlatform$platform"
createRunIntegrationTestsTask("runIntegrationTestsPlatform$platform", "buildPlatform$platform")
}
task runIntegrationTest(type: Test) {
dependsOn 'runIntegrationTestPlatformA'
dependsOn 'runIntegrationTestPlatformB'
}
I want to be able to run the following command with the tests filter:
gradlew :runIntegrationTest --tests "com.somestuff.methodTest"
For some reason when the above command runs, it does not pass the tests filter to runIntegrationTestPlatformA and runIntegrationTestPlatformB task. Both the runIntegrationTestPlatform... tasks run the whole suite of integration tests.
The current behavior I get is for runIntegrationTestPlatform... tasks to run the whole integration test suite for the specified platform and runIntegrationTest to run the integration test suite for all platforms.
But, when I pass the --tests filter to runIntegrationTest task, it does not get propagated to the chained tasks, i.e. runIntegrationTestPlatformA and runIntegrationTestPlatformB. Instead, it runs the whole integration test suite for both platforms. I want runIntegrationTestPlatformA and runIntegrationTestPlatformB to use the tests filter passed to runIntegrationTest to only run the specified integration tests.
Is there a way to get runIntegrationTestPlatformA and runIntegrationTestPlatformB to run from runIntegrationTest with the --tests filter.
Any help would be appreciated. Thank you.
Additional Sources: