How can I pass JVM system properties on to my tests?

Ray Nicholus picture Ray Nicholus · Apr 12, 2011 · Viewed 15.2k times · Source

I have the following task

task testGeb(type:Test) {
   jvmArgs '-Dgeb.driver=firefox'
   include "geb/**/*.class"
   testReportDir = new File(testReportDir, "gebtests")
}

The system property doesn't appear to make it to the Geb tests, as Geb does not spawn Firefox to run the tests. When I set the same system property in Eclipse and run the tests, everything works fine.

Answer

Nikita Skvortsov picture Nikita Skvortsov · Apr 13, 2011

Try using system properties:

test {
   systemProperties['geb.driver'] = 'firefox'
   include "geb/**/*.class"
   testReportDir = new File(testReportDir, "gebtests")
}