このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。
- What's New
- Function Overview
- Service Overview
- Getting Started
-
User Guide
- Working with CodeArts TestPlan
- Enabling CodeArts TestPlan
- Accessing CodeArts TestPlan Homepage
- Configuring a Test Plan
- Configuring a Test Version
-
Configuring a Test Case
- Generating a Test Case
- Creating a Test Case by Using Mind Map
- Creating a Manual Test Case
-
Creating an Automated API Test Case
- Using Automated API Test Cases
- Creating an Automated API Test Case Template
- Adding an API Test Script by Using a Custom URL Request
- Adding an API Script by Importing a Postman File
- Adding an API Script by cURL
- Adding an API Script by Keyword Library
- Adding Logic Control to an API Script
- Setting Test Case Parameters of an API Script
- Setting Environment Parameters of an API Script
- Importing an Automated API Test Case Dataset
-
Built-in Functions
- Binary Addition Function
- Binary Subtraction Function
- Binary Multiplication Operation
- Binary Division Operation
- Obtaining the Current Timestamp
- Obtaining a Specified Timestamp
- Converting a Date into a Timestamp
- Converting a Timestamp into a Date
- Timestamp Addition and Subtraction Operations
- Generating Base64 Encoding
- Generating SHA512 Encoding
- Generating SHA256 Encoding
- Generating an MD5 Hash Value
- Generating a Random Number in a Specified Range
- Generating a Random String of a Specified Length
- Generating a Random Decimal in a Specified Range
- Generating a UUID
- Obtaining an Array via Reverse Index
- Obtaining the Element Values of an Array via Reverse Index
- Converting Uppercase Letters into Lowercase Letters
- Converting Lowercase Letters into Uppercase Letters
- Concatenating Strings
- Cutting Strings
- Obtaining String Length
-
System Keywords
- Overview
- GetIAMToken
- MySQLQuery
- MySQLUpdate
- MySQLInsert
- MySQLDelete
- OpenGaussQuery
- OpenGaussUpdate
- OpenGaussInsert
- OpenGaussDelete
- PostgreSQLQuery
- PostgreSQLUpdate
- PostgreSQLInsert
- PostgreSQLDelete
- MongoDBQuery
- MongoDBInsert
- MongoDBUpdate
- MongoDBDelete
- RedisGet
- RedisSet
- OBSWrite
- OBSDelete
- OBSQuery
- KafkaProducer
- KafkaConsumer
- TCP
- UDP
- WSConnect
- WSRequest
- WSWriteOnly
- WSReadOnly
- WSDisConnect
- DubboClient
- Executing a Test Case
- Managing Test Cases
- Creating and Executing a Test Suite
- Viewing and Evaluating Test Quality
- Settings
- API Reference
- Best Practices
-
FAQs
- What Do I Do If No Test Case Exists in a Test Suite?
- What Can I Do If I Do Not Have the Operation Permission?
- Why Am I See a Message Indicating that an API Automation Test Suite Is Being Executed or Queuing?
- What Do I Do If a Test Suite Does Not Exist?
- Why Can't I Download the Document in a Manual Test Case?
- What Do I Do If No Test Case Exists In a Test Plan
- Why Can't I Add Work Items of the Task Type When a Test Plan Is Created or Updated?
- What Do I Do If Test Cases Cannot Be Associated with Work Items of the Task Type?
- What Do I Do If the Test Case Completion Rate in the Test Report Is Lower Than 100%?
- Why Is the Status of Test Cases in a Test Plan Inconsistent with That in a Test Case Library?
- How Are Variables Passed Between Steps in API Automation Cases?
- How Do I Set Checkpoints for Test Procedures in API Automation Cases?
- Videos
- General Reference
Show all
Copied.
Setting the Response Extraction of an API Script
Response extraction is to extract a part of the API response result and name it as a parameter for invoking in subsequent test steps. Response extraction needs to be defined in the previous test steps and used in subsequent test steps.
- In the Pre-steps tab page, create the parameters to be passed on the Extract Response tab page. Built-in parameters are used for response extraction. For details, see Built-in Parameters. Response extraction also supports regular expression matching and extracts the return value that matches the given regular expression.
- In subsequent test steps, use ${parameter name} to reference the response extraction created in the previous test steps. This parameter can be referenced in the URL, request header, and request body in subsequent steps. If this parameter is referenced in the request body in JSON format, enclose the parameter with quotation marks. For example:
{ id: "Test case ID" name:"${name}" }
- The response extraction function can obtain strings based on the specified key:value. For details, see Example: Obtaining a String from the Response Body Based on the Specified key:value.
Parameter
Description
Output Parameter
${Output Parameter}, which will be referenced later. The name consists of letters, digits, and underscores (_).
Source
Source of the detected field, such as the response body (JSON), response header, and response code.
Property
Enter $ to invoke global variables, local variables, and built-in functions.
- If the source is a response code, this parameter can be left empty. For details, see Response Code Check.
- If the source is a response header, the property is the name of the field in the response header. For details, see Response Header Check.
- If the source is the response body (JSON), the property can be set in either of the following ways:
- Common extraction expression (not starting with $), for example, item.name.
Obtain the value of a field. Nested values are supported. For details, see Response Body (JSON) Check.
When an array is extracted from the response body, the index can be a number or a key:value expression. For details, see Example: Obtaining a String from the Response Body Based on the Specified key:value.
- JSONPath expression (starting with $. or $[), for example, $.store.book[0].title.
For details, see Example: Obtaining Data from the Response Body Based on JSONPath.
- Common extraction expression (not starting with $), for example, item.name.
Advanced Extraction Type
(Optional) Use the advanced extraction type to assist in extracting response information. If N/A is selected, no additional matching mode is used.
Currently, there are two modes:
- Character string extraction (truncation). For details, see Character String Extraction Description.
- Regular expressions to filter source strings. For details, see Regular Expression Description.
For the advanced extraction type, the string extraction function is preferred. If the function cannot meet the requirements, you can use the regular expression.
Assign Value to Dynamic Environment Parameter
Assigns the value extracted from the response to the dynamic parameter so that the dynamic parameter can be referenced in subsequent tests.
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