Using BDD with a system comprised of multiple services

Skip to first unread message

Harrison Brown

Feb 14, 2022, 4:46:11 AM2/14/22
This isn't necessarily a DDD question but I reckon the folks in this community will have useful insights regardless!

How do you go about applying BDD to a system that comprises multiple services? 

We're developing a system at the moment that requires orchestration between a few different services to achieve one business outcome so our options seem to be (a) write BDD scenarios at the service level in their respective Git repositories, describing only their own behaviour, or (b) write BDD scenarios at a level higher in a dedicated repository and describe the behaviour of the whole system.

Option (a) has the obvious downside that lots of the behaviour the business cares about involves multiple services so the BDD scenarios are anaemic, but option (b) is a pain to automate because the test code (we use Behat) can't easily reach 'inside' any of the individual services to set up our Given steps.

If anyone has any thoughts, however brief, on this — or could point me to a book/article/video on the subject — I'd be grateful.


Harrison Brown

Feb 14, 2022, 4:48:04 AM2/14/22
(Equally, if anyone can point me to a BDD community where this question would be better asked that's helpful too.)

Chris Sampson

Feb 14, 2022, 8:20:18 AM2/14/22

We use BDD inside the solution at a unit test level for each service, that's where you should be able to "reach inside", but still use the public interface for this. For us that is messaging, so commands in (given, when) and events out (then).
We also use at the integration level, testing across multiple services. For this we use the web service endpoints, calling them directly over http (given, when) and check responses from them (Then)
We also use it a UI level where we use a UI testing framework to interact with the application.

Units are far more granular (and thus more numerous) than Ints. Ints just do enough to cover all service to service interactions that cannot be covered in units and Ints are more granular than Web UI tests.

Hope that helps

You received this message because you are subscribed to the Google Groups "DDD/CQRS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Chris Sampson

Feb 14, 2022, 8:22:02 AM2/14/22
The scenarios are most "business like" at the web UI level, and least  "business like" at the unit level. 
Reply all
Reply to author
0 new messages