Configuring a Case Script
After a test case is created, you can modify it as required.
Creating a Case Script
- Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
- Click the name of the desired PerfTest project to go to the details page.
- On the Cases tab, select the desired test case in the case list on the left.
- Click Case Script and select Pre-Steps or Steps.
Pre-Steps are executed only once in each execution thread. This configuration is optional.
Steps are executor of a test case, which needs to be configured.
- Add concurrency weight controllers, throughput controllers, requests, transactions, data sets, cycle controllers, condition judgments, and rendezvous points as required.
You can add both requests and transactions, or add either of them. In practice, data sets, cycle controllers, condition judgments, and rendezvous points are used together with requests.
- For details about how to add requests, see Adding Request Information (Packet), Adding Request Information (Think Time), Adding Request Information (Response Extraction), and Adding Request Information (Checkpoint).
- Add a transaction. A transaction mode already exists on the Transactions tab page. Click Add Transaction, select a transaction name, and click OK. For details about how to create a transaction, see Creating a Transaction.
- For details about how to add data sets, cycle controllers, condition judgments, or rendezvous points, see Adding a Data Instruction, Cycle Controller, Condition Judgment, or Rendezvous Point.
- For details about how to add concurrency weight controllers or throughput controllers, see Adding Concurrency Weight Controllers and Throughput Controllers.
- When the configuration is complete, click Save.
Skipping a Request Upon Failure
When a request fails during case execution, the case does not report an error to terminate the execution. Instead, the case continues to execute subsequent requests. The failure of a request does not affect the execution of subsequent key steps.
- Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
- Click the name of the desired PerfTest project to go to the details page.
- On the Cases tab, select the desired test case in the case list on the left.
- On the Case Script tab page, find the desired request (AW).
- Click the second button () on the right of the request to configure whether to skip the AW request upon failure. The default value is No.
Samples
Retrying a Request Upon Failure
When a request fails during case execution, the system retries the request based on the configuration, including the retry times and retry interval. If a request fails to be executed due to network or performance errors, configure retries for fault tolerance.
- Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
- Click the name of the desired PerfTest project to go to the details page.
- On the Cases tab, select the desired test case in the case list on the left.
- On the Case Script tab page, find the desired request (AW).
- On the Checkpoint tab, enable Enable Result Check to configure retry upon failure.
Samples
- If the aw-1 request is successfully executed, the aw-2 request will be executed without retrying aw-1.
- If the aw-1 request fails, it will be retried three times at an interval of 3000 ms based on the checkpoint.
- If the aw-1 request is successful during the three retries, the aw-2 request will be executed.
- If all the three retries fail, the aw-1 request fails, and the aw-2 request will be interrupted.
Disabling/Enabling a Case Request
If you want to retain a request of a case but do not want to use it, you can disable it. If you want to resume the use of the request, you can enable it again.
- Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
- Click the name of the desired PerfTest project to go to the details page.
- On the Cases tab, select the desired test case in the case list on the left.
- Disable a case request.
On the Case Script tab, click next to the desired request to disable it. Other requests are not affected.
- Enable a case request.
On the Case Script tab, click next to the desired request to enable it. Other requests are not affected.
Copying/Pasting a Case Request
- Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
- Click the name of the desired PerfTest project to go to the details page.
- On the Cases tab, select the desired test case in the case list on the left.
- On the Case Script tab, click > Copy next to the desired request. The copy is successful! is displayed in the upper right corner of the page.
- You can select a request in any project under PerfTest Projects, click > paste to front or paste to behind next to the request.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot