【Software Testing】How to design test cases?


insert image description here

1. Universal formula for designing test cases

设计测试用例的万能公式: 功能测试+性能测试+界面测试+兼容性测试+易用性测试+安全测试

  • Functional testing: Verify that the software system works according to the functions defined in the requirements specification, including normal functions, abnormal functions and edge cases.
  • Performance testing: Verify whether the software system works according to the functions defined in the requirements specification, including normal functions, abnormal functions and edge cases.
  • Interface testing: Verify whether the user interface of the software system complies with the design specifications, including interface layout, font color, button functions, etc.
  • Compatibility testing: verify the compatibility of the software system in different operating systems, browsers, devices and other environments to ensure that the system can work normally.
  • Ease of use test: Verify whether the user experience of the software system is good, including interface friendliness, ease of operation, prompt information, etc.
  • Security testing: Verify the security of the software system, including data confidentiality (whether private data is encrypted), data integrity, authority control (problem of exceeding authority), etc.

2. Specific design methods of test cases

Requirements-based design approach:

  1. equivalence class
  2. Boundary value
  3. causal diagram
  4. Orthogonal sort
  5. Scenario Design
  6. wrong guess

2.1 Equivalence classes

Equivalence class is a commonly used method in test case design, which divides input values ​​or conditions into mutually equivalent categories, and selects a test case from each category to represent the entire category. This can effectively reduce the number of test cases while ensuring that cases of different equivalence classes are covered.

Equivalence classes are divided into effective equivalence classes (meaningful collections for requirements document requirements) and invalid equivalence classes (meaningless collections)

2.2 Boundary value

Boundary value testing is an approach in test case design that focuses on testing the edge cases of inputs or conditions. The purpose of boundary value testing is to detect the behavior of the system at the boundary because 通常在边界处出现错误的可能性更高.

The boundary value is divided into有效边界和无效边界

In boundary value testing, test cases are designed based on taking the boundary value of an input or condition and its adjacent values ​​as test data. Typically, boundary value testing includes the following aspects:

  1. Lower bound test: Select the minimum value of the boundary value for testing to verify the system's ability to handle the minimum value.
  2. Upper bound test: Select the maximum value of the boundary value for testing to verify the system's ability to handle the maximum value.
  3. In-boundary test: Select the middle value of the boundary value for testing to verify the processing capability of the system within the boundary.
  4. Out-of-boundary testing: Select values ​​adjacent to the boundary value for testing to verify the system's ability to handle outside the boundary.

2.3 Decision table (cause and effect diagram)

Decision table method design test case:

  1. Confirm input conditions and output conditions
  2. Find the relationship between input conditions and output conditions
    • First find all possible combinations between the input conditions
    • According to the combination to give the corresponding output result
  3. draw decision table
  4. Write test cases based on decision tables

2.4 Scene Design Method

The scenario design method mainly plays the role of guiding ideas. It requires us not to fully refer to the situation written in the requirements document, but to design possible unexpected processes as much as possible

2.5 Orthogonal method

rarely used, uncommon

Orthogonal Design is a software test design method, which aims to cover all aspects of the system as much as possible by selecting the most representative and effective test case set. Based on the concept of "orthogonality", the method parameterizes the test cases and constructs a set of independent and minimal test cases by choosing combinations of different parameter values.

Tools for generating orthogonal tables:allpairs

How to use allpairsGenerate Orthogonal Table?

  1. Write levels and factors to Excel (other tools are not recommended)
  2. Create a new txt file (a.txt) in the same directory as allpairs.exe, copy the factors and levels in Excel, and paste it into the newly created txt file (a.txt). Save it directly without any other operations
  3. Use the command line prompt (cmd), enter the corresponding directory of the allpairs.exe tool, and execute the akkpairs.exe above-mentioned newly created txt file > the txt file to be saved to (this file does not need to be created in advance)

2.6 Error Guessing Method

The error-guessing method is by guessing possible errors in the program and testing against them. This approach tries to find unconsidered bugs in the program based on the experience and intuition of the tester.

3. Summary

The above methods of designing test cases are just some concepts, and different methods should be selected for different scenarios to design test cases.

Thank you for watching! I hope this article can help you!
Column: "Software Testing" is constantly being updated, welcome to subscribe!
"Wish to encourage you and work together!"

insert image description here

Guess you like

Origin blog.csdn.net/m0_63463510/article/details/131977608