Okay, so I'm writing some BDD tests for a REST API using pytest-bdd.
Let's suppose I have endpoints A, B, C and D. Normally, when someone uses this API, a request is first done to endpoint A, then if A is successful a request to B can be done, and if A and B were successful then C can be called, and so on.
So okay, I started by testing A:
Given the API receives an A request with x argument
Then a 200 status code is returned
And entity a is returned
And then B:
Given entity a created [...]
When the API receives a B request with y argument
Then a 200 status code is returned
And entity B is returned
[...]
When I implemented the Then step for the first scenario (testing A), I checked if a 200 status code was returned.
When implementing the Given step for the second scenario, which expects endpoint A to have been called, should I:
- make sure that the endpoint A was both called and completed in a successful way (by checking the status code);
- OR should I only implement the request to A, without checking whether it was successful - and expect that, if endpoint A has an issue, then the respectful (first) scenario should be responsible for detecting it?