Is easyb Easy?
You can have as many
ands linking them within your Scenarios.
easyb supports the following syntax for should and ensure. Remember, you can also check that an exception is thrown by your code using the
ensureThrows variant of the
ensure closure; like we did in our 3rd scenario.
Here is a list of the should and ensure syntax:
And now finally, the verdict. Is easyb Easy? In my opinion, it was very
What do you think? Give it a try, it is easy.
Update: Jochen Bedersdorfer, commented that it would be interesting to see what happens when a test fails. So, here is what happens:
In my case, I changed the password for the Account. The scenario one was supposed to validate that the user name was "meera" and password was "password". When you run the same:
[easyb] easyb is preparing to process 1 file(s)
[easyb] Running login service test story (LoginServiceTest.story)
[easyb] FAILURE Scenarios run: 3, Failures: 1, Pending: 0, Time Elapsed: 0.529 sec
[easyb] "the system returns a valid account" -- expected password1 but was password
[easyb] 3 total behaviors run with 1 failure
[easyb] easyb execution FAILED
Total time: 1 second
And within the Story.txt file, you will also see the output as such for the scenario which failed:
scenario User enters valid credentials
given user account already exists
when user logins
then the system returns a valid account [FAILURE: expected password1 but was password]
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)