why I need testings in rails?

} 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 } tests? } I am confused

Different languages and frameworks offer different tradeoffs, among them being different safety nets.

C++ provides strong type safety in its duck typing (yes, the C++ templating language supports duck typing) that guarantees (unsafe casting aside) that if your program compiles then there is code backing all method calls, not to mention excellent runtime performance. On the other hand, it allows arbitrary memory access, requires manual memory management, requires many more lines of code as compared to a language like Ruby to accomplish similar tasks, and the extent of the running code is fixed at compile time modulo explicit plugin interfaces.

There is still value to automated tests (and assertions!) in C++, but many of the sorts of tests that are important for Ruby code occur implicitly at compile time; the compiler is a static code analyzer, and the code itself provides sufficient information to support this analysis.

Ruby is sufficiently dynamic in a number of senses (e.g. loading code can alter existing code paths), which precludes such static analysis. To regain a level of certainty that the code works after a seemingly minor change, one writes tests that assert preconditions and postconditions and results and failure modes and such. Running those automated tests is similar to performing the static analysis that the C++ compiler performs. While it is possible to run Ruby code that has not undergone such automated testing, it is best to consider it similar to trying to run C++ code without compiling it. (Sadly, I am routinely guilty of this.)

} pete --Greg