# Testing duplication in model and functional

**URL:** <https://www.ruby-forum.com/t/testing-duplication-in-model-and-functional/75616>\
**Category:** Rails\
**Created:** [March 2, 2006, 7:08am UTC](https://www.ruby-forum.com/t/testing-duplication-in-model-and-functional/75616 "2006-03-02T07:08:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [March 2, 2006, 7:08am UTC](https://www.ruby-forum.com/t/testing-duplication-in-model-and-functional/75616/1 "2006-03-02T07:08:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [March 2, 2006, 11:42am UTC](https://www.ruby-forum.com/t/testing-duplication-in-model-and-functional/75616/2 "2006-03-02T11:42:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [March 2, 2006, 11:56pm UTC](https://www.ruby-forum.com/t/testing-duplication-in-model-and-functional/75616/3 "2006-03-02T23:56:57Z")

</div>

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](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)
