why I need testings in rails?

Hi --

All the time I hear that RoR has great testing enviroment.
Well, why I need tests? I test my webapp all the time - code a page and
than test it. So why I need that extra test - does it make some special
I am confused

See various other comments on the merits of rigorous testing. I'll
throw in a bit of a footnote, which is that the question has arisen in
my mind about testing things that have already been tested.... What I
mean is that, for example, ActiveRecord has a pretty serious test
suite. So if I do:

   validates_size_of :comment, :maximum => "100"

I sometimes wonder whether I really need a test like:

   def test_size_of_comment
     @thing.comment = "hello" * 21

or whatever. The method I'm using, validates_size_of, already has
unit tests. On the other hand, one could view it as testing to make
sure the validation didn't accidentally get deleted from the model
file. But then, how does one test to make sure that one didn't forget
to put "test_" at the beginning of every test? And so on.

In sum, we live with a horizon beyond which there is no testing. The
question is: where is that horizon? Perversely, perhaps, I find this
as interesting a question as any in the test realm.


Regarding tests on validations, see Luke Redpath's excellent discussion at:


The part I'm specifically referring to is "avoid meaningless tests." With
that said, it's important to note that when you write
validates_something_or_other, you are imposing a constraint on your model.
At some point in the future, you might write other code that is in conflict
with this constraint. My perspective is not to test whether the validation
really validates, but that expected data actually is validated the way you

Does that make sense?


dblack wrote: