To answer your question more specifically: there is no problem in using
as many steps classes you want for a single story, as a matter of fact
is a recommended practice to not have a single class or a class hierarchy.
In your case, it should suffice to add the PerStoryWebDriverSteps to
your steps factory to have the WebDriver initialised before each story.
Then you define your other steps independently - i.e. no need to inherit
from it.
On 04/08/2012 14:24, Mauro Talevi wrote:
Hi Roy,
this information is not sufficient for us to help you.
As already noted in https://jira.codehaus.org/browse/JBEHAVE-810 there
is a working tutorial available at
http://jbehave.org/tutorials.html
and an archetype that you can use
http://jbehave.org/reference/web/stable/archetypes.html
Note that JBehave Web provides the WebDriverProvider interface to
instantiate the WebDriver and is typically per scenario, story or
stories, e.g.
org.jbehave.web.selenium.PerStoryWebDriverSteps
On 04/08/2012 10:53, Roy de Kleijn wrote:
I like to organize my steps in multiple class files. (because we have
many steps in our application)
Question is: how can we use the steps from multiple step definition
classes to execute a single story.
I use webdriver, I tried the following:
BaseClass.java
Instantiates the driver and opens the browser.
LoginSteps.java inherit from BaseClass.java
steps to login in application
SearchSteps.java inherit from BaseClass.java
Verify is elements is present.
BUT here is my driver instance suddenly null.
I think it has something to do with the way I execute my tests:
@Override
public InjectableStepsFactory stepsFactory() { return new
InstanceStepsFactory(configuration(), new LoginSteps(), new
searchPageSteps()); }
Please tell what other information you need or what I have to do
differently.
Thanks