Test case design method - detailed explanation of scenario method

01. Definition

The scenario method is a method to improve the test effect by using scenarios to describe the function points or business processes of the system.

The scenario method generally includes basic flows and alternate flows, starting from a process, determining the process by describing the path passed, and completing the entire scenario by traversing all the basic flows and alternate flows.

Scenes mainly include 4 main types:

normal use case scenario

Alternative Use Case Scenarios

Unusual Use Case Scenarios

hypothetical scenario

02. Basic flow standby flow
insert image description here

The picture above shows: the use case basic flow and alternative flow (note: the start and end points of the alternative flow)

Basic flow: It is represented by a straight black line, which is the simplest path through the use case (without any errors, the program is executed directly from the beginning to the end)

Alternative flow: Indicated by different colors, an alternative flow may start from the basic flow, execute under a certain condition, and then rejoin the basic flow (such as 1 and 3), or it may originate from another alternative flow ( Such as 2), or terminate use cases, not added to the basic flow (such as 4); (various error conditions)

The scene generated in the above figure is as follows:

Scenario 1: Elementary Stream

Scenario 2: Basic Stream Alternative Stream 1

Scenario 3: Basic stream alternative stream 1 alternative stream 2

Scenario 4: Basic Stream Alternative Stream 3

Scenario 5: Basic flow Alternative flow 3 Alternate flow 2

Scenario 6: Basic flow Alternate flow 3 Alternate flow 2 Alternate flow 1

Scenario 7: Basic Stream Alternative Stream 4

Scenario 8: Basic flow Alternative flow 3 Alternative flow 4

Why can the scene method describe the whole event so clearly?

Because, the current system basically triggers the control process by events.

For example: when we apply for a project, we need to submit the approval documents first, and then the department manager will approve it. After the review is passed, the general manager will make the final approval. If the department manager fails to pass the review, it will be returned directly. The context in which each event fires forms the scene. However, different trigger sequences and processing results of the same event form an event flow. This series of processes can be clearly described by using the scene method.

03. Scenario method design steps

According to the instructions, describe the basic flow of the program and various alternative flows

Generate different scenarios based on the basic flow and various alternative flows

Generate corresponding [url=]test cases[/url] for each scenario

Re-review all the generated test cases, remove redundant test cases, and determine the test data value for each test case after the test cases are determined

For each scenario, test cases need to be identified. Test cases can be identified and managed using matrices or decision tables.

A general format is shown in the example below, where rows represent individual test cases and columns represent information for the test cases.

In this example, for each test case, there is a test case ID, condition (or description), all data elements involved in the test case (either as input or already in the [url=]database[/url]), and the expected result.

Build the matrix by starting by identifying the data elements needed to execute the use case scenario. Then, for each scenario, at least identify the test cases that contain the appropriate conditions needed to execute the scenario. For example, in the matrix below, V (valid) is used to indicate that this condition must be VALID (valid) before the basic flow can be executed, and I (invalid) is used to indicate that this condition will activate the required alternative flow. "n/a" (not applicable) used in the table below indicates that this condition does not apply to the test case.

04. Scenario method design example

There is an example of online shopping. The user enters an online shopping website for shopping. After purchasing the item, he needs to log in with the account. After the login is successful, the payment transaction is performed. After the transaction is successful, the order form is generated and completed. the whole shopping process.

1. According to the instructions, describe the basic flow of the program and various alternative flows

Basic flow: log in to the website, purchase items, account login, payment transactions, and generate orders

Alternative flow: no account, wrong account or password, no money in the account, insufficient account balance, the user exits the system

2. Generate different scenarios according to the basic flow and various alternative flows

Scenario 1: Log in to the website, buy items, log in with an account, and have no account

Scenario 2: Log in to the website, purchase items, log in with an account, wrong account or password

Scenario 3: Log in to the website, purchase items, log in to the account, pay for transactions, and have no money in the account

Scenario 4: Login to the website, purchase items, account login, payment transaction, insufficient account balance

Scenario 5: Log in to the website, purchase items, account login, pay for transactions, and generate orders

Scenario 6: Log in to the website, purchase items, log in with an account, and the user logs out of the system

3. Generate corresponding test cases according to the scenario

Test case ID scenario/condition account password balance expected result

Scenario 1: No account In/an/a prompts no account

Scenario 2: The account or password is wrong (the account is wrong, the password is correct) IVn/a prompts that the account or password is wrong and re-enter

Scenario 2: The account or password is wrong (account is correct, password is wrong) VIn/a prompts that the account or password is wrong and re-enter

Scenario 3: The account balance is insufficient VVI prompts that the account balance is insufficient

Scenario 4: There is no money in the account VVI prompts that the account balance is insufficient

Scenario 5: VVV generates an order after successful shopping

Scenario 6: Exit the system during operation VV user exits the system

4. According to the above table, design the data and fill in the data

Test case ID scenario/condition account password balance expected result

Scenario 1: No account hn/an/a prompts no account

Scenario 2: The account or password is wrong (the account is wrong, the password is correct) f0n/a prompts that the account or password is wrong and re-enter

Scenario 2: Account or password error (account is correct, password is incorrect) ffIn/a prompts that the account or password is incorrect and re-enter

Scenario 3: The account balance is insufficient ff010 prompts that the account balance is insufficient

Scenario 4: The account has no money ff00 prompts that the account balance is insufficient

Scenario 5: Successful shopping ff0500 generates an order, and the balance decreases

Scenario 6: Exit the system during operation ff0 user exits the system

Guess you like

Origin blog.csdn.net/nhb687095/article/details/131764689
Recommended