I am just starting out with Jbehave Web with WebDriver and wondered whether it was possible to have the same textual step apply to different step methods.
Say for example you have the following two scenarios
Scenario 1
- Given I am on the properties to buy page
- When I click Search
- Then I should see the results page containing all properties to buy
Scenario 2
- Given I am on the properties to rent page
- When I click Search
- Then I should see the results page containing all properties to rent
If I implemented this using the page object pattern I would have a page object called for example buyProperties and likewise for rental properties a page object called something along the lines of rentProperties (as well as result page objects).
In both scenarios a search button/link is clicked so the step text is the same. However, in reality they are on different pages (and page objects).
How could I implement Jbehave so that for the rental scenario it knows to call the step method implementing clicking the search button on the rentProperties page and for the buy scenario it knows to call the step method implementing clicking the search button on the buyProperties page?