developwithpassion.bdd – notes
A few notes I’ve compiled while starting to play with JP Boodhoo’s BDD framework (http://github.com/developwithpassion). At first sight the syntax looks quite alien but try it for a while you eyes soon adjust.
JP blog posts
- How I’m Currently Writing My BDD Style Tests – Part 1
- How I’m Currently Writing My BDD Style Tests – Part 2
- Test examples with MBUnit and jpboodhoo.bdd
- Slight addition to jpboodhoo.bdd
- Using jpboodhoo.bdd with TestDriven.Net
- More new conventions for how I organize my tests!!
Base classes
- observations_for_a_static_sut – For testing a static class or a quick inline test
- observations_for_a_sut_with_a_contract – For testing against the interface of a class
- sut is automatically created
- No more broken test when you add a new dependency to a class! YAY
- Automatic creation of sut can be over ridden
- observations_for_a_sut_without_a_contract – For testing against a concrete class
Delegate call order
- context
- Can define a context block in the concerns base class which will be run before a context block in the inheriting class
- Can call method provide_a_basic_sut_constructor_argument
- after_sut_has_been_initialized
- because
- it
- after_each_observation
Exceptions
When you want to test spec? for an exception use the doing method:
because b = () =>
doing(() => sut.MethodWhichThrows());it should_throw_exception = () =>
exception_thrown_by_the_sut.Message.should_contain("MY EXCEPTION");