Self-study test day 3: test case design method

According to the self-study video, the personal notes organized may not be perfect, there are deficiencies, please correct me! ! !

1. Equivalence class division method

Description: In all test data, data sets with certain common characteristics are divided

equivalence class division

        Valid equivalence class: all valid data sets, just take one

        void equivalence class: collection of all void data, take an interface

step:

        1. Clarify needs

        2. Identify valid and invalid equivalence classes

        3. Extract data and write test cases

Applicable scene

        Aimed at: where a large amount of data is required to test input, but there is no way to test exhaustively

        Such as input box, drop-down list, radio check box

        Typical: page-level input box test.

Case (the case given in the learning video)

        1-1 Requirement: Verify the legitimacy of the QQ account; 6-10 natural numbers are required.

        Writing steps:

                1. Clarify needs

                2. Effective equivalence class: 6<=natural number<=10, invalid equivalence class: non-natural number, greater than 10, less than 6

                3. The compiled use cases look at the table

        

        1-2 Requirements. Verify the correctness of a certain city's TV number (practice, slightly difficult, but)

                Requirements: 1. Area code: empty or three digits

                           2. Prefix code: a three-digit number that is not 0 and does not start with 1

                           3. Is the suffix: four digits

                Writing steps:

                      1. View the requirements to clarify the parameters in the requirements, area code, prefix, suffix, type (number), length, rules

                        2. List valid equivalence classes and invalid equivalence classes

                           3. Use Cases

2. Boundary Value Analysis

Role: An important supplement to the method of equivalence class test cases. Statistics show that a large number of program errors are often easily sent at the boundary.
 

Boundary range node: select a value that is exactly equal to, just greater than, or just smaller than the boundary as the test number

        upper point: point on the boundary (exactly equal to)

        From point: the closest point in distance

        Inliers: points within range

For example: verify the legitimacy of the QQ account; require a natural number between -99 and 99.

        

 At this time: the green point is the upper point; the yellow point is the out point; the blue point is the inner point.

Through the data, it is found that this type of method generally has a maximum of 7 test cases (can be counted), and a minimum of 5 test cases (from 4 test points to 2 test points by opening the inner and closing the outer).

PS: Open inside and close outside means that when -99<=a<100, it can be written as [-99,100), at this time [ is the closed interval,) is the open interval, and the open interval selects the number within the range, so the number near 100 There are 99 and 101 departure points. At this time, it can be judged by opening the inside, and 99 and 101 should be tested. The same is true for closing the outside.

Applicable scene

Based on equivalence classes, canonical representations have bounded range input tests

Common words: size, weight, most, at most, etc.

Hint: Boundary values ​​can override the length of an equivalence class, but not its type.

Case 2-1

Requirement: Verify the legitimacy of the title length through the boundary value method

Requirements: The title length is greater than 0 and less than or equal to 30 characters

step:

1. Clarify needs

2. Determine valid equivalence and invalid equivalence (valid: 1, 15, 29, 30; invalid: 0, 31)

3. Determine the boundary range (this question is: 0, 15, 29, 30, 31)

4. Raise data and write test cases

2-2 exercises

Requirements: Verify the legitimacy of QQ numbers through boundary values

Requirements: 6-10 natural numbers

3. Judgment table method

Function: It can list complex problems according to various possible combinations, simply and avoid "missing test points"


Explanation: It means that there are multiple inputs and multiple outputs, and there is a combination relationship between the input and the input, and there is a mutual dependency between the input and the output.

Consists of:
Condition stubs: all the conditions in the question, the order in which the conditions are listed does not matter Action stubs
: the possible actions in the question, no
constraints on the sort order of actions Value
action items: list the condition items and the action results under various values

Case: Verify the test of the function of "If the user owes the bill or shuts down the phone, he is not allowed to be called"

step:

1. Requirements analysis;
2. List conditional stubs and action stubs;
3. Combine conditional stubs;
4. Define the action items corresponding to each combination;
5. Design test cases, each line of data corresponds to a test case

condition Are you in arrears yes yes no no
condition whether to shut down yes no yes no
operate Whether to allow the caller to be called no no no yes

Analysis: Analyzing the case, we will find that there are two conditions in the case. At this time, they have two results, so they are combined into four results, that is, four action results.

PS: An example of running through condition items and action items in the decision table is a rule, N conditions, each condition has two values ​​(0, 1), and the whole combination has 2 to the Nth power of rules

Exercise: Purchase Order Check

step:

1. Requirements analysis;
2. List conditional stubs and action stubs;
3. Combine conditional stubs;
4. Define the action items corresponding to each combination;
5. Design test cases, each line of data corresponds to a test case

get figure

The resulting use case diagram

  

Exercise 2: File Modification Rules

 hint

Condition: the first column must be A/B; the second column must be a number

Action: If the first column is incorrect, information L will be given; if the second column is incorrect, information M will be given; if both are correct, the modification will be successful.

Usage scenarios: integration testing; system testing; acceptance testing, smoke testing

There are multiple input conditions, multiple output results, there is a combination relationship between the input conditions, and there is a dependency (restriction) relationship between the input conditions and the output results

The judgment table is generally suitable for situations where the number of condition combinations is small (for example, less than 4 conditions)

PS: More than 4 conditions, use orthogonal tables and causal diagrams (basically not used at present, difficult, less used)

4. Scene method

Extension: flow chart (just know it)

Use standard graphics to solve business use cases.

1. Understand the flow chart and design business use cases

2. When the requirement document information is incomplete, the process can be sorted out according to the requirement

ProcessOn - Free online drawing, mind mapping, flow chart, real-time collaboration

Tutorial: http://t.csdn.cn/LJiiH

Flowchart exercise:

1. The user name is admin and the password is: 123456, the output: login successfully

2. Log in, search for products, add shopping cart, go to settlement, and pay. If the payment is successful, it will prompt that the order is successful, otherwise it will prompt that the payment failed

scene method

illustrate:

The scenario method can also be called the flow chart method, which uses the flow chart to describe the user's applicable scenario, and then designs the test case by covering the flow chart path.

significance:

User perspective: users usually use not a single function, but a combination of multiple functions

Tester’s angle of use: Usually, a single function point is tested, and it is easy to ignore the combined test of multiple functions.

Step
Requirements analysis
Determine the basic flow and alternative flow
Design test scenarios based on the basic flow and alternative flows
A scenario is a test case
 

Case-ATM withdrawal process

 Look at the picture and draw a flow chart

 According to the flowchart, we can write test cases.

Some situations need to be taken into account and need to be added to the flow chart and test. (Common scene method in ATM system)

Practice Business Use Case Design

 Draw a flow chart

Write test cases

Practice Single Module Use Case Design

5. Wrong inference method

Concept: Use the intuition or experience of the tester to find out where the program may be wrong or easy to make mistakes, emphasizing the testing experience.

Usage scenario:
Use when time is tight and tasks are heavy. (no time to write use cases)

!!! Summary of the eight test case design methods:

with input functions, but there is no combination relationship between the inputs - the equivalence class division method
has input boundaries, such as length, type - use boundary values ​​to supplement test cases with
multiple inputs, multiple outputs, There is a combination relationship between input and input, and there is a dependency and constraint relationship between input and output——When the cause-and-effect diagram and judgment table
use the least test cases to obtain the maximum test coverage——
The combination test of multiple functions in the orthogonal method—— The flow chart and scenario method
are finally recommended to use the error recommendation method to further supplement the test cases

Guess you like

Origin blog.csdn.net/weixin_43693674/article/details/125458329