[Software Testing] Talking about Test Case Design

1. Why do test cases exist?

1.1 Definition

Test case (Test Case) refers to the description of the test task of a specific software product, reflecting the test plan, method, technology and strategy. The content of the test case includes the test target, test environment, input data, test steps, expected results, test scripts, etc., and finally forms the output of the document class. In short, a test case is a set of test inputs, execution conditions, and expected results designed for a certain purpose to verify whether a certain software requirement is met.

1.2 Function

①Guide the execution of test (development)

The test case serves as the work benchmark of each test stage to guide the testers to implement the test according to the use case project and test steps. In addition, when the test work is shifted to the left, the test cases output by the test students in advance can also guide the development work of the developers.

② Preparation of test materials

• Data: Prepare one or several sets of raw data required for testing according to the test cases.

• Test scripts: basis for designing automated test scripts.

③Test work progress control

• Test workload assessment

• Improve test work organization efficiency

④Measurement benchmark of test results

After the test is completed, it is necessary to write a test report to judge whether the test is completed and to measure the quality of the test. The quantitative results are more accurate and effective. Example: What is the test coverage rate, what is the test pass rate, what is the important test pass rate, and so on.

⑤ Analyzing Defects

By comparing test cases and defect databases, the cause and type of defects are analyzed.

2. Basic principles of test case design

①Correctness: The test case must be correct and must pass the test case review.

② Representativeness: Test cases cannot be "exhaustive", and it is expected to conduct effective tests within a limited test time, and the use cases must be representative.

③ Decidability: The test results of the use case must be quantifiable, so that after the test is completed, the test results can be compared with the expected results to determine whether there is a BUG.

④Reproducibility: The reproducibility of test case execution ensures the accuracy of problem location.

⑤ Operability: Detailed, accurate and clear steps are the necessary conditions for the execution of test cases and the basis for the reproducibility of test cases.

3. A few words about test case design

3.1 Foundation: common test case design method (black box test)

Equivalence Class Partition and Boundary Value Analysis

• Equivalence class division

Divide the scope of the test into several disjoint subsets, and their union is the full set, and select several representative values ​​from each subset as test cases.

• Boundary value analysis

Boundary value analysis is a method of testing the boundary value of the input or output, usually as a supplement to the equivalence class partition method, in this case, the test cases come from the boundary of the equivalence class.

scene method

The scenario method is to describe the path of use case execution through the scenario, and traverse all the basic flows and alternative flows on this path from the beginning to the end of the use case. The scenario method is suitable for testing systems or functions with clear business processes, and tests the system from all perspectives of the entire business process of the system.

For example: to buy a product in JD.com, APP->Select product->Click to buy->Confirm purchase information->Payment, the combination of different results of each link here is a different use case.

error guessing

Error guessing is mainly an informal engineering method that relies on experience and intuition. The basic idea is to list possible errors in the program or test points that are prone to errors, and then write test cases based on the test points.

Example: Check the special characters in the search input box of JD.com APP.

Cause and Effect Diagrams and Decision Tables

Use the graphical method to express various combination relations, write out the judgment table, and design the corresponding test cases. Similar to the Boolean logic operation in mathematical knowledge, it combines various input conditions. Each combined condition is the "cause", and it has an output result, which is the "effect".

Example:

Orthogonal Experiment

Orthogonal experimental design is to use the already built orthogonal table for data analysis, and select some representative points for the experiment. Efficient and fast use case design method.

Example:

3.2 Building a house: test case design in practice

In actual work, many times we cannot follow the theoretical test case design method and write large and comprehensive use cases to perform tests for all large and small requirements. In more cases, the lean test strategy should be followed when designing use cases, and the test coverage should not be blindly pursued. Effective testing is more valuable. Utilize lean testing guided by information such as the four quadrants of testing, pursue business value as the goal, deliver high-quality software with as little cost as possible, achieve effective coverage, and reduce waste. Regardless of whether it is manual testing or automated testing, it is necessary to clarify the business value and quality goals first, and the test case design and execution process need to make corresponding considerations (such as the priority of test cases).

frame building

Before use case design, we should be familiar with the business background and technical architecture of the requirement, so as to outline the overall framework of the test case. Then, use the combined mode of [horizontal expansion] + [vertical layering] to complete the use case disassembly and coverage for each requirement.

•Horizontal business expansion: From a business perspective, what business scenarios are there in total and what capabilities are provided, that is, the functional panorama of the top layer of the product.

•Vertical architecture layering: It refers to the analysis from the level of technical architecture. The current product can be divided into several layers macroscopically, so as to facilitate the verification and use case coverage at different levels in the use case verification.

Example:

building blocks

After the test framework is built, it is necessary to improve the test scope and confirm the details of the function points. For example, in general, regression testing and exception testing are required, and concurrency testing, security testing, and performance testing may be required. Starting from the test type, use case design and writing are combined with conventional use case design methods.

Example:

 Standing outside the house: testing like a user

How to test like a user, whether it can restore the usage scenarios of real users, and restore the true psychology of users when using the product. It sounds a bit mysterious, but the idea is actually very simple. The first step is to imagine yourself as a user, how many strange operations or needs I would have; the second step is to bridge the gap between testers and users, align users with test information, and guide users to use the software better. Guided tests are more empathetic.

small coup

•User portrait: We have a high probability of knowing who the user group is and what his typical portrait is like, which is also the basis for our empathy.

• Do not trust the upstream and downstream: We cannot guarantee that the information or functions given to me by the upstream and downstream must be perfect. Combined with our own system positioning and business to confirm what kind of feedback we should make in different scenarios.

3.3 Expansion: house maintenance, test case management

Test cases are the precious wealth of our testers, and test cases are the most important foundation in testing work. Therefore, a good test case can not only help testers to read, understand, and modify, but also facilitate us to manage it, thereby improving the quality and efficiency of testing work. Different business lines or teams can formulate some rules according to their own needs, so that everyone can follow them when designing test cases.

Finally:  In order to give back to the die-hard fans, I have compiled a complete software testing video learning tutorial for you. If you need it, you can get it for free【保证100%免费】

insert image description here

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. I hope it can help you too!

How to obtain the full set of information:

Guess you like

Origin blog.csdn.net/weixin_50829653/article/details/130405673