Test method-boundary value / causality diagram design

1. Black box-boundary value

(For example, 0.01 ~ 200 is the range of money for red envelopes. You can find the most representative data range, that is, the equivalent class, when you get the boundary value.)

1. The boundary value analysis method is a kind 补充等价划分的测试用例设计技术, it is not to choose any element of the equivalence class, but选择等价类边界的测试用例。

2. Practice has proved that when designing test cases, sufficient attention must be paid to the processing near the boundary. Specially designed test cases for testing the processing near the boundary often achieve good test results.

3. Boundary value analysis不仅重视输入条件边界,而且也从输出域导出测试用例(输出也要在乎边界)

Principles of boundary value design

1. If the input condition specifies the value range, it should be以范围的边界内及刚刚超范围的边界外的值作为测试用例

2. 如以a和b为边界,测试用例应当包含a和b及略大于a和略小于b的值(The last value that meets the condition and the first value that does not meet the condition) The boundary value
Insert picture description here
of the invalid equivalence class and the effective equivalence class can be determined by the above pseudocode
Insert picture description here
: the so-called boundary condition refers to the input and output equivalence The states in the class that are just at the boundary, beyond the boundary, or below the boundary;

Two characteristics: select one or more elements so that each boundary of the equivalence class has been tested; instead of focusing only on the input conditions, you need to consider the result space (output equivalence class) to design test cases;

The boundary conditions may be very delicate, so it takes a lot of effort to determine them;

Use scenarios: input + output need to be considered (range of values; number of values; ordered collection; internal data structure; analysis specifications;)

Example 1: Using the boundary method to improve the calculator in the equivalence class

Insert picture description hereSince the allowed values ​​are between -99 and 99, we can think of -99 and 99 as two boundary values. When we test, we can take the value next to the boundary value and the boundary value itself as input
Insert picture description here

Example 2: Withdrawal of Yu'ebao in the division of equivalence classes

Insert picture description here

Example 3: Examples of boundary values

Take the triangle test as an example: enter 3 integers as the three sides of the triangle, 1 <a, b, c <10, and determine the type of triangle through the program;
Insert picture description here

2. Causality Diagram

解决的是等价类划分和边界法解决不到的问题。Because the division of equivalence classes and boundary methods are focused on the input conditions, regardless of 输入条件的各种组合、输入条件之间的相互制约关系。(for example, what value a enters after b can only choose what value, such as selecting the province to choose the city)
Applicable conditions:
If you must consider the input For various combinations of conditions, the number of possible combinations will be astronomical,
so one must be considered 适合于描述多种条件的组合、产生多个相应动作的测试方法, which requires the use of a causality diagram (logical model)

The cause-effect graph method is based on the idea
that the functions of some programs can be expressed in the form of decision tables, and the corresponding operations are specified according to the combination of input conditions. Therefore, it can be considered that in a 决策表中的每一列设计一个测试用例,以便测试程序在输入条件的某种组合下的输出是否正确
nutshell, the causality diagram method is to find the cause (input condition) and the effect (output result or program state change) from the description of the program specification to
convert the cause and effect diagram into a judgment table,为决策表中的每一列设计一个测试用例 这种方法考虑到了输入情况的各种组合以及各个输入情况之间的相互制约关系

Decision table

Auxiliary tool for writing programs to
express complex logical relationships and conditions in a specific and clear manner
Insert picture description here
The decision table usually consists of four parts:

Condition Stub: Lists all the conditions of the problem. It is generally considered that the order of the listed conditions does not matter. (Similar to the question in the table above)
Action Stub: Lists the possible actions prescribed by the question. The order of these actions is not restricted. (These results are generally mutually exclusive)
Condition Entry: List the value of the conditions for its left column, the true and false values ​​in all possible cases.
Action Entry (Action Entry): List the actions that should be taken under various values ​​of the condition item. (The final result or action required)

Causality diagram design steps:
1. 分析软件规格说明中哪些是原因(即输入条件或输入条件的等价类)Which are the results (that is, output conditions), and assign an identifier to each cause and result.
2. Analyze the semantic content in the software specification, 找出原因与结果之间、原因与原因之间对应的关系,根据这些关系画出因果图。(equivalent methods may be used, first determine which ones are valid and those are invalid, etc.)
3. Due to grammatical or environmental limitations, there are some reasons and reasons, The combination of cause and effect cannot occur. To show these specific situations, 在因果图上使用一些记号表明约束或限制条件
4. Put the cause and effect into Figure 转换为判定表
5. Design test cases according to each column in the decision table

Example 1: Use causality diagram + decision table to design test cases

Insert picture description here
Analyze the input and output conditions:
Insert picture description here
Analyze the mutually exclusive conditions:
Insert picture description here
analyze, simplify and draw the decision table:
Insert picture description herethen write test cases according to the decision table:

Insert picture description here

Example 2: Example of Causal Diagram Exercise Yubao

Analysis of input and output conditions:
Analysis of input and output conditions:

Decision table:
Insert picture description here

Question: payroll for a factory

Description and analysis: The
salary is divided into annual salary system a1 and monthly salary system a2; the
degree of error is divided into ordinary a3 and serious a4;

Employees with salary a1 will be deducted 2% (b1) for common mistakes and 6% (b2) will be deducted for serious mistakes;
employees will be deducted 4% (b3) for common mistakes if deducted for serious mistakes and wages will be deducted for serious mistakes 8% (b4);
Among them, a1 and a2 are mutually exclusive; b1, b2 and b3, b4 are mutually exclusive; a3 and a4 can have both.

Analyzing the input and output conditions:
Input
Input 1: Conditions 1- pay wages monthly salary system conditions 2- prepared
Input 2: 3- conditions make ordinary error condition 4- 5- serious mistakes while making serious conditions and common error
output
results 1- Salary 2% Result 2– Salary 6% Result 3– Salary 8%
Result 4– Salary 4% Result 5– Salary 8% Result 6– Salary 12%
Result 7– No Salary
Insert picture description here

Published 82 original articles · praised 7 · visits 4174

Guess you like

Origin blog.csdn.net/sunshine612/article/details/105279495