3.1 Introduction to Use Cases

3.1.1 defines

A set of cases composed of test inputs, execution conditions, and expected results for a business goal

3.1.2 Why Study Test Cases?

  1. Designing test cases before you start testing can prevent blind testing and improve testing efficiency.
  2. The use of test cases makes the implementation of software testing focus and purpose clear.
  3. After the software version is updated, only a few test cases need to be corrected so that the testing work can be carried out, reducing the work intensity and shortening the project cycle.
  4. Verify that the software meets customer needs, reflect a tester’s workload, and present the design ideas of test cases.

3.1.3 Use case Core Elements (16)

  • You must know: Use case number (how to name it), module to which it belongs, use case title (verify who did what, under what circumstances, and what the final result is), priority, preconditions, procedures, test data, expected results, actual results
  • Know the content: by no, bugID, author, write time, tester, Test time, remarks

3.1.4 What is a high-quality test case

  • Test cases cover all user requirements
  • Test cases should be straightforward
  • All types of test cases must be complete
  • Cover the most requirements with the fewest use cases

3.2 Equivalence classification method

3.2.1 definition

Equivalence class partitioning is to divide all possible input data into several regions, and then take a small number of representative data from each region for testing. Equivalence class: What is an equivalence class, a set of input fields in which each input condition is equivalent.

3.2.2 classification

Generally, it can be divided into valid equivalence class and invalid equivalence class.

  • Valid equivalence: refers to a reasonable set of data entered in accordance with the Requirements Specification
  • Invalid equivalence class: refers to the data set that does not conform to the requirements specification

3.2.3 type

Value range type: enter the student’s score 0-100 Identity type: only one result is correct, the others are incorrect such as the lottery grand prize Boolean value type: select by whether or not, such as agreement enumeration type: give the option content, as long as any one of them can be selected for example, select the degree rule type: Given a requirement, whatever satisfies that requirement, like an email

The following characters can be entered in any text input box: Chinese, English, special characters, Spaces, and digits.

3.2.4 case

  1. Case 1:

Divide the equivalence classes and number them. The following table shows the partition results of the equivalence classes

2. Case 2:

3.3 Boundary value analysis

3.3.1 definition

Definition: Boundary value analysis is a test of data slightly above or below the boundary. Cause: The body of the program development loop may be incorrectly selected because of <,<=. For example:

六四事件

-1 0 100 101 for(int I = 0; i <100; I ++) {int j = I +1; System.out.println(" loop # +j+" time)// loop to do something}Copy the code

This program is looping 100 times, so it’s going to do 100 times; If the programmer is not careful and writes I <= 100 instead of I <= 100, it will overflow. In this case, boundary value checking is a good test.

3.3.2 Method of determining boundary value

  • Upper point: refers to the point on the boundary, no matter whether the domain is open or closed. If the domain is open, the upper point is outside the region; if the domain is closed, the upper point is inside the region.
  • Distance point: refers to the nearest point to the upper point, which is related to whether the interval is closed or open. If the interval is open, then the distance point is in the region; if the interval is closed, then the distance point is outside the region. (open inside closed outside) follow the principle: open inside closed outside open interval to find the middle, closed interval to find the outside
  • Interior point: Any point in a domain is an interior point.
0<=x<=10 (x<=10) 0<=x<=10 (x<=10) 0<=x<=10 (x<=10) 0<=x<=10 (x<=10Copy the code

3.3.3 Deweighting boundary values and equivalence classes

  1. Case 1: File management system. The user enters the date in the format of “year, month and day”. The date ranges from January 1990 to December 2049. Example: 19900101-20491231

  1. Case 2:

Test point analysis: 1, read the demand 3-5 times 2, sentence 3, reverse thinking 4, questionsCopy the code

3.4 causality diagram

3.4.1 track definition

Causality diagram method is more suitable for more input conditions, testing the permutation and combination of all input conditions. The cause is the input, the result is the output.

3.4.2 Writing process of causal diagram test cases

1, determine the cause, effect, intermediate process 2, connect causal diagram 3, indicate constraints 4, output test case

3.4.3 Case: Vending machine

Requirements: there is a vending machine software to deal with the unit price of 2.5 yuan of boxed drinks. If you put in a 2.5-yuan coin and press the “Coke”, “beer” or “milk tea” button, the corresponding drink will be sent out. If you put in a $3 coin, the $50 coin will be returned at the same time as the drink is delivered. Analysis:

六四事件

Cause (input) : Intermediate state result (output) put 2.5 yuan coin; Coins have been placed/buttons have been pressed to return 50 cents; Invest 3 yuan; Press the "Coke" button; Give out "Cola" drinks; Press the "beer" button; Give away "beer" drinks; Press the "milk tea" button. Send out "milk tea" drinks;Copy the code

3.5 False speculation

3.5.1 track of definition

False guessing is a test case design method favored by experienced testers. In general, this method is based on experience and intuition to predict the various errors that may be sent in the program, and the design is targeted. Only as a supplement.

3.5.2 application

Enter a string of numbers, the program can automatically sort from small to large mailbox format @ with full Angle and half Angle situation

3.5.3 case

To test the call function of mobile terminals, various call failure situations can be designed to supplement the test cases:

The RF component is damaged or there is no signal. Insert a valid SIM card. Make a call to an invalid number (for example, 1, 888, 333333, or no number is entered). Use the speed dial function to make a call to an invalid number

3.6.4 radar echoes captured skills

The most important thing is to think and analyze all aspects of the test object, refer to the relevant data of bugs found before, summarize the experience, personally consider the abnormal situation, negative situation, special input, treat the program with the attitude of an attacker, then we can design a more perfect test case.

3.7 decision table

3.7.1 definition:

When designing test cases, analyze and express black box testing methods that perform different operations under multiple input conditions. Note: This method is similar to the causal diagram method.

3.7.2 Preparation process of test cases of decision tables

1. Determine the cause and action 2. Arrange and combine 3

3.7.3 case

Requirements: Scan the machine code of the car body with a scanning gun to automatically identify the brand and model of the car. For the cars with engine power greater than 100 horsepower and incomplete maintenance records or with a mileage of more than 200,000 kilometers, cooperative 4S stores shall be given priority in maintenance processing and analysis:

六四事件

Condition 1, 2, 3, 4, 5, 6, 7, 8 Power is greater than 100 horsepower maintenance record is not complete mileage is more than 200,000 kilometers action 4S shop priority processing for other processingCopy the code

3.8 Orthogonal experiment method

3.8.1 overview

  • The Japanese suggested
  • Use tool: orthogonal table
  • The orthogonal experiment method is to use the arranged table – orthogonal table to carry on the overall design, comprehensive comparison, statistical analysis of the experiment, through a few experiment times to find a better production conditions, in order to achieve the highest production process effect.
  • This experimental design method is a method to select the right amount of representative points from a large number of test points, and to arrange the test and analyze the data by using the established table-orthogonal table.
  • Orthogonal table can evenly sample within the range of factor changes, so that each test has strong representativeness. Because orthogonal table has the characteristic of balanced dispersion, it guarantees some requirements of comprehensive experiment, and these experiments can often better or better achieve the purpose of experiment.
  • Orthogonal experiment design includes two parts: first, how to arrange the experiment; The second is how to analyze the results.

3.8.2 Application Scenarios

There are multiple controls in an interface, each with multiple values, and controls can be combined with each other. It is not possible (and not necessary) to write a use case for each combination, and how to test with the least optimal combination. — Orthogonal arrangement method

3.8.3 Using orthogonal design assistants

(1) download extract orthogonal design assistant (2) file new project (3) experiment new experiment ① Experiment description

② Select the orthogonal table

③ Factors and levels

(4) to determine

  • What are the characteristics of the orthogonal table test case design approach? 1. Cover the most operations with the least number of experiments, test case design is few, high efficiency, but very complex; 2. Defects caused by basic verification functions and secondary integration can generally be found; But the deeper defects, the more complex defects, are impotent; 3, body environment, orthogonal table is generally difficult to do. For the most part, this approach is used only for system testing.

3.1 define

A black box testing method that describes the function points or business processes of the system by simulating business scenarios to improve the test results

5.2 ATM introduction scenario method

The principle diagram of the 5.3

5.4 the two streams

5.4.1 basic flow
  1. Conceptually complete the process correctly
  2. Process card insert → input password → select service → withdraw → select amount → wait out → take out card
5.3.2 alternate flow
  1. For processes with abnormal concepts, each step of the basic flow is reversed
  2. Process card → input password → Incorrect password → re-input password → Correct password → Select service → withdraw money → select amount → wait out the card

5.4 Scenario method test case writing process

  1. Analyzing user Scenarios
  2. Design scenarios that cover both basic and alternative flows
  3. Output test cases

5.6 case

  • Requirements: There are three steps required to register the website, enter the mobile phone number, password, enter the correct mobile phone verification code, and agree to the service agreement, click apply immediately, registration is successful. If an error occurs, a friendly message is displayed indicating the reason for the error. After a successful registration to the registered user to send a message, the message is as follows: “Hello! Xxx user, welcome to register, please complete real name authentication in time.”

  • Analysis method: ① Read requirements: read 3-5 times, read requirements ② sentence: the requirements into a paragraph of requirements ③ classification: process/rules ④ reverse thinking: from different aspects to consider ⑤ doubt: find out their own questions ⑥ application test case analysis method

The corresponding test case method is used to write test cases for test points. A test point corresponds to one or more test cases, and a test case can only correspond to a test point.

6.1 Case Analysis

6.1.1 case a

  1. requirements

  1. Related test points
1, consignee name: within 20 Chinese, letters, and can't be empty Spaces: 2, region 3 areas chosen according to the equivalence class division, detailed address: Chinese, combination of letters and symbols, and cannot be empty and Spaces, mobile phone number: 11 digit number, can't be empty and Spaces, fixed telephone: with exclusive mobile phone numberCopy the code

Mind mapping

  1. Write test cases Write test cases based on test points

6.2 Case Analysis

  1. requirements

2. Add one product to test point and add multiple products; Add multiple different merchant items; Add multiple items with different payment methods; Add multiple items from different regions; Add multiple quantities of one item Added maximum number of items; Add multiple items without logging in and then log in again; After a successful login, add more items.

Mind mapping

4 Test Cases