El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.
- 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
Copied.
Saving Test Procedure as an API Keyword
Background
API keywords define the request of a single API, and can be generated by importing a Swagger file or saving a user-defined URL request.
Swagger is a tool for defining, developing, and debugging APIs such as RESTful. Swagger can be used to define API attributes in a standardized manner, facilitating interconnection and interworking. API automation allows you to import API description files in Swagger 2.0 and 3.0 format, parse API definition descriptions, and generate a script template. You only need to enter API parameters based on the template to create automated API test cases.
You can import a Swagger API description file to generate a script template. A script template corresponds to an API definition in the Swagger file. Test cases can be orchestrated in a visualized manner based on the script template.
The following tables show the mapping between the script template and the fields in the Swagger API description.
- Swagger 2.0 format
Script Template Attribute
Swagger API Definition Attribute
Name
By default, operationId is used. You can set it to summary.
Path
schema + :// + basePath + path.
Request parameter hostURL
host
Other request parameters
parameters
- Swagger 3.0 format
Script Template Attribute
Swagger API Definition Attribute
Name
By default, operationId is used. You can set it to summary.
Path
url + path
Request parameter hostURL
servers:
- URL: https://{hostURL}/variable
variables:
hostURL:
default: test.demo.com
Other request parameters
parameters, requestBody, and responses
Importing a Swagger File to Generate a Test Script
- After the operations described in Creating an Automated API Test Case Template are complete, click the test case name, and click the Scripting tab.
- On the Keyword Library page on the right, click Import API.
- Click Click to add file or drag upload, select the configured Swagger API file, and click OK.
- After the file is imported successfully, the system automatically parses and generates a script template. The script template contains the basic description of the API. You can click
or drag and drop an API on the Keyword Library page to add it to the test step. You only need to enter the API parameters based on the template to perform the test.
Saving a Customized API Keyword
- After the operations described in Creating an Automated API Test Case Template are complete, click the automated API test case name and click the Scripting tab.
- After the operations described in Adding an API Test Script by Using a Custom URL Request are complete, select the test step to be set as a keyword (only for custom URL request steps), and click
at the upper right corner of the test step page to save the API keyword.
- On the page that is displayed, set API Keyword and Description, and select the directory for storing the keyword. By default, keywords are stored in Default Folder under API > Keyword.
- Click Save.
Managing Existing Keywords
For an added keyword, you can hover the cursor over the keyword area and perform the following operations:
- Click a keyword name to view the details about the keyword.
- Click
on the right of the Keyword to create a folder. Save the keyword set in Step 3 to a custom folder.
- Hover the cursor over the left area of a keyword name to adjust the keyword sequence.
- Click
or hover the cursor over the keyword and drag it to the blank page of the test step to add a test step as a keyword.
- Click any area of the test keyword to edit the keyword pair application case details.
- Click
to view the information about the key word.
- Click
to disable a keyword, and click it again to enable the keyword.
- Click
to delete the keyword from the test procedure.
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