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?
Using the -D command-line option, you can pass a system property to the JVM which runs Gradle. The -D option of the gradle command has the same effect as the -D option of the java command. You can also set system properties in gradle. properties files with the prefix systemProp.
Parallel execution Yet Gradle will only run one task at a time by default, regardless of the project structure (this will be improved soon). By using the --parallel switch, you can force Gradle to execute tasks in parallel as long as those tasks are in different projects.
Run Gradle testsIn your Gradle project, in the editor, create or select a test to run. From the context menu, select Run <test name>. icon in the left gutter. If you selected the Choose per test option, IntelliJ IDEA displays both Gradle and JUnit test runners for each test in the editor.
See Test
task type in the Gradle Build Language Reference.
test {
systemProperty "waitTimeout", "20"
systemProperty "apolloURL", "..."
}
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