5

I would like to pass JVM parameters to my Gradle test task. I use the parameters in a Cucumber feature file: ${app.url}. In the build.gradle file, I put those lines:

test {
    testLogging.showStandardStreams = true
    systemProperties System.getProperties()
}

When I execute gradle test -Dapp.url=http://....., I don't see the parameter was passed to the application. I also tried the below, but the result is the same:

test {
    testLogging.showStandardStreams = true
    systemProperty "app.url", System.getProperty("app.url")
}

When I use Maven and pass the same parameters as Jvm arguments, it works fine. Now I would like to switch to the Gradle, but I am stuck with passing parameters.

Vampire
  • 35,631
  • 4
  • 76
  • 102
Softengilker
  • 173
  • 1
  • 3
  • 11
  • I just tested and it works fine here. Can you provide an [MCVE](http://stackoverflow.com/help/mcve)? – Vampire Jun 27 '17 at 10:39

1 Answers1

0

gradle is having -P or --project-prop option. Try this one and see.

-P, --project-prop Set project property for the build script

  • How should that help at all? Setting system properties on the Gradle process is fine. Setting the properties as project properties does not help at all in resolving the question of the OP at all. – Vampire Jun 27 '17 at 09:49