Setting Test Case Parameters
Background
Proper test design requires that the test logic and test data be separated to maximize the reuse of the test logic and enhance the maintainability and input-to-output ratio of test cases. For example, the URL domain names of different test environments are test data independent of the test logic and related to the test environment. Test case parameters can be used to manage test data.
Parameters of API automation test cases are classified into the following types:
Local Parameters
Local parameters can be used in the current test case. For example, parameters, checkpoints, and variables of test steps can reference local parameters.
Use ${Parameter name} to reference a local parameter, for example, ${hostIp}.
To set local parameters, perform the following steps:
- Go to the Scripting tab page and click
.
- Click New Variable. Enter the parameter name, type, and value.
After all the parameters are set, click Save.
Built-in Parameters
Built-in parameters are used to parameterize the corresponding part of an HTTP or HTTPS response. You can select built-in parameters from the Source options in the Checkpoints and Response pages.
The following table lists the built-in parameters of CodeArts TestPlan.
Built-in Parameter |
Description |
Multi-level Values Supported or Not |
Function |
Example |
---|---|---|---|---|
Response body (JSON) |
Response body returned by an API. |
Yes |
|
|
Response Header |
Response header returned by an API. |
Yes |
|
|
Response Code |
Response code returned by an API. |
No |
|
|

Built-in parameters support multi-level values, for example:
- If the response body is {"result":{"appId":12}}, the format of appId is as follows: Source=Response body; Property=result.appId. If the value of result is in array format, Property=result[i].appId, where i is a non-negative integer.
Response Extraction Parameters
Response extraction parameters are extracted from the response body of an API. For details about the definition and usage, see Setting Response Extraction.
Feedback
Was this page helpful?
Provide feedbackFor any further questions, feel free to contact us through the chatbot.
Chatbot