On Tue, Sep 17, 2013 at 2:37 PM, rickkar <
rmka...@gmail.com> wrote:
> thanks in advance...
>
> 1) given separate projects, is it possible to see examples/pointers for
> sharing glue code, i.e., calling one project's glue code from another
> project?
The glue code is searched in the classpath, so technically you should
be able to import and use a jar with glue code.
Not sure if it's your case, but usually this is a test smell. If
different projects use the same set of steps, it might mean that they
are too generic and you are using an imperative style.
A bad scenario example with reusable steps (as they target the browser
domain and not the application domain):
Given I go to the home page
And I click "sign in"
And I fill "username" with "bob"
And I fill "password" with "bobspass"
When I click "signin"
Then I should be redirected to the home page
And I should see "Hello, Bob"
A better example would be something like:
Given a user exists
When he signs in
Then he should be redirected to the home page
And he should be greeted
This is called "pushing how down the stack", as Matt explained in his talk here:
http://skillsmatter.com/podcast/java-jee/why-your-step-definitions-should-be-one-liners-and-other-pro-tips
I think it would be much better to write a helper library of reusable
code to plug into step definitions, instead of a library of reusable
steps that would probably make your scenarios unreadable.
Paolo