Run specific scenarios identified by names

92 views
Skip to first unread message

Klaus Bayrhammer

unread,
Mar 1, 2012, 8:08:32 AM3/1/12
to cu...@googlegroups.com
Hi,

Is there a way to run specific scenarios in Cucumber-jvm when I want to identify them by their names?

Given the feature-file calc.feature

Feature: Basic Arithmetic
  Background: A Calculator
    Given a calculator I just turned on

  Scenario: Addition
    # Try to change one of the values below to provoke a failure
    When I add 4 and 5
    Then the result is 9

  Scenario: AnotherAddition
    # Try to change one of the values below to provoke a failure
    When I add 4 and 7
    Then the result is 11

Can I run the scenario "Another Addition" with a command like Main.main("features/calc.feature#AnotherAddition"). I know there is a way to run specific line numbers of a feature but they are likely to be changed so I would prefer a mechanism to identify scenarios by their names.

Greets Klaus


aslak hellesoy

unread,
Mar 1, 2012, 8:24:22 AM3/1/12
to cu...@googlegroups.com
On Thu, Mar 1, 2012 at 1:08 PM, Klaus Bayrhammer
<klaus.ba...@inso.tuwien.ac.at> wrote:
> Hi,
>
> Is there a way to run specific scenarios in Cucumber-jvm when I want to
> identify them by their names?
>

Not yet: https://github.com/cucumber/cucumber-jvm/issues/233

> Given the feature-file calc.feature
>
> Feature: Basic Arithmetic
>   Background: A Calculator
>     Given a calculator I just turned on
>
>   Scenario: Addition
>     # Try to change one of the values below to provoke a failure
>     When I add 4 and 5
>     Then the result is 9
>
>   Scenario: AnotherAddition
>     # Try to change one of the values below to provoke a failure
>     When I add 4 and 7
>     Then the result is 11
>
> Can I run the scenario "Another Addition" with a command
> like Main.main("features/calc.feature#AnotherAddition"). I know there is a
> way to run specific line numbers of a feature but they are likely to be
> changed so I would prefer a mechanism to identify scenarios by their names.
>
> Greets Klaus
>
>

> --
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/cukes/-/50dNQTp52MgJ.
> 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
> http://groups.google.com/group/cukes?hl=en.

Chuck van der Linden

unread,
Mar 1, 2012, 12:01:11 PM3/1/12
to cu...@googlegroups.com


On Thursday, March 1, 2012 5:24:22 AM UTC-8, Aslak Hellesøy wrote:
On Thu, Mar 1, 2012 at 1:08 PM, Klaus Bayrhammer
<klaus.ba...@inso.tuwien.ac.at> wrote:
> Hi,
>
> Is there a way to run specific scenarios in Cucumber-jvm when I want to
> identify them by their names?
>

Not yet: https://github.com/cucumber/cucumber-jvm/issues/233

In the meantime as a workaround, could he use tags?  is that supported on the JVM side?

Rob Crawford

unread,
Mar 1, 2012, 12:05:02 PM3/1/12
to cu...@googlegroups.com
Tags are supported in cucumber-jvm.

--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cukes/-/UjUuZ2t0Zo8J.

David Kowis

unread,
Mar 1, 2012, 12:05:56 PM3/1/12
to cu...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/01/2012 11:01 AM, Chuck van der Linden wrote:


>
>
> On Thursday, March 1, 2012 5:24:22 AM UTC-8, Aslak Helles�y wrote:
>
> On Thu, Mar 1, 2012 at 1:08 PM, Klaus Bayrhammer
> <klaus.ba...@inso.tuwien.ac.at

> <mailto:klaus.ba...@inso.tuwien.ac.at>> wrote:
>> Hi,
>>
>> Is there a way to run specific scenarios in Cucumber-jvm when I
> want to
>> identify them by their names?
>>
>
> Not yet: https://github.com/cucumber/cucumber-jvm/issues/233
> <https://github.com/cucumber/cucumber-jvm/issues/233>
>
> In the meantime as a workaround, could he use tags? is that
> supported on the JVM side?

Certainly. Either through a tags="" option in an @Feature annotation
in JUnit or through using -t on the cli.

- --
David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQGcBAEBAgAGBQJPT6x0AAoJEMnf+vRw63ObMFkL/Av4DbhSVSMNqgYpATCvFZan
jg3VPcHg2QWdT/pJdAlfWxMfTlS9W4NasQMww9CEq/3/3yJTAeHzXjD2hwylK06b
rBqbTIvB5soLErpKcDG37LO4IkJUrQk26EMRZVAs8kW/UzTEnw2jLTVOwFDlGjC/
pT5bhfPHB0UEe8NYojCABenb5HKqYxJhuBNlwVY74zH1UV9ezC6wffFLeiNS3R6y
BRQ0u2BkjGi6JjysydwbYnpYz6HEy3uAEDl7t0uaPDRAOj4H+3Ykhr7mExdgFtus
GfpIgu7kSjewSk8fZTbnWa7cKPYH2ZG08AFqgMk+3PlPS/AHHy8Kp9KlongtooCC
iGVF3VZx0rmCnRTfljtqrbsOrjzOKZYGypvvf+TmzGctKTomLVeHEqh/57vhcLvv
5vgaoIXqzj+0RgVOJ3/oxAm+r4XImj/x8O0rT3opahP94eBa35Wp0bRtSL/Sy/7u
NbiMcjOo9rOPpK9R51LlQvgV22WyOBU+oGZ5gUUklA==
=XYmM
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages