Skip to content

com.beust.jcommander.ParameterException: Trouble running test with tags option #266

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
restagner opened this issue Mar 19, 2012 · 7 comments

Comments

@restagner
Copy link

Cucumber-JVM version: 1.0.0.RC21
Modules: cucumber-picocontainer, cucumber-junit & cucumber-html
Executed the following JUnit test:

@RunWith(Cucumber.class)
@Cucumber.Options(features = {"features/"}, glue = {"com.twds.example.stepdefs"}, tags = {"@selenium"})
public class RunExampleTest {
}

Output from test

com.beust.jcommander.ParameterException: Could not read file selenium: java.io.FileNotFoundException: selenium (The system cannot find the file specified)
at com.beust.jcommander.JCommander.readFile(JCommander.java:463)
at com.beust.jcommander.JCommander.expandArgs(JCommander.java:338)
at com.beust.jcommander.JCommander.parse(JCommander.java:274)
at com.beust.jcommander.JCommander.parse(JCommander.java:257)
at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:49)
at cucumber.junit.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:27)
at cucumber.junit.Cucumber.(Cucumber.java:54)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Steps to reproduce

  1. add the 'tags' option to the Cucumber.Options annotation contained in the JUnit class
  2. add a tag to a feature file (place the tag at the scenario level) -- the name of the tag should match the one added in Step 1.
  3. run the test
@aslakhellesoy
Copy link
Contributor

I just ran into the same issue - I'll look into it

@aslakhellesoy
Copy link
Contributor

The culprit is here. It's common for many command line tools to use @ to refer to contents in a file.

We have 3 options:

  1. Patch JCommander and wait for a new release
  2. Don't use JCommander at all

I'll have to think about this.

@aslakhellesoy
Copy link
Contributor

I'll probably get rid of jcommander altogether and parse arguments "manually" again: https://github.com/cucumber/cucumber-jvm/blob/78cc1d9d1f84e89a289cd3f85203000df66099d7/core/src/main/java/cucumber/cli/Main.java

@cbeust
Copy link

cbeust commented Mar 20, 2012

For what it's worth, it would have been trivial for me to make this '@' parameter configurable.

@aslakhellesoy
Copy link
Contributor

@cbeust yeah I figured it would have been easy, but implementing our own parsing turned out to be just as simple :-)

@cbeust
Copy link

cbeust commented Mar 20, 2012

Fair enough :-)

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants