JBehave
  1. JBehave
  2. JBEHAVE-843

ExampleTables with parameterized data

    Details

    • Type: Task Task
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core Examples
    • Labels:
      None
    • Environment:
      Windows Eclipse
    • Number of attachments :
      0

      Description

      I am trying to run Trader Example to implement ExampleTable for Parameterized Tabular Data. I am getting an error of "No runnable methods".

      my story:
      Scenario: To print tabular data

      Given the traders:

      name rank
      Larry Stooge 3
      Moe Stooge 1
      Curly Stooge 2

      When a wildcard search ".*y" is executed"

      Then the traders returned are:

      name rank
      Larry Stooge 3
      Curly Stooge 2

      package com.BaseStory;

      import java.util.ArrayList;
      import java.util.Collections;
      import java.util.List;
      import java.util.Map;

      import org.jbehave.core.annotations.Given;
      import org.jbehave.core.annotations.Then;
      import org.jbehave.core.annotations.When;
      import org.jbehave.core.model.ExamplesTable;
      import java.util.ArrayList;
      import java.util.Collections;
      import java.util.List;
      import java.util.Map;
      import static org.junit.Assert.*;
      import model.Stock;
      import model.Trader;
      import model.Stock.AlertStatus;
      import service.TradingService;

      public class TraderSteps {

      private TradingService service;
      private Stock stock;
      private Trader trader;
      private List<Trader> traders = new ArrayList<Trader>();
      private List<Trader> searchedTraders;

      @Given("the traders: %tradersTable")
      public void theTraders(ExamplesTable tradersTable)

      { traders.clear(); traders.addAll(toTraders(tradersTable)); }

      @When("a wildcard search \"%regex\" is executed")
      public void aWildcardSearchIsExecuted(String regex) {
      searchedTraders = new ArrayList<Trader>();
      for (Trader trader : traders) {
      if ( trader.getName().matches(regex) )

      { searchedTraders.add(trader); }

      }
      }

      @Then("the traders returned are: %tradersTable")
      public void theTradersReturnedAre(ExamplesTable tradersTable)

      { List<Trader> expected = toTraders(tradersTable); assertEquals(expected.toString(), searchedTraders.toString()); }

      private List<Trader> toTraders(ExamplesTable table) {
      List<Trader> traders = new ArrayList<Trader>();
      List<Map<String, String>> rows = table.getRows();
      for (Map<String, String> row : rows)

      { String name = row.get("name"); String rank = row.get("rank"); traders.add(service.newTrader(name, rank)); }

      Collections.sort(traders);
      return traders;
      }

      }

        Activity

        Hide
        Brian Repko added a comment -

        Please do NOT log a JIRA item for a discussion - please use the mailing lists. If a bug is found as part of that discussion, then we will log a bug (or feature request).

        Show
        Brian Repko added a comment - Please do NOT log a JIRA item for a discussion - please use the mailing lists. If a bug is found as part of that discussion, then we will log a bug (or feature request).
        Hide
        Goops Shre added a comment -

        Hi Brian,
        I am really struggling to post my message.
        I am new in Jbehave and mailing list. I don't know where it goes all the time.

        Can you please help me or give me steps how to post messages??

        Show
        Goops Shre added a comment - Hi Brian, I am really struggling to post my message. I am new in Jbehave and mailing list. I don't know where it goes all the time. Can you please help me or give me steps how to post messages??
        Hide
        Cristiano Gavião added a comment -

        Goops, if you take a look at jbehave.org you will find this: http://jbehave.org/mailing-lists.html.

        Btw, this is not only a best practice restrict to Jbehave, but to any open source project that you will work with...
        Always search for "user" forum or mailing list to discuss problems related using the product... and "dev" to discuss things related to development of the product...

        Show
        Cristiano Gavião added a comment - Goops, if you take a look at jbehave.org you will find this: http://jbehave.org/mailing-lists.html . Btw, this is not only a best practice restrict to Jbehave, but to any open source project that you will work with... Always search for "user" forum or mailing list to discuss problems related using the product... and "dev" to discuss things related to development of the product...
        Hide
        Brian Repko added a comment -

        That codehaus system is not the most intuitive. Goops, you can go to http://xircles.codehaus.org/, then click on "Lists" on the header. Then you can enter user@jbehave.codehaus.org - which will find the list. In the display will be a Subscribe link which will let you subscribe. Then you can send emails to user@jbehave.codehaus.org with your questions.

        Apologies that that system is not so clear (and apparently broken as I can't login to it - or there is no single signon)

        Show
        Brian Repko added a comment - That codehaus system is not the most intuitive. Goops, you can go to http://xircles.codehaus.org/ , then click on "Lists" on the header. Then you can enter user@jbehave.codehaus.org - which will find the list. In the display will be a Subscribe link which will let you subscribe. Then you can send emails to user@jbehave.codehaus.org with your questions. Apologies that that system is not so clear (and apparently broken as I can't login to it - or there is no single signon)

          People

          • Assignee:
            Unassigned
            Reporter:
            Goops Shre
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: