Coverage rate detection method and device, equipment and storage medium

By screening the interface and combined code that match the response time, the effective code collection is generated, which solves the problem of inaccurate code detection in the existing technology, and achieves more accurate coverage test results.

CN119377108APending Publication Date: 2025-01-28SHENZHEN YISHIHUOLALA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411427145.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

When detecting code coverage, the prior art cannot effectively exclude redundant codes, resulting in inaccurate detection results.

Method used

By receiving the detection request, determine the n first interface, and screen the M second interface according to its response time. Then, according to the code of the second interface, the effective code collection is generated, and the test results are finally based on the collection of the collection.

Benefits of technology

By checking the redundant code, the accuracy of the code coverage detection is improved, and the detection results do not contain redundant code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377108A_ABST
    Figure CN119377108A_ABST
Patent Text Reader

Abstract

The invention provides a coverage rate detection method and device, equipment and a storage medium. The method comprises the following steps: receiving a detection request; determining N first interfaces in response to the detection request; the first interface is an interface called by the detection request, and N is a positive integer greater than 1; determining M second interfaces according to the response time corresponding to each first interface; the M second interfaces are at least part of interfaces in the N first interfaces, and M is a positive integer smaller than or equal to N; determining an effective code set according to the code corresponding to each second interface; and generating a coverage rate detection result based on the effective code set. In the embodiment of the invention, the redundant codes are checked in the mode, and then the coverage rate detection result is generated based on the effective code set. The code coverage rate obtained through detection does not comprise redundant codes, and the accuracy is 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 a coverage detection method, apparatus, device, and storage medium. Background Art

[0002] Code coverage is a metric used to measure the extent to which software tests are covered. It represents the percentage of total code that is executed during testing. Currently, the JaCoCo tool is commonly used to detect code coverage.

[0003] Currently, when building new business lines, the system architecture of existing business lines is often copied and modified, resulting in a significant amount of redundant code in the new business line systems. Furthermore, existing technologies for code coverage testing often fail to exclude redundant code, leading to inaccurate code coverage results. Summary of the Invention

[0004] The main objective of this application is to provide a coverage detection method, apparatus, computer device, and storage medium, which aims to solve the technical problem that the detected code coverage is not accurate enough.

[0005] To achieve the above objectives, this application provides a coverage detection method, which includes:

[0006] Receive detection requests;

[0007] In response to the detection request, N first interfaces are determined; the first interfaces are the interfaces invoked by the detection request, and N is a positive integer greater than 1;

[0008] Based on the response time corresponding to each first interface, M second interfaces are determined; the M second interfaces are at least some of the N first interfaces, and M is a positive integer less than or equal to N;

[0009] Based on the code corresponding to each second interface, determine the set of valid codes;

[0010] Based on the aforementioned collection of valid code, coverage detection results are generated.

[0011] Optionally, determining M second interfaces based on the response time corresponding to each first interface includes:

[0012] The call relationships between the various first interfaces are obtained using a code link analysis tool;

[0013] Based on the response time of each first interface and the calling relationship, the N first interfaces are filtered.

[0014] Based on the response time of each selected first interface, determine M second interfaces.

[0015] Optionally, obtaining the call relationships between the various first interfaces using a code link analysis tool includes:

[0016] The call chain between the various first interfaces is obtained using the code chain parsing tool.

[0017] Based on the call chain, a static call graph or a dynamic call graph corresponding to the N first interfaces is generated.

[0018] Optionally, the step of filtering the N first interfaces based on their response times and the call relationships includes:

[0019] Determine whether the call relationship of each first interface matches the corresponding response time;

[0020] Delete the first interface among the N first interfaces whose call relationship does not match the corresponding response time.

[0021] Optionally, determining M second interfaces based on the response time corresponding to each first interface includes:

[0022] Get the response time for each of the first interfaces;

[0023] The first interface whose corresponding response time falls within a preset time period is identified as the second interface, thus obtaining the M second interfaces.

[0024] Optionally, determining the set of valid codes based on the codes corresponding to each second interface includes:

[0025] Obtain the code corresponding to each second interface;

[0026] The code corresponding to each of the second interfaces is merged to obtain a valid code set.

[0027] Optionally, generating coverage detection results based on the effective code set includes:

[0028] Obtain the number of lines of executed code in the valid code set;

[0029] The ratio between the number of lines of executed code and the number of lines of code in the effective code set is determined as the code coverage rate.

[0030] Furthermore, to achieve the above objectives, this application also provides a coverage detection device, the coverage detection device comprising:

[0031] The receiving module is used to receive detection requests;

[0032] The first determining module is used to determine N first interfaces in response to the detection request; the first interface is the interface called by the detection request, and N is a positive integer greater than 1;

[0033] The second determining module is used to determine M second interfaces based on the response time corresponding to each first interface; the M second interfaces are at least some of the N first interfaces, and M is a positive integer less than or equal to N;

[0034] The third determining module is used to determine the set of valid codes based on the codes corresponding to each second interface;

[0035] The generation module is used to generate coverage detection results based on the set of valid code.

[0036] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0037] The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the coverage detection method proposed in any of the embodiments of this application.

[0038] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0039] The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the coverage detection method proposed in any of the embodiments of this application.

[0040] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0041] This application provides a coverage detection method, apparatus, device, and storage medium. The method includes: receiving a detection request; in response to the detection request, determining N first interfaces; the first interfaces are interfaces invoked by the detection request, and N is a positive integer greater than 1; determining M second interfaces based on the response time corresponding to each first interface; the M second interfaces are at least some of the N first interfaces, and M is a positive integer less than or equal to N; determining a valid code set based on the code corresponding to each second interface; and generating a coverage detection result based on the valid code set. In this embodiment, N first interfaces responding to the detection request are obtained, and the N first interfaces are filtered according to the response time of each first interface to the detection request to obtain M second interfaces. A valid code set is determined based on the code corresponding to each second interface. Redundant code is screened through the above method, and a coverage detection result is generated based on the valid code set. The code coverage obtained by this method does not include redundant code, thus improving accuracy. Attached Figure Description

[0042] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0043] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0044] Figure 2 This is a flowchart of the coverage detection method provided in the embodiments of this application;

[0045] Figure 3 This is an application flowchart of the coverage detection method provided in the embodiments of this application;

[0046] Figure 4 This is a schematic diagram of the structure of one embodiment of the coverage detection device provided in this application;

[0047] Figure 5 This is a basic structural block diagram of a computer device provided in the embodiments of this application. Detailed Implementation

[0048] The coverage detection method provided in this application is applied to a coverage detection device. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this application. The terms "comprising" and "having," and any variations thereof, in the description, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the description, claims, or accompanying drawings of this application are used to distinguish different objects, not to describe a particular order.

[0049] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0050] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0051] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. Network 104 is a medium for providing communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0052] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social online platform software.

[0053] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.

[0054] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0055] It should be noted that the coverage detection method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the coverage detection device is generally set in the server / terminal device.

[0056] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.

[0057] Please refer to Figure 2 The diagram shows a flowchart of an embodiment of the coverage detection method proposed in this application. Embodiments of this application can acquire and process relevant data based on artificial intelligence technology.

[0058] The coverage detection method provided in this application includes the following steps:

[0059] S210, Receive detection request.

[0060] During code coverage testing, a testing request can be sent to the system to be tested. The response to the testing request can be used to determine the interface that receives the testing request.

[0061] Optionally, the above detection request can be a test case.

[0062] S220, in response to the detection request, determine N first interfaces.

[0063] In this step, the interface called by the detection request is determined as the first interface, resulting in N first interfaces, where N is a positive integer greater than 1.

[0064] S230, determine M second interfaces based on the response time of each first interface.

[0065] In this step, the response time corresponding to each first interface is obtained, and based on the response time of each first interface, M second interfaces are determined. The M second interfaces are at least a subset of the N first interfaces, and M is a positive integer less than or equal to N.

[0066] For details on how to determine the implementation method of the second interface, please refer to the following embodiments.

[0067] S240, determine the set of valid codes based on the codes corresponding to each second interface.

[0068] In this step, the code corresponding to the second interface is obtained, and a set of valid codes is determined based on the code corresponding to each second interface.

[0069] It should be understood that the valid code set includes the code corresponding to the called interface. Since the second interface is the interface being called, the code corresponding to the second interface is valid code.

[0070] S250, Based on the aforementioned set of valid codes, generate coverage detection results.

[0071] In this step, after obtaining the valid code set, the valid code set can replace the full code set, and the coverage test results can be generated based on the valid code set.

[0072] It should be understood that the above coverage test results are used to characterize the proportion of executable code in the effective code set.

[0073] In this embodiment, N first interfaces responding to detection requests are obtained. Based on the response time of each first interface to the detection request, the N first interfaces are filtered to obtain M second interfaces. A set of valid code is determined based on the code corresponding to each second interface. Redundant code is identified through this method, and a coverage detection result is generated based on the set of valid code. The code coverage obtained in this way does not include redundant code, thus improving accuracy.

[0074] Optionally, determining M second interfaces based on the response time corresponding to each first interface includes:

[0075] The call relationships between the various first interfaces are obtained using a code link analysis tool;

[0076] Based on the response time of each first interface and the calling relationship, the N first interfaces are filtered.

[0077] Based on the response time of each selected first interface, M second interfaces are determined. In this embodiment, the call relationships between the first interfaces can be obtained using a code link analysis tool. Optionally, the code link analysis tool mentioned above can be an open-source tool from GitHub, such as java-callgraph, SonarQube, and tree-sitter.

[0078] The response time of each first interface is obtained, and based on the response time of each first interface and the call relationship, the N first interfaces are filtered. For details on how to filter the N first interfaces, please refer to subsequent embodiments.

[0079] After filtering N first interfaces, M second interfaces are determined based on the response time of each filtered first interface.

[0080] Optionally, obtaining the call relationships between the various first interfaces using a code link analysis tool includes:

[0081] The call chain between the various first interfaces is obtained using the code chain parsing tool.

[0082] Based on the call chain, a static call graph or a dynamic call graph corresponding to the N first interfaces is generated.

[0083] In this embodiment, the bytecode of each interface can be analyzed using a code link analysis tool to obtain the call chain between the various first interfaces. Bytecode is a set of instructions that a virtual machine can execute; it is closer to machine language than source code and therefore easier to analyze.

[0084] An alternative implementation involves analyzing the bytecode using Java-callgraph to determine the calling methods between the various first interfaces in the detection request and generating a static call graph. The static call graph is a directed graph where nodes represent methods and edges represent the calling relationships between methods.

[0085] Another alternative implementation involves using Java-callgraph to analyze bytecode, determine the call methods between the various first interfaces in the detection request, and generate a dynamic call graph. The dynamic call graph is generated during program runtime and reflects the actual program execution; generating a dynamic call graph requires running the program and collecting runtime data, thus it is more time-consuming than generating a static call graph.

[0086] In this embodiment, a code link parsing tool is used to generate static or dynamic call graphs corresponding to N first interfaces, thereby accurately obtaining the call links between each first interface.

[0087] Optionally, the step of filtering the N first interfaces based on their response times and the call relationships includes:

[0088] Determine whether the call relationship of each first interface matches the corresponding response time;

[0089] Delete the first interface among the N first interfaces whose call relationship does not match the corresponding response time.

[0090] In this embodiment, after obtaining the response time of each first interface and the calling relationship between N first interfaces, it is necessary to determine whether the calling relationship of each first interface matches the corresponding response time. If the calling relationship of a certain first interface does not match the response time, it means that the response time of the first interface is incorrect. The fact that the first interface is in a response state may not be caused by the detection request. Therefore, the first interface whose calling relationship does not match the corresponding response time among the N first interfaces is deleted.

[0091] For example, the calling order between interface A, interface B, and interface C is as follows: interface A calls interface B, and interface B calls interface C; the response time for interface A is 18:55, the response time for interface B is 19:30, and the response time for interface C is 19:05.

[0092] In the example above, the response time of interface B should precede that of interface C. Therefore, it is determined that the call relationship of interface B does not match the corresponding response time, and interface B is deleted.

[0093] In this embodiment, by comparing whether the call relationship of the first interface matches the corresponding response time, N first interfaces are filtered out, thereby deleting invalid interfaces from the N first interfaces.

[0094] Optionally, determining M second interfaces based on the response time corresponding to each first interface includes:

[0095] Get the response time for each of the first interfaces;

[0096] The first interface whose corresponding response time falls within a preset time period is identified as the second interface, thus obtaining the M second interfaces.

[0097] In this embodiment, a time period is preset, the response time corresponding to each first interface is obtained, and the first interface whose corresponding response time is within the preset time period is determined as the second interface, thus obtaining M second interfaces.

[0098] In this embodiment, the call time of each first interface is used to determine whether the first interface is invalid or valid. Then, N first interfaces are filtered to obtain M second interfaces, thereby eliminating the wireless interfaces from the N first interfaces.

[0099] For example, interfaces A, B, C, and D send detection requests and monitor the call requests of each interface. If interface A has a call record from at least one year ago, interface B has a call record from at least five months ago, and interfaces C and D have call records every day for the past 30 days, then, given a preset time period of 30 days, interfaces A and B can be determined as wireless interfaces, and interfaces C and D as valid interfaces; that is, interfaces C and D are secondary interfaces.

[0100] Optionally, determining the set of valid codes based on the codes corresponding to each second interface includes:

[0101] Obtain the code corresponding to each second interface;

[0102] The code corresponding to each of the second interfaces is merged to obtain a valid code set.

[0103] In this embodiment, after determining the second interface, the code corresponding to the second interface is obtained, and the code corresponding to each second interface is merged to obtain a valid code set.

[0104] Optionally, the `jacoco report` command in the detection request can be modified to replace the full code set with the valid code set when generating coverage detection results. The `jacoco report` command is used to generate coverage detection results.

[0105] In this embodiment, since the second interface is a valid interface, the valid code set is obtained by merging the code corresponding to each second interface and deleting invalid code.

[0106] Optionally, generating coverage detection results based on the effective code set includes:

[0107] Obtain the number of lines of executed code in the valid code set;

[0108] The ratio between the number of lines of executed code and the number of lines of code in the effective code set is determined as the code coverage rate.

[0109] In this embodiment, the jacoco report command can be called to generate coverage detection rate results.

[0110] Specifically, the code coverage rate is determined by the ratio of the number of lines of executed code to the number of lines of code in the valid code set.

[0111] For example, if the effective code set contains 100 lines of code and 80 lines of code are executed, then the code coverage rate is determined to be 80%.

[0112] In this embodiment, coverage detection results are generated based on a valid code set. The code coverage obtained by this method does not include redundant code, thus improving the accuracy of the code coverage detection results.

[0113] For a better understanding of the overall technical solution, please refer to [link / reference]. Figure 3 ,like Figure 3 As shown, a detection request is sent to the business system to identify N first interfaces with traffic records in the business system; the first interfaces whose response times are within a preset time period are counted to obtain M second interfaces; the code set involved in the M second interfaces is obtained; finally, the above code set is used to generate the coverage detection result.

[0114] Please see Figure 4 This application provides a coverage detection device 400, which includes:

[0115] Receiver module 410 is used to receive detection requests;

[0116] The first determining module 420 is used to determine N first interfaces in response to the detection request; the first interfaces are the interfaces called by the detection request, and N is a positive integer greater than 1;

[0117] The second determining module 430 is used to determine M second interfaces based on the response time corresponding to each first interface; the M second interfaces are at least some of the N first interfaces, and M is a positive integer less than or equal to N;

[0118] The third determining module 440 is used to determine the set of valid codes based on the codes corresponding to each second interface;

[0119] The generation module 450 is used to generate coverage detection results based on the set of valid codes.

[0120] Optionally, the second determining module 430 is specifically used for:

[0121] The call relationships between the various first interfaces are obtained using a code link analysis tool;

[0122] Based on the response time of each first interface and the calling relationship, the N first interfaces are filtered.

[0123] Based on the response time of each selected first interface, determine M second interfaces.

[0124] Optionally, the second determining module 430 is further specifically used for:

[0125] The call chain between the various first interfaces is obtained using the code chain parsing tool.

[0126] Based on the call chain, a static call graph or a dynamic call graph corresponding to the N first interfaces is generated.

[0127] Optionally, the second determining module 430 is further specifically used for:

[0128] Determine whether the call relationship of each first interface matches the corresponding response time;

[0129] Delete the first interface among the N first interfaces whose call relationship does not match the corresponding response time.

[0130] Optionally, the second determining module 430 is further specifically used for:

[0131] Get the response time for each of the first interfaces;

[0132] The first interface whose corresponding response time falls within a preset time period is identified as the second interface, thus obtaining the M second interfaces.

[0133] Optionally, the third determining module 440 is specifically used for:

[0134] Obtain the code corresponding to each second interface;

[0135] The code corresponding to each of the second interfaces is merged to obtain a valid code set.

[0136] Optionally, the generation module 450 is specifically used for:

[0137] Obtain the number of lines of executed code in the valid code set;

[0138] The ratio between the number of lines of executed code and the number of lines of code in the effective code set is determined as the code coverage rate.

[0139] To solve the above technical problems, the present application also provides a computer device. Figure 5 , Figure 5 This is a basic structural block diagram of the computer device in this embodiment.

[0140] The computer device 5 includes a memory 51, a processor 52, and a network interface 53 that are interconnected via a system bus. It should be noted that only the computer device 5 with components 51-53 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0141] The computer device may be a desktop computer, notebook computer, PDA, cloud server, etc. The computer device may interact with the user via a keyboard, mouse, remote control, touchpad, or voice control device.

[0142] The memory 51 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 51 may be an internal storage unit of the computer device 5, such as the hard disk or memory of the computer device 5. In other embodiments, the memory 51 may also be an external storage device of the computer device 5, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 5. Of course, the memory 51 may include both the internal storage unit and its external storage device of the computer device 5. In this embodiment, the memory 51 is typically used to store the operating system and various application software installed on the computer device 5, such as the program code of the coverage detection method. In addition, the memory 51 can also be used to temporarily store various types of data that have been output or will be output.

[0143] In some embodiments, the processor 52 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 52 is typically used to control the overall operation of the computer device 5. In this embodiment, the processor 52 is used to run program code stored in the memory 51 or process data, for example, to run the program code for the coverage detection method.

[0144] The network interface 53 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 5 and other electronic devices.

[0145] This application also provides another embodiment, namely, providing a computer-readable storage medium storing the coverage detection program, the coverage detection program being executable by at least one processor to cause the at least one processor to perform the steps of the coverage detection method as described above.

[0146] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware online platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0147] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0148] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.

Claims

1. A coverage detection method, characterized in that: include: receiving a detection request; In response to the detection request, determining N first interfaces; The first interface is the interface called by the detection request, and N is a positive integer greater than 1; Determine M second interfaces according to the response time corresponding to each first interface; the M second interfaces are at least part of the N first interfaces, and M is a positive integer less than or equal to N; Determine a valid code collection according to the codes corresponding to each second interface; Based on the valid code collection, a coverage detection result is generated.

2. The method according to claim 1, characterized in that The determining of the M second interfaces according to the response time corresponding to each first interface includes: Obtaining the calling relationship between the first interfaces through a code link parsing tool; Filtering the N first interfaces according to the response time of each first interface and the calling relationship; M second interfaces are determined according to the response time corresponding to each of the screened first interfaces.

3. The method according to claim 2, characterized in that The obtaining the calling relationship between the first interfaces through the code link parsing tool includes: Obtaining the call links between the first interfaces through the code link parsing tool; Based on the call link, a static call graph or a dynamic call graph corresponding to the N first interfaces is generated.

4. The method according to claim 2, characterized in that: The screening of the N first interfaces according to the response time of each of the first interfaces and the calling relationship includes: Determine whether the calling relationship of each first interface matches the corresponding response time; Delete the first interface whose calling relationship does not match the corresponding response time among the N first interfaces.

5. The method according to claim 1, characterized in that The determining of the M second interfaces according to the response time corresponding to each first interface includes: Obtaining the response time corresponding to each first interface; The first interface whose corresponding response time is within the preset time period is determined as the second interface, and the M second interfaces are obtained.

6. The method according to claim 1, characterized in that The determining of a valid code collection according to the codes corresponding to the respective second interfaces includes: Obtain the code corresponding to each second interface; The codes corresponding to the second interfaces are combined to obtain a valid code collection.

7. The method according to any one of claims 1 to 6, characterized in that The generating a coverage detection result based on the valid code collection includes: Obtaining the number of lines of executed code in the valid code collection; The ratio between the number of lines of the executed code and the number of lines of code in the valid code collection is determined as the code coverage.

8. A coverage detection device, characterized in that: include: A receiving module, used for receiving a detection request; A first determining module, configured to determine N first interfaces in response to the detection request; The first interface is the interface called by the detection request, and N is a positive integer greater than 1; A second determination module is used to determine M second interfaces according to the response time corresponding to each first interface; the M second interfaces are at least part of the N first interfaces, and M is a positive integer less than or equal to N; A third determination module, used to determine a valid code collection according to the codes corresponding to the second interfaces; A generation module is used to generate coverage detection results based on the valid code collection.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the coverage detection method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the coverage detection method according to any one of claims 1 to 7 are implemented.