Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

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
Help Center/ CodeArts TestPlan/ Best Practices/ E-Commerce Platform Test Driven by API Automation Test Cases and Keywords

E-Commerce Platform Test Driven by API Automation Test Cases and Keywords

Updated on 2024-10-18 GMT+08:00

Application Scenarios

With increasingly complex functions of cloud platforms, the same pre-steps or test logic is often used during test case design. If these steps are written in each test case, the workload is heavy and the maintenance is difficult. Through the auto API test function of CodeArts TestPlan, you can create test projects, compile test cases, and run automatic execution of test case scripts. URL test steps can be set as API keywords. The keyword library manages API keywords, combined keywords, and system keywords, and makes them easy-to-use, understandable, maintainable, and reusable in different test scenarios, such as component test and system test.

This section demonstrates the test steps of product management function of an e-commerce platform.

Adding URL Test Steps and Setting a Keyword

To query product information of an e-commerce platform, perform the following steps.

  1. Log in to the CodeArts TestPlan homepage, search for your target project, and click the project name to access the project.
  2. In the navigation pane, choose Testing > Testing Case.
  3. Click the Auto API Test tab and click Create on the right.
  4. Enter the case name, configure other information as required, and click Save and Write Script. The Scripting page is displayed.

  5. Create a user login API. (Before managing product information, you need to log in to the e-shop homepage.) On the Scripting page, select the Pre-steps tab and click URL Request to generate a test step.

    Select POST as the request method, enter the request URL of the tested service, and set request parameters (username and password).

    Click the Checkpoints tab and set the checkpoints based on the response code.

    Click the Extract Response tab and set the response extraction parameters to extract parameters for subsequent test steps.

  6. Create an API for adding new products. On the Scripting page, select the Test Procedure tab and click URL Request to generate a test step.

    Set the request method to POST, enter the request URL of the service to be tested, set the request parameters (inventory, description, icon, ID, category, name, price, and title) and request header parameters (using the response parameters extracted in the pre-steps).

  7. Create an API for querying specified product information. On the Scripting page, select the Test Procedure tab and click URL Request to generate a test step.

    Set the request method to GET, enter the request URL of the tested service, and set the request parameters (the product ID).

  8. Create an API for updating products. On the Scripting page, select the Test Procedure tab and click URL Request to generate a test step.

    Select the request method to PUT, enter the request URL of the tested service, and set the request parameters (for updating the product information).

  9. Create an API for deleting products. On the Scripting page, select the Test Procedure tab and click URL Request to generate a test step.

    Select the request method to DEL, enter the request URL of the tested service, and set the request parameters (ID of the product to be deleted).

  10. Create an API for querying the product list. On the Scripting page, select the Test Procedure tab and click URL Request to generate a test step.

    Set the request method to GET and enter the request URL of the tested service.

  11. You can add, delete, modify, and query system keywords based on the database type. Database operations are stored as system keywords in the keyword library so that the operations can be reused in multiple service scenarios. For details, see system keywords of API automation test cases.

  12. After the script is edited, click Save and execute the test case. After the execution is complete, view the execution result on the Results tab page.

  13. Set test steps that may be reused in future script editing as API keywords.

    Click the icon on the right of the URL request name. On the page that is displayed, set API Keyword and Description, and select the directory where the keyword is to be stored.

Setting Combined Keywords for a Full Process

When designing test cases, you may often use the same pre-steps or test logic. If these steps are written in each test case, the workload is heavy and the maintenance is difficult. Combined keywords encapsulate multiple test steps as common test logic. This test logic can be reused when the combined keywords are invoked by other test cases. The process of adding, deleting, modifying, and querying products can be set as a basic combined keyword for reuse on the e-commerce platform.
  • Scenario 1
  1. Click in the upper right corner of the Scripting page.
  2. Set Name and Description, select the directory where the keywords are to be stored, and set request parameters as required. Select the added URL Request and click Save.

  3. Choose Keyword Library > Combine, and view the stored combined keywords.

  • Scenario 2
  1. Store the preceding test steps to the API of the keyword library by referring to the steps of setting API keywords.

  2. On the Keyword Library > Combine tab page, click next to the folder where the keywords are to be saved. Set Name and Description.
  3. Click the API tab, select the folder where the keyword to be added is located, and click on the right of the keyword to be added or hover the cursor over the keyword area and drag the keyword to the test step area.

  4. Click Save.

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback