You can use a conditional jump instruction to configure the execution path of a business session request based on the response parameters of an API. This topic provides an example on how to use a conditional jump instruction in typical e-commerce scenarios.
Background information
You can add a conditional jump instruction after you add APIs. Conditional jump instructions include jump, continue, and end instructions. If you configure multiple conditions, the logical relationship between the conditions is AND, and the conditions are matched in sequence during a stress test. If you configure conditional jump instructions, the logical relationship between the conditional jump instructions is OR.
In typical e-commerce scenarios, a user needs to complete the following steps: log on to the system, top up the account balance, add the product to the shopping cart, and then complete the payment. The user configures a conditional jump instruction to check whether the account balance is topped up in the step to add a product to the shopping cart. If the account balance is topped up, perform subsequent operations. If the account balance is not topped up, an API is provided to top up the account balance.
Procedure
Log on to the PTS console, choose , and then click PTS.
Add and configure the following APIs to complete the following steps: log on to the system, top up the account balance, add the product to the shopping cart, and then complete the payment. For more information, see HTTP APIs.
Configure response parameters for the API of topping up the account balance. For more information, see API response parameters.
In the Business Session section, click the Add Instruction drop-down list and select Conditional Jump.
Expand Conditional Jump and configure the Default Action parameter and jump conditions. The following figure shows an example.
Default Action: You can select Jump, Continue, or End.
Jump: You can select another API for the business session.
Continue: You are redirected to the next API. If no subsequent APIs exist, the execution is complete.
End: The execution is interrupted.
Select Session: You can select the API for which you need to configure response parameters.
Action: You can select Jump, Continue, and End. If you select Jump, you must configure the API to which you are redirected.
Add Condition: Add a jump condition. The logical relationship between jump conditions is AND.
Add the configured conditional jump instruction to the end of the API for adding the product to the shopping cart.