Ruud,
On 2/13/18 7:10 AM,
r.gro...@gmail.com wrote:
>
>
> On Thursday, February 8, 2018 at 2:42:44 PM UTC+1, apremdas wrote:
>
> The best approach is probably to not write scenarios that are
> shareable. Scenarios should be specific to your application. So the
> language you should be using should be high level business language
> focusing on the particular context of the application, and should be
> all about WHAT the application does, not HOW it does things.
>
> With this approach you will rarely have scenarios or steps that are
> easily shared unless all your applications are very similar.
>
>
> Hi Andrew,
> I understand your point. However in my case, the situation is different.
> We are making sites that are created with building blocks in drupal. The
> sites share code and share the way the look like. For example they all
> have the same 'log in' button with the same underlying HTML, the menu's
> have different items, but the HTML has the same structure.
> That is why the test steps are alike: logging in is the same in all
> sites, including the underlying HOW it is done, as well as selecting
> menu items .
How are you including the shared building blocks? I don't know drupal,
but sharing functionality across projects is what libraries were meant
to solve. I don't suggest sharing the step definitions themselves, but
the code that the step definitions call to access the system under test.
>
> I find it difficult to deal with this. Right now I have now three
> directory's for three sites. The shared steps are included in the
> directory tree using symlinks.
> I have considered putting all code together in one directory with
> different feature sub directories and sharing the same env.rb. In env.rb
> I could select the site to test. But this leaves me with the problem
> that I have to select the proper site specific steps: all shared steps
> are loaded by default and then the steps that only apply to the selected
> site should be loaded.
>
>
> I don't know yet what the best strategy is to tackle this. All I know is
> that there are now three similar sites and that there are many more to
> come. I fear that using your advice (sharing the helper routines and NOT
> the test steps) will result in a lot of code duplication (the step
> definition). On the other hand gives it more flexibility to have
> differences in behaviior of the steps. I cannot oversee which of these
> considartions will prove to be more important in the future.
The step definitions that are the same for the multiple sites should be
one-liners, delegating to helper routines. Separate the expression of
business intent and the implementation details. The step definitions
should be oriented around business intent. The helper routines should
handle all of the implementation details.
- George
--
----------------------------------------------------------------------
* George Dinwiddie *
http://blog.gdinwiddie.com
Software Development
http://www.idiacomputing.com
Consultant and Coach
http://www.agilemaryland.org
----------------------------------------------------------------------