I have a custom Test task that sets the systemProperties
based on a system property passed to the gradle runner.
task integrationTests(type: Test) {
description = 'Runs integration tests'
group = 'verification'
systemProperties = [
'itRun': System.getProperty('itRun')
]
}
This works just fine when I pass use -DitRun=xxx
What I would like to do however is set up some additional tasks that would set set a specific value for itRun
and then run my Test task.
task myIT {
System.setProperty 'itRun', 'theseTests'
finalizedBy integrationTests
}
However, I’m struggling to see how to set the system property from other tasks because my Test task is configured before my other task and so the value is not being configured for the test VM.
Is there a way to defer configuring system properties for the Test task to execution time or a better way of doing this?
btw I perhaps should say I define the integrationTests
task through a custom plugin that I apply to various sub projects, so I’m trying to create the custom tasks within a particular sub project.
TIA
Craig