Forum: Ruby on Rails testing duplication in model and functional

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joe Van D. (Guest)
on 2006-03-02 08:08
(Received via mailing list)
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
Tom T. (Guest)
on 2006-03-02 12:42
(Received via mailing list)
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
Eric H. (Guest)
on 2006-03-03 00:56
(Received via mailing list)
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. - removed_email_address@domain.invalid - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
This topic is locked and can not be replied to.