Reputation: 21
I like the idea of focusing on business scenarios. However, as a developper I also want error cases to have automated non-regression tests.
For example, in a e-commerce feature, there would be a scenario
James uses his credit card to pay
James should see that the purchase was successful
But what about scenarios where his credit card is invalid or his bank rejected the transaction. These scenarios are strongly linked to implementation details.
I don't see how I can handle automated testing of these scenarios within the Serenity philosophy. If I write scenarios, i will have to mention current implementation details. When reading literature around Serenity I feel like it's only meant to test the happy path because this is what business people care about. However in the real world error cases and more complex flows are important parts of the applications, and benefit from automated tests.
Could you please help me understand how I should approach testing those scenarios? Thanks!
Upvotes: 0
Views: 629
Reputation: 942
I think your question is related to BDD/Gherkin, rather than Serenity. BDD absolutely does not limit acceptance criteria to happy day paths - I would even say that is an anti-pattern. If the business is interested in a negative path (and often they are), it should be an acceptance criteria. For example:
Scenario: James has insufficient funds on his account
Given James has a $1000 limit on his credit card
And he has already spent $900
When he attempts to purchase a meal costing $150
Then the transaction should be refused
Upvotes: 1