หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Setting Test Case Parameters of an API Script

Updated on 2025-01-10 GMT+08:00

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 automated API 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}.

The following tables show the main configuration items of local parameters.

Table 1 Main local parameter configuration items

Configuration Item

Mandatory

Description

Name

Yes

The value can contain 1 to 300 characters. Only letters, digits, periods (.), underscores (_), and hyphens (-) are supported.

Type

Yes

Supported types: text, random character string, random integer, timestamp, formatted timestamp, UUID, Base64 encoding, MD5 hash value, password or authentication information, and SHA-512 encoding.

For details, see Table 2.

Description

No

Brief description of the parameter (current parameter by default). The value can contain up to 3,000 characters.

Click the text box to enter the description.

Click , enter a JSON string, click JSON Parse to add line breaks and indentation, and click Fill Back.

Value

No

Local parameter values. Assign values to the supported parameter types by referring to Table 2.

Sensitive

No

CodeArts TestPlan encrypts sensitive parameter values during storage and overwrites them with asterisks (*) in test result logs. Sensitive data includes but is not limited to personal and authentication information, such as names, addresses, and usernames.

Dynamic

No

Values of dynamic parameters can be assigned during test case execution. The initial value of a dynamic parameter can be empty. After a value is assigned, the latest value is displayed.

Assigning values to dynamic parameters: In the Extract Response tab page of a test step, set the value of the Assign Value to Dynamic Environment Parameter column. The extracted value will be assigned to the dynamic parameter during test execution.

Table 2 Parameter types

Name

Description

Text

The value can contain up to 10,000 characters. A local parameter of text type can be set to Sensitive and Dynamic, which are not selected by default.

Random character string

The system randomly generates a character string of a length from 1 to 9999 digits. The parameter of this type cannot be set to Sensitive or Dynamic.

Random integer

The system randomly generates an integer from -999999999 to 999999999. The parameter of this type cannot be set to Sensitive or Dynamic.

For example, if this parameter is set to [-9999,9999], a random integer in this range will be generated.

Timestamp

The system generates the current integer timestamp. No value needs to be set. The parameter of this type cannot be set to Sensitive or Dynamic.

Formatted timestamp

The format is yyyy-MM-dd HH:mm:ss or yyyy-MM-dd. The parameter of this type cannot be set to Sensitive or Dynamic.

Example 1: For yyyy-MM-dd HH:mm:ss:33250825252000, the expected value is 3023-09-05 20:20:52.

Example 2: For yyyy-MM-dd:33250825252000, the expected value is 3023-09-05.

UUID

No value needs to be set. The parameter of this type cannot be set to Sensitive or Dynamic.

Base64 encoding

The parameter of this type uses Base64 encoding method. The value can contain up to 256 characters. The parameter of this type cannot be set to Sensitive or Dynamic.

MD5 hash value

The system generates an MD5 hash value with the parameters of this type. The value can contain up to 256 characters. The parameter of this type cannot be set to Sensitive or Dynamic.

Password or authentication information

The value can contain up to 256 characters. The parameter of this type is set to Sensitive by default and cannot be changed.

SHA-512 encoding

The value can contain up to 256 characters. The parameter of this type is set to Sensitive by default and cannot be changed.

Array

The value is in JSON format and contains up to 10,000 characters. This parameter cannot be set as sensitive or dynamic.

To set local parameters, perform the following steps:

  1. Go to the Scripting tab page and click .
  2. 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

  • Checkpoint property field.
  • Property field for parameter passing.
  • Checkpoint: Check whether the value of id in the response body is 100.
  • Settings: Set Source to Response body (JSON), Property to id (only if the id field exists in the JSON string), Comparison Operator to Equals (case insensitive), and Target Value to 100.

Response Header

Response header returned by an API.

Yes

  • Checkpoint property field.
  • Property field for parameter passing.
  • Checkpoint: Check whether the value of token in the response header is abcd.
  • Settings: Set Source to Response Header, Property to token (only if token exists in the response header), Comparison Operator to Equals (case insensitive), and Target Value to abcd.

Response Code

Response code returned by an API.

No

  • Property or value of a checkpoint.
  • Property field of a variable.
  • Checklist: Check whether the response code is 200.
  • Settings: Set Source to Response Code, Comparison Operator to Equals, and Target Value to 200.
NOTE:

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 the Response Extraction of an API Script.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback