Coverage detection method, device, electronic device and computer readable storage medium
By obtaining access authorization from different interfaces, the pipelines without single-test frameworks are automatically identified and filtered out, and the coverage detection tool is used for timed detection, which solves the problem of low coverage detection efficiency in the existing technology and achieves efficient and accurate coverage detection.
Patent Information
- Application Number
- CN202210832984.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-14
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2042-07-14
AI Technical Summary
In the prior art, software testing coverage detection efficiency is low, especially under the microservice architecture, single-test coverage inspection is large in workload and easy to miss detection, resulting in program errors.
By obtaining access authorization for two different interfaces, obtaining the overall pipeline and the local pipeline with preset single-test framework configured, taking the difference between the two, filtering out the partial pipelines without preset single-test framework configured, and by judging whether the pipeline key value is equal to None, automatically identifying and generating coverage detection tools, performing timing detection, and generating coverage report.
It avoids missed inspections by manual inspections, improves coverage detection efficiency, and reduces the time of human repeated inspections. The execution time of the coverage detection tool is only a few seconds, and it can detect non-compliant pipelines in a timely manner.
Smart Images

Figure CN115203038B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a coverage detection method, device, electronic device and computer-readable storage medium. Background Art
[0002] Test coverage is an important indicator in software quality testing, as widespread errors in software may lead to catastrophic events, such as the luggage-turned-nothing incident at Heathrow Airport in 2008. Software quality can be improved by testing coverage. Test coverage is defined as a testing technical indicator that indicates whether our test cases truly and completely cover all possibilities in the application code and how much code is executed when running these test cases.
[0003] Usually, software test engineers are responsible for testing work. When a single test fails, development engineers need to add single test code and re-issue the pipeline after completion (re-check the single test change coverage). Then the test engineer needs to manually check twice or more times. At the same time, since some products are based on microservice architecture, each service needs to create a pipeline, and multiple pipelines are involved in the release. As microservices become more and more common, the workload of checking single test coverage will increase exponentially, which will increase the time it takes to launch a product. Since it is a manual check, when there are many pipelines, some pipelines may be missed, resulting in program errors. Therefore, how to improve the efficiency of coverage detection has become an urgent problem to be solved. Summary of the invention
[0004] The present invention provides a coverage detection method, device and computer-readable storage medium, the main purpose of which is to solve the problem of low efficiency in coverage detection.
[0005] To achieve the above object, the present invention provides a coverage detection method, comprising:
[0006] Obtaining a first access authorization for a first interface, and obtaining a second access authorization for a second interface;
[0007] Acquire the overall pipeline according to the first access authorization, and select the local pipeline including the preset single test framework from the overall pipeline according to the second access permission, and take the difference set between the overall pipeline and the local pipeline as the pipeline difference set;
[0008] Decoding the local pipeline information to obtain a pipeline name and a pipeline key value;
[0009] The pipelines whose pipeline key values are equal to None are collected as the first pipeline, the pipeline names of the first pipelines are screened using a preset name screening rule to obtain a standard pipeline, and the union of the standard pipeline and the pipeline difference set is taken to obtain an unconfigured pipeline;
[0010] The pipelines whose pipeline key values are not equal to None are collected as the second pipeline, and the pipelines whose pipeline key values in the second pipeline meet the preset threshold range are screened out as unexecuted pipelines;
[0011] A coverage detection tool is obtained according to the unconfigured pipeline and the unexecuted pipeline, and all pipelines are periodically detected using the coverage detection tool. When it is detected that the pipeline has non-compliant coverage, a coverage report is generated.
[0012] Optionally, the filtering out the pipelines whose pipeline key values in the second pipeline meet a preset threshold range as unexecuted pipelines includes:
[0013] Comparing the size of the pipeline key value with a first preset threshold, and when the pipeline key value is greater than or equal to the first preset threshold, determining that the pipeline corresponding to the pipeline key value is a compliant pipeline;
[0014] When the pipeline key value is less than the first preset threshold, comparing the pipeline key value with a second preset threshold;
[0015] When the pipeline key value is greater than the second preset threshold, determining that the pipeline corresponding to the pipeline key value is a non-compliant pipeline;
[0016] When the pipeline key value is equal to the second preset threshold, it is determined that the pipeline corresponding to the pipeline key value is an unchanged pipeline, and an unexecuted pipeline is generated according to the non-compliant pipeline and the unchanged pipeline.
[0017] Optionally, obtaining the first access authorization of the first interface includes:
[0018] Receiving a permission verification request sent by the application system through the first interface when obtaining a service request, wherein the permission verification request carries an interface key and a user identifier;
[0019] Authenticating the interface calling authority according to the interface identifier corresponding to the first interface and the interface key;
[0020] When the authentication is successful, a corresponding role identifier is determined according to the user identifier;
[0021] The interface operation authority is queried according to the role identifier to obtain a first access authorization for the first interface.
[0022] Optionally, acquiring the entire pipeline according to the first access authorization includes:
[0023] Obtaining the number of calls corresponding to the first interface within a preset time period;
[0024] When the number of calls is greater than or equal to the preset number of calls, refusing to respond to the access request of the first interface;
[0025] When the number of calls is less than the preset number of calls, obtaining all pipeline information within the preset time period according to the first access authorization;
[0026] The time stamps of all the pipeline information are obtained, and the pipeline information corresponding to the latest time is selected as the entire pipeline according to the time stamps.
[0027] Optionally, the decoding of the local pipeline information to obtain a pipeline name and a pipeline key value includes:
[0028] Performing character cutting on the local pipeline information to obtain pipeline characters;
[0029] Filter the pipeline characters using a preset index to obtain a pipeline name;
[0030] The pipeline name is assigned a value using a preset assignment algorithm to obtain a pipeline key value.
[0031] Optionally, the using a preset name screening rule to screen the pipeline name of the first pipeline to obtain a standard pipeline includes:
[0032] Performing string conversion on the pipeline name of the first pipeline to obtain a pipeline string;
[0033] Generate a keyword string of the pipeline to be filtered, calculate the matching degree between the pipeline string and the keyword string, and obtain a string matching value;
[0034] The string matching value is screened according to a preset character weight set to obtain a target string, and a standard pipeline is obtained according to the target string.
[0035] Optionally, obtaining the first access authorization of the first interface includes:
[0036] receiving an access request for accessing the first interface, and obtaining an interface protocol in the access request;
[0037] Convert the input parameter information and the output parameter information in the interface protocol according to a preset description method to obtain the first interface access information;
[0038] Access authorization for the first interface is obtained according to the first interface access information.
[0039] In order to solve the above problem, the present invention further provides a coverage detection device, the device comprising:
[0040] An access authorization module, used to obtain a first access authorization for a first interface, and to obtain a second access authorization for a second interface;
[0041] A pipeline acquisition module is used to acquire the overall pipeline according to the first access authorization, and to filter out a local pipeline including a preset single test framework from the overall pipeline according to the second access permission, and to take a difference set between the overall pipeline and the local pipeline as a pipeline difference set;
[0042] A pipeline decoding module, used for decoding the local pipeline information to obtain a pipeline name and a pipeline key value;
[0043] A pipeline screening module, used for collecting the pipelines whose pipeline key values are equal to None as the first pipeline, screening the pipeline names of the first pipelines using a preset name screening rule to obtain a standard pipeline, and taking the union of the standard pipeline and the pipeline difference set to obtain an unconfigured pipeline;
[0044] A pipeline partitioning module, used for collecting the pipelines whose pipeline key values are not equal to None as the second pipeline, and screening out the pipelines whose pipeline key values in the second pipeline meet the preset threshold interval as unexecuted pipelines;
[0045] The report generation module is used to obtain a coverage detection tool based on the unconfigured pipeline and the unexecuted pipeline, use the coverage detection tool to perform regular detection on all pipelines, and generate a coverage report when it is detected that the pipeline has non-compliant coverage.
[0046] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0047] at least one processor; and,
[0048] a memory communicatively connected to the at least one processor; wherein,
[0049] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the coverage detection method described above.
[0050] In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned coverage detection method.
[0051] The embodiment of the present invention obtains the access authorization of two different interfaces, obtains the overall pipeline and the local pipeline configured with the preset single test framework, takes the difference set between the two, and screens out the partial pipeline that is not configured with the preset single test framework. At the same time, by judging whether the key value of the local pipeline is equal to None, when the key value of the local pipeline is equal to None, the pipeline configured with the preset single test framework on the database side and the front end is obtained. When the key value of the local pipeline is not equal to None, a secondary branch judgment is performed to obtain the pipeline with code changes but not executed and the pipeline with coverage not meeting the standard. The above process avoids missed inspections of manual inspections. At the same time, when there are codes that are constantly modified, manual repeated inspections are avoided. The coverage detection tool can produce detection results in just a few seconds, which greatly improves work efficiency. The coverage detection tool is used for regular detection, and non-compliant pipelines can be detected in time. Therefore, the present invention proposes a coverage detection method, device, electronic device and computer-readable storage medium, which can solve the problem of low coverage detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A schematic diagram of a flow chart of a coverage detection method provided by an embodiment of the present invention;
[0053] Figure 2 A schematic diagram of a process for obtaining access authorization provided by an embodiment of the present invention;
[0054] Figure 3 A schematic diagram of a process flow of a screening line provided by an embodiment of the present invention;
[0055] Figure 4 A functional module diagram of a coverage detection device provided by an embodiment of the present invention;
[0056] Figure 5 A schematic diagram of the structure of an electronic device for implementing the coverage detection method provided by an embodiment of the present invention.
[0057] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0058] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0059] The embodiment of the present application provides a coverage detection method. The execution subject of the coverage detection method includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the coverage detection method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0060] Reference Figure 1 FIG. 1 is a flow chart of a coverage detection method provided by an embodiment of the present invention. In this embodiment, the coverage detection method includes:
[0061] S1. Obtain a first access authorization for a first interface, and obtain a second access authorization for a second interface.
[0062] In the embodiment of the present invention, the required pipeline information is acquired according to the first access authorization and the second access authorization.
[0063] In an embodiment of the present invention, obtaining the first access authorization for the first interface includes: receiving an access request for accessing the first interface, and obtaining the interface protocol in the access request; converting the input parameter information and the output parameter information in the interface protocol according to a preset description method to obtain the first interface access information; and obtaining the access authorization for the first interface based on the first interface access information.
[0064] In detail, the access request may refer to an http request, which can be implemented using httplib in combination with urllib. After sending the request, a response is obtained, and the response information of the response is read. According to the response information, the specified header information, the list of response header tuples, the underlying socket file descriptor and the header content are obtained to form an http version of the header.
[0065] In detail, the difference between the first interface and the second interface lies in whether the interface parameters are configured with a unit test framework, so that the obtained pipeline information has a formal difference.
[0066] In the embodiment of the present invention, obtaining the first access authorization of the first interface includes:
[0067] S21, receiving an authorization verification request sent by the application system through the first interface when obtaining a service request, wherein the authorization verification request carries an interface key and a user identifier;
[0068] S22, authenticating the interface calling authority according to the interface identifier corresponding to the first interface and the interface key;
[0069] S23. When the authentication is passed, a corresponding role identifier is determined according to the user identifier;
[0070] S24. Query the interface operation authority according to the role identifier to obtain a first access authorization for the first interface.
[0071] In detail, the interface operation authority may be queried using a preconfigured node operation tree and organization tree to obtain a first access authorization for the first interface.
[0072] In detail, the method of querying the interface operation permissions using the preconfigured node operation tree and organization tree to obtain the first access authorization for the first interface includes: querying the node identifier corresponding to the role identifier from the preconfigured node operation tree, and determining the operation permissions corresponding to the node identifier; querying the organization identifier corresponding to the role identifier from the preconfigured organization tree, and determining the data permissions corresponding to the user identifier based on the organization label corresponding to the organization identifier or the position of the organization identifier in the organization tree; and obtaining the first access authorization for the first interface corresponding to the user identifier based on the operation permissions and the data permissions.
[0073] In detail, the configuration steps of the node operation tree include: constructing a node tree including at least one node; obtaining the operation item to be configured, associating the operation item with the node to obtain the operation permission corresponding to the node; establishing a corresponding relationship between the node and the role identifier to be configured; and obtaining the node operation tree according to the node tree, the operation permission corresponding to each node in the node tree, and the role identifier configuration.
[0074] In detail, the interface key is used to sign the request parameters according to the specified rules when the interface is called. When the server receives the request, it will perform signature verification, which can define the identity and prevent malicious tampering of the request data through some means.
[0075] S2. Acquire the overall pipeline according to the first access authorization, and select the local pipeline containing the preset single test framework from the overall pipeline according to the second access permission, and take the difference set of the overall pipeline and the local pipeline as the pipeline difference set.
[0076] In the embodiment of the present invention, the obtained pipeline difference set can represent some pipelines that are not configured with a unit test framework, and are also pipelines that need to be printed in the report. According to the first access authorization, all pipeline information (including executed and unexecuted) under a certain version can be obtained. According to the second access permission, all pipeline information configured with Junit can be obtained, which can avoid manual lengthy selection operations through the page.
[0077] In an embodiment of the present invention, obtaining the entire pipeline according to the first access authorization includes: obtaining the number of calls corresponding to the first interface within a preset time period; when the number of calls is greater than or equal to the preset number of calls, refusing to respond to the access request of the first interface; when the number of calls is less than the preset number of calls, obtaining all pipeline information within the preset time period according to the first access authorization; obtaining the time stamp of all pipeline information, and selecting the pipeline information corresponding to the latest time as the entire pipeline according to the time stamp.
[0078] S3. Decode the local pipeline information to obtain a pipeline name and a pipeline key value.
[0079] In the embodiment of the present invention, obtaining the pipeline name and pipeline key value according to the local pipeline information can facilitate subsequent pipeline identification.
[0080] In detail, the pipeline name can be represented by a keyword, and the pipeline key value can be from 0 to 100, or can be displayed as None, for example: "xxx-web" is None, "db-xxx" is None, "auth" is 0, and "system" is 99.
[0081] In an embodiment of the present invention, the decoding process of the local pipeline information to obtain the pipeline name and the pipeline key value includes: character cutting of the local pipeline information to obtain pipeline characters; filtering the pipeline characters using a preset index to obtain the pipeline name; and assigning a value to the pipeline name using a preset assignment algorithm to obtain a pipeline key value.
[0082] In detail, the character cutting is to cut a sentence to obtain phrases or numbers. For example, "Xiao Ming's postgraduate entrance examination score is 410 points" can be cut into "Xiao Ming / Postgraduate Entrance Examination / Score / Is / 410 / Points". The characters obtained after cutting are filtered to obtain "Xiao Ming" as the required name. Among them, the pipeline name can also be "Xiao Hong", "Xiao Hua", "Xiao Liang", and "Xiao Ming" is assigned a value according to "410" to obtain a key value.
[0083] S4. The pipelines whose pipeline key values are equal to None are collected as the first pipeline, and the pipeline names of the first pipelines are filtered using a preset name filtering rule to obtain a standard pipeline, and the union of the standard pipeline and the pipeline difference set is taken to obtain an unconfigured pipeline.
[0084] In the embodiment of the present invention, the pipeline whose pipeline key value is equal to None can be judged as the first pipeline using the pipeline key value.
[0085] In detail, the name screening rule can set the names of certain systems, programs and software, and use these names to screen the pipeline names.
[0086] In an embodiment of the present invention, the method of filtering the pipeline name of the first pipeline by using a preset name filtering rule to obtain a standard pipeline includes:
[0087] S31, performing string conversion on the pipeline name of the first pipeline to obtain a pipeline string;
[0088] S32, generating a keyword string of the pipeline to be filtered, calculating the matching degree between the pipeline string and the keyword string, and obtaining a string matching value;
[0089] S33. Perform a screening operation on the string matching value according to a preset character weight set to obtain a target string, and obtain a standard pipeline according to the target string.
[0090] In detail, the string conversion method depends on the pipeline name, for example: converting milliseconds to dates, converting dates to milliseconds, converting hexadecimal to decimal, converting bytes to hexadecimal strings, converting numeric strings to ASCII strings, etc.
[0091] S5. Collect the pipelines whose pipeline key values are not equal to None as the second pipeline, and filter out the pipelines whose pipeline key values in the second pipeline meet the preset threshold range as unexecuted pipelines.
[0092] In the embodiment of the present invention, the unexecuted pipelines screened out according to the preset threshold interval are pipelines indicating that the unit test change coverage does not meet the standard and pipelines where the code has been changed but the changed lines have not been unit tested.
[0093] In an embodiment of the present invention, the screening out of the pipelines in the second pipeline whose pipeline key values meet the preset threshold interval as unexecuted pipelines includes: comparing the size of the pipeline key value with a first preset threshold, and when the pipeline key value is greater than or equal to the first preset threshold, determining that the pipeline corresponding to the pipeline key value is a compliant pipeline; when the pipeline key value is less than the first preset threshold, comparing the size of the pipeline key value with the second preset threshold; when the pipeline key value is greater than the second preset threshold, determining that the pipeline corresponding to the pipeline key value is a non-compliant pipeline; when the pipeline key value is equal to the second preset threshold, determining that the pipeline corresponding to the pipeline key value is an unchanged pipeline, and generating an unexecuted pipeline based on the non-compliant pipeline and the unchanged pipeline.
[0094] In detail, the pipelines whose pipeline key values in the second pipeline meet the preset threshold interval are screened out as unexecuted pipelines and the following operations can be performed: when value is not equal to None, the value is judged and divided into three branch logics: value is greater than or equal to 12, indicating that the unit test change coverage rate meets the standard, and the pipeline name is printed out in large; value is less than 12, indicating that the unit test change coverage rate does not meet the standard, and the pipeline name needs to be printed out; value is equal to 0, indicating that the code has changed, but the changed line has not been unit tested, that is, there is no unit test code coverage, and the pipeline name needs to be printed out.
[0095] S6. Obtain a coverage detection tool based on the unconfigured pipeline and the unexecuted pipeline, use the coverage detection tool to perform regular detection on all pipelines, and generate a coverage report when it is detected that the pipeline has non-compliant coverage.
[0096] In the embodiment of the present invention, the coverage detection tool is a detection tool that periodically determines the coverage according to the previous steps, thereby avoiding missed detection during manual inspection and improving detection efficiency.
[0097] In detail, the use of the coverage detection tool to perform timed detection on all pipelines can be based on setting a scheduled task, such as using crontab to set operators, the command is composed of time plus action, and the time includes minutes, hours, days, months, and weeks, and the operators include all numbers in the value range, " / " over a certain number of numbers, "-" from X to Z, etc.; you can also create a thread method, let it run in a while loop, and then use the sleep method to achieve the effect of the scheduled task; you can also use TimerTask, by implementing specific tasks in the run() method, when the Timer constructor is called, it creates a thread, and this thread can be used to schedule tasks.
[0098] In detail, the coverage report can be output as a table, with non-compliant items listed in the left column and pipelines listed in the right column. The printed non-compliant items may include three types, for example: the unit test change coverage does not reach the standard value of 12%, there are code changes, but the change lines have no unit test code coverage, and the unit test change coverage is not configured. The corresponding pipelines are: System-service: 9.7%, Appas-notice-service: 0%, and Appas-deployment-service.
[0099] The embodiment of the present invention obtains the access authorization of two different interfaces, obtains the overall pipeline and the local pipeline configured with the preset single test framework, takes the difference set between the two, and screens out the partial pipeline that is not configured with the preset single test framework. At the same time, by judging whether the key value of the local pipeline is equal to None, when the key value of the local pipeline is equal to None, the pipeline configured with the preset single test framework on the database side and the front end is obtained. When the key value of the local pipeline is not equal to None, a secondary branch judgment is performed to obtain the pipeline with code changes but not executed and the pipeline with coverage not meeting the standard. The above process avoids missed inspections due to manual inspections. At the same time, when there are codes that are constantly modified, manual repeated inspections are avoided. The coverage detection tool can produce detection results in just a few seconds, which greatly improves work efficiency. The coverage detection tool is used for regular detection to detect non-compliant pipelines in a timely manner. Therefore, the present invention proposes a coverage detection method that can solve the problem of low coverage detection efficiency.
[0100] like Figure 4 , which is a functional module diagram of a coverage detection device provided by an embodiment of the present invention.
[0101] The coverage detection device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the coverage detection device 100 may include an access authorization module 101, a pipeline acquisition module 102, a pipeline decoding module 103, a pipeline screening module 104, a pipeline partitioning module 105 and a report generation module 106. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0102] In this embodiment, the functions of each module / unit are as follows:
[0103] The access authorization module is used to obtain a first access authorization for the first interface and to obtain a second access authorization for the second interface;
[0104] The pipeline acquisition module is used to acquire the overall pipeline according to the first access authorization, and to filter out a local pipeline including a preset single test framework from the overall pipeline according to the second access permission, and to take a difference set between the overall pipeline and the local pipeline as a pipeline difference set;
[0105] The pipeline decoding module is used to decode the local pipeline information to obtain the pipeline name and pipeline key value;
[0106] The pipeline screening module is used to collect the pipelines whose pipeline key values are equal to None as the first pipeline, filter the pipeline names of the first pipelines using a preset name screening rule to obtain a standard pipeline, and take the union of the standard pipeline and the pipeline difference set to obtain an unconfigured pipeline;
[0107] The pipeline partitioning module is used to collect the pipelines whose pipeline key values are not equal to None as the second pipeline, and screen out the pipelines whose pipeline key values in the second pipeline meet the preset threshold range as unexecuted pipelines;
[0108] The report generation module is used to obtain a coverage detection tool based on the unconfigured pipeline and the unexecuted pipeline, use the coverage detection tool to perform regular detection on all pipelines, and generate a coverage report when it is detected that the pipeline has non-compliant coverage.
[0109] like Figure 5 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing a coverage detection method provided by an embodiment of the present invention.
[0110] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a coverage detection program.
[0111] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing a coverage detection program, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.
[0112] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can be used not only to store application software and various types of data installed in the electronic device, such as the code of the coverage detection program, but also to temporarily store data that has been output or is to be output.
[0113] The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0114] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0115] The figure only shows an electronic device with components. Those skilled in the art will understand that the structure shown in the figure does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0116] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0117] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0118] The coverage detection program stored in the memory 11 in the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:
[0119] Obtaining a first access authorization for a first interface, and obtaining a second access authorization for a second interface;
[0120] Acquire the overall pipeline according to the first access authorization, and select the local pipeline including the preset single test framework from the overall pipeline according to the second access permission, and take the difference set between the overall pipeline and the local pipeline as the pipeline difference set;
[0121] Decoding the local pipeline information to obtain a pipeline name and a pipeline key value;
[0122] The pipelines whose pipeline key values are equal to None are collected as the first pipeline, the pipeline names of the first pipelines are screened using a preset name screening rule to obtain a standard pipeline, and the union of the standard pipeline and the pipeline difference set is taken to obtain an unconfigured pipeline;
[0123] The pipelines whose pipeline key values are not equal to None are collected as the second pipeline, and the pipelines whose pipeline key values in the second pipeline meet the preset threshold range are screened out as unexecuted pipelines;
[0124] A coverage detection tool is obtained according to the unconfigured pipeline and the unexecuted pipeline, and all pipelines are periodically detected using the coverage detection tool. When it is detected that the pipeline has non-compliant coverage, a coverage report is generated.
[0125] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.
[0126] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0127] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:
[0128] Obtaining a first access authorization for a first interface, and obtaining a second access authorization for a second interface;
[0129] Acquire the overall pipeline according to the first access authorization, and select the local pipeline including the preset single test framework from the overall pipeline according to the second access permission, and take the difference set between the overall pipeline and the local pipeline as the pipeline difference set;
[0130] Decoding the local pipeline information to obtain a pipeline name and a pipeline key value;
[0131] The pipelines whose pipeline key values are equal to None are collected as the first pipeline, the pipeline names of the first pipelines are screened using a preset name screening rule to obtain a standard pipeline, and the union of the standard pipeline and the pipeline difference set is taken to obtain an unconfigured pipeline;
[0132] The pipelines whose pipeline key values are not equal to None are collected as the second pipeline, and the pipelines whose pipeline key values in the second pipeline meet the preset threshold range are screened out as unexecuted pipelines;
[0133] A coverage detection tool is obtained according to the unconfigured pipeline and the unexecuted pipeline, and all pipelines are periodically detected using the coverage detection tool. When it is detected that the pipeline has non-compliant coverage, a coverage report is generated.
[0134] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0135] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0137] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0138] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0139] The blockchain referred to in the present invention is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.
[0140] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0141] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A coverage detection method, characterized in that: The method comprises: Obtaining a first access authorization for a first interface, and obtaining a second access authorization for a second interface; The overall pipeline is acquired according to the first access authorization, and the local pipeline including the preset single test framework is screened out from the overall pipeline according to the second access permission, and the difference set between the overall pipeline and the local pipeline is taken as the pipeline difference set; Decoding the local pipeline information to obtain a pipeline name and a pipeline key value; The pipelines whose pipeline key values are equal to None are collected as the first pipeline, the pipeline names of the first pipelines are screened using a preset name screening rule to obtain a standard pipeline, and the union of the standard pipeline and the pipeline difference set is taken to obtain an unconfigured pipeline; The pipelines whose pipeline key values are not equal to None are collected as the second pipeline, and the pipelines whose pipeline key values in the second pipeline meet the preset threshold range are screened out as unexecuted pipelines; A coverage detection tool is obtained according to the unconfigured pipeline and the unexecuted pipeline, and all pipelines are periodically detected using the coverage detection tool. When it is detected that the pipeline has non-compliant coverage, a coverage report is generated.
2. The coverage detection method according to claim 1, characterized in that: The filtering out the pipelines whose pipeline key values in the second pipeline meet the preset threshold range as unexecuted pipelines includes: Comparing the size of the pipeline key value with a first preset threshold, and when the pipeline key value is greater than or equal to the first preset threshold, determining that the pipeline corresponding to the pipeline key value is a compliant pipeline; When the pipeline key value is less than the first preset threshold, comparing the pipeline key value with a second preset threshold; When the pipeline key value is greater than the second preset threshold, determining that the pipeline corresponding to the pipeline key value is a non-compliant pipeline; When the pipeline key value is equal to the second preset threshold, it is determined that the pipeline corresponding to the pipeline key value is an unchanged pipeline, and an unexecuted pipeline is generated according to the non-compliant pipeline and the unchanged pipeline.
3. The coverage detection method according to claim 1, characterized in that: The obtaining of the first access authorization for the first interface includes: Receiving a permission verification request sent by the application system through the first interface when obtaining a service request, wherein the permission verification request carries an interface key and a user identifier; Authenticating the interface calling authority according to the interface identifier corresponding to the first interface and the interface key; When the authentication is successful, a corresponding role identifier is determined according to the user identifier; The interface operation authority is queried according to the role identifier to obtain a first access authorization for the first interface.
4. The coverage detection method according to claim 1, characterized in that: The obtaining of the entire pipeline according to the first access authorization includes: Obtaining the number of calls corresponding to the first interface within a preset time period; When the number of calls is greater than or equal to the preset number of calls, refusing to respond to the access request of the first interface; When the number of calls is less than the preset number of calls, obtaining all pipeline information within the preset time period according to the first access authorization; The time stamps of all the pipeline information are obtained, and the pipeline information corresponding to the latest time is selected as the entire pipeline according to the time stamps.
5. The coverage detection method according to claim 1, characterized in that: The decoding process of the local pipeline information to obtain the pipeline name and pipeline key value includes: Performing character cutting on the local pipeline information to obtain pipeline characters; Filter the pipeline characters using a preset index to obtain a pipeline name; The pipeline name is assigned a value using a preset assignment algorithm to obtain a pipeline key value.
6. The coverage detection method according to claim 1, characterized in that: The method of filtering the pipeline name of the first pipeline by using a preset name filtering rule to obtain a standard pipeline includes: Performing string conversion on the pipeline name of the first pipeline to obtain a pipeline string; Generate a keyword string of the pipeline to be filtered, calculate the matching degree between the pipeline string and the keyword string, and obtain a string matching value; The string matching value is screened according to a preset character weight set to obtain a target string, and a standard pipeline is obtained according to the target string.
7. The coverage detection method according to any one of claims 1 to 6, characterized in that: The obtaining of the first access authorization for the first interface includes: receiving an access request for accessing the first interface, and obtaining an interface protocol in the access request; Convert the input parameter information and the output parameter information in the interface protocol according to a preset description method to obtain the first interface access information; Access authorization for the first interface is obtained according to the first interface access information.
8. A coverage detection device, characterized in that: The device comprises: An access authorization module, used to obtain a first access authorization for a first interface, and to obtain a second access authorization for a second interface; A pipeline acquisition module is used to acquire the overall pipeline according to the first access authorization, and to filter out a local pipeline including a preset single test framework from the overall pipeline according to the second access permission, and to take a difference set between the overall pipeline and the local pipeline as a pipeline difference set; A pipeline decoding module, used for decoding the local pipeline information to obtain a pipeline name and a pipeline key value; A pipeline screening module, used for collecting the pipelines whose pipeline key values are equal to None as the first pipeline, screening the pipeline names of the first pipelines using a preset name screening rule to obtain a standard pipeline, and taking the union of the standard pipeline and the pipeline difference set to obtain an unconfigured pipeline; A pipeline partitioning module, used for collecting the pipelines whose pipeline key values are not equal to None as the second pipeline, and screening out the pipelines whose pipeline key values in the second pipeline meet the preset threshold interval as unexecuted pipelines; The report generation module is used to obtain a coverage detection tool based on the unconfigured pipeline and the unexecuted pipeline, use the coverage detection tool to perform regular detection on all pipelines, and generate a coverage report when it is detected that the pipeline has non-compliant coverage.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the coverage detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the coverage detection method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for deploying pipeline engine system, method and device for continuous integration
CN112527382A
Assembly line resource intelligent scheduling method and device, equipment and medium
CN113344350A