I've managed to get the test task to run my unit tests, but they fail because env properties I am using are not set, eg: String base=System.getenv("TESTNG_BASE_PATH");
So, I've done something like:
tasks.withType(Test) {
systemProperty 'TESTNG_BASE_PATH','long\\path\\to\env\var\value'
}
But I still get the same exception from my code that the file is not found, so its obviously not the right way of doing this.
So how to do this, please?
If you are getting via System.getenv(...)
you'll need to set an environment variable. I've also included a command line flag for switching on/off standard streams
tasks.withType(Test) {
environment 'TESTNG_BASE_PATH','long\\path\\to\env\var\value'
testLogging.showStandardStreams = Boolean.parseBoolean(findProperty('showStandardStreams'))
}
To run you could do
./gradlew check -PshowStandardStreams=true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With