Principles of software testing

Posted Jun 16, 20203 min read

Regarding the principles of software testing, there are the following five points:

First, the test should be conducted as early as possible, and it is best to be able to intervene during the requirements phase.

The thousands of miles of dike were destroyed in the ant den. For the test, the sooner you intervene, the sooner the problem will be discovered, and the cost of modifying or adjusting the direction will be smaller.

The test is involved in the requirements stage. The most serious error is nothing more than the system cannot meet the user's needs. However, if the traditional waterfall model is used to wait for the software development to complete the test, then, if it deviates from the direction, correct it The cost will be huge.

Secondly, those responsible for software development should avoid checking their own programs.

The authorities are obsessed with bystanders and clear that their own mistakes are often unconscious.

When we were students, it was difficult to find errors if we wrote our own composition and checked it by ourselves. Mainly affected by the inertia of thinking, I feel that there is nothing wrong with this expression, and even typos cannot be discerned. If you give it to other classmates or teachers to help you check, the effect will be different.

At this time, some people have doubts. Are unit tests not tested by developers?

Yes, this is equivalent to self-test. The function of each module's code, and the specific implementation logic, are clear to the developer himself. Unit testing by developers can effectively correct some low-level errors.

In addition, it is also because the testers have insufficient coding ability, and the efficiency of unit testing is low. Therefore, developers need to conduct self-inspection to ensure the quality of such code, and the role of testers is to improve the quality of the code by a new level.

Third, the design of test cases must consider both legal and illegal situations.


There is a saying in the development world:never trust user input.

Regarding the amount of WeChat red envelopes, although the input range has been specified to be 0.01-200 yuan, sometimes, users will enter illegal content intentionally or unintentionally. What's more, hackers will specifically find vulnerabilities in forwarded pieces to attack. Therefore, both legal and illegal input must be considered, and restrictions should be properly controlled.

Fourthly, when testing a program, it is necessary to verify not only whether the program has done what it should do, but also whether the program has done something it should not do. Extra work will bring side effects, affect the efficiency of the program, and even Bring potential harm and errors.

This inspection work is mainly carried out according to the requirements document, including whether the program code is considered comprehensively and whether the logic is rigorous.

Fifth, all test cases should be kept for a long time, which is helpful for regression testing after modifying the program in the future.

The software will be iteratively updated and upgraded for a long time, but there is no guarantee that the updated and upgraded content will not negatively affect the original functions. Therefore, regression testing is required.

If you redesign and develop test cases, it will consume huge labor costs.

At the beginning, WeChat does not have a red envelope function. Will adding this function affect the original chat function? This requires regression testing.

Because the test case of the chat function has been written before, if it is retained, you can take it directly to start the test, otherwise, you need to rewrite it.

The above is the content to be shared in this article, you are welcome to correct me. Your corrections will allow me to grow quickly on the test road.

Leo Never Stop Fighting!