[rspec-users] [cucumber, jruby] Same steps are being added multiple times?

John Goodsen jgoodsen at radsoft.com
Thu Apr 9 16:09:47 EDT 2009

I understand how this happens when I *really do* have ambiguous steps, but
in my simple case, I don't.  I only have a single class which contains steps
(attached below).  I can run a single scenario just fin, but when I try to
run multiple scenarios in one run, I get Ambiguous step errors.  It's like
the steps are getting added again before each scenario runs - I've got to be
missing something really basic here.

thanks in advance,  John

PS:  Here's the one, and only one, step class that I'm using (implementation
removed for shortness):

package com.timeinc.ecommerce.storytests.cucumber;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.thoughtworks.selenium.Selenium;
import com.timeinc.ecommerce.KickOffFulfillment;
import com.timeinc.ecommerce.domain.FulfillmentTransaction;
import com.timeinc.ecommerce.domain.Order;
import com.timeinc.ecommerce.domain.PersistenceService;
import com.timeinc.ecommerce.storytests.StoryTestProperties;
import com.timeinc.ecommerce.storytests.checkers.OrderChecker;
import com.timeinc.ecommerce.storytests.selenium.Page;
import com.timeinc.ecommerce.storytests.selenium.ReceiptPage;
import com.timeinc.ecommerce.storytests.selenium.SeleniumController;

import cucumber.Given;
import cucumber.Table;
import cucumber.Then;
import cucumber.When;

public class NavigationSteps {

  @Given("the microsite with")
  public void givenTheMicrosite(Table table) {

  @When("I navigate to the microsite")
  public void whenTheUserNavigatesToTheMicrosite() {

  @When("I submit the form with")

  @Then("I see a receipt page")
  public void theUserIsPresentedWithAReceiptPage() {

  @Then("a new order is created with")
  public void aNewOrderIsCreatedWith(Table table) {

  @Then("the following error messages are displayed")
  public void theFollowingErrorsShouldBeDisplayed(Table table) {
    Page.ensureErrorsAreDisplayed(selenium, table);

  @When("fulfillment runs")
  public void fulfillmentRuns() throws Exception {

  @Given("an order exists in the system")
  public void anOrderExistsInTheSystem() {

  @When("the user navigates to the status tracking page for the order")
  public void navigatesToStatusTrackingPage() {

  @Then("the transaction is displayed as succeeded")
  public void theTransactionIsDisplayedAsSucceeded() {


On Thu, Apr 9, 2009 at 2:52 PM, James Byrne <lists at ruby-forum.com> wrote:

> John Goodsen wrote:
> >
> > but when I run my tests with:  jruby -S cucumber -r
> > stories/support/env.rb
> >
> > I am getting Ambiguous match of my steps - but I only have a single
> > class of steps, NavigationSteps.
> >
> > any ideas what's going on?
> You have two (or more) step matchers that match a single clause in a
> scenario.  The error message usually tells you exactly which steps in
> which files collide, for the MRI anyway
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

John Goodsen                 RADSoft / Better Software Faster
jgoodsen at radsoft.com            Lean/Agile/XP/Scrum Coaching and Training
http://www.radsoft.com          Ruby on Rails and Java Solutions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090409/f69c3703/attachment.html>

More information about the rspec-users mailing list