CN110209576A - The calculation method and relevant device of test case coverage rate - Google Patents

The calculation method and relevant device of test case coverage rate Download PDF

Info

Publication number
CN110209576A
CN110209576A CN201910421939.8A CN201910421939A CN110209576A CN 110209576 A CN110209576 A CN 110209576A CN 201910421939 A CN201910421939 A CN 201910421939A CN 110209576 A CN110209576 A CN 110209576A
Authority
CN
China
Prior art keywords
test case
program
mark
subprogram
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910421939.8A
Other languages
Chinese (zh)
Inventor
颜平平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201910421939.8A priority Critical patent/CN110209576A/en
Publication of CN110209576A publication Critical patent/CN110209576A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

This application involves the calculation methods and relevant device of test and management more particularly to a kind of test case coverage rate in the field of test technology, are applied to management equipment, this method comprises: obtaining target detection use-case and the associated target program of target detection use-case;Obtain N number of program identification of M the test case mark and target program of target detection use-case;Each program identification in N number of program identification is subjected to keyword match with each test case mark in M test case mark, to obtain matching result;Test case coverage rate is determined based on matching result.It can be used for simplifying the method for inspection of aacode defect in software design using the embodiment of the present application.

Description

The calculation method and relevant device of test case coverage rate
Technical field
This application involves the calculation methods and correlation of the field of test technology more particularly to a kind of test case coverage rate to set It is standby.
Background technique
Coverage rate is to measure a means of test completeness, is a measurement of test validity.Currently, being opened in software During hair, the common method of inspection software design defect is the coverage rate of calculation code.Its specific implementation are as follows: compiling rank Section is inserted into probe functions in source code, and the source code after being compiled by test run is not transported quickly to position which code Row, to find the defects of software design.However, this aacode defect method of inspection needs tester to have programming energy Power, complex steps are complicated.
Summary of the invention
The embodiment of the present application provides the calculation method and relevant device of a kind of test case coverage rate, sets for simplifying software The method of inspection of aacode defect in meter.
In a first aspect, the embodiment of the present application provides a kind of calculation method of test case coverage rate, it is applied to management equipment, The described method includes:
It obtains target detection use-case and the associated target program of target detection use-case, the target detection use-case includes M sub- test cases, the corresponding test case mark of every sub- test case, the target program have N number of subprogram, each Subprogram corresponds to a program identification, and the M and the N are the integer more than or equal to 1;
Obtain N number of program identification of M the test case mark and the target program of the target detection use-case;
Each test in each program identification and M test case mark in N number of program identification is used Example mark carries out keyword match, to obtain matching result;
Test case coverage rate is determined based on the matching result.
Second aspect, the embodiment of the present application provide a kind of computing device of test case coverage rate, are applied to management equipment, Described device includes:
Acquiring unit, for obtaining target detection use-case and the associated target program of target detection use-case, the mesh Marking test case includes M sub- test cases, and every sub- test case corresponds to a test case mark, and the target program has N number of subprogram, the corresponding program identification of each subprogram, the M and the N are the integer more than or equal to 1;Obtain institute State N number of program identification of M the test case mark and the target program of target detection use-case;
Matching unit, used in identifying each program identification in N number of program identification and the M test case Each test case mark carry out keyword match, to obtain matching result;
Determination unit, for determining test case coverage rate based on the matching result.
The third aspect, the embodiment of the present application provide a kind of electronic equipment, including processor, memory, communication interface and One or more programs, wherein said one or multiple programs are stored in above-mentioned memory, and are configured by above-mentioned It manages device to execute, above procedure is included the steps that for executing the instruction in method described in the embodiment of the present application first aspect.
Fourth aspect, the embodiment of the present application provide a kind of computer readable storage medium, wherein above-mentioned computer-readable Storage medium is for storing computer program, wherein above-mentioned computer program is executed by processor, to realize that the application such as is implemented Step some or all of described in method described in example first aspect.
5th aspect, the embodiment of the present application provide a kind of computer program product, wherein above-mentioned computer program product Non-transient computer readable storage medium including storing computer program, above-mentioned computer program are operable to make to calculate Step some or all of described in method of the machine execution as described in the embodiment of the present application first aspect.The computer program produces Product can be a software installation packet.
As can be seen that in the embodiment of the present application, management equipment first obtains target detection use-case and target detection use-case closes The target program of connection, M sub- test cases of target detection use-case correspond to N number of son of M test case mark and target program Program corresponds to N number of program identification, and each program identification and each test case mark are then carried out keyword match, are based on institute It states matching result and determines test case coverage rate.Each program identification and each test case mark are being subjected to keyword match During, it does not need to be inserted into target program probe functions and compilation run, direct matching test use-case mark and program mark Knowledge can be obtained by test case coverage rate, then may determine that the integrated degree of target program by test case coverage rate, To simplify the method for inspection of aacode defect in software design.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow diagram of the calculation method of test case coverage rate provided by the embodiments of the present application;
Fig. 2 is the flow diagram of the calculation method of another test case coverage rate provided by the embodiments of the present application;
Fig. 3 is a kind of structural schematic diagram of management equipment provided by the embodiments of the present application;
Fig. 4 is a kind of structural schematic diagram of the computing device of test case coverage rate provided by the embodiments of the present application.
Specific embodiment
In order to make those skilled in the art more fully understand application scheme, below in conjunction in the embodiment of the present application Attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is only The embodiment of the application a part, instead of all the embodiments.Based on the embodiment in the application, ordinary skill people Member's every other embodiment obtained without making creative work, all should belong to the model of the application protection It encloses.
It is described in detail separately below.
The description and claims of this application and term " first ", " second ", " third " and " in the attached drawing Four " etc. are not use to describe a particular order for distinguishing different objects.In addition, term " includes " and " having " and it Any deformation, it is intended that cover and non-exclusive include.Such as it contains the process, method of a series of steps or units, be System, product or equipment are not limited to listed step or unit, but optionally further comprising the step of not listing or list Member, or optionally further comprising other step or units intrinsic for these process, methods, product or equipment.
Referenced herein " embodiment " is it is meant that a particular feature, structure, or characteristic described can wrap in conjunction with the embodiments It is contained at least one embodiment of the application.Each position in the description occur the phrase might not each mean it is identical Embodiment, nor the independent or alternative embodiment with other embodiments mutual exclusion.Those skilled in the art explicitly and Implicitly understand, embodiment described herein can be combined with other embodiments.
Management equipment, the first electronic equipment and the second electronic equipment may include various hand-held with wireless communication function Equipment, wearable device, calculates equipment, service equipment or is connected to other processing of radio modem and set mobile unit Standby and various forms of user equipmenies (User Equipment, UE), mobile station (Mobile Station, MS), terminal is set Standby (terminal device) etc..
Referring to Figure 1, Fig. 1 is that a kind of process of the calculation method of test case coverage rate provided by the embodiments of the present application is shown It is intended to, is applied to management equipment, this method comprises:
Step 101: obtaining target detection use-case and the associated target program of target detection use-case, the target detection Use-case includes M sub- test cases, and the corresponding test case of every sub- test case identifies, and the target program has N number of son Program, the corresponding program identification of each subprogram, the M and the N are the integer more than or equal to 1.
Wherein, target detection use-case (Test Case) be for some special objective and work out one group of test input, execute Condition and expected results, to test some Program path or to verify whether meet some particular demands.Test case includes It is following at least one information: the title of software or project, the version of software or project, functional module name, test case it is simple The preposition item of dependence, this use-case between description, the reference information of test case, this test case and other test cases Part, the number (ID) of use-case, step number, operating procedure description, test data description, expected results and actual result, exploit person Member and tester, test execution date.
Wherein, the corresponding test case mark of every sub- test case is used for the sub- test case of unique identification, test Use-case mark can be sub- test case ID, can be the application scenarios of sub- test case, or the survey of sub- test case Try is rapid, can also be the expected results of sub- test case, can also be the mark of other energy test cases of unique identification, This is not construed as limiting.
Wherein, target program is one group of instruction computer capacity identification and executed, and runs on electronic computer, meets people Certain demand information tool.
Wherein, the corresponding program identification of each subprogram can be the program ID of subprogram, be also possible to subprogram Application scenarios, can also for subprogram function describe, be not limited thereto.
For example, table 1 is a login interface test case, which realizes following functions: using Family inputs appropriate address in address field, it is desirable that display login interface;Username and password is inputted, is logged in, system automatic Verification, and Provide corresponding prompt information;If user name or password any information do not input, system provides corresponding prompt information after login; It is continuous 3 times it is unverified when, browser is automatically closed.
Table 1
Step 102: obtaining N number of program of M the test case mark and the target program of the target detection use-case Mark.
Further, the M test case mark of the target detection use-case is writing in the target detection use-case Test case mark of the stage based on corresponding sub- test case name, N number of program identification is to program rank in target program Program identification of the section based on the name of corresponding subprogram.
Step 103: will be every in each program identification and the M test case mark in N number of program identification A test case mark carries out keyword match, to obtain matching result.
Wherein, by each survey in each program identification and M test case mark in N number of program identification The specific implementation that example mark on probation carries out keyword match can be with are as follows: by the program identification i's in N number of program identification The keyword of each test case mark in keyword and M test case mark carries out keyword match, until institute State the keyword of program identification all in N number of program identification with each test case in M test case mark The keyword of mark carries out keyword match;It is also possible to the pass of the test case mark j in identifying the M test case The keyword of each program identification in key word and N number of program identification carries out keyword match, until the M test is used Keyword of the keyword of all test case marks with each program identification in N number of program identification in example mark Keyword match is carried out, is not limited thereto.
Table 2
For example, table 2 is that the test case mark of the login interface test case of an acquisition and login interface survey are answered With the program identification one-to-one relationship table of program.Specific matching way can be by test case identify in " initial page Display " keyword " initial page show " and program identification in " initial page shows 1.0 " keyword " initial page show Show ", the keyword " User Log In " of " User Log In_1.0 ", " user name-fault-tolerance verifying 1.0 " keyword " use Name in an account book-fault-tolerance verifying ", the keyword " user name-fault-tolerance verifying " of " user name-fault-tolerance verifying 2.0 ", " user The keyword " user name-fault-tolerance verifying " of name-fault-tolerance verifying 3.0 ", the keyword of " system login-success 1.0 " " are System login-success " carries out keyword match, is also possible to the keyword of " initial page shows 1.0 " in program identification The keyword " initial page is shown " of " initial page is shown " in " initial page is shown " and test case mark, " user name The keyword " user name-typing verifying " of typing-verifying ", the keyword " user name-appearance of " user name-fault-tolerance is verified " Mistake verifying ", the keyword " password-password typing " of " password-password typing ", " system login-success " keyword " system login-success " carries out keyword match.
Step 104: test case coverage rate is determined based on the matching result.
In the implementation of the application, the matching result includes Q successful match record, each successful match record At least one matched program identification is identified including a test case mark and one test case, it is described to be based on institute It states matching result and determines test case coverage rate, comprising:
Determine the Q test case mark recorded in the Q successful match record, the Q is more than or equal to 0 and small In or equal to M integer;
Test case coverage rate, first formula are determined based on the first formula are as follows: P=Q/M, the P are test case Coverage rate.
Table 3
For example, the test case mark that table 3 is another login interface test case obtained is surveyed with login interface The program identification one-to-one relationship table of application program.According to step 103, available 3 successful match record: test case The test case mark " initial page is shown " of TC1 is matched into the program identification " initial page shows 1.0 " of subprogram AP1 Program identification " the user of test case mark " user name-fault-tolerance verifying " and subprogram AP2 of function, test case TC3 Name-fault-tolerance verifies the program identification " user of the program identification " user name-fault-tolerance verifying 2.0 " of 1.0 ", AP3, AP5 Name-fault-tolerance verifies 3.0 " equal successful match, the test case of test case TC5 mark " system login-success " and sub- journey Program identification " system login-success 1.0 " successful match of sequence AP6.Therefore, it can determine the test in table 3 based on the first formula Use-case coverage rate is 60%.
As can be seen that in the embodiment of the present application, management equipment first obtains target detection use-case and target detection use-case closes The target program of connection, M sub- test cases of target detection use-case correspond to N number of son of M test case mark and target program Program corresponds to N number of program identification, and each program identification and each test case mark are then carried out keyword match, are based on institute It states matching result and determines test case coverage rate.Each program identification and each test case mark are being subjected to keyword match During, it does not need to be inserted into target program probe functions and compilation run, direct matching test use-case mark and program mark Knowledge can be obtained by test case coverage rate, then may determine that the integrated degree of target program by test case coverage rate, To simplify the method for inspection of aacode defect in software design.
In the implementation of the application, the management equipment includes output module, the method also includes:
By removing the Q in the output module output Q test case mark, M test case mark M-Q test case mark and the test case coverage rate except a test case mark.
Further, the Q test case mark is exported by the output module, the M test case identifies In except the Q test case mark in addition to M-Q test case mark and the test case coverage rate, comprising:
Determine the first output parameter of the Q test case mark, the M test case in identifying except the Q Second output parameter of the M-Q test case mark except test case mark and the third of the test case coverage rate are defeated Parameter out;
First output parameter is based on by the output module and exports the Q test case mark, based on described Second output parameter exports the M-Q test case mark, and exports the test based on first output parameter and use Example coverage rate.
Wherein, the first output parameter, the first output parameter or third output parameter comprise at least one of the following: font face Color, font weight, font size, font background.First output parameter, the first output parameter and third output parameter can phases Together, it can also be different, it is not limited here.
As can be seen that in the embodiment of the present application, the Q test case mark based on the first output parameter output successful match Know, based on the second output parameter output M-Q test case that it fails to match mark, is used based on the output test of third output parameter Example coverage rate, different output parameters show different parts, to remind user and to facilitate user is subsequent to cover to test case Lid rate is analyzed and is handled.
In the implementation of the application, the method also includes:
When the test case coverage rate is less than or equal to preset threshold, the associated tester of Xiang Suoshu management equipment The first electronic equipment send the first instruction, first instruction carries M-Q test case mark, and described first instructs It is greater than 0 for requesting the tester K test case mark of selection, K from M-Q test case mark And it is less than or equal to the integer of M-Q;
It is selected receiving the carrying tester that first electronic equipment is sent for first instruction K test case mark the first response when, the second electronic equipment of the associated research staff of Xiang Suoshu management equipment is sent Second instruction, second instruction carry selected K test case mark, and second instruction is described for notifying Research staff increases K subprogram into the target program, and a sub- program identification of the corresponding K of the K subprogram can be with Selected K test case identifies successful match.
Wherein, preset threshold can be 40%, 60%, 80% or other values, be not limited thereto.
It illustrates, it is assumed that preset threshold 80%, as shown in table 3, test case coverage rate 60%, to the management The first electronic equipment of the associated tester of equipment sends the first instruction, and first instruction carries 2 test cases It identifies " user name typing-verifying " and " password-password typing ", then selected K test case is identified as " user Name typing-verifying " and/or " password-password typing ".
As can be seen that in the embodiment of the present application, when test case coverage rate is less than or equal to preset threshold, Xiang Guanli The first electronic equipment of the associated tester of equipment sends the first instruction, for reminding tester's test case coverage rate It is relatively low;To the second electronic equipment of the associated research staff of management equipment send second instruction, with for notify research staff by Requirement according to tester supplements new subprogram, and intelligent solves the problems, such as that test case coverage rate is relatively low.
In the implementation of the application, the method also includes:
Second electronic equipment is being received for the increased K of the carrying research staff of the second instruction transmission When the second response of a subprogram, the increased K subprogram is added in the target program, and compiling includes institute The target program of increased K subprogram is stated, so that the increased K subprogram can be run.
As can be seen that in the embodiment of the present application, receiving the second electronic equipment for the carrying of the second instruction transmission When the second response of the increased K subprogram of research staff, increased K subprogram is added in target program, Yi Jibian The target program including increased K subprogram is translated, artificial update target program and compiling target program is not needed, simplifies The process of update and the compiling of target program, to improve the efficiency of work.
In the implementation of the application, before the compiling includes the target program of the K subprogram, the side Method further include:
Determine the matched multiple program identifications of Q test case in the matching result;
Determine the corresponding multiple subprograms of the multiple program identification;
Delete the subprogram in N number of subprogram in addition to the corresponding multiple subprograms of the multiple program identification.
For example, as shown in table 3, it is assumed that there is 10 subprograms: AP1, AP2, AP3, AP4, AP5, AP6, AP7, AP8, AP9, AP10,5 sub- journeys corresponding with 3 test cases mark 5 program identifications of successful match in 3 successful match record Sequence is respectively as follows: AP1, AP2, AP3, AP5, AP6, then deletes subprogram AP4, AP7, AP8, AP9, AP10.
As can be seen that in the embodiment of the present application, deleting extra subprogram, improving the succinct of target program source code Property and readability, to also save the memory of electronic equipment.
In the implementation of the application, if thering is H successful match to record one for including in a successfully record of the Q Test case mark is matched at least two program identifications, before the compiling includes the target program of the K subprogram, institute State method further include:
At least two program identifications for determining that each successful match record includes in the H successful match record are corresponding At least two subprograms;
It is corresponding to obtain at least two program identifications that each successful match record includes in the H successful match record The edit session of at least two subprograms;
At least two program identifications for including by successful match record each in H successful match record are corresponding extremely Target subprogram in few two subprograms is deleted, and the edit session that the target subprogram is deleted is earlier than or equal to when presetting Between.
For example, as shown in table 3, in 5 subprograms AP1, AP2, AP3, AP5, AP6, identifying " user with test case The program identification for having 3 subprograms AP2, AP3, AP5 of name-fault-tolerance verifying " successful match, it is assumed that the edit session of AP2 is On January 18th, 2019, AP3 edit session be the edit session of on January 20th, 2019 and AP5 be on January 23rd, 2019, preset Time is on January 20th, 2019, then deletes subprogram AP2 and AP3.
As can be seen that in the embodiment of the present application, being based on edit session delete target program legacy version at no point in the update process The rubbish of generation improves the terseness and readability of target program source code, to also save the memory of electronic equipment.
It is consistent with the embodiment shown in FIG. 1, referring to Fig. 2, Fig. 2 is another survey provided by the embodiments of the present application The flow diagram of the calculation method of example coverage rate on probation, is applied to management equipment, this method comprises:
Step 201: obtaining target detection use-case and the associated target program of target detection use-case, the target detection Use-case includes M sub- test cases, and the corresponding test case of every sub- test case identifies, and the target program has N number of son Program, the corresponding program identification of each subprogram, the M and the N are the integer more than or equal to 1.
Step 202: obtaining N number of program of M the test case mark and the target program of the target detection use-case Mark.
Step 203: will be every in each program identification and the M test case mark in N number of program identification A test case mark carries out keyword match, to obtain matching result.
Step 204: the matching result includes Q successful match record, and each successful match record includes a survey Example mark on probation and one test case identify at least one matched program identification, determine the Q successful match note The Q test case mark recorded in record, the Q are the integer more than or equal to 0 and less than or equal to M.
Step 205: test case coverage rate, first formula being determined based on the first formula are as follows: P=Q/M, the P are Test case coverage rate.
Step 206: the management equipment includes output module, exports the Q test case by the output module It identifies, M-Q test case in M test case mark in addition to Q test case mark identifies and described Test case coverage rate.
Step 207: when the test case coverage rate is less than or equal to preset threshold, Xiang Suoshu management equipment is associated The first electronic equipment of tester sends the first instruction, and first instruction carries the M-Q test case mark, described First instruction is described for requesting tester K test case mark of selection from M-Q test case mark K is the integer greater than 0 and less than or equal to M-Q.
Step 208: receiving first electronic equipment for the carrying tester of the first instruction transmission When the first response of the K test case mark that member selects, the second electronics of the associated research staff of Xiang Suoshu management equipment Equipment sends the second instruction, and second instruction carries selected K test case mark, and second instruction is used for The research staff is notified to increase K subprogram into the target program, the corresponding K subprogram mark of the K subprogram Successful match can be identified with selected K test case by knowing.
Step 209: determining the matched multiple program identifications of Q test case in the matching result.
Step 210: determining the corresponding multiple subprograms of the multiple program identification.
Step 211: deleting the son in N number of subprogram in addition to the corresponding multiple subprograms of the multiple program identification Program.
Step 212: if test cases mark that the Q successfully has H successful match record to include in record and The matching of at least two program identifications determines each successful match record includes in the H successful match record at least two Corresponding at least two subprogram of program identification.
Step 213: obtaining each successful match in the H successful match record and record at least two program marks for including Know the edit session of corresponding at least two subprogram.
Step 214: each successful match in H successful match record is recorded at least two program identifications for including Target subprogram in corresponding at least two subprogram is deleted, the edit session that the target subprogram is deleted earlier than or be equal to Preset time.
Step 215: receiving second electronic equipment for the carrying research and development people of the second instruction transmission When the second response of the increased K subprogram of member, the increased K subprogram is added in the target program, and Compiling includes the target program of the increased K subprogram, so that the increased K subprogram can be run.
It should be noted that the specific implementation process of the present embodiment can be found in specific implementation described in above method embodiment Process no longer describes herein.
It is consistent with above-mentioned Fig. 1 and embodiment shown in Fig. 2, referring to Fig. 3, Fig. 3 is provided by the embodiments of the present application one The structural schematic diagram of kind electronic equipment, including processor, memory, communication interface and one or more programs, wherein above-mentioned One or more programs are stored in above-mentioned memory, and are configured to be executed by above-mentioned processor, and above procedure includes using In the instruction for executing following steps:
It obtains target detection use-case and the associated target program of target detection use-case, the target detection use-case includes M sub- test cases, the corresponding test case mark of every sub- test case, the target program have N number of subprogram, each Subprogram corresponds to a program identification, and the M and the N are the integer more than or equal to 1;
Obtain N number of program identification of M the test case mark and the target program of the target detection use-case;
Each test in each program identification and M test case mark in N number of program identification is used Example mark carries out keyword match, to obtain matching result;
Test case coverage rate is determined based on the matching result.
As can be seen that in the embodiment of the present application, management equipment first obtains target detection use-case and target detection use-case closes The target program of connection, M sub- test cases of target detection use-case correspond to N number of son of M test case mark and target program Program corresponds to N number of program identification, and each program identification and each test case mark are then carried out keyword match, are based on institute It states matching result and determines test case coverage rate.Each program identification and each test case mark are being subjected to keyword match During, it does not need to be inserted into target program probe functions and compilation run, direct matching test use-case mark and program mark Knowledge can be obtained by test case coverage rate, then may determine that the integrated degree of target program by test case coverage rate, To simplify the method for inspection of aacode defect in software design.
In the implementation of the application, the matching result includes Q successful match record, each successful match note Record includes that a test case mark and one test case identify at least one matched program identification, is being based on institute It states matching result and determines test case coverage rate aspect, above procedure includes the instruction specifically for executing following steps:
Determine the Q test case mark recorded in the Q successful match record, the Q is more than or equal to 0 and small In or equal to M integer;
Test case coverage rate, first formula are determined based on the first formula are as follows: P=Q/M, the P are test case Coverage rate.
In the implementation of the application, the management equipment includes output module, and above procedure includes being also used to hold The instruction of row following steps:
By removing the Q in the output module output Q test case mark, M test case mark M-Q test case mark and the test case coverage rate except a test case mark.
In the implementation of the application, above procedure includes the instruction for being also used to execute following steps:
When the test case coverage rate is less than or equal to preset threshold, the associated tester of Xiang Suoshu management equipment The first electronic equipment send the first instruction, first instruction carries M-Q test case mark, and described first instructs For requesting the tester to determine K test case mark from M-Q test case mark, the K is greater than 0 And it is less than or equal to the integer of M-Q;
It is selected receiving the carrying tester that first electronic equipment is sent for first instruction K test case mark the first response when, the second electronic equipment of the associated research staff of Xiang Suoshu management equipment is sent Second instruction, second instruction carry selected K test case mark, and second instruction is described for notifying Research staff increases K subprogram into the target program, and a sub- program identification of the corresponding K of the K subprogram can be with Selected K test case identifies successful match.
In the implementation of the application, above procedure includes the instruction for being also used to execute following steps:
Second electronic equipment is being received for the increased K of the carrying research staff of the second instruction transmission When the second response of a subprogram, the increased K subprogram is added in the target program, and compiling includes institute The target program of increased K subprogram is stated, so that the increased K subprogram can be run.
In the implementation of the application, before compiling the target program including the K subprogram, above procedure Instruction including being also used to execute following steps:
Determine the matched multiple program identifications of Q test case in the matching result;
Determine the corresponding multiple subprograms of the multiple program identification;
Delete the subprogram in N number of subprogram in addition to the corresponding multiple subprograms of the multiple program identification.
In the implementation of the application, if thering is H successful match to record one for including in a successfully record of the Q Test case mark is matched at least two program identifications, above-mentioned before compiling the target program including the K subprogram Program includes being also used to execute the instruction of following steps:
At least two program identifications for determining that each successful match record includes in the H successful match record are corresponding At least two subprograms;
It is corresponding to obtain at least two program identifications that each successful match record includes in the H successful match record The edit session of at least two subprograms;
At least two program identifications for including by successful match record each in H successful match record are corresponding extremely Target subprogram in few two subprograms is deleted, and the edit session that the target subprogram is deleted is earlier than or equal to when presetting Between.
It should be noted that the specific implementation process of the present embodiment can be found in specific implementation described in above method embodiment Process no longer describes herein.
Above-described embodiment is mainly described the scheme of the embodiment of the present application from the angle of method side implementation procedure.It can With understanding, in order to realize the above functions, it comprises execute the corresponding hardware configuration of each function and/or soft for electronic equipment Part module.Those skilled in the art should be readily appreciated that, described in conjunction with the examples disclosed in the embodiments of the present disclosure Unit and algorithm steps, the application can be realized with the combining form of hardware or hardware and computer software.Some function is studied carefully Unexpectedly it is executed in a manner of hardware or computer software driving hardware, the specific application and design constraint depending on technical solution Condition.Professional technician can specifically realize described function to each using distinct methods, but this It realizes it is not considered that exceeding scope of the present application.
The embodiment of the present application can carry out the division of functional unit according to the method example to electronic equipment, for example, can With each functional unit of each function division of correspondence, two or more functions can also be integrated in a processing unit In.The integrated unit both can take the form of hardware realization, can also realize in the form of software functional units.It needs It is noted that be schematical, only a kind of logical function partition to the division of unit in the embodiment of the present application, it is practical real It is current that there may be another division manner.
It is below the application Installation practice, the application Installation practice is realized for executing the application embodiment of the method Method.Referring to Fig. 4, a kind of computing device of test case coverage rate provided by the embodiments of the present application, sets applied to management Standby, the computing device of the test case coverage rate includes:
Acquiring unit 401, it is described for obtaining target detection use-case and the associated target program of target detection use-case Target detection use-case includes M sub- test cases, the corresponding test case mark of every sub- test case, the target program There is N number of subprogram, each subprogram corresponds to a program identification, and the M and the N are the integer more than or equal to 1;It obtains The journey of each subprogram of the test case mark and target program of every sub- test case of the target detection use-case Sequence mark;
Matching unit 402, for by N number of program identification each program identification and the M test case mark Each test case mark in knowledge carries out keyword match, to obtain matching result;
Determination unit 403, for determining test case coverage rate based on the matching result.
As can be seen that in the embodiment of the present application, management equipment first obtains target detection use-case and target detection use-case closes The target program of connection, M sub- test cases of target detection use-case correspond to N number of son of M test case mark and target program Program corresponds to N number of program identification, and each program identification and each test case mark are then carried out keyword match, are based on institute It states matching result and determines test case coverage rate.Each program identification and each test case mark are being subjected to keyword match During, it does not need to be inserted into target program probe functions and compilation run, direct matching test use-case mark and program mark Knowledge can be obtained by test case coverage rate, then may determine that the integrated degree of target program by test case coverage rate, To simplify the method for inspection of aacode defect in software design.
In the implementation of the application, the matching result includes Q successful match record, each successful match note Record includes that a test case mark and one test case identify a matched program identification, based on described In terms of determining test case coverage rate with result, the determination unit 403 is specifically used for:
Determine the Q test case mark recorded in the Q successful match record, the Q is more than or equal to 0 and small In or equal to M integer;Test case coverage rate, first formula are determined based on the first formula are as follows: P=Q/M, the P are Test case coverage rate.
In the implementation of the application, the management equipment includes output module, and described device further includes that output is single Member 404, is used for:
By removing the Q in the output module output Q test case mark, M test case mark M-Q test case mark and the test case coverage rate except a test case mark.
In the implementation of the application, described device further includes communication unit 405, is used for:
When the test case coverage rate is less than or equal to preset threshold, the associated tester of Xiang Suoshu management equipment The first electronic equipment send the first instruction, first instruction carries M-Q test case mark, and described first instructs For requesting the tester to determine K test case mark from M-Q test case mark, the K is greater than 0 And it is less than or equal to the integer of M-Q;
It is selected receiving the carrying tester that first electronic equipment is sent for first instruction K test case mark the first response when, the second electronic equipment of the associated research staff of Xiang Suoshu management equipment is sent Second instruction, second instruction carry selected K test case mark, and second instruction is described for notifying Research staff increases K subprogram into the target program, and a sub- program identification of the corresponding K of the K subprogram can be with Selected K test case identifies successful match.
In the implementation of the application, described device further includes addition compilation unit 406, is used for:
Second electronic equipment is being received for the increased K of the carrying research staff of the second instruction transmission When the second response of a subprogram, the increased K subprogram is added in the target program, and compiling includes institute The target program of increased K subprogram is stated, so that the increased K subprogram can be run.
In the implementation of the application, before compiling the target program including the K subprogram, the determination Unit 403 is also used to determine the matched multiple program identifications of Q test case in the matching result;Determine the multiple journey Sequence identifies corresponding multiple subprograms;
Described device further includes deleting unit 407, for deleting in N number of subprogram except the multiple program identification pair Subprogram except the multiple subprograms answered.
In the implementation of the application, if thering is H successful match to record one for including in a successfully record of the Q Test case mark is matched at least two program identifications, described before compiling the target program including the K subprogram Determination unit 403 is also used to determine in the H successful match record that each successful match records at least two programs for including Identify corresponding at least two subprogram;
The acquiring unit 401, being also used to obtain each successful match record in the H successful match record includes The edit session of corresponding at least two subprogram of at least two program identifications;
The deletion unit 407, be also used to record the H successful match in each successful match record include to Target subprogram in few corresponding at least two subprogram of two program identifications is deleted, the editor that the target subprogram is deleted Time earlier than or be equal to preset time.
It should be noted that acquiring unit 401, matching unit 402, determination unit 403, output unit 404, addition compiling Unit 406 and deletion unit 407 can realize that communication unit 405 can pass through communication interface by processor.
The embodiment of the present application also provides a kind of computer storage medium, wherein the computer storage medium is stored for depositing Store up computer program, the computer program be executed by processor as in above method embodiment record either method part or Overall Steps.
The embodiment of the present application also provides a kind of computer program product, and above-mentioned computer program product includes storing calculating The non-transient computer readable storage medium of machine program, above-mentioned computer program are operable to that computer is made to execute such as above-mentioned side Some or all of either record method step in method embodiment.The computer program product can be a software installation Packet.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the application is not limited by the described action sequence because According to the application, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, related actions and modules not necessarily the application It is necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment Point, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed device, it can be by another way It realizes.For example, the apparatus embodiments described above are merely exemplary, such as the division of said units, it is only a kind of Logical function partition, there may be another division manner in actual implementation, such as multiple units or components can combine or can To be integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual Coupling, direct-coupling or communication connection can be through some interfaces, the indirect coupling or communication connection of device or unit, It can be electrical or other forms.
Above-mentioned unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If above-mentioned integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can store in a computer-readable access to memory.Based on this understanding, the technical solution of the application substantially or Person says that all or part of the part that contributes to existing technology or the technical solution can body in the form of software products Reveal and, which is stored in a memory, including some instructions are used so that a computer equipment (can be personal computer, server or network equipment etc.) executes all or part of each embodiment above method of the application Step.And memory above-mentioned includes: USB flash disk, read-only memory (ROM, Read-Only Memory), random access memory The various media that can store program code such as (RAM, Random Access Memory), mobile hard disk, magnetic or disk.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of above-described embodiment is can It is completed with instructing relevant hardware by program, which can store in a computer-readable memory, memory May include: flash disk, read-only memory (English: Read-Only Memory, referred to as: ROM), random access device (English: Random Access Memory, referred to as: RAM), disk or CD etc..
The embodiment of the present application is described in detail above, specific case used herein to the principle of the application and Embodiment is expounded, the description of the example is only used to help understand the method for the present application and its core ideas; At the same time, for those skilled in the art can in specific embodiments and applications according to the thought of the application There is change place, in conclusion the contents of this specification should not be construed as limiting the present application.

Claims (10)

1. a kind of calculation method of test case coverage rate, which is characterized in that be applied to management equipment, which comprises
Target detection use-case and the associated target program of target detection use-case are obtained, the target detection use-case includes M Sub- test case, the corresponding test case mark of every sub- test case, the target program have N number of subprogram, every height Program corresponds to a program identification, and the M and the N are the integer more than or equal to 1;
Obtain N number of program identification of M the test case mark and the target program of the target detection use-case;
By each test case mark in each program identification and M test case mark in N number of program identification Know and carry out keyword match, to obtain matching result;
Test case coverage rate is determined based on the matching result.
2. the method according to claim 1, wherein the matching result includes Q successful match record, each Successful match record includes that a test case mark and one test case identify at least one matched program mark Know, it is described that test case coverage rate is determined based on the matching result, comprising:
Determine the Q test case mark recorded in Q successful match record, the Q for more than or equal to 0 and be less than or Integer equal to M;
Test case coverage rate, first formula are determined based on the first formula are as follows: P=Q/M, the P are test case covering Rate.
3. according to the method described in claim 2, the method is also it is characterized in that, the management equipment includes output module Include:
By removing described Q survey in the output module output Q test case mark, M test case mark M-Q test case mark and the test case coverage rate except example mark on probation.
4. according to the method in claim 2 or 3, which is characterized in that the method also includes:
When the test case coverage rate is less than or equal to preset threshold, the of the associated tester of Xiang Suoshu management equipment One electronic equipment sends the first instruction, and first instruction carries the M-Q test case mark, and first instruction is used for It is greater than 0 and small for requesting the tester K test case mark of selection, K from M-Q test case mark In or equal to M-Q integer;
Receiving, the K that the carrying tester that first electronic equipment is sent for first instruction selects is a When the first response of test case mark, the second electronic equipment of the associated research staff of Xiang Suoshu management equipment sends second and refers to It enables, second instruction carries selected K test case mark, and second instruction is for notifying the research and development people Member increases K subprogram into the target program, and a sub- program identification of the corresponding K of the K subprogram can be with the choosing The K test case mark successful match selected out.
5. according to the method described in claim 4, it is characterized in that, the method also includes:
Receiving the increased K son of the carrying research staff that second electronic equipment is sent for second instruction When the second response of program, the increased K subprogram is added in the target program, and compiling includes the increasing The target program of the K subprogram added, so that the increased K subprogram can be run.
6. according to the method described in claim 5, it is characterized in that, the compiling includes the target program of the K subprogram Before, the method also includes:
Determine the matched multiple program identifications of Q test case in the matching result;
Determine the corresponding multiple subprograms of the multiple program identification;
Delete the subprogram in N number of subprogram in addition to the corresponding multiple subprograms of the multiple program identification.
7. according to the method described in claim 6, it is characterized in that, if having H successful match record in a successfully record of the Q Including a test case identify and match at least two program identifications, it is described to compile the target including the K subprogram Before program, the method also includes:
At least two program identifications for determining that each successful match record includes in the H successful match record are corresponding at least Two subprograms;
It is corresponding at least to obtain at least two program identifications that each successful match record includes in the H successful match record The edit session of two subprograms;
Each successful match in H successful match record is recorded at least two program identifications corresponding at least two for including Target subprogram in a subprogram is deleted, the edit session that the target subprogram is deleted earlier than or be equal to preset time.
8. a kind of computing device of test case coverage rate, which is characterized in that be applied to management equipment, described device includes:
Acquiring unit, for obtaining target detection use-case and the associated target program of target detection use-case, the target is surveyed Example on probation includes M sub- test cases, and the corresponding test case mark of every sub- test case, the target program has N number of Subprogram, the corresponding program identification of each subprogram, the M and the N are the integer more than or equal to 1;Described in acquisition N number of program identification of M the test case mark and the target program of target detection use-case;
Matching unit, for will be every in each program identification and the M test case mark in N number of program identification A test case mark carries out keyword match, to obtain matching result;
Determination unit, for determining test case coverage rate based on the matching result.
9. a kind of electronic equipment, which is characterized in that including processor, memory, communication interface, and one or more programs, One or more of programs are stored in the memory, and are configured to be executed by the processor, described program packet Include the instruction for executing the step in the method according to claim 1 to 7.
10. a kind of computer readable storage medium, which is characterized in that the computer readable storage medium is for storing computer Program, the computer program are executed by processor, to realize the method according to claim 1 to 7.
CN201910421939.8A 2019-05-21 2019-05-21 The calculation method and relevant device of test case coverage rate Pending CN110209576A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910421939.8A CN110209576A (en) 2019-05-21 2019-05-21 The calculation method and relevant device of test case coverage rate

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910421939.8A CN110209576A (en) 2019-05-21 2019-05-21 The calculation method and relevant device of test case coverage rate

Publications (1)

Publication Number Publication Date
CN110209576A true CN110209576A (en) 2019-09-06

Family

ID=67787906

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910421939.8A Pending CN110209576A (en) 2019-05-21 2019-05-21 The calculation method and relevant device of test case coverage rate

Country Status (1)

Country Link
CN (1) CN110209576A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111400189A (en) * 2020-03-25 2020-07-10 平安银行股份有限公司 Code coverage rate monitoring method and device, electronic equipment and storage medium
CN111639031A (en) * 2020-06-01 2020-09-08 电信科学技术第十研究所有限公司 Coverage evaluation method and device based on test data
CN112380125A (en) * 2020-11-16 2021-02-19 中信银行股份有限公司 Test case recommendation method and device, electronic equipment and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100095274A1 (en) * 2008-10-10 2010-04-15 American Express Travel Related Services Company, Inc. System, Computer Program, and Method for a Static Code Coverage Analyzer for Computer Programs
US20150161026A1 (en) * 2013-12-09 2015-06-11 International Business Machines Corporation System and method for determining test coverage
US20160034382A1 (en) * 2014-08-01 2016-02-04 Unisys Corporation Automated regression test case selector and black box test coverage tool for product testing
CN107797923A (en) * 2017-10-10 2018-03-13 平安科技(深圳)有限公司 Code coverage rate analysis method and application server
CN108038052A (en) * 2017-11-27 2018-05-15 平安科技(深圳)有限公司 Automatic test management method, device, terminal device and storage medium
CN109308263A (en) * 2018-09-29 2019-02-05 北京云测信息技术有限公司 A kind of small routine test method, device and equipment
CN109766263A (en) * 2018-12-15 2019-05-17 深圳壹账通智能科技有限公司 Automatic test analysis and processing method, device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100095274A1 (en) * 2008-10-10 2010-04-15 American Express Travel Related Services Company, Inc. System, Computer Program, and Method for a Static Code Coverage Analyzer for Computer Programs
US20150161026A1 (en) * 2013-12-09 2015-06-11 International Business Machines Corporation System and method for determining test coverage
US20160034382A1 (en) * 2014-08-01 2016-02-04 Unisys Corporation Automated regression test case selector and black box test coverage tool for product testing
CN107797923A (en) * 2017-10-10 2018-03-13 平安科技(深圳)有限公司 Code coverage rate analysis method and application server
CN108038052A (en) * 2017-11-27 2018-05-15 平安科技(深圳)有限公司 Automatic test management method, device, terminal device and storage medium
CN109308263A (en) * 2018-09-29 2019-02-05 北京云测信息技术有限公司 A kind of small routine test method, device and equipment
CN109766263A (en) * 2018-12-15 2019-05-17 深圳壹账通智能科技有限公司 Automatic test analysis and processing method, device, computer equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
TEEMU KANSTRÉN: "Towards a deeper understanding of test coverage", 《JOURNAL OF SOFTWARE MAINTENANCE AND EVOLUTION: RESEARCH AND PRACTICE》, vol. 20, no. 1, 28 February 2008 (2008-02-28), pages 59 - 76 *
董昕;牟永敏;于秀山;: "代码覆盖与功能覆盖映射方法探究", 数据通信, no. 03, 28 June 2016 (2016-06-28), pages 9 - 17 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111400189A (en) * 2020-03-25 2020-07-10 平安银行股份有限公司 Code coverage rate monitoring method and device, electronic equipment and storage medium
CN111639031A (en) * 2020-06-01 2020-09-08 电信科学技术第十研究所有限公司 Coverage evaluation method and device based on test data
CN111639031B (en) * 2020-06-01 2023-06-30 电信科学技术第十研究所有限公司 Coverage evaluation method and device based on test data
CN112380125A (en) * 2020-11-16 2021-02-19 中信银行股份有限公司 Test case recommendation method and device, electronic equipment and readable storage medium
CN112380125B (en) * 2020-11-16 2024-04-26 中信银行股份有限公司 Recommendation method and device for test cases, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN110209576A (en) The calculation method and relevant device of test case coverage rate
CN107944380A (en) Personal identification method, device and storage device
CN106804055B (en) A kind of Wireless Fidelity Wi-Fi connection method and mobile terminal
CN106021118B (en) Test code generating method and device, test frame code execution method and device
CN109256147A (en) Audio cadence detection method, device and storage medium
CN107957956A (en) Test method, device and the readable storage medium storing program for executing of software differences coverage rate
CN110335139A (en) Appraisal procedure, device, equipment and readable storage medium storing program for executing based on similarity
CN107105093A (en) Camera control method, device and terminal based on hand track
CN109739983A (en) Identify the method, apparatus and computer-readable medium of public security notes character relation
EP4193261A1 (en) Test script generation from test specifications using natural language processing
CN108959067A (en) Test method, device and the computer readable storage medium of search engine
CN112181835A (en) Automatic testing method and device, computer equipment and storage medium
CN109885474A (en) Test case edit methods and device, terminal and computer readable storage medium
CN109492081A (en) Text information search and information interacting method, device, equipment and storage medium
CN109491913A (en) Battery management system test method and system based on Internet of Things
CN110321285A (en) Test case processing method and relevant device
CN110460617A (en) Machine examines examination system and Related product
CN112035630A (en) Dialogue interaction method, device, equipment and storage medium combining RPA and AI
CN106251114A (en) The method and apparatus realizing examination & approval in application
CN106951373A (en) A kind of automated testing method and device that O&M software is moved for power network webmaster
CN107969154A (en) Privacy management
CN109032864A (en) A kind of method and system of NVMe SSD hot plug test
CN109699003B (en) Position determination method and device
CN106933744A (en) Node revision status indication method and device, electronic equipment and storage medium
CN110362672A (en) List display methods, device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination