Interface upgrade detection method and device, storage medium and equipment

By adding annotation attributes to the interface and using a simulated service to obtain the detection results, the problem of low detection efficiency during interface upgrades was solved, achieving efficient detection without manual programming.

CN115586914BActive Publication Date: 2026-03-31HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-08
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

The existing interface upgrade detection relies on user configuration and testing tools, resulting in high time costs and reduced detection efficiency.

Method used

Add annotation attributes to the interface, and after the target version interface is upgraded, send version change information through a simulated service to obtain test results and execution results, and determine the upgrade detection result based on the comparison.

Benefits of technology

No manual programming of test cases is required, which improves the efficiency of interface upgrade detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115586914B_ABST
    Figure CN115586914B_ABST
Patent Text Reader

Abstract

The application discloses an interface upgrade detection method and device, a storage medium and equipment. The method comprises the following steps: when a target version interface is upgraded, a new version interface is generated, the new version interface is deployed in a preset test environment, and a test interface is obtained; an annotation attribute of the new version interface is updated, and version change information is obtained; the version change information is sent to a preset simulation service, so that the simulation service sends a simulation request to the test interface and the target version interface, obtains a test result fed back by the test interface based on the simulation request, and an execution result fed back by the target version interface based on the simulation request; and based on the test result and the execution result, an upgrade detection result of the new version interface is determined. Compared with the prior art, the method does not need to spend time on programming of test cases manually, so that the efficiency of interface upgrade detection is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Mainstream API upgrade detection often relies on user configuration and testing tools. Specifically, it requires collecting API request parameters, as well as traffic information from the API under test and historical versions. Based on these parameters, test cases are generated and run using testing tools to obtain the upgrade detection results for the API under test. Each API upgrade requires testers to spend significant time programming, reducing the efficiency of API upgrade detection.

[0003] Therefore, improving the efficiency of interface upgrade detection has become an urgent problem to be solved in this field. Summary of the Invention

[0004] This application provides an interface upgrade detection method, apparatus, storage medium, and device, with the aim of improving the efficiency of interface upgrade detection.

[0005] To achieve the above objectives, this application provides the following technical solution:

[0006] An interface upgrade detection method includes:

[0007] When the target version interface is upgraded and a new version interface is generated, the new version interface is deployed in a preset test environment to obtain a test interface; the target version interface includes interfaces with pre-added annotation attributes and which have been launched and are in use.

[0008] Update the annotation attributes of the new version interface to obtain version change information;

[0009] The version change information is sent to a preset simulation service, so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests.

[0010] Based on the test results and the execution results, the upgrade detection result of the new version interface is determined.

[0011] Optionally, sending the version change information to a preset simulation service, so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests, includes:

[0012] The new version of the interface is compiled to obtain the service process of the new version of the interface;

[0013] The service process is started, and the version change information is sent to a preset simulation service, so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests.

[0014] Optionally, determining the upgrade detection result of the new version interface based on the test results and the execution results includes:

[0015] The value corresponding to the key to be tested is obtained from the test results and identified as the first value; the test results include multiple key-value pairs; the key to be tested is a key pre-specified by the user;

[0016] The value corresponding to the key to be tested is obtained from the execution result and identified as the second value; the execution result includes multiple key-value pairs.

[0017] If the first value and the second value are the same, and the data type of the first value is the same as the data type of the second value, then the first value is parsed to obtain the first string, and the second value is parsed to obtain the second string;

[0018] If the first string and the second string are the same, the new version interface is determined to have passed the upgrade detection.

[0019] Optional, also includes:

[0020] If the first value and the second value are different, it is determined that the new version interface has failed the upgrade detection.

[0021] Optional, also includes:

[0022] If the first value and the second value are the same, and the data type of the first value is different from the data type of the second value, it is determined that the new version interface has failed the upgrade detection.

[0023] Optional, also includes:

[0024] If the first string and the second string are different, it is determined that the new version interface has failed the upgrade detection.

[0025] Optionally, after determining the upgrade detection result of the new version interface based on the test results and the execution results, the method further includes:

[0026] If the upgrade test result indicates that the new version interface has failed the upgrade test, an alarm will be sent to the user.

[0027] An interface upgrade detection device, comprising:

[0028] The deployment unit is used to deploy the new version interface in a preset test environment after the target version interface is upgraded and a new version interface is generated, so as to obtain a test interface; the target version interface includes interfaces that have been pre-annotated and are already in use.

[0029] The update unit is used to update the annotation attributes of the new version interface to obtain version change information;

[0030] The simulation unit is used to send the version change information to a preset simulation service, so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests.

[0031] The determining unit is used to determine the upgrade detection result of the new version interface based on the test result and the execution result.

[0032] A computer-readable storage medium includes a stored program, wherein the program is executed by a processor to perform the interface upgrade detection method.

[0033] An interface upgrade detection device includes: a processor, a memory, and a bus; the processor and the memory are connected via the bus.

[0034] The memory is used to store the program, and the processor is used to run the program, wherein the program is executed by the processor to perform the interface upgrade detection method.

[0035] The technical solution provided in this application involves deploying the new version interface in a preset test environment after a version upgrade of the target version interface generates a new version interface, thus obtaining a test interface. The annotation attributes of the new version interface are updated to obtain version change information. This version change information is sent to a preset simulation service, which then sends simulated requests to both the test interface and the target version interface. The test interface provides test results based on the simulated requests, and the target version interface provides execution results based on the simulated requests. Based on the test and execution results, the upgrade detection result of the new version interface is determined. This application adds annotation information to the interface and, when the target version interface is upgraded and a new version interface is generated, obtains test and execution results by sending version change information to a preset simulation service. Then, by comparing the test and execution results, the upgrade detection result of the new version interface is determined. Compared to existing technologies, this eliminates the need for manual time spent programming test cases, thereby effectively improving the efficiency of interface upgrade detection. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the 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.

[0037] Figure 1 A flowchart illustrating an interface upgrade detection method provided in an embodiment of this application;

[0038] Figure 2 A flowchart illustrating an information comparison method provided in an embodiment of this application;

[0039] Figure 3 A flowchart illustrating another interface upgrade detection method provided in this application embodiment;

[0040] Figure 4 This is a schematic diagram of the architecture of an interface upgrade detection device provided in an embodiment of this application. Detailed Implementation

[0041] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0042] like Figure 1The diagram shown is a flowchart of an interface upgrade detection method provided in an embodiment of this application, which can be applied to the server and includes the following steps.

[0043] S101: Add annotation attributes to the interface in advance.

[0044] The annotation attributes include, but are not limited to, the interface version information, the interface input parameters, the service unique identifier, the interface unique identifier, the interface request parameters, and the interface noise field.

[0045] It should be noted that adding annotation attributes to the interface does not change the underlying logic of the interface, that is, it does not significantly immerse the business code. Compared with the existing technology that requires writing test cases, the upgrade detection process shown in this embodiment does not require time and manpower costs for programming or maintenance of business code.

[0046] S102: When the target version interface is upgraded and a new version interface is generated, the new version interface is deployed in the preset test environment to obtain the test interface.

[0047] The target version interfaces include those with pre-added annotation attributes and those already in use.

[0048] It should be noted that after the target version interface is upgraded, a new version interface will be obtained. The new version interface can only be used after it has passed the upgrade test. Therefore, it is necessary to deploy the new version interface in the preset test environment, obtain the test interface, and use the test interface to perform upgrade testing.

[0049] S103: Update the annotation attributes of the new version interface to obtain version change information.

[0050] The version change information is essentially the updated annotation attributes. Specifically, if the interface is upgraded from version 1.0 to version 2.0, the version information shown in the updated annotation attributes should be updated to version 2.0. Therefore, version 2.0 will be used as the version change information.

[0051] S104: Compile the new version of the interface to obtain the service process of the new version of the interface.

[0052] S105: Start the service process and send the version change information to the preset mock service so that the mock service sends mock requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the mock requests, and the execution results fed back by the target version interface based on the mock requests.

[0053] The test results include multiple key-value pairs, and the execution results also include multiple key-value pairs.

[0054] S106: Compare the test results with the execution results to obtain the upgrade detection results of the new version interface.

[0055] For a detailed comparison process between the test results and the execution results, please refer to the following: Figure 2 The steps shown, along with explanations of each step.

[0056] S107: If the upgrade test results indicate that the new version interface has failed the upgrade test, send an alarm to the user.

[0057] In summary, this embodiment adds annotation information to the interface, and when the target version interface is upgraded and a new version interface is generated, it sends version change information to a preset simulation service to obtain test results and execution results. Then, based on the comparison of test results and execution results, the upgrade detection result of the new version interface is determined. Compared with the prior art, there is no need for manual time to program test cases, thereby effectively improving the efficiency of interface upgrade detection.

[0058] like Figure 2 The diagram shown is a flowchart of an information comparison method provided in an embodiment of this application, including the following steps.

[0059] S201: Obtain the value corresponding to the key to be tested from the test results and mark it as the first value.

[0060] The key to be tested is a key pre-specified by the user.

[0061] S202: Obtain the value corresponding to the key to be tested from the execution result and mark it as the second value.

[0062] S203: Determine whether the first value and the second value are the same.

[0063] If the first value is the same as the second value, then execute S204; otherwise, execute S205.

[0064] S204: Determine whether the data types of the first value and the second value are the same.

[0065] If the data type of the first value is the same as the data type of the second value, then execute S206; otherwise, execute S207.

[0066] S205: The new version interface has failed the upgrade test.

[0067] S206: Parse the first value to obtain the first string, and parse the second value to obtain the second string.

[0068] After executing S206, continue executing S208.

[0069] S207: The new version interface has failed the upgrade test.

[0070] S208: Determine if the first string and the second string are the same.

[0071] If the first string and the second string are the same, then execute S209; otherwise, execute S210.

[0072] S209: Confirm that the new version interface has passed the upgrade test.

[0073] S210: The new version interface has failed the upgrade test.

[0074] In summary, this embodiment can compare the test results with the execution results to obtain the upgrade detection results of the new version interface.

[0075] It should be noted that the processes shown in the above embodiments are all optional implementations of the interface upgrade detection method shown in the embodiments of this application. Therefore, the processes shown in the above embodiments can be summarized as follows: Figure 3 The method shown.

[0076] like Figure 3 The diagram shown is a flowchart of another interface upgrade detection method provided in this application embodiment, which includes the following steps.

[0077] S301: When the target version interface is upgraded and a new version interface is generated, the new version interface is deployed in the preset test environment to obtain the test interface.

[0078] The target version interfaces include those with pre-added annotation attributes and those already in use.

[0079] S302: Update the annotation attributes of the new version interface to obtain version change information.

[0080] S303: Send the version change information to the preset simulation service so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests.

[0081] S304: Based on the test results and execution results, determine the upgrade detection results of the new version interface.

[0082] In summary, this embodiment adds annotation information to the interface, and when the target version interface is upgraded and a new version interface is generated, it sends version change information to a preset simulation service to obtain test results and execution results. Then, based on the comparison of test results and execution results, the upgrade detection result of the new version interface is determined. Compared with the prior art, there is no need for manual time to program test cases, thereby effectively improving the efficiency of interface upgrade detection.

[0083] Corresponding to the interface upgrade detection method provided in the above embodiments of this application, the embodiments of this application also provide an interface upgrade detection device.

[0084] like Figure 4 The diagram shown is an architectural schematic of an interface upgrade detection device provided in an embodiment of this application, which includes the following units.

[0085] Deployment unit 100 is used to deploy the new version interface in a preset test environment when the target version interface is upgraded and a new version interface is generated, so as to obtain the test interface; the target version interface includes interfaces with pre-added annotation attributes and which have been launched and used.

[0086] Update unit 200 is used to update the annotation attributes of the new version interface to obtain version change information.

[0087] The simulation unit 300 is used to send version change information to a preset simulation service, so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests.

[0088] Optionally, the simulation unit 300 is specifically used for: compiling the new version interface to obtain the service process of the new version interface; starting the service process and sending the version change information to the preset simulation service, so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests.

[0089] Unit 400 is used to determine the upgrade detection result of the new version interface based on the test results and execution results.

[0090] Optionally, the determining unit 400 is specifically used for: obtaining the value corresponding to the key to be tested from the test results and identifying it as the first value; the test results include multiple key-value pairs; the key to be tested is a key pre-specified by the user; obtaining the value corresponding to the key to be tested from the execution results and identifying it as the second value; the execution results include multiple key-value pairs; if the first value and the second value are the same, and the data type of the first value is the same as the data type of the second value, parsing the first value to obtain the first string, and parsing the second value to obtain the second string; if the first string and the second string are the same, determining that the new version interface passes the upgrade detection.

[0091] The determining unit 400 is also used to: determine that the new version interface has failed the upgrade detection if the first value and the second value are different.

[0092] The determining unit 400 is also used to: determine that the new version interface has failed the upgrade detection when the first value and the second value are the same and the data type of the first value is different from the data type of the second value.

[0093] The determination unit 400 is also used to: determine that the new version interface has failed the upgrade detection if the first string and the second string are different.

[0094] The alert unit 500 is used to send an alarm to the user when the upgrade test result indicates that the new version interface has failed the upgrade test.

[0095] In summary, this embodiment adds annotation information to the interface, and when the target version interface is upgraded and a new version interface is generated, it sends version change information to a preset simulation service to obtain test results and execution results. Then, based on the comparison of test results and execution results, the upgrade detection result of the new version interface is determined. Compared with the prior art, there is no need for manual time to program test cases, thereby effectively improving the efficiency of interface upgrade detection.

[0096] This application also provides a computer-readable storage medium including a stored program, wherein the program executes the interface upgrade detection method provided in this application.

[0097] This application also provides an interface upgrade detection device, including a processor, a memory, and a bus. The processor and the memory are connected via the bus. The memory is used to store a program, and the processor is used to run the program. When the program runs, it executes the interface upgrade detection method provided in this application, including the following steps:

[0098] When the target version interface is upgraded and a new version interface is generated, the new version interface is deployed in a preset test environment to obtain a test interface; the target version interface includes interfaces with pre-added annotation attributes and which have been launched and are in use.

[0099] Update the annotation attributes of the new version interface to obtain version change information;

[0100] The version change information is sent to a preset simulation service, so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests.

[0101] Based on the test results and the execution results, the upgrade detection result of the new version interface is determined.

[0102] Specifically, based on the above embodiments, the step of sending the version change information to a preset simulation service, so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests, includes:

[0103] The new version of the interface is compiled to obtain the service process of the new version of the interface;

[0104] The service process is started, and the version change information is sent to a preset simulation service, so that the simulation service sends simulation requests to the test interface and the target version interface, and obtains the test results fed back by the test interface based on the simulation requests, and the execution results fed back by the target version interface based on the simulation requests.

[0105] Specifically, based on the above embodiments, determining the upgrade detection result of the new version interface based on the test results and the execution results includes:

[0106] The value corresponding to the key to be tested is obtained from the test results and identified as the first value; the test results include multiple key-value pairs; the key to be tested is a key pre-specified by the user;

[0107] The value corresponding to the key to be tested is obtained from the execution result and identified as the second value; the execution result includes multiple key-value pairs.

[0108] If the first value and the second value are the same, and the data type of the first value is the same as the data type of the second value, then the first value is parsed to obtain the first string, and the second value is parsed to obtain the second string;

[0109] If the first string and the second string are the same, the new version interface is determined to have passed the upgrade detection.

[0110] Specifically, based on the above embodiments, it also includes:

[0111] If the first value and the second value are different, it is determined that the new version interface has failed the upgrade detection.

[0112] Specifically, based on the above embodiments, it also includes:

[0113] If the first value and the second value are the same, and the data type of the first value is different from the data type of the second value, it is determined that the new version interface has failed the upgrade detection.

[0114] Specifically, based on the above embodiments, it also includes:

[0115] If the first string and the second string are different, it is determined that the new version interface has failed the upgrade detection.

[0116] Specifically, based on the above embodiments, after determining the upgrade detection result of the new version interface based on the test results and the execution results, the method further includes:

[0117] If the upgrade test result indicates that the new version interface has failed the upgrade test, an alarm will be sent to the user.

[0118] If the functions described in the embodiments of this application are implemented as software functional units and sold or used as independent products, they can be stored in a computing device readable storage medium. Based on this understanding, the parts of the embodiments of this application that contribute to the prior art or the technical solutions can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a computing device (which may be a personal computer, server, mobile computing device, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.

[0119] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0120] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An interface upgrade detection method, characterized by, The method comprises the following steps: When a target version interface is upgraded, a new version interface is generated, and the new version interface is deployed in a preset test environment to obtain a test interface; The target version interface comprises an interface with added annotation attributes and an online version; The annotation attributes of the new version interface are updated to obtain version change information; The version change information is sent to a preset simulation service, so that the simulation service sends a simulation request to the test interface and the target version interface, obtains a test result fed back by the test interface based on the simulation request, and an execution result fed back by the target version interface based on the simulation request; Based on the test result and the execution result, an upgrade detection result of the new version interface is determined, including: obtaining a value corresponding to a to-be-tested key from the test result, which is identified as a first value; the test result comprises a plurality of key-value pairs; the to-be-tested key is a key specified by a user in advance; obtaining a value corresponding to the to-be-tested key from the execution result, which is identified as a second value; the execution result comprises a plurality of key-value pairs; in a case where the first value and the second value are the same and the data type of the first value and the data type of the second value are the same, the first value is parsed to obtain a first string, and the second value is parsed to obtain a second string; in a case where the first string and the second string are the same, it is determined that the new version interface passes the upgrade detection.

2. The method of claim 1, wherein, The version change information is sent to a preset simulation service, so that the simulation service sends a simulation request to the test interface and the target version interface, obtains a test result fed back by the test interface based on the simulation request, and an execution result fed back by the target version interface based on the simulation request, comprising: The new version interface is compiled to obtain a service process of the new version interface; The service process is started, the version change information is sent to a preset simulation service, so that the simulation service sends a simulation request to the test interface and the target version interface, obtains a test result fed back by the test interface based on the simulation request, and an execution result fed back by the target version interface based on the simulation request.

3. The method of claim 1, wherein, Further comprising: In a case where the first value and the second value are different, it is determined that the new version interface fails the upgrade detection.

4. The method of claim 1, wherein, Further comprising: In a case where the first value and the second value are the same and the data type of the first value and the data type of the second value are different, it is determined that the new version interface fails the upgrade detection.

5. The method of claim 1, wherein, Further comprising: In a case where the first string and the second string are different, it is determined that the new version interface fails the upgrade detection.

6. The method of claim 1, wherein, After the determination of the upgrade detection result of the new version interface based on the test result and the execution result, the following step is further included: In a case where the upgrade detection result indicates that the new version interface fails the upgrade detection, an alarm prompt is sent to a user.

7. An interface upgrade detection apparatus, characterized by comprising: Further comprising: A deployment unit is configured to deploy a new version interface in a preset test environment after a new version interface is generated when a target version interface is upgraded, to obtain a test interface; the target version interface includes an interface that is added with an annotation attribute in advance and has been put into use; An updating unit is configured to update the annotation attribute of the new version interface to obtain version change information; An simulation unit is configured to send the version change information to a preset simulation service, to enable the simulation service to send a simulation request to the test interface and the target version interface, to obtain a test result fed back by the test interface based on the simulation request and an execution result fed back by the target version interface based on the simulation request; A determination unit is configured to determine an upgrade detection result of the new version interface based on the test result and the execution result, including: obtaining a value corresponding to a to-be-tested key from the test result, which is identified as a first value; the test result includes a plurality of key-value pairs; the to-be-tested key is a key specified by a user in advance; obtaining a value corresponding to the to-be-tested key from the execution result, which is identified as a second value; the execution result includes a plurality of key-value pairs; in a case where the first value and the second value are the same and the data type of the first value and the data type of the second value are the same, analyzing the first value to obtain a first string, and analyzing the second value to obtain a second string; in a case where the first string and the second string are the same, determining that the new version interface passes the upgrade detection.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium includes a stored program, wherein the program is run by the processor to execute the interface upgrade detection method of any one of claims 1-6.

9. An interface upgrade detection device, comprising: It includes: a processor, a memory and a bus; the processor and the memory are connected through the bus; the memory is configured to store a program, and the processor is configured to run the program, wherein the program is run by the processor to execute the interface upgrade detection method of any one of claims 1-6.

Citation Information

Patent Citations

  • Automatic test method and system

    CN111221743A

  • Kubernetes upgrading method and device for container cluster management system

    CN111897558A