The suggested way to implement web testing steps in to abstract from the
actual web implementation and use steps classes and another set of
classes called page classes, the examples on the reference guide
describe how to do that
http://jbehave.org/reference/web/stable/page-objects.html (WebDriver API)
The actual work is done inside the page classes that all inherit from a
class called WebDriverPage, which provides the usual WebDriver methods
like get from Selenium.
If you are constructing the objects yourself, you have to pass a
WebDriverProvider between the classes, if you are using dependency
injection (guice, spring), this will happen automatically. The whole
thing has to be run in a single thread executor unless you use a per
story web driver.
You can use steps classes (plain classes not inheriting from anything)
using different page classes (inheriting from the WebDriverPage class),
so you can organize your classes (plus if you have different step
classes using the same page classes you can refactor step implementations)
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
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email