vendredi 27 octobre 2017

How do I set a different system property for each jmv gradle spawns when testing in parallel?

Gradle allows me to start multiple jvms for testing like so:

test {
   maxParallelForks = 10
}

Some of the tests for an application I have requires a fake ftp server which needs a port. This is quite easy to do with one jvm:

test {
   systemProperty 'ftpPort', 10000
}

However, when running in parallel I would need to start 10 fake ftp servers. How do I add a custom system property for each jvm spawned by gradle?

Something like:

test {
   maxParallelForks 10
   customizeForks { index ->
       systemProperty 'ftpPort', 10000 + index
   }
}

Aucun commentaire:

Enregistrer un commentaire