Have you tried (in build.gradle):
test {
systemProperties = System.properties
}The system properties are null for tests by default. You can override that with something like above. david From: Luke Daley [mailto:[email protected]] Sent: Wednesday, September 07, 2011 5:06 AM To: [email protected] Subject: Re: [gradle-user] Re: system properties for a test task Brett, Any chance you could provide a small gradle build that exhibits this behaviour? I am having trouble reproducing this behaviour. On 07/09/2011, at 10:20 AM, Brett Cave wrote: On Wed, Sep 7, 2011 at 6:36 AM, Peter Niederwieser <[email protected]<mailto:[email protected]>> wrote: Brett Cave wrote: > > The only way I can get it to work currently is by doing: > allJvmArgs = [ "-DtargetHost=" + > System.getProperty("targetHost","localhost") ] > Very strange. Are you sure that the tests were actually run when you perceived these problems? Yes. The reason is that I use the following snippet in a base test class: String host = System.getProperty("targetHost"); if (host == null || "".equals(host) { Assert.fail("targetHost not set"); } The test fails with the assertion printed out. Brett -- Peter Niederwieser Principal Engineer, Gradleware http://gradleware.com<http://gradleware.com/> Creator, Spock Framework http://spockframework.org<http://spockframework.org/> Twitter: @pniederw -- View this message in context: http://gradle.1045684.n5.nabble.com/system-properties-for-a-test-task-tp4754300p4777196.html Sent from the gradle-user mailing list archive at Nabble.com<http://Nabble.com>. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email -- Luke Daley Principal Engineer, Gradleware http://gradleware.com
