Answer the question
In order to leave comments, you need to log in
Is it mandatory to use tests in Rails?
I apologize in advance if the question is moronic and I myself, in your opinion, am a moron :)
Answer the question
In order to leave comments, you need to log in
Now you understand everything, and in 3 months, when there will be not 5, but 20 controllers, not 8, but 35 models, the code will start to break in the most unexpected places. And hardworking and carefully written tests will help in finding the reasons. So write, don't be lazy.
A must if you need to quickly issue a workable product. Even if 10 controllers with 7 actions each have at least 70 actions to check. And usually 2-3 more checks need to be done. Is it all in the browser? Or then to the client to say: "oh, it's fallen, we'll fix it now."
In general, it depends on the task. What you need to get at the output and what quality.
Firstly, tests are different - they test both the operation of the code and the logic, and so on.
Secondly, tests are written not only to check the performance, but also so that the team does not have to then study your code from cover to cover.
While you are working alone, this is not noticeable, as soon as the project grows, it becomes more difficult in all directions, the team grows - you immediately understand that without intelligible documentation and tests, the train will not go further.
Well, saving time. As long as you have a small application - you can, of course, test everything manually, but as soon as the project begins to develop - there are many more places for testing and testing all this by hand is simply stupid - it will take a lot of time, in addition, the risk of missing something increases ( stupid human factor).
After all, tests are a good way to look at code from a different angle. It often happens that while writing a test or just running it, an understanding comes that the code, although it works correctly, is slow, or the implementation is poor or something else will come out. Think of it as a self-control function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question