[JVM] Example of using the cucumber.options system property

3,381 views
Skip to first unread message

Robert

unread,
Jun 12, 2012, 10:04:17 AM6/12/12
to cu...@googlegroups.com
I've recently upgraded to cucumber version 1.0.9, and was wondering if someone could provide me with an example of how to use the recently supported cucumber.options system property.  I'd like to use the property from the command line in conjunction with Maven

mvn clean integration-test -Dcucumber.options ???

aslak hellesoy

unread,
Jun 12, 2012, 12:20:09 PM6/12/12
to cu...@googlegroups.com
That's it! I added an example here:

https://github.com/cucumber/cucumber-jvm/commit/3f470c8c00d91268eff374c783ccc05b86168108

Aslak

> -- 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

Robert

unread,
Jun 12, 2012, 3:09:05 PM6/12/12
to cu...@googlegroups.com


On Tuesday, June 12, 2012 9:20:09 AM UTC-7, Aslak Hellesøy wrote:
On Tue, Jun 12, 2012 at 3:04 PM, Robert <rest...@gmail.com> wrote:
> I've recently upgraded to cucumber version 1.0.9, and was wondering if
> someone could provide me with an example of how to use the recently
> supported cucumber.options system property.  I'd like to use the property
> from the command line in conjunction with Maven
>
> mvn clean integration-test -Dcucumber.options ???
>

That's it! I added an example here:

https://github.com/cucumber/cucumber-jvm/commit/3f470c8c00d91268eff374c783ccc05b86168108

Aslak


Aslak,

Excellent!! Thanks.
 

> -- 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+unsubscribe@googlegroups.com. For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en

ae6rt

unread,
Jun 13, 2012, 11:23:55 PM6/13/12
to cu...@googlegroups.com


On Tuesday, June 12, 2012 9:20:09 AM UTC-7, Aslak Hellesøy wrote:
On Tue, Jun 12, 2012 at 3:04 PM, Robert <rest...@gmail.com> wrote:
> I've recently upgraded to cucumber version 1.0.9, and was wondering if
> someone could provide me with an example of how to use the recently
> supported cucumber.options system property.  I'd like to use the property
> from the command line in conjunction with Maven
>
> mvn clean integration-test -Dcucumber.options ???
>

That's it! I added an example here:

https://github.com/cucumber/cucumber-jvm/commit/3f470c8c00d91268eff374c783ccc05b86168108

If I want to simply set a tag to test in cucumber.options, such as indicated by

-Dcucumber.options="--tags @foo"

does this set to empty, say, the glue classpath that would have otherwise been derived and used had I set no cucumber.options whatsoever on the maven command line?

Said another way, does an option omitted from -Dcucumber.options cause that option to be removed from whatever Cucumber-JVM would have normally used had I not specified a -Dcucumber.options property at all?

My experience is showing that you have to include in cucumber.options *all* the options you want to obtain at runtime, and not just the options you want to add or overwrite to whatever set would have obtained had you not specified a cucumber.options at all.



Aslak

> -- 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+unsubscribe@googlegroups.com. For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en

Aslak Hellesøy

unread,
Jun 14, 2012, 3:36:46 AM6/14/12
to cu...@googlegroups.com




On 14 Jun 2012, at 04:23, ae6rt <mspet...@gmail.com> wrote:



On Tuesday, June 12, 2012 9:20:09 AM UTC-7, Aslak Hellesøy wrote:
On Tue, Jun 12, 2012 at 3:04 PM, Robert <rest...@gmail.com> wrote:
> I've recently upgraded to cucumber version 1.0.9, and was wondering if
> someone could provide me with an example of how to use the recently
> supported cucumber.options system property.  I'd like to use the property
> from the command line in conjunction with Maven
>
> mvn clean integration-test -Dcucumber.options ???
>

That's it! I added an example here:

https://github.com/cucumber/cucumber-jvm/commit/3f470c8c00d91268eff374c783ccc05b86168108

If I want to simply set a tag to test in cucumber.options, such as indicated by

-Dcucumber.options="--tags @foo"

does this set to empty, say, the glue classpath that would have otherwise been derived and used had I set no cucumber.options whatsoever on the maven command line?


Yes.

Said another way, does an option omitted from -Dcucumber.options cause that option to be removed from whatever Cucumber-JVM would have normally used had I not specified a -Dcucumber.options property at all?


Yes.

My experience is showing that you have to include in cucumber.options *all* the options you want to obtain at runtime, and not just the options you want to add or overwrite to whatever set would have obtained had you not specified a cucumber.options at all.


Correct, and I believe this is mentioned in the README above.

The reason it works that way is that it's hard to know whether to append to or replace existing individual options.

People may want both replace and append, and it wouldn't be intuitive to know what's actually happening. So currently it's all or nothing.

I'm open to suggestions.

Aslak


Aslak

> -- 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

-- 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

ae6rt

unread,
Jun 14, 2012, 9:38:53 AM6/14/12
to cu...@googlegroups.com


On Thursday, June 14, 2012 12:36:46 AM UTC-7, Aslak Hellesøy wrote:




On 14 Jun 2012, at 04:23, ae6rt <mspet...@gmail.com> wrote:



On Tuesday, June 12, 2012 9:20:09 AM UTC-7, Aslak Hellesøy wrote:
On Tue, Jun 12, 2012 at 3:04 PM, Robert <rest...@gmail.com> wrote:
> I've recently upgraded to cucumber version 1.0.9, and was wondering if
> someone could provide me with an example of how to use the recently
> supported cucumber.options system property.  I'd like to use the property
> from the command line in conjunction with Maven
>
> mvn clean integration-test -Dcucumber.options ???
>

That's it! I added an example here:

https://github.com/cucumber/cucumber-jvm/commit/3f470c8c00d91268eff374c783ccc05b86168108

If I want to simply set a tag to test in cucumber.options, such as indicated by

-Dcucumber.options="--tags @foo"

does this set to empty, say, the glue classpath that would have otherwise been derived and used had I set no cucumber.options whatsoever on the maven command line?


Yes.

Said another way, does an option omitted from -Dcucumber.options cause that option to be removed from whatever Cucumber-JVM would have normally used had I not specified a -Dcucumber.options property at all?


Yes.

My experience is showing that you have to include in cucumber.options *all* the options you want to obtain at runtime, and not just the options you want to add or overwrite to whatever set would have obtained had you not specified a cucumber.options at all.


Correct, and I believe this is mentioned in the README above.

The reason it works that way is that it's hard to know whether to append to or replace existing individual options.

People may want both replace and append, and it wouldn't be intuitive to know what's actually happening. So currently it's all or nothing.

I'm open to suggestions.

CucumberJVM does a good job of doing the right thing when no cucumber.options are specified.  For example, it develops the messy glue path and classpath.  It would be nice to leverage all it does right with the ability to selectively replace and append by specifying the replacements or appends with a -D system property.  

Maybe -Dcucumber.overlay="--tags @foo"?  Unless you want to change your current meaning for cucumber.options to mean replace and append.  I understand your point about making it clear what an option does.


 

Aslak


Aslak

> -- 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

-- 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+unsubscribe@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en

ae6rt

unread,
Jun 16, 2012, 11:38:56 AM6/16/12
to cu...@googlegroups.com
Here is how I'm selecting tags to run until there is a more elegant way.  Modifying my POM only, I have a property

    <properties>
        <tags>~@IgnoreThisHighlyUnlikelyTagName_0987654321f0464ffeb7327746e9065b1823c377f4</tags>
    </properties>

which seeks by default to ignore a tag I know does not exist and will probably never exist.  

And I have this complementary property defined in my surefire plugin config:

                    <configuration>
                        <systemProperties>
                            <property>
                                <name>cucumber.options</name>
                                <value>--tags ${tags} --format pretty --monochrome --glue classpath:com/foo/qa/cuke/steps classpath:com/foo/qa/cuke/steps</value>
                            </property>
                        </systemProperties>
                    </configuration>

You can run all tags with

mvn clean test 

or one or more tags with

mvn clean test -Dtags="@foo,@bar"

So far this seems to be working for me.
Reply all
Reply to author
Forward
0 new messages