I'm involved in a microservices based application. I'm trying to apply the BDD process for this. I need a recommendation how to apply this process correctly given this type of architecture. It is recommended to avoid or keep at minimal level the end-to-end tests that span across many microservices. I agree with that.
From my point of view, staying away from end-to-end tests means that we don't have executable specifications (one of the bdd benefits) for the use cases that span multiple services. Instead we have only service level specs. Is my understanding correct?
Here is an example. Say, I have a e-commerce system and I need to implement the feature:
Adding a product to the shopping cart.
When discussing this with the client, we put down the following scenario:
Given I'm logged in
And I search for the book "BDD in Action"
And I identified the required book
When I add the item to the shopping cart
Then I see the item added to my shopping cart
This use case spans the following microservices: Security, Product Catalog, Shopping Cart.
Hence the question - how do I implement the above shopping cart feature following the BDD process?
- Should I automate the above feature file? According to the already mentioned recommendation, I should avoid end-to-end tests spanning multiple microservices. Does it mean that the above story remains not executable?
Should I go straight to the Shopping Cart Service and write a specification for it, avoiding the unnecessary Givens from the above story?
When I add an item to the Shopping Cart Then I see the item added to my shopping cart