7

I am using Selenium and Spock for testing my application. Running tests that need System properties from Maven or my IDE works like a charm, but Gradle is getting null values.

@Shared
private int waitTimeout = System.getProperty("waitTimeout", "10").toInteger()

@Shared
protected String apolloURL = System.getProperty("apolloURL")

Maybe I am doing something wrong?

bdkosher
  • 5,753
  • 2
  • 33
  • 40
IowA
  • 966
  • 1
  • 11
  • 25

1 Answers1

15

See Test task type in the Gradle Build Language Reference.

test {
    systemProperty "waitTimeout", "20"
    systemProperty "apolloURL", "..."
}
Peter Niederwieser
  • 121,412
  • 21
  • 324
  • 259
  • 2
    If you're using junit 5, you may also encounter this issue and need its workaround: https://stackoverflow.com/a/41334739/57357 – Dan Tanner Feb 20 '18 at 20:14