Hi Victor, I dont know if I understood you question...

But using Jbehave 3.0 you can reuse a CandidateStep(the class that contain your story steps) in any level you wanted... CandidateSteps could be any java POJO (and you do not need to extend any other class)...

So this way for example you could create a class named MyAuthenticationSteps and put all methods needed to do the authentication verification. And could create another pojo named MyApplicationSeleniumSteps and put all your steps that is needed to verify your application with selenium...

After that you just need is to create a Embedder and configure it to use those steps classes... take a look on Trader examples.

@RunWith(GuiceAnnotatedEmbedderRunner.class)
@Configure()
@UsingEmbedder(embedder = Embedder.class, generateViewAfterStories = true, ignoreFailureInStories = true, ignoreFailureInView = true) @UsingSteps(instances = { TraderSteps.class, BeforeAfterSteps.class, AndSteps.class, CalendarSteps.class, *MyAuthenticationSteps , MyApplicationSeleniumSteps*
        PriorityMatchingSteps.class, SandpitSteps.class })
@UsingGuice(modules = { ConfigurationModule.class })
public class AnnotatedEmbedderUsingStepsAndGuice extends InjectableEmbedder {
You need better reuse than that? :-)

cheers


Victor Moura escreveu:
Hi,

Is there a way to, when defining a step, use a step alteady defined
(not by calling the method)? Something like is done in Cucumber, like
the following


When /I log in the site with the login "(.*)" and password "(.*)"/ do
| login, passwd |  // This is the step that we want to define
    When /I fill the field "txtLogin" with "login"    // This step,
was defined somewhere else, and will be called inside the step we are
defining now
    When /I fill the field "txtPassword" with "passwd" // Calls the
same step as the above, using different parameters
end

The idea is that we can define "higher level" steps independent of the
method we define in java, and that the legibility of those higher
level steps we are defining is greater that what we get when using
something like (in JBehave)

@When "I log in the site with the login \"$login\" and password \"$passwd\"
public void doLogin(String login, String passwd) {
   fillTextField("txtLogin", login); // this method is defined as a
step somewhere else
   fillTextField("txtPassword", passwd);
}

You see, it looks pretty much the same, but I like the idea of being
able to make the steps more reusable, independent and legible.

Thanks in advance.


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

   http://xircles.codehaus.org/manage_email


Reply via email to