IP Library › Granted Patent US 12,579,054
Granted Patent B2
US 12,579,054 · App. 18/366,600 · Granted Mar 17, 2026

Application programming interface test method and apparatus

Inventors: Ruiyuan Wan (Beijing, CN); Shiliang Xiao (Gui'an, CN); Dandan Ji (Shanghai, CN); Minli Bao (Gui'an, CN); Shiheng Xu (Hangzhou, CN); Yi Liu (Singapore, SG); Yuekang Li (Singapore, SG); Yang Liu (Singapore, SG)
Assignee: HUAWEI TECHNOLOGIES CO., LTD.
G06F11/3688G06F11/3684
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,579,054
App. No.
18/366,600
Granted
Mar 17, 2026
Kind
B2
Abstract

In a method of application programming interface (API) testing, a computing device obtains an API file transmitted by a user, parses the API file, and generates an API operation relationship graph and a test oracle. The computing device generates a first test case set based on the API operation relationship graph, and triggers a service node to execute a test case in the first test case set. The computing device obtains an API request initiated in a process of executing the test case in the first test case set and a corresponding API response, and provides the user with a matching status between the test oracle and the API request initiated in the process of executing the test case in the first test case set and the API response.

Claims (63)

1 . An application programming interface (API) testing method performed by a computing device, the method comprising:

obtaining an API file transmitted by a user, the API file comprising an API definition document or API traffic data, the API definition document comprising API description information, and the API traffic data comprising an API request initiated when an API is invoked and an API response corresponding to the API request;

parsing the API file to generate an API operation relationship graph and a test oracle, the API operation relationship graph describing a dependency relationship of API operations, and the test oracle is a prediction rule of the API request initiated when the API is invoked and the corresponding API response;

obtaining configuration information of the user, the configuration information indicating a rule to be followed by a test case, and the configuration information comprises: a test scenario of the test case, an API blocklist or trustlist, an API parameter blocklist or trustlist, or information indicating whether to provide coverage information of a test case;

generating a first test case set based on the API operation relationship graph and the configuration information, the test case in the first test case set complying with the configuration information;

triggering a service node to execute the test case in the first test case set;

obtaining an API request initiated by the service node in a process of executing the test case in the first test case set and a corresponding API response; and

providing the user with a matching status between the test oracle and the API request initiated in the process of executing the test case in the first test case set and the corresponding API response.

2 . The method according to claim 1 , further comprising:

determining a target test case from the first test case set based on the test oracle, wherein an API request initiated when the target test case is executed and an API response do not match the test oracle;

updating the API operation relationship graph based on the target test case, and generating a second test case set based on an updated API operation relationship graph;

triggering the service node to execute a test case in the second test case;

obtaining an API request initiated by the service node in a process of executing the test case in the second test case set and an API response; and

providing the user with a matching status between the test oracle and the API request initiated in the process of executing the test case in the second test case set and the corresponding API response.

3 . The method according to claim 1 , wherein the API file comprises the API traffic data, and the step of parsing the API file to generate an API operation relationship graph comprises:

parsing the API file, to generate the API operation relationship graph and a parameter constraint dictionary, wherein the parameter constraint dictionary comprises a value range of an API parameter.

4 . The method according to claim 3 , wherein a parameter of an API request defined by a test case in the first test case set complies with the parameter constraint dictionary.

5 . The method according to claim 1 , further comprising:

determining coverage information of the test case in the first test case set, wherein the coverage information of the test case in the first test case set describes a coverage status of the test case on the API; and

providing the coverage information of the test case to the user.

6 . The method according to claim 5 , further comprising:

determining a candidate test case set from the first test case set, wherein coverage information of a test case in the candidate test case set meets a preset coverage condition;

generating a derivative test case set based on the candidate test case set; and

triggering the service node to execute a test case in the derivative test case set, and obtaining an API request initiated by the service node in a process of executing the test case in the derivative test case set and an API response.

7 . A computing device for application programming interface (API) testing, the computing device comprising:

a memory storing instructions; and

at least one processor in communication with the memory, the at least one processor configured, upon execution of the instructions, to perform the following steps

obtain an API file transmitted by a user, the API file comprising an API definition document or API traffic data, the API definition document comprising API description information, and the API traffic data comprising an API request initiated when an API is invoked and an API response corresponding to the API request;

parse the API file to generate an API operation relationship graph and a test oracle, the API operation relationship graph describing a dependency relationship of API operations, and the test oracle is a prediction rule of the API request initiated when the API is invoked and the corresponding API response;

obtain configuration information of the user, the configuration information indicating a rule to be followed by a test case, and the configuration information comprises: a test scenario of the test case, an API blocklist or trustlist, an API parameter blocklist or trustlist, or information indicating whether to provide coverage information of a test case;

generate a first test case set based on the API operation relationship graph and the configuration information, the test case in the first test case set complying with the configuration information;

trigger a service node to execute the test case in the first test case set;

obtain an API request initiated by the service node in a process of executing the test case in the first test case set and a corresponding API response; and

provide the user with a matching status between the test oracle and the API request initiated in the process in which the test case in the first test case set is executed and the corresponding API response.

8 . The computing device according to claim 7 , wherein the processor is further configured to:

determine a target test case from the first test case set based on the test oracle, wherein an API request initiated when the target test case is executed and an API response do not match the test oracle;

update the API operation relationship graph based on the target test case, and generate a second test case set based on an updated API operation relationship graph;

trigger the service node to execute a test case in the second test case set, and obtain an API request initiated by the service node in a process of executing the test case in the second test case set and an API response; and

provide the user with a matching status between the test oracle and the API request initiated in the process in which the test case in the second test case set is executed and the corresponding API response.

9 . The computing device according to claim 7 , wherein the API file comprises the API traffic data, and the processor is configured to parse the API file to generate the API operation relationship graph by:

parsing the API file to generate the API operation relationship graph and a parameter constraint dictionary, wherein the parameter constraint dictionary comprises a value range of an API parameter.

10 . The computing device according to claim 9 , wherein a parameter of an API request defined by a test case in the first test case set complies with the parameter constraint dictionary.

11 . The computing device according to claim 7 , wherein the processor is further configured to: determine coverage information of the test case in the first test case set, wherein the coverage information of the test case in the first test case set describes a coverage status of the test case on the API; and provide the coverage information of the test case to the user.

12 . The computing device according to claim 11 , wherein the processor is configured to:

determine a candidate test case set from the first test case set, wherein coverage information of a test case in the candidate test case set meets a preset coverage condition; and generate a derivative test case set based on the candidate test case set; and

trigger the service node to execute a test case in the derivative test case set, and obtain an API request initiated by the service node in a process of executing the test case in the derivative test case set and an API response.

13 . A non-transitory computer-readable media storing computer instructions for application programming interface (API) testing that configure at least one processor, upon execution of the instructions, to perform the following steps:

obtain an API file transmitted by a user, the API file comprising an API definition document or API traffic data, the API definition document comprising API description information, and the API traffic data comprising an API request initiated when an API is invoked and an API response corresponding to the API request;

parse the API file to generate an API operation relationship graph and a test oracle, the API operation relationship graph describing a dependency relationship of API operations, and the test oracle is a prediction rule of the API request initiated when the API is invoked and the corresponding API response;

obtain configuration information of the user, the configuration information indicating a rule to be followed by a test case, and the configuration information comprises: a test scenario of the test case, an API blocklist or trustlist, an API parameter blocklist or trustlist, or information indicating whether to provide coverage information of a test case;

generate a first test case set based on the API operation relationship graph and the configuration information, the test case in the first test case set complying with the configuration information;

trigger a service node to execute the test case in the first test case set;

obtain an API request initiated by the service node in a process of executing the test case in the first test case set and a corresponding API response; and

provide the user with a matching status between the test oracle and the API request initiated in the process in which the test case in the first test case set is executed and the corresponding API response.

14 . The non-transitory computer-readable media according to claim 13 , wherein the computing device is further caused to:

determine a target test case from the first test case set based on the test oracle, wherein an API request initiated when the target test case is executed and an API response do not match the test oracle;

update the API operation relationship graph based on the target test case, and generate a second test case set based on an updated API operation relationship graph;

trigger the service node to execute a test case in the second test case set;

obtain an API request initiated by the service node in a process of executing the test case in the second test case set and an API response; and

provide the user with a matching status between the test oracle and the API request initiated in the process in which the test case in the second test case set is executed and the corresponding API response.

15 . The non-transitory computer-readable media according to claim 13 , wherein the API file comprises the API traffic data, and the computing device is caused to parse the API file to generate the API operation relationship graph and a test oracle by:

parsing the API file, to generate the API operation relationship graph and a parameter constraint dictionary, wherein the parameter constraint dictionary comprises a value range of an API parameter.

16 . The non-transitory computer-readable media according to claim 15 , wherein a parameter of an API request defined by a test case in the first test case set complies with the parameter constraint dictionary.

Assignments (3)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 27, 2025
From: WAN, RUIYUAN; JI, DANDAN; XU, SHIHENG; LIU, YI; LI, YUEKANG; LIU, YANG
To: HUAWEI CLOUD COMPUTING TECHNOLOGIES CO., LTD.
Reel/Frame 073319/0678 →
EMPLOYMENT CONTRACT AND COMMISSIONED TECHNOLOGY DEVELOPMENT AGREEMENT Recorded Dec 27, 2025
From: XIAO, SHILIANG
To: HUAWEI CLOUD COMPUTING TECHNOLOGIES CO., LTD.
Reel/Frame 074076/0858 →
EMPLOYMENT CONTRACT AND COMMISSIONED TECHNOLOGY DEVELOPMENT AGREEMENT Recorded Dec 27, 2025
From: BAO, MINLI
To: HUAWEI CLOUD COMPUTING TECHNOLOGIES CO., LTD.
Reel/Frame 074076/0887 →
Priority Claims (1)
CN 202110220017.8 · Feb 26, 2021 · national
Continuity (2)
Continuation PCTCN2022073096 · Jan 21, 2022
Related Publication 20230376408A1 · Nov 23, 2023
References Cited (15)
US 11467887B1 · Caudill · 2022 [cited by examiner]
US 12073263B1 · Thompson · 2024 [cited by examiner]
US 20100057693A1 · Himstedt · 2010 [cited by examiner]
US 20160011960A1 · Krishna · 2016 [cited by examiner]
US 20180314622A1 · Lowe · 2018 [cited by examiner]
US 20200117583A1 · Durairaj · 2020 [cited by examiner]
US 20240411671A1 · Jiang · 2024 [cited by examiner]
US 20250225059A1 · Bi · 2025 [cited by examiner]
CN 106339312A · 2017 [cited by applicant]
CN 109189666A · 2019 [cited by applicant]
CN 110968505A · 2020 [cited by examiner]
CN 112559348A · 2021 [cited by examiner]
CN 113722228A · 2021 [cited by examiner]
Viglianisi Emanuele et al: “RESTTESTGEN: Automated Black-Box Testing of RESTful APIs”, 2020 IEEE 13th International Conference on Software Testing. Validation and Verification (ICST), IEEE, Oct. 24, 2020 (Oct. 24, 2020)… [cited by applicant]
Emanuele Viglianisi et al., “RESTTESTGEN: Automated Black-Box Testing of RESTful APIs”, 2020 IEEE 13th International Conference on Software Testing, Validation and Verification (ICST), total 11 pages. [cited by applicant]