Search code examples
domain-driven-designbddgherkin

Can a single Gherkin scenario have multiple user roles?


I have the following:

As an approver #... ?

Scenario : approve a profile
When : I approve a profile
Then : the profile owner should be notified about his profile's approval 
# (on his android device)
And : I should see the profile as a valid profile
And : guests should be able to see the profile

Or I can say :

As an owner

Scenario : approve a profile
When : my profile is approved
Then : I should be notified about my profile's approval
...?

Since my profile is approved is an event , it has multiple consequences in this, and other Bounded Contexts.

Some consequences are immediate and some can become eventually consistent. And putting a single event in multiple features can lead to difficulty in managing teams, estimating time, etc.

Any suggestions? Thanks in advance.


Solution

  • Group logical flows 1st by dependency boundaries , and then by user role.

    Try to resolve which can be done by a single developer and which can be broken into smaller parts (So lower lead time it will take).

    In a CQRS system for example when you are using eventual consistency (which should be defined by requirements) you can easily separate write requirement's gherkin from read requirement's gherkin. But if immediate consistency is required by your scenarios you'd better not separate the read side's gherkin from write side's gherkin and let a single developer(or a pair) work on it.

    And the user role to my opinion is less important but if your roles are from different BCs you'd better write different gherkins for each. Stories should be independent and task prioritization is the Product Owner's job but I'd rather prioritize some of them based on Technical issues.