For students who are unclear about the content of the unit test, Ningxia computer training/suggestions can refer to this article and explain the content of the unit test in detail.
There are many misunderstandings in unit testing: 1) It wastes too much time. Once the coding is completed, developers who lack practical experience in software engineering can't wait to start software integration and let the actual system start working. In this development step, real progress is replaced by superficial progress.
The possibility that the system can work normally is very small, and more often it is full of various bugs.
These bugs are contained in independent units, which may be trivial and insignificant, but when the software is integrated into a system, they will increase the extra time limit and cost.
In fact, it takes about the same effort to conduct a complete unit test as to write a piece of code. Once the unit test is completed, efficient software integration is the real progress under the condition of ensuring the stability and reliability of the components at hand.
The reliability of the program has a great influence on the quality of software products. In large software companies, each line of programs may be tested many times.
This shows that large software companies attach importance to testing.
2) Software developers should not participate in unit testing. Unit testing is often synchronized with coding, and unit testing is required every time a module is completed.
When unit testing each module, we can't ignore the relationship with other modules. In order to simulate this relationship, we need auxiliary modules. Therefore, unit testing by a single tester often has a large workload, long cycle and huge cost, and the result is half the effort.
Software developers should always be responsible for the testing of individual units of the program to ensure that each unit can complete the designed function. In fact, in many cases, developers also need to conduct integration testing.
3) I am a great programmer and don't need unit testing. If we are really good at programming and have unique skills, we should not make mistakes, but this is just a myth.
Coding can't be passed at one time, and it must go through various tests, and unit testing is just one of them.
Program code that lacks testing may contain many bugs. Programmers who modify bugs without test protection will cause more bugs, be busy debugging and have no time to test.
This cycle often leads to the collapse of the project.
In order to avoid a vicious circle, the code must be protected by a safety net, and any unit test is this safety net.
4) In any case, the integration test will catch all bugs. The goal of integration testing is to construct the program structure described in the design from the modules that have passed the unit test, and to find the problems related to the interface through the test.
In the process of testing, we found and submitted the software that passed the qualification test. During the testing process, there were many bugs, some serious problems and even crashes, so that we could not test other functions, made wrong modifications, and found other new problems in the regression testing process, which made the testing work difficult to carry out.