How should I be handling passing system properties from Gradle to my tests

What you are trying to do is to set system properties for the test JVM(s), not the Gradle JVM. That’s why you have to add some code to propagate system properties from the latter to the former. Gradle doesn’t do that automatically because it could have adverse effects on tests. As I showed, it’s simple to propagate all system properties if desired.

Of course you can always override the task configuration rule (your first line) for selected tasks. You could potentially save some code by creating those special tasks in a loop.

1 Like