Test case with example

First, the concept of test cases

A test case is a very important document in the testing process. It is the core of the testing work, a set of standards for input and output during testing, and a specific comparison of software requirements.

Second, the role of test cases

  1. Verify that the software meets customer needs
  2. A reflection of the tester's workload
  3. Demonstrate design ideas for test cases

Third, the content of the test case

The eight basic items of test cases are: test case number, test item, test title, importance level, preset condition, input, operation steps, expected output

(The test case content of different companies is different) The following is a more detailed test case content

Use case code, use case name/title, test background, preconditions, priority, importance, test data, test steps, expected results, actual results, testers, test time, remarks

Fourth, the writing process of test cases

Requirement analysis-->Extract test points-->Test case design-->Test case review

Five, common methods of test cases

method Remark example
Equivalence Class Partitioning In each equivalence class a certain number of values ​​are chosen as representatives. The equivalence class is divided into valid equivalence class and invalid equivalence class. Input the value that meets the conditions to test the function. Entering the value of the invalid equivalence class can help to find out where the program is wrong. 

At the time of registration, the password is specified as 6--18 English letters or numbers and underscores, then a string of characters less than 6 or greater than 18 is an equivalence class, and English letters and numbers are included in the 6-18 digits and Characters other than underscore are another equivalence class

Boundary value analysis Boundary value analysis is a black-box testing method for testing the boundary values ​​of input and output, which is a supplement to the equivalence class analysis method. When registering, the password is specified as 6-18 digits, then 5 and 19 are boundary values 
scene method By using scenarios to describe the function points or business processes of the system, the test effect is improved. The scenario method is generally divided into basic flow (also known as correct flow, simulating the correct operation flow of the user) and alternate flow (also known as error flow: simulating the wrong operation flow of the user) 1. According to the requirements, find the basic flow and alternative flow (find out the correct operation process and possible error links) 
(1) Basic flow - correct withdrawal 
①Insert bank card: the customer inserts the bank card into the card reader of the ATM machine 
② Verify bank card: The ATM machine reads the account code from the entry of the bank card and checks whether it belongs to a bank card that can be accepted 
③Enter password: the ATM asks for a password 
④Verify password: Verify that the password is correct 
⑤Enter the ATM machine Main interface: ATM displays various options available in the machine. 
⑥ Withdraw money and select the amount: The customer selects "Withdraw" and selects 
the withdrawal amount. Verify whether the cash in the ATM is enough  ⑧  Update 
the account balance and cash out: the verification is successful, the account balance is updated, the cash is output, and the user is prompted to collect  the  cash .  ③Incorrect password 3 times  ④Insufficient  balance in the card 







In addition, there are also cause and effect diagram method, error speculation method, decision table-driven method, etc., which will not be introduced here for the time being. I will organize a blog post to introduce them later.

6. Design method and writing of test cases

6.1 Test case design

Perform test point analysis on each functional module, extract test points, and write test point use cases in detail

6.2 Example: Take PC QQ login as an example

  • normal login
  • Click to log in when the account is empty
  • Click to log in when the password is blank
  • Click to log in when the account and password are empty
  • Click to log in when the account is wrong
  • Click to log in when the password is wrong
  • Does the remember password function work?
  • Whether the automatic login function is effective
  • Is the password reset function effective?
  • Is the registered account function valid?

Seven, test case review

The use case review is mainly the work done by the product, development and test personnel to determine whether the test case can be used for the testing of the project.

Reviews include peer reviews, panel reviews, departmental reviews and third-party reviews

8. The significance of the review

  1. Identify deficiencies in use cases through reviews
  2. Make it easier for testers to improve use cases
  3. To achieve the purpose of improving test quality during testing

9. Examples

Screenshot of the login interface on the CSDN Web side (part)

You can refer to the original text  https://blog.csdn.net/sdr_zd/article/details/70453027

For the preparation of more actual project test cases and defect reports, please take a look at this  test case and defect report of mine (project actual combat case)

Notice:

There are certain rules for the number of test cases. For example, the number of system test cases is defined as: ProjectName-ST-001, and the naming rule is "project name-test stage type-number". Reasonable definition of test case numbers can make it easier to find test cases. Facilitates test case tracking.