Discussion:
[Cucumber] not tags and cucumber.options on the command line
Paul Bender
2017-12-08 04:20:03 UTC
Permalink
Hello,

I'm working on upgrading a java project from version cucumber-jvm-1.2.5
to cucumber-jvm-2.0.1. We run a few cucumber tests through the JUnit
runner along with a large suite of JUnit tests.

On the first build after upgrading, I received a warning about "~@tag"
being removed and should be replaced replaced with "not @tag".
Replacing that was no problem where the tag option is specified in the
source code.

Where I am having a problem is that we have been overriding the default
cucumber tag options through maven with a command line such as:

mvn -Dcucumber.options="--tags ~@Ignore" -Dtest=jmri.RunCucumberTest test

which of course spits out the same warning as the ~ in the junit runner
file, but changing that to:

mvn -Dcucumber.options="--tags not @Ignore" -Dtest=jmri.RunCucumberTest test

results in the TagExpressionException below.

So how exactly are we supposed to specify "not tag" on the command line?

Thanks,
Paul


[ERROR] initializationError(jmri.RunCucumberTest) Time elapsed: 0.028 s
<<< ERROR!
io.cucumber.tagexpressions.TagExpressionException: empty stack
at
io.cucumber.tagexpressions.TagExpressionParser.pop(TagExpressionParser.java:76)
at
io.cucumber.tagexpressions.TagExpressionParser.pushExpr(TagExpressionParser.java:91)
at
io.cucumber.tagexpressions.TagExpressionParser.parse(TagExpressionParser.java:65)
at cucumber.runtime.TagPredicate.<init>(TagPredicate.java:28)
at cucumber.runtime.Runtime.<init>(Runtime.java:69)
at cucumber.runtime.Runtime.<init>(Runtime.java:45)
at cucumber.runtime.Runtime.<init>(Runtime.java:41)
at cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:84)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at
org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at
org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:362)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143)
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Marit van Dijk
2017-12-12 19:43:19 UTC
Permalink
Hello Paul,

I think you need to use quotation marks, like so:

mvn test -Dcucumber.options='--tags "@smoke and @fast"'

Regards,
Marit
Post by Paul Bender
Hello,
I'm working on upgrading a java project from version cucumber-jvm-1.2.5
to cucumber-jvm-2.0.1. We run a few cucumber tests through the JUnit
runner along with a large suite of JUnit tests.
Replacing that was no problem where the tag option is specified in the
source code.
Where I am having a problem is that we have been overriding the default
which of course spits out the same warning as the ~ in the junit runner
results in the TagExpressionException below.
So how exactly are we supposed to specify "not tag" on the command line?
Thanks,
Paul
[ERROR] initializationError(jmri.RunCucumberTest) Time elapsed: 0.028 s
<<< ERROR!
io.cucumber.tagexpressions.TagExpressionException: empty stack
at
io.cucumber.tagexpressions.TagExpressionParser.pop(TagExpressionParser.java:76)
at
io.cucumber.tagexpressions.TagExpressionParser.pushExpr(TagExpressionParser.java:91)
at
io.cucumber.tagexpressions.TagExpressionParser.parse(TagExpressionParser.java:65)
at cucumber.runtime.TagPredicate.<init>(TagPredicate.java:28)
at cucumber.runtime.Runtime.<init>(Runtime.java:69)
at cucumber.runtime.Runtime.<init>(Runtime.java:45)
at cucumber.runtime.Runtime.<init>(Runtime.java:41)
at cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:84)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at
org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at
org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at
org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:362)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143)
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Paul Bender
2017-12-13 05:13:42 UTC
Permalink
Post by Marit van Dijk
Hello Paul,
|Thanks, that solved the problem.

I had tried escaping the nested quotes before I sent my initial message,
but I hadn't tried using a different type of quote.


Paul|
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...