I'm trying a little bit the BDD approach and I've a question:
I've made a scenario for a fictive bank account:
Scenario: No money as new customer
Given I'm a customer
And I've not any deposit
When I try to withdraw 50 dollars
Then I should get an error
I'm implementing it with Specflow + NUnit.
I'm a little bit borried by the Then I should get an error
.
Because currently I've a bool TryWithdraw(double amount)
.
I can see two way of making it working:
What would be the correct approach? Is my BDD requirement correct or do I have to store the result?
BDD Tests are like unit tests structured. You have an arrange part, an act part and at the end the assert part:
So storing the result of your act (When I try to withdraw 50 dollars) is complete valid. Then you do your assert based on the result.