I was reading this post
(http://blog.jayfields.com/2007/06/testing-one-assertion-per-test.html).
I agree that one assertion per test is nice but the overhead is big,
not to mention you need to figure out a way to show that three methods
are related to the same thing.

Then it hit me, maybe we can have both?

The problem with multiple assertion is that it stops at the first
failure.  But that was with JUnit, JBehave has its own framework!

We could change the and() behavior (or create another method like and)
that calls into ALL assertions and generate a comprehensive error
message.

So

...
ensureThat(phoneNumber, and(
      areaCodeIs('738'), phoneNumberIs('233'), extentionIs('333'))

...

now give:

failed
* area code should be '738' but was null
* phone number should be '233' but was '738'
* extension should be '333' but was null

Thoughts?

--
Shane
http://www.shaneduan.com

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to