How to write test cases

1. Equivalence class division method

Applicable scene:

Where there is data input, the equivalence class partitioning method can be used. For example: input box

Test ideas:

Divide ranges (equivalence classes) from a large amount of data, and then select representative data from each range that reflect the test results of the data in this range.

concept:

Valid equivalence classes: meaningful, reasonable data for the program (correct, valid data)

Invalid equivalence class: data that doesn't make sense, unreasonable for the program (wrong, invalid data)

example:

need:

a. Mobile phone number input box: Only numbers are allowed. (Only take the mobile phone number as a demonstration Lo)

Invalid equivalence classes: Chinese characters, emoticons, symbols, spaces, etc.

Valid Equivalence Classes: Numbers

 

2. Boundary value

Applicable scene:

Where there is data input, in practical work, it is generally applicable together with equivalence class division. ,

Test ideas:

Boundary values ​​are where programmers are most prone to errors when programming, so test the boundaries.

concept:

It is the dividing point between the valid equivalence class and the invalid equivalence class, called the boundary value (minimum, maximum). Also test the secondary boundary, that is, the data on both sides of the boundary value.

example:

b. Password input box: 8-20 characters (only allowed to input: letters, English symbols, numbers)

Boundary value: 8-bit characters, 20-bit characters

Secondary boundaries: 7-bit characters, 9-bit characters, 19-bit characters, 21-bit characters

 

3. Cause and effect diagram / judgment table (not very important, when you are proficient, you can directly apply the judgment table, without drawing a cause and effect diagram)

Applicable scene:

There are multiple controls in an interface. If there is a combination or restriction relationship between the controls, different combinations of controls will produce different output results. In order to figure out what output results will be produced by different input combinations, you can use a cause-and-effect diagram. or decision table.

concept:

Cause: input condition

Result: output result

It is to express the relationship between input conditions and output results by drawing pictures.

Steps for a cause and effect diagram / decision table test:

step:

Step 1: Find all the input conditions

Step 2: Find all the output results

Step 3: Analyze, list all combinations and constraints between input conditions

Step 4: Determine what output result will be produced by the combination of each set of input conditions, draw a cause-and-effect diagram, and fill in the judgment table

(The cause and effect diagram can be omitted in actual work)

Step 5: Write test cases Each column represents a combination, write a test case

Features of cause and effect diagrams/decision tables:

1) The order in which the input conditions are arranged does not matter

2) The order in which the output conditions are arranged does not matter

3) It doesn't matter which combination is tested first and which combination is tested later

4) Each combination is independent

The format of the judgment table is as follows:

Judgment table Noun term

Condition piles: all conditions of the problem

Action stubs: all outputs of the question

Condition item: the value for the condition pile

Action item: the output result under various values ​​of the condition item


4. Orthogonal arrangement method (not important)

Applications:

There are multiple controls in an interface, and each control has multiple values. To consider the combination of different values ​​of different controls, and the number of combinations is large, we can use the orthogonal arrangement method.

Thought:

Use the least sample data to achieve the broadest, highest coverage statistical results.

The quadrature table formula is as follows:

L: line line

n: Indicates the number of rows in the orthogonal table and the number of combinations to be tested

The n value is fixed, once the orthogonal table determines the n value is fixed, and the tester does not need to calculate it by himself.

m: Indicates the maximum value allowed in the orthogonal table

Determine the m value according to the number of values ​​of each control

k: Indicates how many columns the orthogonal table has

Determined according to the number of combined controls, select the appropriate orthogonal table (Baidu search)

Method summary:

a. If there are redundant columns, you can delete them

b. Map the values ​​that can be mapped first (replace)

c. Allocate the extra opportunities of each column to the values ​​of the column as evenly as possible

d. Check to see if there are exactly the same combinations, and if so, deal with them appropriately (recommended to be modified or deleted)

e. When choosing an orthogonal table, it is possible to use the orthogonal representation of the first choice, if it is not suitable, choose the closest one.

In actual work, the orthogonal arrangement method is commonly used in attribute setting testing and compatibility testing, and compatibility testing can directly test various compatible combinations with orthogonal arrangement table without writing test cases.


 

5. Test outline method: (not important)

Applicable scene:

There are multiple windows in the software, and there are several operations (function points) in the windows. In order to clarify the relationship (results) between the windows, the test outline method can be used.

An example is as follows:


 

6. Scene method

Applicable scene:

The software system with complex business is suitable for using the scenario method. The scenario method is a test method based on software business. The tester regards himself as the end user and simulates the operation situation of the user using this software as realistically as possible:

Focus on two types of operations:

The business process of the correct operation of the user—verifies that the business function of the software is implemented correctly

Simulate the situation of user error operation - verify the exception handling capability (robustness) of the software

Test idea:

The scenario method is to simulate various scenarios when users operate the software, and is mainly used to test the business logic and process of the software. When we get a test task, we do not pay attention to whether the equivalence class of a text box meets the requirements, but pay attention to whether its main functions and business processes are correctly implemented, which requires the scenario method to complete the test. When there is no problem with the business process test, that is, when the main function of the software is no problem, we will pay attention to the detailed test of the equivalence class and boundary value of the control. (First overall and then details)

Scene division:

1) Basic flow (valid flow, correct flow)

The correct business operation process of the simulated user is the basic flow

2) Alternative streams (invalid stream, error stream)

The operation flow that simulates user error is the alternative flow

An example is as follows:


Then write test cases according to different scenarios. A scenario can be one test case or multiple test cases.

 


 

 

 


 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325266733&siteId=291194637