Application program interface function verification method and device, equipment and storage medium

By generating a set of standard interface function identification and interface function identification to be verified, the errors between front-end applications and back-end interfaces are quickly and accurately discovered and repaired, solving the high time cost and error-prone problems caused by manual verification, and improving interface function calibration accuracy and speed of test.

CN118963764APending Publication Date: 2024-11-15CHONGQING JINKANG NEW ENERGY VEHICLE CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411028054.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

In software development, in the interaction between front-end applications and back-end interfaces, due to errors in interface function code, the front-end cannot call the back-end interface correctly, affecting the application's functions and user experience, and there is an update method that can be manually checked. Time cost is high and error-prone.

Method used

Provides an application program interface function verification method. By obtaining interface files and code files, a standard interface function identification collection and interface function identification to be verified, and the failed identification is output as the problem interface function identification, prompting the developer to exist in the code. Error, reduce time costs and improve accuracy.

Benefits of technology

Quickly and accurately detect and fix interface function errors, reduce the time cost of application program interface function verification, improve the accuracy of interface function verification, and improve the verification speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118963764A_ABST
    Figure CN118963764A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of software development, in particular to an application program interface function verification method and device, equipment and a storage medium. The method mainly comprises the steps of obtaining an interface file corresponding to an application program in response to a verification instruction, generating a standard identifier set containing a plurality of standard interface function identifiers according to path information of the interface file and interface information in the interface file, obtaining a code file corresponding to the application program, according to an interface function code which is extracted from the code file and used for executing interface calling, generating a to-be-verified interface function identifier, searching the to-be-verified interface function identifier in the standard identifier set, and when searching fails, outputting the to-be-verified interface function identifier which fails to be searched as a problem interface function identifier, and prompting a developer that an interface function corresponding to the problem interface function identifier in the code file of the application program has an error. By adopting the method, the interface function with errors can be quickly and accurately found.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software development technology, and in particular to a verification method, device, equipment and storage medium for an application program interface function. Background Art

[0002] In the field of software development technology, code is the basis for realizing all functions. The code of the front-end application is used to build the user interface and user interaction logic. The logical processing of data and business in the application needs to be implemented through interaction with the back-end server. The interaction between the front-end and the back-end is usually implemented by the interface function in the code of the front-end application calling the back-end interface. If the interface function code is incorrect, the front-end may not be able to correctly call the back-end interface, which will affect the function and user experience of the entire application. Therefore, the accuracy of the interface function code in the code file of the front-end application is crucial for the interaction between the front-end and the back-end.

[0003] When the backend interface changes, the frontend developer needs to manually modify and update the interface function code corresponding to the backend interface to ensure that the frontend can interact with the backend correctly. Currently, the code that needs to be modified and updated is mainly found through manual verification for updating. However, manual verification is time-consuming and error-prone. Summary of the invention

[0004] Based on this, it is necessary to provide a method, device, equipment and storage medium for verifying an application program interface function with low time cost and high accuracy in order to address at least one of the above technical problems.

[0005] In a first aspect, an embodiment of the present application provides a method for verifying an application program interface function, which method may include the following steps:

[0006] In response to the verification instruction, obtaining an interface file corresponding to the application program;

[0007] Generate a standard identifier set including multiple standard interface function identifiers according to the path information of the interface file and the interface information in the interface file, and obtain a code file corresponding to the application program;

[0008] Generate an interface function identifier to be verified according to the interface function code for executing the interface call extracted from the code file;

[0009] The interface function identifier to be verified is searched in the standard identifier set. When the search fails, the interface function identifier to be verified that failed to be found is output as the problem interface function identifier to prompt the developer that an error exists in the interface function corresponding to the problem interface function identifier in the code file of the application.

[0010] Among them, the interface file is used to record the interface information of the back-end interface corresponding to the application. Any standard interface function identifier corresponds to an interface function in the interface file. The standard interface function identifier and the interface function identifier to be verified can both include the following steps: directory name, file name and interface function name.

[0011] In some embodiments, generating a standard identifier set including a plurality of standard interface function identifiers according to the path information of the interface file and the interface information in the interface file may include the following steps:

[0012] Traverse the directory, files and interface codes in the files corresponding to the interface file to obtain the corresponding directory name, file name and interface function name;

[0013] According to the path information of the interface function name, a set of directory names, file names and interface function names that have a corresponding relationship are integrated to generate an interface function identifier;

[0014] The interface function identifier is stored in a preset set to obtain a standard identifier set.

[0015] In some embodiments, generating an interface function identifier to be verified according to the code of the interface function for executing the interface call extracted from the code file may include the following steps:

[0016] Matching the target code corresponding to both the preset start symbol and the preset end symbol in the code file;

[0017] Extract the access path information corresponding to the interface call in the target code and generate the interface function identifier to be verified. The access path information may include the following steps: directory name, file name and interface function name.

[0018] In some embodiments, the interface function identifier to be verified may include multiple ones, and the verification method of the application program interface function may further include the following steps:

[0019] Determine the corresponding interface function category according to the interface function identifier to be checked;

[0020] Determine the verification priority according to the interface function category.

[0021] Among them, the interface function category may include at least a first type of interface function for implementing system configuration or user authority setting and a second type of interface function for implementing the business functions of the application, and the verification priority may include a first priority and a second priority corresponding to the first type of interface function and the second type of interface function respectively.

[0022] Correspondingly, searching for the interface function identifier to be verified in the standard identifier set may include the following steps:

[0023] Determine the search order based on the verification priority;

[0024] The interface function identifier to be verified is searched in the standard identifier set in sequence according to the search order.

[0025] In some embodiments, determining the corresponding interface function category according to the interface function identifier to be verified may include the following steps: determining the interface function category corresponding to the interface function identifier to be verified according to the file name in the interface function identifier to be verified.

[0026] In some embodiments, the verification method of the application program interface function may further include the following steps:

[0027] Determine the location information of the interface function code corresponding to the problematic interface function identifier in the code file, and display the location information in the display interface; and / or,

[0028] The interface function code corresponding to the problematic interface function identifier is visualized in the display interface, so that the display appearance of the interface function code corresponding to the problematic interface function identifier is distinguished from other codes in the code file.

[0029] In some embodiments, the interface file is automatically generated by a code tool based on the OPEN API specification according to the backend interface, and the interface file may include at least the interface name, interface path, calling method and parameter format.

[0030] In some embodiments, the verification method of the application program interface function is implemented based on Node.js.

[0031] In a second aspect, an embodiment of the present application provides a verification device for an application program interface function, which may include an interface file acquisition module, a standard identifier set generation module, a to-be-verified identifier generation module, and an identifier verification module.

[0032] The interface file acquisition module is used to obtain the interface file corresponding to the application program in response to the verification instruction.

[0033] The standard identification set generation module is used to generate a standard identification set containing multiple standard interface function identifications according to the path information of the interface file and the interface information in the interface file.

[0034] The module for generating the identification to be verified is used to obtain the code file corresponding to the application program, and generate the interface function identification to be verified according to the interface function code for executing the interface call extracted from the code file.

[0035] The identification verification module is used to search for the interface function identification to be verified in the standard identification set. When the search fails, the interface function identification to be verified that failed to be found is output as the problem interface function identification, so as to prompt the developer that there is an error in the interface function corresponding to the problem interface function identification in the code file of the application.

[0036] Among them, the interface file is used to record the interface information of the back-end interface corresponding to the application. Any standard interface function identifier corresponds to an interface function in the interface file. The standard interface function identifier and the interface function identifier to be verified can both include the following steps: directory name, file name and interface function name.

[0037] In a third aspect, an embodiment of the present application provides a computer device, which may include a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the processor implements the steps of the method for verifying the application interface function provided in any embodiment of the present application in the first aspect.

[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for verifying the application program interface function provided in any embodiment of the present application in the first aspect.

[0039] The verification method, device, equipment and storage medium of the above-mentioned application interface function, in response to the verification instruction, obtains the interface file and code file corresponding to the application, generates a standard identification set containing multiple standard interface function identifications and an interface function identification to be verified respectively, searches for the interface function identification to be verified in the standard identification set, and if the search fails, it means that there is an error in the interface function corresponding to the interface function identification to be verified, and outputs the interface function identification to be verified that failed to be searched as the problem interface function identification, so as to prompt the developer that there is an error in the interface function corresponding to the problem interface function identification in the code file of the application. By searching the interface function identification to be verified in the standard identification set generated based on the interface file, the interface function with errors can be found quickly and accurately, which reduces the time cost of the application interface function verification and improves the accuracy of the interface function verification.

[0040] At the same time, generating a standard identifier set based on the interface file and generating the interface function identifier to be verified based on the code file, and then using the interface function identifier to replace the complete interface function code for verification and checking can improve the verification speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A schematic diagram of a flow chart of a method for verifying an application program interface function in some embodiments;

[0042] Figure 2 is a flowchart of steps for generating a standard identifier set in some embodiments;

[0043] Figure 3 A schematic diagram of a flow chart of steps involved in determining a verification priority in some embodiments;

[0044] Figure 4 It is a structural block diagram of a verification device for an application program interface function in some embodiments;

[0045] Figure 5 1 is a diagram of the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION

[0046] In order to make the technical solutions and advantages of the present application more clearly understood, the embodiments of the present application and related technical contents are further described in detail below in combination with the accompanying drawings and text descriptions. It should be understood that the implementation methods described below are only used to explain the technical solutions of the embodiments of the present application and are not used to limit more possible implementation methods of the present application.

[0047] It should be noted that the relational terms such as "first", "second" and the like appearing in this document are only used to distinguish things, states or actions, and do not necessarily indicate or imply relative importance or sequential relationships. The terms "include", "comprises" or any other variants thereof are used to indicate non-exclusive inclusion, and the included objects may not be limited to the objects listed in this document. The term "plurality" or other variants are used to indicate that the number of objects is two or more.

[0048] In a first aspect, an embodiment of the present application provides a method for verifying an application program interface function. The method can be applied to a computer device. The computer device can be, but is not limited to, various personal computers, laptops, smart phones, and tablet computers. The computer device can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or can be implemented as a single server or a single terminal device. The number of computer devices can be any number according to the implementation needs.

[0049] In some embodiments, Figure 1 As shown, the verification method of the application program interface function includes steps S101 to S104 that can be executed by the computer device. Each step is described in detail below.

[0050] Step S101: In response to a verification instruction, an interface file corresponding to the application is obtained.

[0051] Among them, the interface file is used to record the interface information of the back-end interface corresponding to the application. Usually, the interface file is stored in a specific storage space of the computer device. In some specific embodiments, the interface file can be automatically generated according to the back-end interface by a code tool based on the OPENAPI specification, and the code tool can be @umijs / openapi (a TypeScript code generator based on the OpenApi3 specification), or apifox (a tool for integrated API management and testing), or other code editing tools. In some other specific embodiments, the interface file can also be manually written and generated by the back-end developer according to the interface information, and the interface file can include the interface name, interface path, calling method, parameter format and other interface information of the back-end interface.

[0052] One application may correspond to multiple interface files, and one interface file may include interface information of multiple interface functions.

[0053] In the related art, when a backend interface changes, the backend developer will update the interface file and notify the frontend developer so that the frontend developer can check and verify the frontend application code according to the updated interface file.

[0054] The verification instruction is used to indicate that the interface function of the application needs to be verified, and can be an instruction input to the computer device by the developer through executing a specific operation after completing the application code or performing a code iteration update operation.

[0055] Specifically, the computer device responds to the verification instruction input by the developer and obtains the interface file of the application corresponding to the verification instruction from the computer storage space. When the application includes multiple interface files, all interface files corresponding to the application may be obtained.

[0056] Step S102: Generate a standard identifier set including a plurality of standard interface function identifiers according to the path information of the interface file and the interface information in the interface file.

[0057] The path information of the interface file refers to the storage path of the interface file in the computer device. In some specific embodiments, the interface file can be stored in a disk space of the computer device, and its path information includes one or more levels of directories. The path information may include the directory name and file name corresponding to the interface file storage path. In some examples, the path information may be: first-level directory / second-level directory / third-level directory / interface file A, where each level of directory may be the name of a specific storage folder, and interface file A may be the file name of the interface file.

[0058] Any standard interface function identifier corresponds to an interface function in the interface file, and the standard interface function identifier may include at least a directory name, a file name, and an interface function name. In some specific examples, the standard interface function identifier may be expressed in the form of "directory name.file name.interface function name". When the path information of the interface file includes multiple directories, the standard interface function identifier includes multiple directory names accordingly. For example, when a secondary directory is included, the standard interface function identifier is: "primary directory name.secondary directory name.file name.interface function name". In some cases, the interface files are uniformly stored in the "services" directory in the computer system storage space, and the standard interface function identifier at this time is "services.directory name.file name.interface function name".

[0059] Specifically, the directory name and file name can be obtained according to the path information of the interface file, and the interface function name contained in the interface file can be obtained according to the interface information in the interface file. The directory name, file name and interface function name are combined to generate a standard interface function identifier. Since an application may correspond to multiple interface files, and an interface file may include interface information of multiple interface functions, correspondingly, multiple standard interface function identifiers can be generated. Multiple standard interface function identifiers are saved in a set to generate a standard identifier set. The multiple standard interface function identifiers in the standard identifier set are accurate interface function identifiers corresponding to the backend interface.

[0060] Step S103: Obtain a code file corresponding to the application program, and generate an interface function identifier to be verified according to the interface function code for executing the interface call extracted from the code file.

[0061] Specifically, a code file of an application corresponding to a verification instruction is obtained from a computer storage space, an interface function code for executing an interface call is extracted from the code file, and an interface function identifier to be verified is generated according to the interface function code.

[0062] The representation form of the interface function identifier to be verified is consistent with the standard interface function identifier, including the directory name, file name and interface function name.

[0063] Usually, interface files are named and stored according to specific specifications, and developers also implement calls to backend interfaces in the code files corresponding to the application according to the corresponding specifications. For example, interface files are stored in the services directory, and the storage path of a specific interface file can be "services. subdirectory. interface file A". Accordingly, when calling a backend interface recorded in interface file A, it is necessary to implement the call in the form of "services. subdirectory. interface file A. interface function B". In other words, the interface function code used to execute a specific interface call includes content corresponding to the storage path of the interface file of the specific interface.

[0064] Obtain the code file corresponding to the application, extract the interface function code for executing the interface call from the code file, and generate the interface function identifier to be verified according to the interface function code. In some examples, the access path information corresponding to the interface call may be extracted from the interface function code.

[0065] Step S104: Search for the interface function identifier to be verified in the standard identifier set. When the search fails, the interface function identifier to be verified that failed to be found is output as the problem interface function identifier to prompt the developer that an error exists in the interface function corresponding to the problem interface function identifier in the code file of the application.

[0066] Since the expression form of the interface function identifier to be verified is consistent with the standard interface function identifier, both include directory name, file name and interface function name. In some examples, the interface function identifier to be verified and the standard interface function identifier are both expressed as "directory name.file name.interface function name". By searching for the interface function identifier to be verified in the standard identifier set, it can be determined whether the current interface function identifier to be verified exists in the interface file, that is, whether there is still an interface corresponding to the interface function to be verified in the back-end interface.

[0067] Specifically, the interface function identifier to be verified is searched and matched in the standard identifier set. If the search is successful, it means that the interface function corresponding to the interface function identifier to be verified is correct and there is a corresponding backend interface. If the search fails, it means that there is an error in the interface function corresponding to the interface function identifier to be verified, and there is no corresponding interface in the backend interface. The interface function identifier to be verified that fails to be searched is output as the problem interface function identifier to prompt the developer that there is an error in the interface function corresponding to the problem interface function identifier in the code file of the application.

[0068] In the above-mentioned verification method of the application interface function, the computer device responds to the verification instruction, obtains the interface file and code file corresponding to the application, generates a standard identification set containing multiple standard interface function identifications and an interface function identification to be verified respectively, searches for the interface function identification to be verified in the standard identification set, and if the search fails, it means that there is an error in the interface function corresponding to the interface function identification to be verified, and outputs the interface function identification to be verified that failed to be searched as the problem interface function identification, so as to prompt the developer that there is an error in the interface function corresponding to the problem interface function identification in the code file of the application. By searching the interface function identification to be verified in the standard identification set generated based on the interface file, the interface function with errors can be found quickly and accurately, which reduces the time cost of the application interface function verification and improves the accuracy of the interface function verification.

[0069] At the same time, generating a standard identifier set based on the interface file and generating the interface function identifier to be verified based on the code file, and then using the interface function identifier to replace the complete interface function code for verification and checking can improve the verification speed.

[0070] In some embodiments, Figure 2 As shown, step S102 may include steps S201 to S203:

[0071] Step S201: traverse the directory, file and interface code in the file corresponding to the interface file to obtain the corresponding directory name, file name and interface function name;

[0072] Step S202: According to the path information of the interface function name, a set of directory names, file names and interface function names that have a corresponding relationship are integrated to generate an interface function identifier;

[0073] Step S203: store the interface function identifier into a preset set to obtain a standard identifier set.

[0074] Specifically, in the storage space storing the interface file, the directory storing the interface file is traversed to obtain the directory name, and then the files under the directory are traversed to obtain the file name, and then the interface information (i.e., interface code) in each file is read to obtain the interface function name. The file name and directory name corresponding to the obtained multiple interface function names are determined according to their path information, and a set of directory names, file names, and interface function names that have a corresponding relationship are sequentially integrated to generate an interface function identifier. The multiple interface function identifiers generated by the multiple interface functions are stored in a preset set to obtain a standard identifier set.

[0075] For example, the storage path of the interface file "file1" is services / project / file1, and the interface file includes the interface function "upload". Accordingly, by traversing the directories and files corresponding to the interface file, the directory names "services" and "project", as well as the file name "file1" can be obtained. Then, by traversing and reading the interface code in the file, the interface function name "upload" included therein can be obtained. According to the path information of the interface function name, "services", "project", "file1" and "upload" are integrated to generate the interface function identifier: "services.project.file1.upload.

[0076] In some embodiments, step S103 may include the following steps:

[0077] Matching the target code corresponding to both the preset start symbol and the preset end symbol in the code file;

[0078] The access path information corresponding to the interface call in the target code is extracted to generate the interface function identifier to be verified.

[0079] The preset start symbol and the preset end symbol can be determined according to the writing method of the interface function code used to execute the interface call in the code file. In some specific examples, the writing method of the interface function code is: "first-level directory name. second-level directory name. file name. interface function name (parameter content)", for example: "services.project.file1.upload()". Accordingly, the preset start symbol is the first-level directory name "services", and the preset end symbol is the front bracket "(". The access path information includes the directory name, file name and interface function name.

[0080] Specifically, the target code that meets the preset start symbol and the preset end symbol is matched in the code file. Taking the interface function code as written in the manner of "first-level directory name. second-level directory name. file name. interface function name (parameter content)" as an example, the preset start symbol is the first-level directory name, and the preset end symbol is the leading bracket. Matching in the code file can obtain the target code with the first-level directory name as the start symbol and the leading bracket as the end symbol. Further, the access path information corresponding to the interface call in the target code, that is, the code corresponding to the access path information part including the directory name, file name and interface function name is extracted to generate the interface function identifier to be verified. In some other specific embodiments, the end symbol in the target code can also be removed, and the remaining code is the code corresponding to the access path information, and the remaining code part is extracted to generate the interface function identifier to be verified.

[0081] In some embodiments, the interface function identifier to be checked includes multiple, such as Figure 3 As shown, the verification method of the application program interface function may further include step S301 and step S302.

[0082] Step S301: Determine the corresponding interface function category according to the interface function identifier to be checked.

[0083] Step S302: Determine the verification priority according to the interface function category.

[0084] The interface function categories include at least a first category of interface functions for implementing system configuration or user authority settings and a second category of interface functions for implementing business functions of an application program.

[0085] In some specific embodiments, the interface function category corresponding to the interface function identifier to be verified can be determined based on the file name in the interface function identifier to be verified. In some specific examples, the interface function category corresponding to the interface function identifier to be verified can be determined based on the file name in the interface function identifier to be verified and the preset file name and category mapping relationship. In some further specific examples, since developers are usually accustomed to naming file names according to the functions that can be achieved by the interface function in the file, the file name can be identified and analyzed. When the file name includes keywords related to the system or user authority, such as "system", "user", "common", etc., the interface function category of the interface function identifier to be verified is determined to be a first-class interface function. When the file name includes keywords related to the business functions of the application, such as "function", "data analysis", etc., it is determined to be a second-class interface function.

[0086] The verification priority includes a first priority and a second priority corresponding to the first type of interface function and the second type of interface function respectively.

[0087] Correspondingly, searching for the interface function identifier to be checked in the standard identifier set in step S104 may include the following steps: determining a search order according to a verification priority, and searching for the interface function identifier to be checked in the standard identifier set in sequence according to the search order.

[0088] Those skilled in the art can set the hierarchical setting of the verification priorities and the number of interface function categories corresponding to the verification priorities according to actual needs.

[0089] When there are multiple interface function identifiers to be verified, a specific interface function identifier to be verified can be searched and verified first by setting the priority, so that the developer can obtain the search and verification result of the specific interface function identifier to be verified first.

[0090] In some specific embodiments, the interface function category may also include a third category interface function. The application program involved in the embodiment of the present application may be an application for implementing a vehicle information management class. In some specific examples, the preset file name and category mapping relationship may be as follows:

[0091] The file names corresponding to the first type of interface functions include: system, user, and common, and the verification priority is the first priority;

[0092] The file names corresponding to the second type of interface functions include: car model (car model library), function library (function library), Statistics statement (statistical statement), and the verification priority is the second priority;

[0093] The file names corresponding to the third type of interface functions include: part and component control, part and component controller, and information. The verification priority is the third priority.

[0094] Among them, the file named system may include interface functions for implementing system configuration, such as log-related interface functions: list Logs (log list), search Log (log search), clear Logs (log clearing), system monitoring interface functions: get System Health (system health acquisition), and resource management-related interface functions: list Resources (resource list). The file named user may include interface functions for implementing user management, such as user authentication-related interface functions: log in (login), log out (registration), refresh Token (user token refresh), and user information or account management interface functions: get User Profile (user profile acquisition), update date User Profile (user profile update), change Password (password change), verifyEmail (email verification), forgot Password (forgot password), etc. The file named common may include interface functions for implementing common functions of applications, such as up load (upload) and search (query).

[0095] In the file names corresponding to the second category of interface functions, the file named car model may include interface functions that call the car model library interface, such as get Car Model List (get car model list) and put Car Model (input car model). In the file named function library, the interface functions that call the interfaces of various car systems or component functions may be included, such as get Function Library (get function library) and post Function Library (post function library). In the file named statistical statement, the interface functions related to data statistical analysis may be included, such as get Statistical Statement List (get statistical report list) and get StatisticalStatements By Id (get statistical report by ID).

[0096] In the file names corresponding to the third category of interface functions, the file named part and component control may include interface functions for obtaining component information, such as get Part And Component Control List (get a list of components) and get Part And Component Control By Id (get a component by ID). The file named part and component controller may include interface functions for obtaining component controller information, such as get Part And Component Controller List (get a list of component controllers) and getPart And Component Controller By Id (get a component controller by ID). The file named Information may include interface functions related to application information operations, such as getInformation (get information) and post Information (post information).

[0097] In some embodiments, the verification method of the application program interface function may further include the following steps: determining the location information of the interface function code corresponding to the problematic interface function identifier in the code file, and displaying the location information in the display interface.

[0098] Specifically, in step S103, when the interface function identifier to be verified is generated according to the interface function code extracted from the code file, the location information of the interface function code corresponding to the interface function identifier to be verified is recorded, and when the interface function identifier to be verified fails to be found, the location information is displayed in the display interface. The location information can be code page number or line number information, and can also provide a jump link to the location information.

[0099] In some embodiments, the verification method of the application interface function may also include the following steps: visualizing the interface function code corresponding to the problematic interface function identifier in the display interface so that the display appearance of the interface function code corresponding to the problematic interface function identifier is different from other codes in the code file.

[0100] Specifically, the interface function code corresponding to the problematic interface function identifier in the code file may be highlighted in the display interface, or underlined, or highlighted in other visual ways.

[0101] In some embodiments, the interface file is automatically generated by a code tool based on the OPEN API specification according to the backend interface, and the interface file includes at least the interface name, interface path, calling method and parameter format.

[0102] In some embodiments, the verification method of the application program interface function is implemented based on Node.js (a JavaScript runtime environment based on the ChromeV8 engine).

[0103] It should be understood that although Figure 1-3 The steps in the flowchart are displayed in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Figure 1-3 Unless otherwise specified herein, the steps shown and the steps involved in other embodiments are not strictly limited in order of execution, and the steps can be executed in other orders. Moreover, at least a part of the steps in the aforementioned embodiments may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0104] In a second aspect, an embodiment of the present application provides a verification device for an application program interface function, such as Figure 4 As shown, the verification device 400 for the application program interface function may include: an interface file acquisition module 410 , a standard identifier set generation module 420 , a to-be-verified identifier generation module 430 , and an identifier verification module 440 .

[0105] The interface file acquisition module 410 is used to acquire the interface file corresponding to the application program in response to the verification instruction.

[0106] The standard identifier set generating module 420 is used to generate a standard identifier set including a plurality of standard interface function identifiers according to the path information of the interface file and the interface information in the interface file.

[0107] The to-be-verified identifier generating module 430 is used to obtain a code file corresponding to the application program, and generate an to-be-verified interface function identifier according to an interface function code for executing an interface call extracted from the code file.

[0108] The identifier verification module 440 is used to search for the interface function identifier to be verified in the standard identifier set. When the search fails, the interface function identifier to be verified that failed to be found is output as the problem interface function identifier to prompt the developer that an error exists in the interface function corresponding to the problem interface function identifier in the code file of the application.

[0109] The interface file is used to record the interface information of the backend interface corresponding to the application. Any standard interface function identifier corresponds to an interface function in the interface file. The standard interface function identifier and the interface function identifier to be verified both include a directory name, a file name, and an interface function name.

[0110] In some embodiments, the standard identification set generation module 420 may include an information acquisition unit, an identification generation unit, and a set generation unit.

[0111] The information acquisition unit is used for the information acquisition unit, the identification generation unit and the set generation unit.

[0112] The identification generating unit is used to integrate a group of directory names, file names and interface function names that have corresponding relationships according to the path information of the interface function name to generate an interface function identification.

[0113] The set generation unit is used to store the interface function identifier into a preset set to obtain a standard identifier set.

[0114] In some embodiments, the to-be-verified identification generating module 430 may include a target code searching unit and a code extracting unit.

[0115] The target code search unit is used to match the target code corresponding to the preset start symbol and the preset end symbol in the code file.

[0116] The code extraction unit is used to extract the access path information corresponding to the interface call in the target code and generate the interface function identifier to be verified.

[0117] The access path information includes directory name, file name and interface function name.

[0118] In some embodiments, the interface function identifiers to be verified include multiple ones, and the application program interface function verification device 400 may further include a category determination module and a priority determination module.

[0119] The category determination module is used to determine the corresponding interface function category according to the interface function identifier to be checked.

[0120] The priority determination module is used to determine the verification priority according to the interface function category.

[0121] Among them, the interface function category includes at least a first type of interface function for implementing system configuration or user authority setting and a second type of interface function for implementing the business functions of the application, and the verification priority includes a first priority and a second priority corresponding to the first type of interface function and the second type of interface function respectively.

[0122] Correspondingly, the identifier verification module 440 is further used to determine a search order according to a verification priority, and to search for the interface function identifier to be verified in the standard identifier set in sequence according to the search order.

[0123] In some embodiments, the category determination module may also be used to determine the interface function category corresponding to the interface function identifier to be verified according to the file name in the interface function identifier to be verified.

[0124] In some embodiments, the verification device 400 for the application program interface function may further include a location information determination module for determining the location information of the interface function code corresponding to the problematic interface function identifier in the code file, and displaying the location information in a display interface.

[0125] In some embodiments, the verification device 400 for the application interface function may also include a code visualization module for visualizing the interface function code corresponding to the problematic interface function identifier in the display interface, so that the display appearance of the interface function code corresponding to the problematic interface function identifier is different from other codes in the code file.

[0126] For more specific limitations on the verification device for the application interface function, please refer to the limitations on the verification method for the application interface function in the above text. The verification device for the application interface function can also be used to execute more steps of the verification method for the application interface function in the embodiments of the present application, which will not be repeated here. Each module in the above-mentioned verification device for the application interface function can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.

[0127] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for verifying an application program interface function provided in any embodiment of the present application in the first aspect when executing the computer program.

[0128] In some embodiments, the computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the verification method of the application program interface function in any embodiment of the present invention is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0129] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a partial structure related to the embodiment scheme of the present application, and does not constitute a limitation on the computer device to which the embodiment scheme of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0130] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for verifying the application program interface function provided in any embodiment of the present application in the first aspect.

[0131] The computer readable storage medium may be Figure 5 A computer-readable storage medium in the computer device shown.

[0132] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The aforementioned computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments of the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0133] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0134] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the protection scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A verification method for an application program interface function, It is characterized in that The method comprises: In response to the verification instruction, an interface file corresponding to the application is obtained, wherein the interface file is used to record interface information of a backend interface corresponding to the application; Generate a standard identifier set including a plurality of standard interface function identifiers according to the path information of the interface file and the interface information in the interface file, wherein any of the standard interface function identifiers corresponds to an interface function in the interface file; Obtaining a code file corresponding to the application, and generating an interface function identifier to be verified according to an interface function code for executing an interface call extracted from the code file; Searching for the interface function identifier to be verified in the standard identifier set, and when the search fails, outputting the interface function identifier to be verified that failed to be searched as the problem interface function identifier, so as to prompt the developer that an error exists in the interface function corresponding to the problem interface function identifier in the code file of the application; The standard interface function identifier and the interface function identifier to be verified both include a directory name, a file name and an interface function name.

2. The method according to claim 1, It is characterized in that The step of generating a standard identifier set including a plurality of standard interface function identifiers according to the path information of the interface file and the interface information in the interface file comprises: Traverse the directory, file and interface code in the file corresponding to the interface file to obtain the corresponding directory name, file name and interface function name; According to the path information of the interface function name, a set of directory names, file names and interface function names that have a corresponding relationship are integrated to generate an interface function identifier; The interface function identifier is stored in a preset set to obtain a standard identifier set.

3. The method according to claim 1, It is characterized in that The step of generating the interface function identifier to be verified according to the code of the interface function for executing the interface call extracted from the code file comprises: Matching the target code corresponding to both the preset start symbol and the preset end symbol in the code file; Access path information corresponding to the interface call in the target code is extracted to generate the interface function identifier to be verified, wherein the access path information includes a directory name, a file name and an interface function name.

4. The method according to claim 1, It is characterized in that The interface function identifier to be verified includes multiple ones; The method further comprises: determining a corresponding interface function category according to the interface function identifier to be verified; determining a verification priority according to the interface function category; wherein the interface function category at least includes a first category of interface functions for implementing system configuration or user authority setting and a second category of interface functions for implementing the business functions of the application program, and the verification priority includes a first priority and a second priority corresponding to the first category of interface functions and the second category of interface functions, respectively; The searching for the interface function identifier to be checked in the standard identifier set includes: determining a search order according to the verification priority; and searching for the interface function identifier to be checked in the standard identifier set in sequence according to the search order.

5. The method according to claim 4, It is characterized in that The determining the corresponding interface function category according to the interface function identifier to be checked includes: According to the file name in the interface function identifier to be verified, the interface function category corresponding to the interface function identifier to be verified is determined.

6. The method according to claim 1, It is characterized in that The method further comprises: Determine the location information of the interface function code corresponding to the problematic interface function identifier in the code file, and display the location information in the display interface; and / or, The interface function code corresponding to the problematic interface function identifier is visualized in the display interface, so that the display appearance of the interface function code corresponding to the problematic interface function identifier is different from other codes in the code file.

7. The method according to claim 1, It is characterized in that The interface file is automatically generated by a code tool based on the OPEN API specification according to the backend interface, and the interface file at least includes an interface name, an interface path, a calling method and a parameter format; and / or, the method is implemented based on Node.js.

8. A verification device for an application program interface function, It is characterized in that The device comprises: An interface file acquisition module, used to obtain an interface file corresponding to the application in response to a verification instruction, wherein the interface file is used to record interface information of a backend interface corresponding to the application; A standard identification set generating module, used to generate a standard identification set including a plurality of standard interface function identifications according to the path information of the interface file and the interface information in the interface file, wherein any of the standard interface function identifications corresponds to an interface function in the interface file; A to-be-verified identifier generation module is used to obtain a code file corresponding to the application program, and generate an to-be-verified interface function identifier according to an interface function code for executing an interface call extracted from the code file; An identification verification module is used to search for the interface function identification to be verified in the standard identification set, and when the search fails, output the interface function identification to be verified that failed to be found as the problem interface function identification, so as to prompt the developer that there is an error in the interface function corresponding to the problem interface function identification in the code file of the application; The standard interface function identifier and the interface function identifier to be verified both include a directory name, a file name and an interface function name.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Processing method and device for checking service interface calling information

    CN119759361A

  • Loadable file creation method, executable module installation method and application operation control method

    CN121501362A

  • Method for controlling creation of loadable files, installation of executable modules and running of applications

    CN121501362B