[JVM] Commandline cucumber.options not overriding Junit @Cucumber.Options for features

547 views
Skip to first unread message

Matt Seashore

unread,
Sep 12, 2013, 4:00:44 PM9/12/13
to cu...@googlegroups.com
I'm running Cucumber JVM 1.1.2 and I have a Junit class with the Cucumbers Options annotation to run all features like this:
@Cucumber.Options( features={"src/test/resources"} )

However, when developing new features I usually only want to run one feature file. To do this, I want to override cucumber options on the command line to just run one feature file, like this:
-Dcucumber.options="src\test\resources\myfeature.feature"

What I see is that the -Dcucumber.options parameter only works if I *remove* the 'features' options from the @Cucumber.Options annotation. From the Googling I've done it appears that the new features should override all Cucumber.Options values (https://github.com/cucumber/cucumber-jvm/commit/3f470c8c00d91268eff374c783ccc05b86168108).

Is the behavior I'm seeing where the command line specified features files don't override the Java annotation features correct?  Are there other things I should check or things I might be doing wrong?

Thanks much for your time,

Matt

Björn Rasmusson

unread,
Sep 13, 2013, 3:04:37 AM9/13/13
to cu...@googlegroups.com
Matt Seashore wrote:
I'm running Cucumber JVM 1.1.2 and I have a Junit class with the Cucumbers Options annotation to run all features like this:
@Cucumber.Options( features={"src/test/resources"} )

However, when developing new features I usually only want to run one feature file. To do this, I want to override cucumber options on the command line to just run one feature file, like this:
-Dcucumber.options="src\test\resources\myfeature.feature"

What I see is that the -Dcucumber.options parameter only works if I *remove* the 'features' options from the @Cucumber.Options annotation. From the Googling I've done it appears that the new features should override all Cucumber.Options values (https://github.com/cucumber/cucumber-jvm/commit/3f470c8c00d91268eff374c783ccc05b86168108).

From what I can see in the code, this behavior was changed a year ago (in v1.1.1 I think, commit: https://github.com/cucumber/cucumber-jvm/commit/604cd43d891a98a6ecf3a94e8f7116a47a94ba29). I would seem that Cucumber.Options values are always used, and the command line properties are amending to or overriding each individual option (options that only can have one value are overridden, and options which can have list of values are amended to). In case of the feature paths you would end up will the list {"src/test/resources", "src\test\resources\myfeature.feature"}, which of course is the same as {"src/test/resources"}.

If this change in overriding semantic of Cucumber.Options was really intentional, I don't know, the Java-Helloworld Readme you are referring to suggest it was not intentional.

Best regards
Björn
 

aslak hellesoy

unread,
Sep 13, 2013, 4:29:09 AM9/13/13
to Cucumber Users
On Fri, Sep 13, 2013 at 8:04 AM, Björn Rasmusson <bj.ras...@gmail.com> wrote:
Matt Seashore wrote:
I'm running Cucumber JVM 1.1.2 and I have a Junit class with the Cucumbers Options annotation to run all features like this:
@Cucumber.Options( features={"src/test/resources"} )

However, when developing new features I usually only want to run one feature file. To do this, I want to override cucumber options on the command line to just run one feature file, like this:
-Dcucumber.options="src\test\resources\myfeature.feature"

What I see is that the -Dcucumber.options parameter only works if I *remove* the 'features' options from the @Cucumber.Options annotation. From the Googling I've done it appears that the new features should override all Cucumber.Options values (https://github.com/cucumber/cucumber-jvm/commit/3f470c8c00d91268eff374c783ccc05b86168108).

From what I can see in the code, this behavior was changed a year ago (in v1.1.1 I think, commit: https://github.com/cucumber/cucumber-jvm/commit/604cd43d891a98a6ecf3a94e8f7116a47a94ba29). I would seem that Cucumber.Options values are always used, and the command line properties are amending to or overriding each individual option (options that only can have one value are overridden, and options which can have list of values are amended to). In case of the feature paths you would end up will the list {"src/test/resources", "src\test\resources\myfeature.feature"}, which of course is the same as {"src/test/resources"}.

If this change in overriding semantic of Cucumber.Options was really intentional, I don't know, the Java-Helloworld Readme you are referring to suggest it was not intentional.

I think it was intentional, just not well thought through. I have fixed this:


So in the next release things will work as advertised.

Aslak
 

Best regards
Björn
 

Is the behavior I'm seeing where the command line specified features files don't override the Java annotation features correct?  Are there other things I should check or things I might be doing wrong?

Thanks much for your time,

Matt

--
-- 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
---
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Matt Seashore

unread,
Sep 17, 2013, 4:24:59 PM9/17/13
to cu...@googlegroups.com
Cool.  That sounds great!
Reply all
Reply to author
Forward
0 new messages