[JVM Cucumber] How do I set multiple values for format and tag options when using CLI runner?

1,855 views
Skip to first unread message

Ayoseg

unread,
Dec 16, 2012, 2:11:06 PM12/16/12
to cu...@googlegroups.com
I use the following when using JUnit runner
@Cucumber.Options( tags= {"@test1", "@test2"}, glue = "uk.co.mycompany.myStepsDef", format= {"pretty", "html:target/cucumber", "json:target/cucumber.json"})

When running test using CLI, this works
java -jar myjarfile.jarĀ classpath:uk/co/mycompany/features --glueĀ classpath:uk/co/mycompany/myStepsDef --tags @test1 --formatĀ html:target/cucumber

however, how do I add or specify more tags and features?Ā 
So I want -- tags @test1 @test2 --formatĀ pretty html:target/cucumber json:target/cucumber.json
I have tried using comma to separate the option values, but it didn't work.

Robert

unread,
Dec 16, 2012, 10:33:57 PM12/16/12
to cu...@googlegroups.com


On Sunday, December 16, 2012 11:11:06 AM UTC-8, Ayoseg wrote:
I use the following when using JUnit runner
@Cucumber.Options( tags= {"@test1", "@test2"}, glue = "uk.co.mycompany.myStepsDef", format= {"pretty", "html:target/cucumber", "json:target/cucumber.json"})

When running test using CLI, this works
java -jar myjarfile.jarĀ classpath:uk/co/mycompany/features --glueĀ classpath:uk/co/mycompany/myStepsDef --tags @test1 --formatĀ html:target/cucumber

however, how do I add or specify more tags and features?Ā 
So I want -- tags @test1 @test2 --formatĀ pretty html:target/cucumber json:target/cucumber.json

try the following for tags

--tags @test1 --tags @test2

I'm not too clear on how to run multiple features.

Ayoseg

unread,
Dec 17, 2012, 4:25:18 AM12/17/12
to cu...@googlegroups.com
Roberts, I tried Ā --tags @test1 --tags@test2, unfortunately, it Ā didn't work. I got an exception.

I managed to get it working by using comma with no space, so --tags @test1,@test2 worked. With the format values, I got that to work as well using : Ā --format html:target/cucumber --format json:target/cucumber.json.

To run multiple features, you do not need to use the tags option, just give the classpath to the folder containing your feature files, it will run all the feature files in that classpath.

Thanks
Ayoseg

aslak hellesoy

unread,
Dec 17, 2012, 5:35:36 AM12/17/12
to Cucumber Users
On Mon, Dec 17, 2012 at 9:25 AM, Ayoseg <seg...@hotmail.com> wrote:
Roberts, I tried Ā --tags @test1 --tags@test2, unfortunately, it Ā didn't work. I got an exception.


What exception?
Ā 
I managed to get it working by using comma with no space, so --tags @test1,@test2 worked.

That's a logical OR. SeeĀ https://github.com/cucumber/cucumber/wiki/TagsĀ for an explanation of tag boolean logic.
Ā 
With the format values, I got that to work as well using : Ā --format html:target/cucumber --format json:target/cucumber.json.

To run multiple features, you do not need to use the tags option, just give the classpath to the folder containing your feature files, it will run all the feature files in that classpath.

Thanks
Ayoseg


On Monday, 17 December 2012 03:33:57 UTC, Robert wrote:


On Sunday, December 16, 2012 11:11:06 AM UTC-8, Ayoseg wrote:
I use the following when using JUnit runner
@Cucumber.Options( tags= {"@test1", "@test2"}, glue = "uk.co.mycompany.myStepsDef", format= {"pretty", "html:target/cucumber", "json:target/cucumber.json"})

When running test using CLI, this works
java -jar myjarfile.jarĀ classpath:uk/co/mycompany/features --glueĀ classpath:uk/co/mycompany/myStepsDef --tags @test1 --formatĀ html:target/cucumber

however, how do I add or specify more tags and features?Ā 
So I want -- tags @test1 @test2 --formatĀ pretty html:target/cucumber json:target/cucumber.json

try the following for tags

--tags @test1 --tags @test2

I'm not too clear on how to run multiple features.
Ā 
I have tried using comma to separate the option values, but it didn't work.

--
-- Rules --
Ā 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
Ā 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Ā 
Ā 

Ayoseg

unread,
Dec 17, 2012, 7:31:14 AM12/17/12
to cu...@googlegroups.com


On Monday, 17 December 2012 10:35:36 UTC, Aslak HellesĆøy wrote:



On Mon, Dec 17, 2012 at 9:25 AM, Ayoseg <seg...@hotmail.com> wrote:
Roberts, I tried Ā --tags @test1 --tags@test2, unfortunately, it Ā didn't work. I got an exception.


What exception?

Ā Exception in thread "main" cucumber.runtime.CucumberException: None of the featuresĀ 
at [classpath:uk/co/mycompany/features] matched the filters: [@test1, @test2]
Ā  Ā  Ā  Ā  at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:45)
Ā  Ā  Ā  Ā  at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:93)
Ā  Ā  Ā  Ā  at cucumber.runtime.Runtime.run(Runtime.java:81)
Ā  Ā  Ā  Ā  at cucumber.cli.Main.run(Main.java:20)
Ā  Ā  Ā  Ā  at cucumber.cli.Main.main(Main.java:12)

Please note that I am using tags to select which feature files to run, not scenarios on this occasion

aslak hellesoy

unread,
Dec 17, 2012, 8:23:23 AM12/17/12
to Cucumber Users
On Mon, Dec 17, 2012 at 12:31 PM, Ayoseg <seg...@hotmail.com> wrote:


On Monday, 17 December 2012 10:35:36 UTC, Aslak HellesĆøy wrote:



On Mon, Dec 17, 2012 at 9:25 AM, Ayoseg <seg...@hotmail.com> wrote:
Roberts, I tried Ā --tags @test1 --tags@test2, unfortunately, it Ā didn't work. I got an exception.


What exception?

Ā Exception in thread "main" cucumber.runtime.CucumberException: None of the featuresĀ 
at [classpath:uk/co/mycompany/features] matched the filters: [@test1, @test2]
Ā  Ā  Ā  Ā  at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:45)
Ā  Ā  Ā  Ā  at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:93)
Ā  Ā  Ā  Ā  at cucumber.runtime.Runtime.run(Runtime.java:81)
Ā  Ā  Ā  Ā  at cucumber.cli.Main.run(Main.java:20)
Ā  Ā  Ā  Ā  at cucumber.cli.Main.main(Main.java:12)

Please note that I am using tags to select which feature files to run, not scenarios on this occasion

Technically speaking you can't "run" a feature. A feature is just a grouping of scenarios. Only scenarios can be "run".
A scenario carries the tags placed on the scenario, plus any tags placed on the enclosing feature.

In your case, nothing matched because no scenarios are tagged with @test1 AND @test2.

Aslak
Reply all
Reply to author
Forward
0 new messages