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.
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 Joe Van Dyk (Guest)
on 2006-03-02 07: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
143d37bc67b04ad4fdc69beddda48651?d=identicon&s=25 Tom Taylor (Guest)
on 2006-03-02 11:42
(Received via mailing list)
Joe Van Dyk 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
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-03-02 23:56
(Received via mailing list)
On Mar 1, 2006, at 10:08 PM, Joe Van Dyk 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 Hodel - drbrain@segment7.net - 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.