Suppose I have an API that has three steps:
I am writing a BDD for this API. My question is, should I check if the document is updated after the above steps have passed? Or that the document should not be mutated if any of the above steps have failed?
I ask this question as BDDs are for the product to read. So okay, the product should be able to see that the charge was successful, but does the product need to see if the database was updated? Isn't it too for technical for them?
What would be the correct way to test such steps, especially if they are the last step of your action chain?
Should I check if the document is updated after the above steps have passed? Or that the document should not be mutated if any of the above steps have failed?
The answer is "yes".
You should check if the document was updated when all steps passed.
You should have additional scenarios highlighting the fact the document is not updated if any of the steps fail. In fact, this feels like 5 separate scenarios:
While the product team is mainly thinking about scenario 1, if you introduce them to scenarios 2-5 you will quickly learn that they care about these scenarios as well.