A
A
Anton2016-08-22 01:36:10
Ruby on Rails
Anton, 2016-08-22 01:36:10

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 :)

  • Rails makes it very easy to write tests. As you create your models and controllers, it starts creating a skeleton of test code.
  • Simply running Rails tests allows you to make sure your code sticks to the functionality you want, even after a big code rewrite.
  • Rails tests can also simulate browser requests, so you can test your application's response without having to test with the browser.

In all seriousness, at the current stage of my existence, I see no point in writing tests. I am well aware that I write in models, and I successfully test the work of controller actions through the browser.
With this question, I ask professionals, and just knowledgeable people, to push me on the right path, if writing tests is still necessary. Explain to me, please, their main advantages. At the moment, it's really more convenient for me to debug in the browser ...
PS Please be understanding :)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
Eugene Burmakin, 2016-08-22
@Freika

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.

V
Vasily Shakhunov, 2016-08-22
@inf

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.

M
mukizu, 2016-08-22
@mukizu

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.

C
CapeRatel, 2016-08-22
@CapeRatel

Ruby code without tests is a time bomb @ some senor, I don't remember

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question