1.0 State migration method definition

Find out each state of the current object under test, analyze how to transform between each state, and design test cases according to the transformation process.

The state transfer method does not guarantee the correctness of a single function, but only considers whether the transformation between states is consistent with the requirements.

Suitable for complex business scenarios

2.0 Case 1 — Online ticketing system

2.1 Analysis of online ticket purchasing system

1. Query ticket information of the corresponding destination, [query ticket], information [unreserved]

2. Select the ticket to be booked, [Submit order], ticket information [booked]

3. The order payment is successful, and the information becomes “Paid”.

4. When the user arrives at the railway station, he takes out the ticket, and the information changes to “received ticket”.

5. When the user logs in, the information changes to “checked in”.

6. The user passes through the ticket barrier, gets on the bus, and the information becomes “used”.

7. The ticket can be cancelled before the check-in is completed, and the information will change to “Cancelled”.

2.2 Specific operations of the state migration method

1. All status nodes are identified

Unreserved, reserved, paid, collected, pulled in, used, cancelled

2. Draw a status migration diagram

3. Draw a status migration tree

2.3 Design test cases based on test paths

Path:

Unreserved → Booked → Paid → Tickets collected → In → Used

Unreserved → booked → cancelled

Unbooked → Booked → Paid → cancelled

Unreserved → Reserved → Paid → Tickets collected → Cancelled

Unbooked → Booked → Paid → Collected → In → Cancelled

3.0 Case 2 — Shopping and placing an order

3.1 Analysis of shopping orders

1. After the user submits the order, the order is generated and the order status changes to “Waiting for payment”.

2. After the payment is completed, the order status changes to waiting for delivery.

3. After the merchant confirms the order and delivers the goods, the user’s order status changes to “Waiting for delivery”.

4. After receiving the product, the user needs to confirm receipt, and the order status changes to [Waiting for evaluation].

5. The user uses the product, the evaluation is completed, and the order status changes to [Done].

6. Before the merchant delivers the goods, the user can cancel the order, and the order status changes to [Cancelled].

Users can return the goods after the merchant delivers the goods

8. Before the user pays, the merchant cancels the order and the order status is invalid.

Find all state nodes

Waiting for payment, waiting for shipment, waiting for receipt, waiting for evaluation, completed, cancelled, void

3.2 Specific operations of the state migration method

State transition tree

3.3 Design test cases based on the state transition path

Waiting for payment → waiting for shipment → waiting for receipt → waiting for evaluation → completion

Waiting for payment → void

Waiting for payment → cancelled

Waiting for payment → waiting for shipment → Cancelled

Waiting for payment → waiting for delivery → waiting for receipt → Returned

Waiting for payment → waiting for shipment → waiting for receipt → waiting for comment → Returned

Waiting for payment → waiting for shipment → waiting for receipt → waiting for evaluation → completed → Returned

4.0 Business Process

4.1 the flow chart

4.2 Drawing flow Charts

Example — ATM withdrawals

4.3 Business process test

Focus: Focus on whether the core business is working properly rather than focusing on the details of each function

This value

Test: in the work arrangement, the functional modules are divided, the business process may be missing, smoke test

Customer: The most valuable thing is the implementation of the business, not the individual functionality

4.4 Application Scenarios

Smoke: in the case of a single function module is basically available

Test the business process before going live

4.5 Business process test steps

1. Requirement analysis, clear process

2. Draw a flow chart

3. Write test cases according to the flow chart. Each path is a test case

Note:

If there are many paths, set priorities based on service paths

4.6 Shanghui Youpin places an order

Browse the goods – > add to cart – > to settle – > write order information – > submit orders – > select payment – > wait for receiving