Hi Nino,

Nino Saturnino Martinez Vazquez Wael wrote:
Hi Guys

I've just started looking at jbehave. It looks really cool:)

It's great that you like it.  We are really excited by it!

But I am having some troubles, my scenarios just passes even if they should fail, I can see that they are not picking up my steps:

Let's see what the issues are:


my steps class:

  @Given("when a user visits %page")
  public void visits(WebPage page) {
      wicketTester.startPage(page.getClass());

  }

  @Then("%page are rendered")
  public void seesPage(WebPage page) {
      wicketTester.assertRenderedPage(page.getClass());
  }

my scenario (user_visits_pages.scenario) :

when a user visits homePage
errorPage are rendered


First off, the scenario should look like:

When a user visits homePage
Then errorPage are rendered

A few things to note:

- the step annotation should be
@When("a user visits %page")

- the Given/When/Then are required in the text scenario but should not be repeated in the annotation

- the parameter prefix should be configured to "%" in your MyProjectSteps(), because by default it's "$"

For an example - take a look at

https://svn.codehaus.org/jbehave/trunk/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/TraderSteps.java

my scenario class (UserVisitsPages.java)

public class UserVisitsPages extends JUnitScenario {

  public UserVisitsPages() {
      this(Thread.currentThread().getContextClassLoader());
  }

  public UserVisitsPages(final ClassLoader classLoader) {
      super(new PropertyBasedConfiguration() {
          public ScenarioDefiner forDefiningScenarios() {
return new ClasspathScenarioDefiner(new UnderscoredCamelCaseResolver(".scenario"), new PatternScenarioParser(this), classLoader);
          }
      }, new MyProjectSteps(classLoader));
  }

}


When I get these things rolling, I'll probably do a Apache Wicket integration. Wicket could really need something like this, I know theres already an integration towards jDave. But I really like the loosely defined scenarios. It seems as one could really really fast create tests :)


In general, it would be also useful if you could attach behaviours as example that we can reproduce (just a little zip archive with the minimal files to build and reproduce problem).

We are more than happy to help you get started and use JBehave to the fullest of its potential :-)

Cheers


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to