I have a "when" in JBehave which under certain circumstances should throw an exception. I cant find any documentation, however, on how to handle this. Here is my scenario:
given a game with 6 existing bets and the game's max bets are 6 when a user places a bet
there's no then, since I want an exception thrown when the user places the bet.
Keep in mind, I don't always want the when to throw an exception. E.g. when the existing bets are less than max bets. In that case, I want to do some ensuring in the "then".
My understanding of BDD is that it is stakeholder-focused, allowing non-technical people to write what a system is supposed to do, using (more-or-less) natural language, in a way that developers can code to:
It extends TDD by writing test cases:
in a natural language that non-programmers can read.
[wikipedia]
That said, a stakeholder would never write "throw an exception" in a "Then". They'd probably write:
Given a game where 6 bets are allowed and 5 bets have been made,
When a user makes the 6th bet,
Then the "Bet" button should become disabled.
or
Given a game where 6 bets are allowed and 6 bets have been made,
When a user tries to make a bet,
Then the a message appears, saying:
"You can not bet. The maximum of 6 bets has already been placed."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With