Explain the profound things in a simple way: a summary of the classic software test case method

 Simple test case

1. Test item: elevator

Demand test: check the elevator operation manual, safety manual, etc.;

Interface test: check the appearance of the elevator;

Function test: Test whether the elevator can realize normal ascent and descend functions, and whether the elevator buttons can be used;

Whether the opening and closing of the elevator doors are normal; whether the alarm device is available and whether the alarm phone is available;

What is the ventilation status? The situation when the power is suddenly cut off; whether there is a mobile phone signal;

For example, the response on the way up. The elevator was originally on the 1st floor. If someone presses the 18th floor, then when the elevator rises to the 5th floor, someone presses the 10th floor. Will it stop on the 10th floor?

When the elevator descends to the 10th floor, it shows that it is full. If there is someone waiting for the elevator on the 8th floor, whether it stops on the 8th floor;

Reliability: When an obstacle appears when the door is closed, press the close and open buttons at the same time, click the current floor number, click the number of the same floor multiple times, etc.; what happens when you press the up and down buttons at the same time

Ease of use: Whether the design of the elevator buttons conforms to the habits of ordinary people;

User documentation: Does the user manual have a detailed description of the usage, restrictions, and conditions of use of the cup;

Pressure test: See the maximum weight of the elevator, whether the alarm device has a reminder when the load is too heavy, and continuously let the elevator rise or fall within a certain period of time, and the longest time for smooth operation under the maximum load.

2. Test item: cup

Demand test: check the cup instruction manual;

Interface test: check the appearance of the cup;

Functionality: Fill a glass with water to see if it leaks; can the water be drunk;

Safety: Whether the cup is poisonous or bacteria;

Reliability: the degree of damage of the cup falling from different heights;

Portability: Whether the cup can be used normally in different places, temperatures and other environments;

Compatibility: Whether the cup can hold juice, white water, alcohol, gasoline, etc.;

Ease of use: Whether the cup is hot, whether there are anti-slip measures, whether it is convenient to drink;

User documentation: Does the user manual have a detailed description of the usage, restrictions, and conditions of use of the cup;

Fatigue test: fill the cup with water (case 1) for 24 hours to check the time and condition of leakage; fill the cup with gasoline (case 2) for 24 hours to check the time and condition of leakage;

Pressure test: use a needle and continuously add weight to the needle, see how high the pressure will penetrate;

Drop test: The cup and the packaging (with filling), at what height does it fall without breaking;

Vibration test: cup and packaging (filled), vibration on six sides, check whether the product can handle the harsh railway, highway, and air transportation;

Test data: The specific writing of test data is omitted here (I hate writing test data most). It is applied to: scene method, equivalence class division method, causality diagram method, error speculation method, boundary value method and other methods;

Expected output: The expected output needs to consult the national standard, the industry standard and the needs of the user.

3. Test question: table

Demand test: check relevant national standards;

Function: The table is used for office or placement, first consider whether the area of ​​the table is appropriate;

Interface: Whether the layout of the table is smooth, and whether the table is uneven;

Safety: The table must have its support point. If the support point is unstable, it is easy to break the object and it is inconvenient to use;

Ease of use: how mobile the table is and whether its weight is appropriate;

Reliability: After pushing down the table, check whether the table is easily damaged;

Performance: Put heavy objects on the table and see what the maximum weight it can bear.

4. Test topic: washing machine

Function test: whether the washing machine can wash clothes normally;

Demand test: Check the operating instructions and safety instructions of the washing machine;

Performance test: How is the power consumption during use and whether it meets user needs;

Interface test: Does the appearance of the washing machine meet the needs of customers;

Ease of use test: Whether the washing machine is easy to operate;

Compatibility test: The washing machine can wash other things besides washing clothes;

Safety test: Whether the washing machine has electricity after being touched by people after being energized;

Load test: By gradually increasing the system load, it is finally determined under what load conditions the system performance will be in a crash state, so as to obtain the maximum service that the system can provide;

Stress test: By gradually increasing the system load, it is finally determined under what load conditions the system performance will be in a crash state, so as to obtain the maximum service level test that the system can provide;

Stability test: add to a certain amount of clothes and then see if the washing machine works normally after a period of time.

Commonly used test case methods

1. Equivalence class division

Question: A program stipulates: "Enter three integers a, b, and c as the side lengths of the three sides to form a triangle. The type of triangle formed is determined by the program. When the triangle is a general triangle, an isosceles triangle, and an equilateral triangle Calculate separately...". Use equivalence class division method to design test cases for this program. (The complexity of the triangle problem is that the relationship between input and output is more complicated.)

solution:

Analyze the requirements for input conditions given and implicit in the question:

(1) Integer

(2) Three numbers

(3) Non-zero number

(4) Positive number

(5) The sum of the two sides is greater than the third side

(6) Isosceles

(7) Equilateral

If a, b, and c satisfy the conditions (1) ~ (4), one of the following four cases will be output:

1) If the condition (5) is not met, the program output is "non-triangular".

2) If the three sides are equal, the condition (7) is satisfied, and the program output is "Equilateral triangle".

3) If only two sides are equal, that is, condition (6) is satisfied, the program output is "isosceles triangle".

4) If the three sides are not equal, the program output is "general triangle".

List and number the equivalent class table

Equivalence class table

Test cases covering valid equivalence classes:

abc covers the equivalence class number

3 4 5 (1)--(7)

4 4 5 (1)--(7),(8)

4 5 5 (1)--(7),(9)

5 4 5 (1)--(7),(10)

4 4 4 (1)--(7),(11)

Test cases covering invalid equivalence classes:

Invalid equivalence class

2. Boundary value analysis method

Boundary value analysis test case of NextDate function

In the NextDate function, it is implicitly stipulated that the value ranges of the variable mouth and the variable day are 1≤mouth≤12 and 1≤day≤31, and the value range of the variable year is set to 1912≤year≤2050.

 

Boundary value analysis of NextDate function

3. Wrong speculation

To test a program that sorts a linear table (such as an array), it can be speculated to list the following conditions that require special testing:

I. The input linear table is empty;

II. There is only one element in the table;

III. All elements in the input table have been sorted;

IV. The input table has been sorted in reverse order;

V. Some or all elements in the input table are the same.

4. Causality Diagram

There is a design of a test case for a vending machine software that deals with drinks with a unit price of 5 cents. The specifications are as follows: if you put in a coin of 5 cents or 1 yuan and press the button of [Orange Juice] or [Beer], the corresponding drink will be delivered. If there is no change in the vending machine, a red light showing "finished change" will be on. At this time, after inserting a 1 yuan coin and pressing the button, the drink is not delivered and the 1 yuan coin is also withdrawn; if there is change, then The red light indicating [finished change] is off, and the 5 cents coin will be refunded when the drink is delivered.

1) Analyze this description, list the reasons and results

the reason:

1. There is change in the vending machine

2. Put in 1 yuan coin

3. Put in a 5 dime coin

4. Press the orange juice button

5. Press the beer button

result:

21. Vending machine [finished change] light on

22. Refund of 1 yuan coin

23. Refund of 5 dimes

24. Give out orange juice

25. Give out beer

2) Draw a cause and effect diagram, as shown in the figure. All cause nodes are listed on the left, and all result nodes are listed on the right. Establish an intermediate node to indicate the intermediate state of processing. Intermediate node:

11. Put in a 1 yuan coin and press the drink button

12. Press the button of [Orange Juice] or [Beer]

13. You should get 5 cents of change and the vending machine has change

14. The money has been paid

Cause and effect diagram of beverage vending machine

3) Converted into a judgment table:

Decision table

5. Decision table-driven analysis method

Problem requirements: "...For machines with power greater than 50 horsepower, incomplete maintenance records, or machines that have been in operation for more than 10 years, priority should be given to maintenance...". It is assumed here that both "incomplete maintenance records" and "priority maintenance treatment" have been more strictly defined elsewhere. Please create a decision table.

answer:

①Determine the number of rules: There are 3 conditions, each of which has two values, so there should be 2*2*2=8 rules.

②List all the conditions and action stakes:

Condition stubble and action pile

③Fill in the condition items. It can start from the last line of condition items and fill up line by line. For example, the third line is: YNYNYNYN, the second line is: YYNNYYNN and so on.

④Fill in the action pile and action top. In this way, the initial decision table with the shape of the figure is obtained.

Initial Judgment Form

Initial Judgment Form

⑤ Simplify. The graph is obtained after merging similar rules.

Simplified initial judgment table

Guess you like

Origin blog.csdn.net/m0_52650621/article/details/113529371