[RAILS] What is testing? ・ About the importance of testing

What is a test?

** What is a test? ** A program to check if a program behaves as expected.

The importance of testing

① 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.

Rails test

** 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

Summary

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

What is testing? ・ About the importance of testing
'% 02d' What is the percentage of% 2?
What is the model test code testing
What is the data structure of ActionText?
What is JSP? ~ Let's know the basics of JSP !! ~
About the handling of Null
What is the pluck method?
About the description of Docker-compose.yml
What is the BufferedReader class?
What is the constructor for?
What is the initialize method?
What is the representation of domain knowledge in the [DDD] model?
About the behavior of ruby Hash # ==
What kind of StringUtil is good
What is it? ~ 3 types of "no" ~
About the role of the initialize method
Think about the 7 rules of Optional
What kind of method is define_method?
Summary about the introduction of Device
About the log level of java.util.logging.Logger
Want to know what Ruby n is the power of 2? (Power judgment of 2)
What is @Override or @SuppressWarnings ("SleepWhileInLoop") in front of the function? ?? ??
About the version of Docker's Node.js image
What is the right migration data type? ??
About the operation of next () and nextLine ()
What is the best file reading (Java)
About the initial display of Spring Framework
What is the main method in Java?
What are the updated features of java 13
What is the Facade pattern useful for?
About the error message Invalid redeclaration of'***'
About the treatment of BigDecimal (with reflection)
About the number of threads of Completable Future
About the mechanism of the Web and HTTP
What is Pullback doing in The Composable Architecture
What is Cubby
What is Docker?
What is null? ]
Think about the combination of Servlet and Ajax
Summary of what I learned about Spring Boot
About the official start guide of Spring Framework
ActiveSupport underscore is not the inverse of camelize
About the description order of Java system properties
What is java
About the idea of anonymous classes in Java
What is Keycloak
What is maven?
The order of Java method modifiers is fixed
What is Jackson?
What is different from the PHP language. [Note]
What is Docker
What is self
What is Jenkins
What is ArgumentMatcher?
What is IM-Juggling?
What is params
What is SLF4J?
About the method
What is Facade? ??
What is Java <>?
What is the volatile modifier for Java variables?