Current location - Trademark Inquiry Complete Network - Overdue credit card - How to write a good test case
How to write a good test case
Test case is a guide to test execution; It is the entity of test execution and the important basis and embodiment of test method, test quality and test coverage. It is the basis of internal communication and cross-testing, which facilitates the tracking and management of testing work, including tracking the progress of testing implementation, tracking the quality of testing, and tracking and assessing the workload of testers; Writing test cases before test execution can avoid the blindness of test work; Test cases are the best basis for users to believe in product quality, and can also be provided to customers as the basis for project acceptance. From the above, we can see the position and role of test cases in the whole test work. Here are some personal suggestions on how to write a good test case:

1. Participate in requirements review. The process of reviewing requirements is actually the process of getting familiar with business requirements. Only when you are familiar with the business can you design high-quality test cases better and more fully.

2. Read more documents, including product plans, specifications, requirements documents, interface documents, etc. We can collect all relevant documents to help us understand the goals that the products under test need to achieve.

3. Participate in meetings within the project team as much as possible. Such as demand discussion, design discussion, planning discussion and other meetings, so as to deepen the understanding of products in the discussion process.

4. Be good at communication, and communicate with customers, developers and testers. If you encounter unclear problems or questionable needs, you can consult the project leader or customers. Only in this way can we solve the deviation of demand understanding in advance.

5. The name of the test case, also known as the title of the test case, must be written concisely. It is necessary to describe the starting point and focus of test cases in common language, so that testers can understand the purpose of test cases at first sight. Generally, it is required that there should be no hypothetical statements in the use case name. In principle, the name of each use case cannot be repeated.

6. The preset conditions should be clear, including test environment, test data and test scenario. Because many bugs can only be reproduced in specific environments and specific scenarios. Without the correct preconditions, the following test steps cannot be carried out or the expected results cannot be obtained.

7. The description of the test steps should be simple and clear, and the description of each step should be clear and clear. Every action of our mouse and keyboard usually represents an operation step. For example: step one, enter the user name; Step 2, enter the login password; Step 3, the user clicks Login. The steps are clearly written, which helps to improve the operability of the use case.

8. The expected result of the use case should be complete and clear, and the output result should be written, including the content of the return value, the records of relevant fields in the database, the response result of the interface, the rule compliance of the output result, the check of the log and the check of other business impacts.

9. Test case levels should be clearly divided, so that test execution can be divided into primary and secondary levels.

10, the division of test cases should be single, and a test case only checks one situation of function points. There are too many use cases in a use case, which will lead to unclear purpose of use cases. In addition, organizing use cases in this way is beneficial to the statistics of demand coverage. It is clear at a glance what we have tested at a function point and which function points we have paid attention to.