Cucumber-JVM: Tags and the commandline

1,269 views
Skip to first unread message

Robert

unread,
Aug 31, 2011, 7:46:28 AM8/31/11
to cu...@googlegroups.com
At this stage in the development of cucumber-jvm, does it support passing tags in from the commandline?  I'm looking for something equivalent to the existing Cuke4Duke functionality whereby you can supply -DcukeArgs="--tags @foo" from the commandline

aslak hellesoy

unread,
Aug 31, 2011, 7:55:04 AM8/31/11
to cu...@googlegroups.com
On Wed, Aug 31, 2011 at 12:46 PM, Robert <rest...@gmail.com> wrote:
At this stage in the development of cucumber-jvm, does it support passing tags in from the commandline?  I'm looking for something equivalent to the existing Cuke4Duke functionality whereby you can supply -DcukeArgs="--tags @foo" from the commandline


However, the CLI is still a little clunky. Try out the JRuby example to see some of its warts:

Aslak

--
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/-/fwTnsaONf28J.
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.

Robert

unread,
Aug 31, 2011, 9:44:56 AM8/31/11
to cu...@googlegroups.com


On Wednesday, August 31, 2011 4:55:04 AM UTC-7, Aslak Hellesøy wrote:


On Wed, Aug 31, 2011 at 12:46 PM, Robert <rest...@gmail.com> wrote:
At this stage in the development of cucumber-jvm, does it support passing tags in from the commandline?  I'm looking for something equivalent to the existing Cuke4Duke functionality whereby you can supply -DcukeArgs="--tags @foo" from the commandline


However, the CLI is still a little clunky. Try out the JRuby example to see some of its warts:

Aslak


Hi Aslak,

Thanks for the pointers!!  I've read the contents contained in each link and successfully used the information in the README.md file to run the JRuby example contained in the cucumber-jvm source.

So, I went ahead and took a stab at trying to run my project, which has been created using Eclipse.  However, when I attempt to run my feature file via the CLI, it simply echoes back the feature file contents and some suggestions for step definitions.  The odd thing is that I've implemented the step definitions, so I would expect the tests to run.  I'm pretty sure that I'm doing something wrong.  Here is the CLI command I'm using

java -classpath src/test/resources:/home/restagner/.m2/repository/info/cukes/cucumber-picocontainer/1.0.0-SNAPSHOT/cucumber-picocontainer-1.0.0-SNAPSHOT-full.jar cucumber.cli.Main --glue cucumber/runtime hello.feature

I am executing this from within my project's directory.  And, the output returned is

Feature: My hello feature

  Scenario: Saying hello                    # hello.feature:3
    Given a precondition
    When an action takes place
    Then the expected behavior is displayed

  @foo
  Scenario: A tagged scenario                        # hello.feature:9
    Given a tag
    When an action takes place for a tagged scenario
    Then the result is shown

You can implement missing steps with the snippets below:

@Given("^a precondition$")
public void a_precondition() {
    // Express the Regexp above with the code you wish you had
}

@Given("^a tag$")
public void a_tag() {
    // Express the Regexp above with the code you wish you had
}

@Then("^the expected behavior is displayed$")
public void the_expected_behavior_is_displayed() {
    // Express the Regexp above with the code you wish you had
}

@Then("^the result is shown$")
public void the_result_is_shown() {
    // Express the Regexp above with the code you wish you had
}

@When("^an action takes place$")
public void an_action_takes_place() {
    // Express the Regexp above with the code you wish you had
}

@When("^an action takes place for a tagged scenario$")
public void an_action_takes_place_for_a_tagged_scenario() {
    // Express the Regexp above with the code you wish you had
}

aslak hellesoy

unread,
Aug 31, 2011, 9:48:06 AM8/31/11
to cu...@googlegroups.com
On Wed, Aug 31, 2011 at 2:44 PM, Robert <rest...@gmail.com> wrote:


On Wednesday, August 31, 2011 4:55:04 AM UTC-7, Aslak Hellesøy wrote:


On Wed, Aug 31, 2011 at 12:46 PM, Robert <rest...@gmail.com> wrote:
At this stage in the development of cucumber-jvm, does it support passing tags in from the commandline?  I'm looking for something equivalent to the existing Cuke4Duke functionality whereby you can supply -DcukeArgs="--tags @foo" from the commandline


However, the CLI is still a little clunky. Try out the JRuby example to see some of its warts:

Aslak


Hi Aslak,

Thanks for the pointers!!  I've read the contents contained in each link and successfully used the information in the README.md file to run the JRuby example contained in the cucumber-jvm source.

So, I went ahead and took a stab at trying to run my project, which has been created using Eclipse.  However, when I attempt to run my feature file via the CLI, it simply echoes back the feature file contents and some suggestions for step definitions.  The odd thing is that I've implemented the step definitions, so I would expect the tests to run.  I'm pretty sure that I'm doing something wrong.  Here is the CLI command I'm using

java -classpath src/test/resources:/home/restagner/.m2/repository/info/cukes/cucumber-picocontainer/1.0.0-SNAPSHOT/cucumber-picocontainer-1.0.0-SNAPSHOT-full.jar cucumber.cli.Main --glue cucumber/runtime hello.feature


--glue should point to the package where your own stepdefs are defined.
 
To view this discussion on the web visit https://groups.google.com/d/msg/cukes/-/xiTXxNSxJPQJ.

Robert

unread,
Sep 1, 2011, 8:14:23 AM9/1/11
to cu...@googlegroups.com


On Wednesday, August 31, 2011 6:48:06 AM UTC-7, Aslak Hellesøy wrote:


On Wed, Aug 31, 2011 at 2:44 PM, Robert <rest...@gmail.com> wrote:


On Wednesday, August 31, 2011 4:55:04 AM UTC-7, Aslak Hellesøy wrote:


On Wed, Aug 31, 2011 at 12:46 PM, Robert <res...@gmail.com> wrote:
At this stage in the development of cucumber-jvm, does it support passing tags in from the commandline?  I'm looking for something equivalent to the existing Cuke4Duke functionality whereby you can supply -DcukeArgs="--tags @foo" from the commandline


However, the CLI is still a little clunky. Try out the JRuby example to see some of its warts:

Aslak


Hi Aslak,

Thanks for the pointers!!  I've read the contents contained in each link and successfully used the information in the README.md file to run the JRuby example contained in the cucumber-jvm source.

So, I went ahead and took a stab at trying to run my project, which has been created using Eclipse.  However, when I attempt to run my feature file via the CLI, it simply echoes back the feature file contents and some suggestions for step definitions.  The odd thing is that I've implemented the step definitions, so I would expect the tests to run.  I'm pretty sure that I'm doing something wrong.  Here is the CLI command I'm using

java -classpath src/test/resources:/home/restagner/.m2/repository/info/cukes/cucumber-picocontainer/1.0.0-SNAPSHOT/cucumber-picocontainer-1.0.0-SNAPSHOT-full.jar cucumber.cli.Main --glue cucumber/runtime hello.feature


--glue should point to the package where your own stepdefs are defined.


I've had some luck using the CLI.  After adding the proper package to the --glue paramater, I am no longer receiving any sort of error.  

$ java -classpath src/test/java:src/test/resources:/home/restagner/.m2/repository/info/cukes/cucumber-picocontainer/1.0.0-SNAPSHOT/cucumber-picocontainer-1.0.0-SNAPSHOT-full.jar cucumber.cli.Main --glue org/stag/hello hello.feature --tags @foo

Yet, for some odd reason, the feature file is not being run -- I guess I'm just not handling something right.  It still echoes back the contents as if the scenario has not been implemented.  

I've noticed that tags are also supported within the @Feature annotation that is included within the JUnit test.  I'll probably stick with using that until the CLI is finalized.

Feature: My hello feature

  @foo
  Scenario: Saying hello                    # hello.feature:4
    Given a precondition
    When an action takes place
    Then the expected behavior is displayed

You can implement missing steps with the snippets below:

@Given("^a precondition$")
public void a_precondition() {
    // Express the Regexp above with the code you wish you had
}

@Then("^the expected behavior is displayed$")
public void the_expected_behavior_is_displayed() {
    // Express the Regexp above with the code you wish you had
}

--
To unsubscribe from this group, send email to cukes...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
Reply all
Reply to author
Forward
0 new messages