How to write high-quality test cases

Source: Internet
Author: User
How to write high-quality test cases

1. What are test cases
Test cases are a collection of operational steps and expected results that are written to standardize the behavior of testers during software testing.

2. Four elements of software testing
Test objects, test purposes, test methods, test results.

3. Two points of the test case
Operation steps, expected results.

4. Problem segmentation principle
Software testing is to find errors and find errors in order to find the cause, so the test case is written to facilitate the location of the problem.

5. Principle of equivalent compatibility
Software testing is not to test all the test points, but to find a representative of all the test points. See the boundary effect below.

6. Test the convergence principle
Tests are unavoidable to test different results under various combination conditions, and the combination of conditions may increase exponentially, and this situation must be avoided.

7. The operability of test cases
Although software testing can be done with automated tools, the final results and steps of the operation still require human involvement, so the test case must be within the paradigm that humans can control. In addition, in order to facilitate the statistical and analysis of results, the final test results are best to "fit" and "incompatible".

8. Validity of test Cases
Single use cases achieve a single purpose, and different use cases achieve different purposes.

9. Validity of test results
The purpose of software testing is to find the problem, the analysis of the problem is not the purpose of software testing, the results of all tests must be objective enough, neither cannot be located, nor can it be reproduced.

10. About the coverage of test cases
The common practice is to use the number of test cases, the number of bugs, the number of lines of code as a reference value. But the most important thing to ensure the coverage of test cases is to list all the necessary test points, first of all to ensure functional requirements, and then non-functional requirements. The key points in non-functional requirements include execution efficiency, code size, stability, robustness, compatibility, operability, and many others. When writing a functional test case, consider both the correct value and the error value, which should have been done in the design phase as well. Coverage (statistically) is not the higher the better, do not aimless design test cases, with the fewest test cases to complete the most test point is the high-quality test as an example.

Attached: Boundary effect
For a series of consecutive or discrete test points, the most valuable test points are often the maximum and minimum values. In the actual development process, there are few bugs on the whole value interval, but the most likely bugs are on the boundary value.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.