An API interface testing method, device, equipment and storage medium

By building a test demo development framework and using keywords to extract and modify reference demo source code, the problem of low test demo generation efficiency in existing technologies is solved, enabling rapid development and efficient testing.

CN116185821BActive Publication Date: 2026-07-21深圳开鸿数字产业发展有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
深圳开鸿数字产业发展有限公司
Filing Date
2022-12-08
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies cannot improve the efficiency of test demo generation, resulting in high testing time costs and high redundancy, which affects the effectiveness of API interface interactive function testing.

Method used

By extracting keywords for the interactive functions of the API interface, obtaining and modifying the reference demo source code, and encapsulating it into JavaScript, CSS, and HTML files, a test demo development framework is built, reducing repetitive work.

Benefits of technology

It shortens the API interface testing cycle, improves the efficiency of test demo generation, facilitates portability and modification, has wider applicability, and better sustainability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116185821B_ABST
    Figure CN116185821B_ABST
Patent Text Reader

Abstract

The application discloses an API interface test method and device, equipment and a storage medium. The method comprises the following steps: acquiring an interaction function of an API interface to be tested, and extracting a keyword in the interaction function; determining whether a preset function description contains the keyword; if the function description contains the keyword, acquiring a reference Demo installation package corresponding to the function description, and extracting reference Demo source code from the reference Demo installation package; acquiring a modification operation of the reference Demo source code by a user, modifying the reference Demo source code according to the modification operation, and taking the modified reference Demo source code as test Demo code; encapsulating the test Demo code into a JavaScript file; encapsulating a preconfigured element style into a CSS file; encapsulating preconfigured page content into an HTML file; and constructing a Demo development framework for developing the test Demo based on the CSS file, the HTML file and the JavaScript file. The application is beneficial to shortening the API interface test period.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer communications, and in particular to an API interface testing method, apparatus, device, and storage medium. Background Technology

[0002] In the field of computer communications, during the testing of application API interfaces, it is sometimes necessary to use test demos to test the interactive functions of the API interfaces in order to discover and locate problems in the software.

[0003] However, existing technologies cannot improve the efficiency of test demo generation because developing test demos involves a lot of repetitive work. For example, each time a test demo is developed, the webpage must be remade, which increases the testers' testing time cost and the repetition of their work. Therefore, it is not conducive to improving the efficiency of test demo generation, nor is it conducive to improving the testing effect of API interface interactive functions. Summary of the Invention

[0004] This application provides an API interface testing method, apparatus, device, and storage medium to solve the technical problem that the prior art cannot improve the generation efficiency of test demos.

[0005] In a first aspect, embodiments of this application provide an API interface testing method, the API interface testing method comprising:

[0006] Obtain the interactive functions of the API interface to be tested, and extract keywords from the interactive functions;

[0007] Determine whether the preset function description contains the keyword;

[0008] If the function description contains the keyword, obtain the reference Demo installation package corresponding to the function description, and extract the reference Demo source code from the reference Demo installation package;

[0009] Obtain user modification operations on the reference Demo source code, modify the reference Demo source code according to the modification operations, and use the modified reference Demo source code as the test Demo code;

[0010] Encapsulate the test demo code into a JavaScript file;

[0011] The pre-configured element styles are encapsulated into a Cascading Style Sheets (CSS) file;

[0012] The pre-configured page content is encapsulated into an HTML file;

[0013] Based on the CSS file, the HTML file, and the JavaScript file, a demo development framework is built for developing the test demo.

[0014] As an optional implementation, if the function description contains the keyword, obtaining the reference demo installation package corresponding to the function description, and extracting the reference demo source code from the reference demo installation package, specifically involves:

[0015] If the function description contains the keyword, obtain the reference Demo name corresponding to the function description, and obtain the download link corresponding to the reference Demo name;

[0016] Download the reference demo installation package from the download link, extract the reference demo installation package to obtain the reference demo directory;

[0017] Search for the Demo source code directory in the reference Demo directory, and extract the reference Demo source code from the reference Demo installation package through the Demo source code directory.

[0018] As an optional implementation, the step of obtaining the user's modification operation on the reference demo source code, modifying the reference demo source code according to the modification operation, and using the modified reference demo source code as the test demo code specifically involves:

[0019] The user's modifications to the reference demo source code are obtained through preset JavaScript utility functions;

[0020] When the modification operation is a writing operation, the user-written interface test code snippet is written into the reference Demo source code according to the writing operation. After the writing is completed, the reference Demo source code is set as the test Demo code.

[0021] When the modification operation is a deletion operation, the user-selected non-test code segment is deleted from the reference Demo source code according to the deletion operation. After the deletion is completed, the reference Demo source code is set as the test Demo code.

[0022] As an optional implementation, encapsulating the test demo code into a JavaScript file specifically involves:

[0023] The command line to be executed is obtained in the test demo code, the execution method of the command line is obtained, the command line and the execution method are encapsulated into a function of the test demo code, and the function is written into the JavaScript file.

[0024] As an optional implementation, after encapsulating the pre-configured element styles into a Cascading Style Sheets (CSS) file, the method further includes:

[0025] The system obtains the user's modification operation on the element style, modifies the element style according to the modification operation, obtains the modified element style, and encapsulates the modified element style into the CSS file. The element style includes one or a combination of background style, font style, and border style.

[0026] As an optional implementation, after obtaining the interactive functions of the API interface to be tested and extracting keywords from the interactive functions, the method further includes:

[0027] Add the API interface to the API interface set;

[0028] Obtain the test case execution code corresponding to the API interface, and add the test case execution code to the test case execution code set;

[0029] The API interface set and the test case execution code set are stored in a preset file.

[0030] As an optional implementation, the components of the page content include one or a combination of buttons, drop-down selection boxes, and input boxes.

[0031] Secondly, this application also provides an API interface testing device, which includes a processor and a memory. The memory stores a computer program, and the processor executes the above-described API interface testing method when it calls the computer program in the memory.

[0032] Thirdly, embodiments of this application also provide an apparatus, which includes the API interface testing device as described above.

[0033] Fourthly, embodiments of this application also provide a storage medium for storing a computer program, which, when executed by a processor, enables the processor to implement the aforementioned API interface testing method.

[0034] This application provides an API interface testing method, apparatus, device, and storage medium. The beneficial effects of this application are twofold: firstly, the development of the test demo can be quickly completed by calling the demo development framework, which will greatly shorten the API interface testing cycle, improve the efficiency of test demo generation, and better discover and locate problems in the software; secondly, it is easy to port and modify, realize one-time development and reuse, and can be continuously updated and added to test functions, with wider applicability and better sustainability. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 This is a flowchart illustrating the API interface testing method provided in the embodiments of this application;

[0037] Figure 2 A flowchart illustrating the modification of element styles provided in this application embodiment;

[0038] Figure 3 A block diagram of the development framework provided for embodiments of this application;

[0039] Figure 4 A schematic block diagram of an API interface testing device provided in an embodiment of this application. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0041] It should be noted that the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features.

[0042] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in some embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0043] Furthermore, the technical solutions of the various embodiments can be combined with each other, but only if they are based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0044] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.

[0045] Please see Figure 1 , Figure 1 This is a flowchart illustrating the API interface testing method provided in this application embodiment. This method can be applied to devices, which can be any of the following: mobile phone, camera, tablet computer, wearable device, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, personal computer (PC), netbook, personal digital assistant (PDA). No restrictions are imposed in this application embodiment.

[0046] like Figure 1 As shown in the embodiments of this application, the API interface testing method includes the following steps.

[0047] S101, Obtain the interactive functions of the API interface to be tested, and extract keywords from the interactive functions;

[0048] The method further includes, after obtaining the interactive functions of the API interface to be tested and extracting keywords from the interactive functions:

[0049] Add the API interface to the API interface set;

[0050] Obtain the test case execution code corresponding to the API interface, and add the test case execution code to the test case execution code set;

[0051] The API interface set and the test case execution code set are stored in a preset file.

[0052] The API interface can be added to the API interface set before S102, after S102, or simultaneously with S102; there are no restrictions on this.

[0053] S102, determine whether the preset function description contains the keyword;

[0054] S103, if the function description contains the keyword, obtain the reference Demo installation package corresponding to the function description, and extract the reference Demo source code from the reference Demo installation package;

[0055] Specifically, S103 is:

[0056] If the function description contains the keyword, obtain the reference Demo name corresponding to the function description, and obtain the download link corresponding to the reference Demo name;

[0057] Download the reference demo installation package from the download link, extract the reference demo installation package to obtain the reference demo directory;

[0058] Search for the Demo source code directory in the reference Demo directory, and extract the reference Demo source code from the reference Demo installation package through the Demo source code directory.

[0059] It should be noted that if the function description contains the keyword, the reference demo name corresponding to the function description is obtained from the preset demo list, and the download link corresponding to the reference demo name is obtained. The demo list includes the preset function description, the preset reference demo name, and the download link corresponding to the preset reference demo name. There is a correspondence between the preset function description and the preset reference demo name; each function description has a corresponding preset reference demo name.

[0060] Each preset reference demo name has a corresponding download link.

[0061] The function descriptions can be user-defined or system-defined. For ease of explanation, the following example illustrates the functions: recording, volume control, playing recordings, screenshotting, opening shared screen, saving whiteboard, obtaining file codes, uploading files, reporting file information, obtaining QR codes, accessing the large screen's camera, and video previewing, or any combination thereof.

[0062] S104, Obtain the user's modification operation on the reference Demo source code, modify the reference Demo source code according to the modification operation, and use the modified reference Demo source code as the test Demo code;

[0063] The reference demo is for reference only, and it refers to a previously developed demo.

[0064] The demo was generated within a preset timeframe, which could be a week ago or a month ago; there are no restrictions on the timeframe.

[0065] Among them, the testDemo is used for testing, and the testDemo is the currently developed Demo.

[0066] Specifically, S104 is as follows:

[0067] The user's modifications to the reference demo source code are obtained through preset JavaScript utility functions;

[0068] When the modification operation is a write operation, the user-written interface test code snippet is written into the reference Demo source code according to the write operation. After the writing is completed, the reference Demo source code is set as the test Demo code. When the modification operation is a delete operation, the user-selected non-test code snippet is deleted from the reference Demo source code according to the delete operation. After the deletion is completed, the reference Demo source code is set as the test Demo code.

[0069] It should be noted that when the modification operation is a writing operation, a code writing environment is provided. The user writes interface test code snippets within this environment, and these snippets are then written into the reference demo source code. The reference demo source code is then set as the test demo code. The interface test code snippets are code snippets used for interface testing. In this way, users only need to write interface test code snippets instead of the entire code, allowing for rapid development of test demos and shortening API interface testing time. Therefore, this significantly reduces testing time costs and the repetitive nature of the work.

[0070] When some interfaces in the reference demo source code do not need to be tested, the non-test code snippets selected by the user in the reference demo source code are retrieved. When the modification operation is a deletion operation, the user-selected non-test code snippets are deleted from the reference demo source code according to the deletion operation. After deletion, the reference demo source code is set as the test demo code. Non-interface test code snippets are code snippets not used for interface testing. This reduces the amount of data in the test demo code during testing.

[0071] S105, encapsulate the test Demo code into a JavaScript file;

[0072] Specifically, encapsulating the test demo code into a JavaScript file involves:

[0073] The test demo code retrieves the command line to be executed and the execution method of the command line. It then encapsulates the command line and the execution method into a function within the test demo code and writes this function into the JavaScript file. This function is used to call the command line and the execution method.

[0074] S106, the pre-configured element styles are encapsulated into a Cascading Style Sheets (CSS) file;

[0075] S107, the pre-configured page content is encapsulated into an HTML file;

[0076] The components of the page content include one or a combination of buttons, drop-down selection boxes, and input boxes.

[0077] S108. Based on the CSS file, the HTML file, and the JavaScript file, construct a demo development framework for developing the test demo.

[0078] Following S108, the method also includes:

[0079] Displays components that allow users to select different functions. These components include one or a combination of buttons, drop-down selection boxes, and input boxes.

[0080] The beneficial effects of this application's embodiments are twofold. Firstly, by calling the Demo development framework, the development of test demos can be completed quickly, significantly shortening the API interface testing cycle and improving the efficiency of test demo generation, thus enabling better identification and localization of software issues. Secondly, it facilitates portability and modification, achieving "develop once, reuse repeatedly," allowing for continuous updates and additions of testing functions, resulting in wider applicability and better sustainability. Please refer to... Figure 2 , Figure 2 The flowchart for modifying element styles provided in the embodiments of this application is described in detail below:

[0081] S201, Obtain the user's modification operation on the element style, and modify the element style according to the modification operation;

[0082] S202, obtain the modified element style, and encapsulate the modified element style into the CSS file. The element style includes one or a combination of background style, font style, and border style.

[0083] S201 can be executed before S107, after S107, or simultaneously with S107; there are no restrictions on this.

[0084] In this embodiment, element styles can be reused, thus saving testers' testing time and reducing the repetition of their work.

[0085] Please see Figure 3 , Figure 3 A block diagram of the development framework provided in the embodiments of this application is described in detail below:

[0086] The demo development framework includes CSS, HTML, and JavaScript components, detailed below:

[0087] The CSS section encapsulates element styles, including background styles, font styles, border styles, or combinations thereof. These styles can be layered and continuously modified. Since demos typically don't require modification, it's relatively easy to exhaustively list the element styles needed for the test demo and encapsulate them in a CSS file. Furthermore, considering various screen sizes, resolutions, and pixel densities, to ensure compatibility with the test demo display, it's generally recommended that each row contain no more than two buttons or display units.

[0088] The HTML section encapsulates the page content, which includes a series of tags to unify the document format. Unlike web pages, application development or test demo development doesn't require complex operations. Common operations in test demo writing typically include buttons, dropdown selection boxes, input boxes, and display elements. API calls are usually implemented by clicking buttons; dropdown selection boxes are often used for selecting limited parameters; when multiple input parameter types are supported, input boxes are typically used. The proper use of input boxes depends on the input method being properly started and running. The display unit presents the return results and execution results.

[0089] The JavaScript section encapsulates operations, including response operations, data structure operations, and common workflow operations. The specific operations of the script statements in the test demo are implemented in the documentation, assigning the passed dropdown values ​​to the corresponding parameters and binding the script calls to the button clicks. Additionally, common command lines and execution methods for related operations can be encapsulated into functions, which can be directly called during testing.

[0090] In this embodiment of the application, during the development of the test demo based on CSS, HTML, and JavaScript, it is not necessary to modify multiple files. Only the addition of interface test code snippets is required to complete the corresponding modifications, which is flexible and versatile.

[0091] Please see Figure 4 , Figure 4 A schematic block diagram of an API interface testing device provided in an embodiment of this application.

[0092] like Figure 4 As shown, the API interface testing device 200 may include a processor 211 and a memory 212, which are connected by a bus, such as an I2C (Inter-integrated Circuit) bus.

[0093] Specifically, the processor 211 can be a microcontroller unit (MCU), a central processing unit (CPU), or a digital signal processor (DSP), etc.

[0094] Specifically, the memory 212 can be a Flash chip, a read-only memory (ROM) disk, an optical disk, a USB flash drive, or a portable hard drive, etc. The memory 212 stores various computer programs for the processor 211 to execute.

[0095] The processor 211 is used to run a computer program stored in the memory processor 211, and performs the following steps when executing the computer program:

[0096] Obtain the interactive functions of the API interface to be tested, and extract keywords from the interactive functions;

[0097] Determine whether the preset function description contains the keyword;

[0098] If the function description contains the keyword, obtain the reference Demo installation package corresponding to the function description, and extract the reference Demo source code from the reference Demo installation package;

[0099] Obtain user modification operations on the reference Demo source code, modify the reference Demo source code according to the modification operations, and use the modified reference Demo source code as the test Demo code;

[0100] Encapsulate the test demo code into a JavaScript file;

[0101] The pre-configured element styles are encapsulated into a Cascading Style Sheets (CSS) file;

[0102] The pre-configured page content is encapsulated into an HTML file;

[0103] Based on the CSS file, the HTML file, and the JavaScript file, a demo development framework is built for developing the test demo.

[0104] In some embodiments, processor 211 is configured to implement:

[0105] If the function description contains the keyword, obtain the reference Demo name corresponding to the function description, and obtain the download link corresponding to the reference Demo name;

[0106] Download the reference demo installation package from the download link, extract the reference demo installation package to obtain the reference demo directory;

[0107] Search for the Demo source code directory in the reference Demo directory, and extract the reference Demo source code from the reference Demo installation package through the Demo source code directory.

[0108] In some embodiments, processor 211 is configured to implement:

[0109] The user's modifications to the reference demo source code are obtained through preset JavaScript utility functions;

[0110] When the modification operation is a writing operation, the user-written interface test code snippet is written into the reference Demo source code according to the writing operation. After the writing is completed, the reference Demo source code is set as the test Demo code.

[0111] When the modification operation is a deletion operation, the user-selected non-test code segment is deleted from the reference Demo source code according to the deletion operation. After the deletion is completed, the reference Demo source code is set as the test Demo code.

[0112] In some embodiments, processor 211 is configured to implement:

[0113] The command line to be executed is obtained in the test demo code, the execution method of the command line is obtained, the command line and the execution method are encapsulated into a function of the test demo code, and the function is written into the JavaScript file.

[0114] In some embodiments, processor 211 is configured to implement:

[0115] The system obtains the user's modification operation on the element style, modifies the element style according to the modification operation, obtains the modified element style, and encapsulates the modified element style into the CSS file. The element style includes one or a combination of background style, font style, and border style.

[0116] In some embodiments, processor 211 is configured to implement:

[0117] Add the API interface to the API interface set;

[0118] Obtain the test case execution code corresponding to the API interface, and add the test case execution code to the test case execution code set;

[0119] The API interface set and the test case execution code set are stored in a preset file.

[0120] The embodiments of this application also provide a device, the type of which includes, but is not limited to, mobile phones, cameras, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, personal computers (PCs), netbooks, personal digital assistants (PDAs), etc., and no limitations are made in the embodiments of this application.

[0121] The device includes an API interface testing apparatus, which, for example, can be the API interface testing apparatus 200 described in the above embodiments.

[0122] The device can execute any of the API interface testing methods provided in the embodiments of this application. Therefore, it can achieve the beneficial effects that any of the API interface testing methods provided in the embodiments of this application can achieve. For details, please refer to the previous embodiments, which will not be repeated here.

[0123] This application also provides a storage medium storing a computer program, which includes program instructions. The processor executes the program instructions to implement the steps of the API interface testing method provided in the above embodiments. For example, when the computer program is loaded by the processor, it can perform the following steps:

[0124] Obtain the interactive functions of the API interface to be tested, and extract keywords from the interactive functions;

[0125] Determine whether the preset function description contains the keyword;

[0126] If the function description contains the keyword, obtain the reference Demo installation package corresponding to the function description, and extract the reference Demo source code from the reference Demo installation package;

[0127] Obtain user modification operations on the reference Demo source code, modify the reference Demo source code according to the modification operations, and use the modified reference Demo source code as the test Demo code;

[0128] Encapsulate the test demo code into a JavaScript file;

[0129] The pre-configured element styles are encapsulated into a Cascading Style Sheets (CSS) file;

[0130] The pre-configured page content is encapsulated into an HTML file;

[0131] Based on the CSS file, the HTML file, and the JavaScript file, a demo development framework is built for developing the test demo.

[0132] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0133] The storage medium can be an internal storage unit of the API interface testing device or equipment described in the foregoing embodiments, such as a hard drive or memory of the API interface testing device or equipment. Alternatively, the storage medium can be an external storage device of the API interface testing device or equipment, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the API interface testing device or equipment.

[0134] Since the computer program stored in the storage medium can execute any of the API interface testing methods provided in the embodiments of this application, it can achieve the beneficial effects that any of the API interface testing methods provided in the embodiments of this application can achieve, as detailed in the preceding embodiments, and will not be repeated here.

[0135] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. An API interface testing method, characterized in that, The API interface testing methods include: Obtain the interactive functions of the API interface to be tested, and extract keywords from the interactive functions; Determine whether the preset function description contains the keyword, wherein the function description includes any one or a combination of recording, volume adjustment, playing recording, screenshot, opening shared screen, saving whiteboard, obtaining file code, uploading file, reporting file information, obtaining QR code, calling the large screen camera, and video preview; If the function description contains the keyword, obtain the reference Demo installation package corresponding to the function description, and extract the reference Demo source code from the reference Demo installation package; Obtain user modification operations on the reference Demo source code, modify the reference Demo source code according to the modification operations, and use the modified reference Demo source code as the test Demo code; Encapsulate the test demo code into a JavaScript file; Encapsulate pre-configured element styles into a Cascading Style Sheets (CSS) file; Encapsulate the pre-configured page content into an HTML file; Based on the CSS file, the HTML file, and the JavaScript file, a demo development framework is built for developing the test demo.

2. The method according to claim 1, characterized in that, If the function description contains the keyword, the process involves obtaining the reference demo installation package corresponding to the function description, and extracting the reference demo source code from the reference demo installation package. If the function description contains the keyword, obtain the reference Demo name corresponding to the function description, and obtain the download link corresponding to the reference Demo name; Download the reference demo installation package from the download link, extract the reference demo installation package to obtain the reference demo directory; Search for the Demo source code directory in the reference Demo directory, and extract the reference Demo source code from the reference Demo installation package through the Demo source code directory.

3. The method according to claim 1, characterized in that, The step of obtaining user modifications to the reference demo source code, modifying the reference demo source code according to the modifications, and using the modified reference demo source code as the test demo code specifically involves: The user's modifications to the reference demo source code are obtained through preset JavaScript utility functions; When the modification operation is a writing operation, the user-written interface test code snippet is written into the reference Demo source code according to the writing operation. After the writing is completed, the reference Demo source code is set as the test Demo code. When the modification operation is a deletion operation, the user-selected non-test code segment is deleted from the reference Demo source code according to the deletion operation. After the deletion is completed, the reference Demo source code is set as the test Demo code.

4. The method according to claim 1, characterized in that, The step of encapsulating the test demo code into a JavaScript file specifically involves: The command line to be executed is obtained in the test demo code, the execution method of the command line is obtained, the command line and the execution method are encapsulated into a function of the test demo code, and the function is written into the JavaScript file.

5. The method according to claim 1, characterized in that, After encapsulating the pre-configured element styles into a Cascading Style Sheets (CSS) file, the method further includes: The system obtains the user's modification operation on the element style, modifies the element style according to the modification operation, obtains the modified element style, and encapsulates the modified element style into the CSS file. The element style includes one or a combination of background style, font style, and border style.

6. The method according to claim 1, characterized in that, After obtaining the interactive functions of the API interface to be tested and extracting keywords from the interactive functions, the method further includes: Add the API interface to the API interface set; Obtain the test case execution code corresponding to the API interface, and add the test case execution code to the test case execution code set; The API interface set and the test case execution code set are stored in a preset file.

7. The method according to any one of claims 1 to 6, characterized in that, The components of the page content include one or a combination of buttons, drop-down selection boxes, and input boxes.

8. An API interface testing device, characterized in that, The API interface testing device includes a processor and a memory. The memory stores a computer program that can be executed by the processor. When the computer program is executed by the processor, it implements the API interface testing method as described in any one of claims 1 to 7.

9. A device, characterized in that, The device includes the API interface testing apparatus as described in claim 8.

10. A storage medium for computer-readable storage, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the steps of the API interface testing method according to any one of claims 1 to 7.