Using BDD with a system comprised of multiple services

208 views
Skip to first unread message

Harrison Brown

unread,
Feb 14, 2022, 4:46:11 AM2/14/22
to DDD/CQRS
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.

Thanks,
Harrison

Harrison Brown

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

Chris Sampson

unread,
Feb 14, 2022, 8:20:18 AM2/14/22
to ddd...@googlegroups.com
Hi, 

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 dddcqrs+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dddcqrs/2de6e004-4945-43f2-a0b0-e0817e4f477cn%40googlegroups.com.

Chris Sampson

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