I had to upgrade the JUnit version I have been using to version 4.4 in a recent project to get Spring/JUnit integration working with new testing features available in Spring 2.5 release (which make it easy to get a reference to any Spring bean w/o having to specifically load Spring application context). JUnit 4.4 also comes with Hamcrest testing framework which has several additional assert statements than what are there in plain JUnit.
I started using some of these new assert statements which are very BDD'ish in nature and make the test methods more readable on what we are asserting. We no longer have to struggle with the limited number of assert's that are available in JUnit.
Here is a good presentation that talks about the new features in JUnit 4.4 (additional assets, timeout, datapoints etc.)
Tuesday, May 13, 2008
JUnit 4.4 - Hamcrest Asserts
Posted by srinip at 6:54 PM
Subscribe to:
Post Comments (Atom)
2 comments:
Body Dysmorphic Disorder?
Yeah we've been using Hamcrest for a while, can be a bit tricky to figure out how to use since Java doesn't exactly lend itself easily to DSL's.
Hi Casper, That's a good one for BDD acronym. Both Behavior Driven Development or your definition should do the trick :). You guys use any frameworks like JBehave or JDave? I haven't really done much work in this area, but I would love to try out DSL/BDD type of work in my java projects.
Thanks
Srini
Post a Comment