** What is a test? ** A program to check if a program behaves as expected.
① Reduce bugs and let users use it with confidence ② It becomes easier to change the program ③ Write a program faster
(1) Users who use the service can write a test and use it with confidence to ensure that there are no bugs. (2) By writing a test, you can check how far it is working and it will be easier to find the cause. Easier to remove, add, and edit features (3) Even if a bug appears when the development side writes the code, it will be easier to find the cause and fix it thanks to the test, so you can write the code with confidence.
The importance of the test is, can not be said unconditionally anywhere until you write a test for change by the project or company In the medical field, I think that testing is very important because I want to prevent errors such as leakage of patient data and inability to view information. A service that requires few additions or edits. Simple applications that don't cost money may be less.
** There are three main tests for rails ** ・ Request spec (Controller test) ・ Model spec (Model test) ・ System spec (appearance test)
The test flow (in the case of Controller test) ① I want to check the setting that the title is not saved when it is not entered (2) Create dummy data with no title and execute it. ③ Check if dummy data is saved
This time, I briefly explained about the test. I think that the more you write a test, the more maintainable it will be, but writing 100 or more will be difficult, so I would like to introduce a description method that makes the test as easy as possible next time.
Recommended Posts