Test coverage detection method and system, electronic equipment and storage medium

By analyzing the proportion relationship and data span ratio between the test data set and the preset data set, combined with data clustering, the accuracy problem of test case set coverage detection in the existing technology is solved, and the timely judgment of coverage meeting the requirements is realized. Effect.

CN118550819APending Publication Date: 2024-08-27QINGMUTEC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410548862.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-06
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

The existing technology is difficult to accurately detect the coverage of the test case set and determine whether it meets the requirements in a timely manner.

Method used

By obtaining the proportional relationship between the test data set and the preset data set of the parameters to be detected, the test coverage is determined, including calculating the data span ratio and data clustering to evaluate the coverage, and judging whether the requirements are met based on the threshold.

Benefits of technology

It achieves accurate detection of test coverage, promptly determines whether the coverage of the test case set meets the requirements, and improves the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550819A
    Figure CN118550819A
Patent Text Reader

Abstract

The invention relates to the technical field of data analysis, and particularly discloses a test coverage detection method and system, electronic equipment and a storage medium, and the method comprises the steps: obtaining a test data set of to-be-detected parameters; and based on a proportion relationship between the test data set and a preset data set of a to-be-detected parameter, determining the test coverage of the to-be-detected parameter. According to the method and the device, the test coverage can be accurately detected, so that whether the coverage of the test case set meets the requirement or not is timely determined.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] At present, it is difficult to accurately detect the coverage of a test case (test result data) set, and it is impossible to determine in time whether the coverage of the test case set meets the requirements.

[0003] Therefore, it is urgent to provide a technical solution to solve the above problems. Summary of the invention

[0004] In order to solve the above technical problems, the present invention provides a test coverage detection method, system, electronic device and storage medium.

[0005] In a first aspect, the present invention provides a test coverage detection method, the technical solution of the method is as follows:

[0006] Obtain a test data set of parameters to be tested;

[0007] Based on the ratio relationship between the test data set and the preset data set of the parameter to be detected, the test coverage of the parameter to be detected is determined.

[0008] The beneficial effects of a test coverage detection method of the present invention are as follows:

[0009] The method of the present invention can accurately detect the test coverage, thereby timely determining whether the coverage of the test case set meets the requirements.

[0010] Based on the above solution, a test coverage detection method of the present invention can also be improved as follows.

[0011] In an optional manner, the step of determining the test coverage of the parameter to be detected based on the ratio relationship between the test data set and the preset data set of the parameter to be detected includes:

[0012] Determine a first data span of the test data set according to a difference between a maximum value and a minimum value of the test data set, and determine a second data span of the preset data set according to a difference between a maximum value and a minimum value of the preset data set of the parameter to be detected;

[0013] The test coverage of the parameter to be detected is determined according to a ratio between the first data span and the second data span.

[0014] In an optional manner, the step of determining the test coverage of the parameter to be detected based on the ratio relationship between the test data set and the preset data set of the parameter to be detected includes:

[0015] Performing data clustering on the preset data set of the parameter to be detected to obtain a plurality of target groups of the preset data set; wherein each target group corresponds to a target data span;

[0016] The test coverage of the parameter to be detected is determined according to the ratio of the number of target data spans to the total number of target data spans in the test data set.

[0017] In an optional manner, the method further includes:

[0018] Determine whether the test coverage of the parameter to be detected is greater than a threshold value, and obtain a determination result;

[0019] When the judgment result is yes, it is determined that the coverage of the parameter to be detected meets the requirements.

[0020] In a second aspect, the present invention provides a test coverage detection system, the technical solution of the system is as follows:

[0021] Including: acquisition module and detection module;

[0022] The acquisition module is used to: obtain a test data set of parameters to be detected;

[0023] The detection module is used to determine the test coverage of the parameter to be detected based on the ratio relationship between the test data set and the preset data set of the parameter to be detected.

[0024] The beneficial effects of a test coverage detection system of the present invention are as follows:

[0025] The system of the present invention can accurately detect the test coverage, so as to timely determine whether the coverage of the test case set meets the requirements.

[0026] Based on the above solution, a test coverage detection system of the present invention can also be improved as follows.

[0027] In an optional manner, the detection module is specifically used to:

[0028] Determine a first data span of the test data set according to a difference between a maximum value and a minimum value of the test data set, and determine a second data span of the preset data set according to a difference between a maximum value and a minimum value of the preset data set of the parameter to be detected;

[0029] The test coverage of the parameter to be detected is determined according to a ratio between the first data span and the second data span.

[0030] In an optional manner, the detection module is specifically used to:

[0031] Performing data clustering on the preset data set of the parameter to be detected to obtain a plurality of target groups of the preset data set; wherein each target group corresponds to a target data span;

[0032] The test coverage of the parameter to be detected is determined according to the ratio of the number of target data spans to the total number of target data spans in the test data set.

[0033] In an optional manner, the method further includes: a determination module; the determination module is used to:

[0034] Determine whether the test coverage of the parameter to be detected is greater than a threshold value, and obtain a determination result;

[0035] When the judgment result is yes, it is determined that the coverage of the parameter to be detected meets the requirements.

[0036] In a third aspect, a technical solution of an electronic device of the present invention is as follows:

[0037] The invention comprises a memory, a processor and a program stored in the memory and running on the processor. When the processor executes the program, the steps of the test coverage detection method of the present invention are implemented.

[0038] In a fourth aspect, the present invention provides a computer-readable storage medium having the following technical solution:

[0039] Instructions are stored in the computer-readable storage medium. When the computer-readable storage medium reads the instructions, the computer-readable storage medium executes the steps of the test coverage detection method of the present invention.

[0040] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:

[0042] Figure 1 A schematic diagram of a flow chart of an embodiment of a test coverage detection method of the present invention;

[0043] Figure 2 It is one of the specific flow diagrams of S2;

[0044] Figure 3 This is the second specific flow diagram of S2;

[0045] Figure 4 A schematic diagram of the structure of an embodiment of a test coverage detection system of the present invention;

[0046] Figure 5 The figure is a schematic structural diagram of an embodiment of an electronic device of the present invention. DETAILED DESCRIPTION

[0047] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.

[0048] Figure 1 FIG. 2 is a flow chart showing an embodiment of a test coverage detection method provided by the present invention. Figure 1 As shown, the following steps are included:

[0049] S1. Obtain a test data set of the parameters to be detected.

[0050] The parameters to be tested are parameters that need to be tested for test coverage in this embodiment, such as the actual payment amount of the order, the average order value, etc., which are not limited here. The test data set includes multiple test data of the parameters to be tested.

[0051] S2. Determine the test coverage of the parameter to be detected based on the ratio between the test data set and the preset data set of the parameter to be detected.

[0052] The proportion relationship can be the proportion relationship of the numerical range, the proportion relationship of the data volume, or the proportion relationship of a certain information in the data set, and there is no limitation here. The test coverage is the data coverage in the test data set.

[0053] In an alternative approach, Figure 2 As shown, S2 includes:

[0054] S21A: Determine a first data span of the test data set according to a difference between a maximum value and a minimum value of the test data set, and determine a second data span of the preset data set according to a difference between a maximum value and a minimum value of the preset data set of the parameter to be detected.

[0055] If the maximum value of the test data set is b and the minimum value is a, the first data span is ba. If the maximum value of the preset data set of the parameter to be detected is d and the minimum value is c, the second data span is dc.

[0056] S22A: Determine the test coverage of the parameter to be detected according to a ratio between the first data span and the second data span.

[0057] If the first data span is ba and the second data span is dc, the test coverage is

[0058] In an alternative approach, Figure 3 As shown, S2 includes:

[0059] S21B: performing data clustering on the preset data set of the parameter to be detected to obtain a plurality of target groups of the preset data set.

[0060] In this embodiment, an unsupervised clustering algorithm is used to cluster data to obtain multiple target groups of a preset data set. Each target group corresponds to a target data span. For example, there are five target groups in the preset data set, denoted as A1, A2, A3, A4, and A5, and the corresponding target data spans are r1, r2, r3, r4, and r5 respectively; n =[r ns ,r ne ],r n is the nth target data span, r ns is the starting value (minimum value) of the nth target data span, r ne The end value (maximum value) of the nth target data span.

[0061] S22B: Determine the test coverage of the parameter to be detected according to the ratio of the number of target data spans to the total number of target data spans in the test data set.

[0062] Assume that the test data set contains data a1, a2, a3, a4, a5; a1∈A1→r1=[r 1s ,r 1e ],a2∈A2→r2=[r 2s ,r 2e ],a3∈A3→r3=[r 3s ,r 3e ],a4∈A4→r4=[r 4s ,r 4e ],a5∈A5→r5=[r 5s ,r 5e ]. At this time, the number of data in the test data set that exist in the target data span is 5, and the test coverage of the parameter to be detected is determined to be 100%.

[0063] In an optional manner, the method further includes:

[0064] It is determined whether the test coverage of the parameter to be detected is greater than a threshold value to obtain a determination result.

[0065] When the judgment result is yes, it is determined that the coverage of the parameter to be detected meets the requirements.

[0066] The threshold value may be set according to actual conditions (eg, 90%) and is not limited here.

[0067] The technical solution of this embodiment uses the diversity of test result data (test data set) as a measure of test coverage, and makes full use of the value range of online data (preset data set) and the value range corresponding to the library table field type, etc., to automatically discover the value domain coverage through clustering, thereby achieving accurate detection of test coverage, thereby timely determining whether the coverage of the test case set meets the requirements.

[0068] Figure 4 FIG. 2 is a schematic diagram showing a structure of an embodiment of a test coverage detection system 200 provided by the present invention. Figure 4 As shown, the system 200 includes: a collection module 210 and a detection module 220;

[0069] The acquisition module 210 is used to: obtain a test data set of parameters to be detected;

[0070] The detection module 220 is used to determine the test coverage of the parameter to be detected based on the ratio relationship between the test data set and the preset data set of the parameter to be detected.

[0071] In an optional manner, the detection module 220 is specifically used to:

[0072] Determine a first data span of the test data set according to a difference between a maximum value and a minimum value of the test data set, and determine a second data span of the preset data set according to a difference between a maximum value and a minimum value of the preset data set of the parameter to be detected;

[0073] The test coverage of the parameter to be detected is determined according to a ratio between the first data span and the second data span.

[0074] In an optional manner, the detection module 220 is specifically used to:

[0075] Performing data clustering on the preset data set of the parameter to be detected to obtain a plurality of target groups of the preset data set; wherein each target group corresponds to a target data span;

[0076] The test coverage of the parameter to be detected is determined according to the ratio of the number of target data spans to the total number of target data spans in the test data set.

[0077] In an optional manner, the method further includes: a determination module; the determination module is used to:

[0078] Determine whether the test coverage of the parameter to be detected is greater than a threshold value, and obtain a determination result;

[0079] When the judgment result is yes, it is determined that the coverage of the parameter to be detected meets the requirements.

[0080] The technical solution of this embodiment can accurately detect the test coverage, so as to timely determine whether the coverage of the test case set meets the requirements.

[0081] The above-mentioned parameters and steps for each module to implement corresponding functions in the test coverage detection system 200 of this embodiment can refer to the parameters and steps in the embodiment of the test coverage detection method above, and will not be repeated here.

[0082] like Figure 5 As shown, an electronic device 300 according to an embodiment of the present invention includes a processor 320, the processor 320 is coupled to a memory 310, and the memory 310 stores at least one computer program 330, and the at least one computer program 330 is loaded and executed by the processor 320, so that the electronic device 300 implements any one of the above test coverage detection methods, specifically:

[0083] The electronic device 300 may have relatively large differences due to different configurations or performances, and may include one or more processors 320 (Central Processing Units, CPU) and one or more memories 310, wherein the one or more memories 310 store at least one computer program 330, and the at least one computer program 330 is loaded and executed by the one or more processors 320, so that the electronic device 300 implements any test coverage detection method provided in the above embodiments. Of course, the electronic device 300 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the electronic device 300 may also include other components for implementing device functions, which will not be described in detail here.

[0084] A computer-readable storage medium according to an embodiment of the present invention stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements any one of the above-mentioned test coverage detection methods.

[0085] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0086] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs any of the above-mentioned test coverage detection methods.

[0087] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and represent the definition of a specific order or sequence. The order of use of similar objects can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than the order shown or described.

[0088] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code.

[0089] Any combination of one or more computer-readable media can be used. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0090] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A test coverage detection method, characterized in that: include: Obtain a test data set of parameters to be tested; Based on the ratio relationship between the test data set and the preset data set of the parameter to be detected, the test coverage of the parameter to be detected is determined.

2. The test coverage detection method according to claim 1, characterized in that: The step of determining the test coverage of the parameter to be detected based on the ratio relationship between the test data set and the preset data set of the parameter to be detected includes: Determine a first data span of the test data set according to a difference between a maximum value and a minimum value of the test data set, and determine a second data span of the preset data set according to a difference between a maximum value and a minimum value of the preset data set of the parameter to be detected; The test coverage of the parameter to be detected is determined according to a ratio between the first data span and the second data span.

3. The test coverage detection method according to claim 1, characterized in that: The step of determining the test coverage of the parameter to be detected based on the ratio relationship between the test data set and the preset data set of the parameter to be detected includes: Performing data clustering on the preset data set of the parameter to be detected to obtain a plurality of target groups of the preset data set; wherein each target group corresponds to a target data span; The test coverage of the parameter to be detected is determined according to the ratio of the number of target data spans to the total number of target data spans in the test data set.

4. The test coverage detection method according to any one of claims 1 to 3, characterized in that: Also includes: Determine whether the test coverage of the parameter to be detected is greater than a threshold value, and obtain a determination result; When the judgment result is yes, it is determined that the coverage of the parameter to be detected meets the requirements.

5. A test coverage detection system, characterized in that: include: Acquisition module and detection module; The acquisition module is used to: obtain a test data set of parameters to be detected; The detection module is used to determine the test coverage of the parameter to be detected based on the ratio relationship between the test data set and the preset data set of the parameter to be detected.

6. The test coverage detection system according to claim 5, characterized in that: The detection module is specifically used for: Determine a first data span of the test data set according to a difference between a maximum value and a minimum value of the test data set, and determine a second data span of the preset data set according to a difference between a maximum value and a minimum value of the preset data set of the parameter to be detected; The test coverage of the parameter to be detected is determined according to a ratio between the first data span and the second data span.

7. The test coverage detection system according to claim 5, characterized in that: The detection module is specifically used for: Performing data clustering on the preset data set of the parameter to be detected to obtain a plurality of target groups of the preset data set; wherein each target group corresponds to a target data span; The test coverage of the parameter to be detected is determined according to the ratio of the number of target data spans to the total number of target data spans in the test data set.

8. The test coverage detection system according to any one of claims 5 to 7, characterized in that: Also includes: Determination module; The determination module is used for: Determine whether the test coverage of the parameter to be detected is greater than a threshold value, and obtain a determination result; When the judgment result is yes, it is determined that the coverage of the parameter to be detected meets the requirements.

9. An electronic device, characterized in that: The electronic device includes a processor, the processor is coupled to a memory, the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor so that the electronic device implements the test coverage detection method as described in any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that the computer-readable storage medium implements the test coverage detection method according to any one of claims 1 to 4.