Tuesday, November 7, 2017

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

Leave a Comment

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    } } 

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment