Hi,

I have a custom test task that runs a test class. the task definition is as
follows:
task myTest(type: Test) {
   systemProperties "targetHost":
System.getProperty("targetHost","localhost")
  include '**/MyTest.*'
}

The test class (java) checks for variables, using
System.getProperty("targetHost") in an @BeforeClass method, failing if they
are null or empty ("")

Gradle is executed without explicitly setting these variables via -D - so i
had an error there, but using a default value on the System.getProperty
should set it. I have added in a println
System.getProperty("targetHost","-manual-") and confirmed that when the test
task runs, a default value is returned from System.getProperty.

The test was previously working, and stopped recently, I am not sure why -
anything obvious I am overlooking? If I set the properties via allJvmArgs =
[ "-DtargetHost=localhost" ] the test runs as expected, only when setting
systemProperties do the properties not get set on the test.


-- 


Brett Cave
Jemstep, Inc

www.jemstep.com

Reply via email to