Closed chrisjowen closed 7 years ago
Hi,
Apologies for the delay, I'll take a look at this and another request over the weekend. Hopefully ship a new version.
Regards, Mike
On 2016-12-02 14:12, Chris Owen wrote:
Hi,
I am having trouble passing JVM arguments via:
sbt -DsomeArg=someVal cucumber
The argument is lost, as a quick test I added the following to my steps:
Before() { scenario => println("OPTS:::::") println(System.getProperty("someArg")) }
Which results in null. Similar tests work with sbt run etc
Cheers, Chris
-- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or mute the thread [2].
*
Links:
[1] https://github.com/lewismj/cucumber/issues/21 [2] https://github.com/notifications/unsubscribe-auth/AOfhDniLRnq9pK1DeDz8oLBounSQTxeoks5rECdqgaJpZM4LClzf
Delay? I literally asked this 4 mins ago, I wouldn't call that a delay :)
I think this should be an easy fix:
val runtimeMXBean = ManagementFactory.getRuntimeMXBean
import scala.collection.JavaConversions._
val args = runtimeMXBean.getInputArguments.toList
Gets me the arguments passed in. I'll do that fix in the next couple of hours.
The cucumber-plugin should now pass through the JVM arguments. Will look at the runner too, basically two ways Cucumber can be invoked, one through its own command 'sbt cucumber' the other is hooking into the "JUnit" test frameworks. I need to check the later. But, if you are using 'sbt cucumber' that should now pass through arguments fine and return error on failing test. Checked into master, may take a bit of time to hit Maven.
Your a star :)
No worries, like the other one, I'll leave the open issue for a day or two in case of problems, then I'll close it down.
for 0.1.4 I still have this issue could you please help?
Will take a look this evening, can generate a new release if required.
Just wondering, I guess "sbt -DsomeArg=someVal test" on the runner doesn't work? The plugin creates its own JVM for the new command. The runner hooks into the test framework..., will investigate.
I tried many ways sbt "-DsomeArg=someVal cucumber --tags @debug" sbt -DsomeArg=someVal "cucumber --tags @debug" sbt -DsomeArg=someVal cucumber
none of them works however in CI, where we lunch it with with java & teamcity cucumber plugin, flags are passed
@lewismj hey, I have plugin v0.1.6 and facing the exact same issue. Im passing in -Dbrowser and getProperty is returning null. Im using scala 2.11
Finally, getting a chance to look at this today. Busy at work Mifid2 :(
Looking first at the Runner, if I do:
tangaroa:example lewismj$ export K="2049"
and the run sbt test
with println(System.getenv("K"))
in one of the steps, I can see that the env is picked up:
Feature: Multiplication In order to avoid making mistakes As a dummy I want to multiply numbers
@my-test Scenario: Multiply two variables # Multiplication.feature:7 2049 Given a variable x with value 2 # MultiplicationSteps.scala:44 And a variable y with value 3 # MultiplicationSteps.scala:49 When I multiply x * y # MultiplicationSteps.scala:53 Then I get 6 # MultiplicationSteps.scala:57
1 Scenarios (1 passed) 4 Steps (4 passed) 0m0.117s
Which I think is fine for the runner (running tests as a JUnit framework), I will look at the standalone plugin...
For the next (sbt 1.0) version of the plugin (not the runner) you can override the environment variables by setting an 'envProperties' flag, e.g.
CucumberPlugin.envProperties := Map("K"->"2049")
The runner documentation and plugin doc should show how to filter by tags.
e.g.
sbt "cucumber --tags ~@my-tag"
Will be a few hours before its checked in and published.
n.b. Unfortunately the SBT interface has changed so the next version of the plugin will be SBT 1.0.2 only.
Hi,
I am having trouble passing JVM arguments via:
sbt -DsomeArg=someVal cucumber
The argument is lost, as a quick test I added the following to my steps:
Which results in
null
. Similar tests work with sbt run etcCheers, Chris