Testing duplication in model and functional

Hi,

I’m starting a new application, and want it to be tested out the wazoo.

Do people duplicate tests in both unit and functional tests? Say I
have a Product model. I write tests that make sure that it acts
appropriately (tests the validations and so forth). Is it good
practice to also write the functional tests for the same sort of tests
(i.e. make sure that the validations are working correctly and put the
correct things inside the error div)?

Thanks!
Joe

Joe Van D. wrote:

Do people duplicate tests in both unit and functional tests? Say I
have a Product model. I write tests that make sure that it acts
appropriately (tests the validations and so forth). Is it good
practice to also write the functional tests for the same sort of tests
(i.e. make sure that the validations are working correctly and put the
correct things inside the error div)?

There’s no hard and fast rules on this type of thing, but if you test in
both you can work out what exactly is broken a lot quicker. ie, if your
unit test fails, then you know you have a problem with the model.

Tom

On Mar 1, 2006, at 10:08 PM, Joe Van D. wrote:

I’m starting a new application, and want it to be tested out the
wazoo.

Do people duplicate tests in both unit and functional tests? Say I
have a Product model. I write tests that make sure that it acts
appropriately (tests the validations and so forth). Is it good
practice to also write the functional tests for the same sort of tests
(i.e. make sure that the validations are working correctly and put the
correct things inside the error div)?

Here’s a good rule of thumb:

“If your tests are passing you don’t have enough tests.”

(I believe Kent Beck said something similar to this.)


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com