Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Test engineer must: master these five design methods to quickly write test cases ~ train of thought analysis

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

In 2014, I was in YX with the test team, a use case review meeting, accidentally extraordinary performance, the result stuck in a use case design method, very impressive, when the business scenario is the choice of payment methods and preferential solutions.

In the later work, I also encountered the need to choose a reasonable design method to write use cases, but each time I searched the Internet for a long time and could not find a satisfactory answer. Many simple problems are complicated, and then the ideas given to solve the problems are even more puzzling.

Under the network resources, there is no shortage of answers to any question, and more often what is missing is a clear answer at a glance.

Preparation before test

As a tester, the process of software testing should first be very familiar with, when and where can be blurted out, to avoid all the possibility of turning over. It is important to note that there is no unique answer to the process, which is determined by the project. So what is given is only a fairly general reference process.

The testing process we need to be familiar with:

To sum up: there are six parts in the testing process, three of which involve use cases, which shows the importance of writing good use cases.

So, combined with the losses we have suffered over the years, I will give you a lot of information on how to quickly get to the design method of test cases.

Five common test case design methods

I. Classification of equivalence classes

1) concept

A set of input fields in which every input condition is equivalent, and if the input of one of them does not cause a problem, then other input conditions in the set are less likely to find errors.

Two important concepts about the division of equivalence classes:

Effective equivalence class: effective equivalence class is meaningful and reasonable input data for program specification.

For example, logging in to the system with the correct user name and password is a valid equivalence class.

Invalid equivalence class: invalid equivalence class is meaningless and unreasonable input data in the program specification.

For example, logging in to the system with a user name and password that does not exist is an invalid equivalence class.

2) the steps of designing test cases by equivalence class method

Divide the equivalence class for each input, get the equivalence class table, and specify a unique number for each equivalence class.

Design a test case to cover as many valid equivalence classes as possible that have not been covered. Repeat this step so that all valid equivalence classes are covered by test cases to design a test case that covers only one invalid equivalence class. Repeat this step so that all invalid equivalence classes are overwritten.

Assuming that you do not understand the above words, then do a topic to understand.

3) here comes the case

The procedure stipulates that three positive integers are entered as the lengths of the three sides to form a triangle. Please use the equivalence class method to design test cases to judge when the triangles input three integers are general triangles, isosceles triangles and equilateral triangles.

Tip:

Requirements extraction:

1. Three-sided requirements: integer / 3 numbers / non-zero / positive numbers

2. the requirement of a general triangle: the sum of the two sides is greater than the third side.

3. Isosceles triangle: the two sides are equal and the sum of the two sides is greater than the third side

4. Equilateral triangle: three sides are equal

Reference answer

Answer analysis: those that meet the demand conditions are effective equivalence classes, for example, isosceles triangles, then at least two sides are required to be equal, and all effective equivalence classes include axiom b bounded c aquivalent c, then the invalid equivalence class includes a valid equivalent b bounded c aquivalent c

Second, boundary value analysis

1) concept

The theoretical basis of the boundary value analysis method is to assume that most of the errors occur on the boundaries of various input conditions, and if the values near the boundaries do not lead to program errors, then the possibility of other values causing program errors is also very small.

2) the steps of designing use cases by boundary value analysis

Analyze the type of input parameter: analyze the type of input parameter from the test specification

Equivalence class division (optional): the input equivalence class division method is used to divide the equivalence class.

Determine the boundary: use the domain test analysis method to determine the boundary of the domain range (upper point, off point and interior point)

Correlation analysis (optional): if there are multiple input fields, the combination of the boundary values of these input fields such as causality diagram and decision table method is needed for further analysis.

Form a test item: select these upper points, departure points and interior points, or a combination of these points to form a test item

3) here comes the case

Suppose the following test scenario exists, the login page of a website:

1. User name: 1-20 characters, including 1 and 20, regardless of others

2. Password: 6 digits, other numbers are not considered

Boundary value analysis is required to test the user name and password input boxes.

Reference answer

The boundary value analysis method is as follows:

Answer: the range of the password field is a closed interval [1-20]. Use the boundary value to design the use case, then find the neighbors of these two numbers + yourself, 1 is 0 and 1 and 2, 20 is 19, 20, and 21.

III. Decision table

1) concept

Decision table is a tool to analyze and express different actions of the system under a variety of input conditions. it can express the complex logical relations and the combination of various conditions concretely and clearly.

2) the steps of designing use cases by decision table method

List all conditional piles and action piles

Fill in conditional piles, conditional items

Fill in action posts, action items

Simplify, merge similar rules

Convert each rule to a use case

3) here comes the case

Suppose you have the following logic:

Use the decision table to design use cases.

Reference answer

Answer analysis: the idea of solving the problem of the decision table is to list all the conditions first, and then list the values of each condition, and finally, as shown in the figure above, a column is a use case.

4. Orthogonal test method

1) concept

Orthogonal experimental design (Orthogonal experimental design) is another design method to study multi-factors and multi-levels. it selects some representative points from the comprehensive test according to the orthogonality. These representative points have the characteristics of "uniform dispersion, neat comparable".

Two important concepts about orthogonal test tables:

1. All the conditions that participate in the test and affect the test results are called factors.

2. The value or input of the influencing factor is called the level of the factor.

How to select an orthogonal table:

1. Consider the number of factors

2. The number of levels to be considered

3. Consider the number of rows of the orthogonal table

4. The one with the least number of rows

2) here comes the case

There are the following user login page, three login conditions: user name, password, CAPTCHA, consider filling in or not, use the orthogonal table to design the test case.

Reference answer

The number of analysis factors, as well as the factor level value:

3 factor 2 state

Corresponding use cases after combination and merger

Add:

Answer analysis: the orthogonal test method is mainly to select the number of factors and horizontal values, list and then merge the two results, not much is used in the work, but can be selected under the appropriate business logic.

Fifth, process analysis

1) concept

The process analysis method regards a certain process of the software system as a path and uses the method of path analysis to design test cases. It is combined according to the order of the process, so that all branches of the process can be reached.

2) process analysis method to design use case steps

1. Draw the business flow chart

2. Set the priority of function path

3. Determine the test path

4. Select test data

5. Construct test cases

3) here comes the case

Example: install QQ, install system Home version of QQ.

Reference answer

Corresponding test case

Answer analysis: for seemingly complex flowcharts and use cases, the core of the design is actually two directions, one is the normal process, that is, the installation wizard clicks "next" until it is finished. The other direction is the scenario in which each judgment condition chooses [no], which will result in many use cases for other branches.

The last part

There are not only five test case design methods mentioned above, but the business scenarios encountered in the work can basically be solved through the above methods. The methods of equivalent class division and boundary analysis are relatively simple and can be used together in many cases. Orthogonal experimental tables and decision tables are generally used in situations where multiple inputs need to be combined to test. As the name implies, the process analysis method is selected when there are different branch processes. I hope the above methods can help you.

Welcome to join the 51 software testing family, where you will get [latest industry information], [free test tool installation package], [software testing technology], [job interview skills]. 51 learn and grow with you! Looking forward to your joining: QQ Group: 755431660

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report