Hi, I'm a new user of JBehave.  I'm exploring it as a simpler alternative to 
Cuke4Duke (and its required technology stack) since our development 
environments are almost pure Java.

I'm doing a proof-of-concept using JBehave to test the product I develop, and 
am writing various story scenarios.  I'm so much happier with the "new user" 
type examples and documentation for JBehave than for Cucumber/Cuke4Duke.  But I 
can't find an example of using a regular expression to map a string in a When 
clause to a Java method.

The page http://jbehave.org/reference/latest/developing-stories.html says 
"JBehave maps textual steps to Java methods via 
CandidateSteps<http://jbehave.org/reference/latest/javadoc/core/org/jbehave/core/steps/CandidateSteps.html>.
 The scenario writer need only provide annotated methods that match, by regex 
patterns, the textual steps."  I took that to mean I could do something like 
this in my Java steps file:

@Then("I can view files.*")
   public void canViewFiles()
   {
// blah blah blah
   }

So that this code would match both

Given I open a new web browser
When I connect to http://ViewSVN
Then I can view files without logging in

And

Given I open a new web browser
When I connect to http://ViewCVS
Then I can view files on my screen


But the @Then("I can view files.*") doesn't match either of those.  Neither 
does "I can view files(.*)"  So what kind of "regex patterns" is the JBehave 
web page talking about?  Or am I missing the real meaning of "The scenario 
writer need only provide annotated methods that match, by regex patterns, the 
textual steps"?


Thanks,
Todd.

Reply via email to