CN109558328A - A kind of test method of code coverage, system, device and readable storage medium storing program for executing - Google Patents

A kind of test method of code coverage, system, device and readable storage medium storing program for executing Download PDF

Info

Publication number
CN109558328A
CN109558328A CN201811475944.9A CN201811475944A CN109558328A CN 109558328 A CN109558328 A CN 109558328A CN 201811475944 A CN201811475944 A CN 201811475944A CN 109558328 A CN109558328 A CN 109558328A
Authority
CN
China
Prior art keywords
test
code coverage
code
script
testing tool
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.)
Granted
Application number
CN201811475944.9A
Other languages
Chinese (zh)
Other versions
CN109558328B (en
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.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information 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 Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201811475944.9A priority Critical patent/CN109558328B/en
Publication of CN109558328A publication Critical patent/CN109558328A/en
Application granted granted Critical
Publication of CN109558328B publication Critical patent/CN109558328B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/3692Test management for test results 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/3696Methods or tools to render software testable

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 discloses a kind of test methods of code coverage, after determination needs to carry out the object code section of code coverage test, tester only needs that preset automatic forwarding script and the two operating procedures of automatic test script is successively called to complete the test operation for originally needing much complex step that could complete, simple, convenient just as clicking two buttons, the degree of automation is higher.It grasps the application method of testing tool in advance also without tester simultaneously, can directly be used as black box, ease for use is higher, and more humanized, testing efficiency also will be enhanced.The application further simultaneously discloses test macro, device and the computer readable storage medium of a kind of code coverage, has above-mentioned beneficial effect.

Description

A kind of test method of code coverage, system, device and readable storage medium storing program for executing
Technical field
This application involves program product the field of test technology, in particular to a kind of test method of code coverage, system, Device and computer readable storage medium.
Background technique
Code coverage test refers to the method for searching the regions of program code not executed by one group of test case, in order to Increase new test case to increase and treat the code coverage for surveying program product.Since code coverage test is that one kind ensures The method of program product quality of used test use cases in test, rather than test the program product actual mass Therefore method belongs to a kind of indirect measurement method.
Code coverage test is to measure an important indicator of test quality, not only needs to carry out such as program product Miscellaneous test such as unit testing, assembling test, integration testing and interface testing, it is also necessary to ensure the matter of above-mentioned test Whether amount functional all tests all codes for constituting the program product, institute in place.If test only covers code Seldom a part, then can not also believe that the quality of the program product is to close regardless of how many test case used in test Lattice.On the contrary, if Test coverage most codes of program product, to the quality of the program product will have reasonable letter The heart.
It is existing carry out code coverage test be mostly using it is independent, completed by the testing tool of third party's exploitation, Since it is totally independent of written in code software, will make as another software that need to be used simultaneously with written in code software With, and the code coverage testing tool usage mode that different developers develop is different, it is also necessary to tester voluntarily learns The step of when practising, is not easy to get started, and using, is cumbersome, easy to operate by mistake, so that being unable to reach expected test effect.
Therefore, existing every technological deficiency, provides a kind of more people when how to overcome existing progress code coverage test Property, integrated level be higher, using easier code coverage test method, and being that those skilled in the art are urgently to be resolved asks Topic.
Summary of the invention
The main purpose that the purpose of the application is to provide the application is to provide a kind of test method of code coverage, true Surely after the object code section for needing to carry out code coverage test, tester only needs successively to call preset automatic forwarding foot This and the two operating procedures of automatic test script complete the test operation for originally needing much complex step that could complete, just as Click that two buttons are equally simple, convenient, and the degree of automation is higher.Testing tool is grasped in advance also without tester simultaneously Application method can directly be used as black box, and ease for use is higher, and more humanized, testing efficiency will also be mentioned It is high.
The another object of the application is the provision of the test macro of code coverage a kind of, device and computer-readable deposits Storage media.
To achieve the above object, the application provides a kind of test method of code coverage, this method comprises:
Determine object code section to be tested;
Call preset automatic forwarding script that the object code section is transmitted to corresponding code coverage testing tool;
Call preset automatic test script control the code coverage testing tool to the object code section into Line code coverage rate test;Wherein, the automatic test script is that the code coverage testing tool is executed the code Each step when coverage rate test obtains after carrying out scripting processing in order;
Receive the test that the code coverage testing tool is generated and returned after the completion of the code coverage is tested Report.
Optionally, calling preset automatic forwarding script that the object code section is transmitted to corresponding code coverage Before testing tool, further includes:
The code coverage testing tool is obtained for receiving the information RX path of code segment to be measured;
The automatic forwarding script is generated according to the information RX path.
Optionally, the test method further include:
The automatic forwarding script and the automatic test script are encapsulated as transmitted test interface, and the forwarding is surveyed Mouth embedded code in the form of plug-in unit of trying is write in application, to the mesh in a manner of by calling the transmitted test interface It marks code segment and carries out the code coverage test.
Optionally, the code coverage is carried out to the object code section by way of calling the transmitted test interface Rate test, comprising:
When the quantity of the transmitted test interface is multiple, call each transmitted test interface to the mesh respectively It marks code segment and carries out the code coverage test;
It is corresponding, it receives the code coverage testing tool and generates and return after the completion of the code coverage is tested Test report, comprising:
Each code coverage testing tool is received respectively to generate and return after the completion of the code coverage is tested The test report returned.
Optionally, receiving each code coverage testing tool respectively after the completion of the code coverage is tested It generates and after the test report that returns, further includes:
The numerical value for the code coverage for including in each test report is extracted, and compares to obtain maximum code coverage rate;
It is reported the test report comprising the maximum code coverage rate as target detection.
Optionally, it after the test report that will include the maximum code coverage rate is reported as target detection, also wraps It includes:
Count what the test report that each code coverage testing tool generates was reported as the target detection Number obtains testing tool statistical form.
Optionally, the test method further include:
Preset automatic comparison script is called to execute the code coverage respectively in different times to the object code section The test report that rate generates when testing is compared;
It receives the test report and compares the comparison result that tool is generated and returned after the completion of comparison.
To achieve the above object, present invention also provides a kind of test macros of code coverage, comprising:
Object code section determination unit, for determining object code section to be tested;
Automatic forwarding script call unit, for calling preset automatic forwarding script to be transmitted to the object code section Corresponding code coverage testing tool;
Automatic test script call unit controls the code coverage for calling preset automatic test script and surveys Trial work tool carries out code coverage test to the object code section;Wherein, the automatic test script is to cover the code Each step when lid rate testing tool executes code coverage test obtains after carrying out scripting processing in order;
Test report receiving unit is tested for receiving the code coverage testing tool in the code coverage At the rear test report for generating and returning.
Optionally, the test macro further include:
Information RX path acquiring unit, for calling preset automatic forwarding script to forward the object code section Before corresponding code coverage testing tool, the code coverage testing tool is obtained for receiving code segment to be measured Information RX path;
Automatic forwarding script generation unit, for generating the automatic forwarding script according to the information RX path.
Optionally, the test macro further include:
Script encapsulation and interface call directly unit, for sealing the automatic forwarding script and the automatic test script Dress is transmitted test interface, and transmitted test interface embedded code in the form of plug-in unit is write in application, is adjusted with passing through The code coverage test is carried out to the object code section with the mode of the transmitted test interface.
Optionally, script encapsulation and interface call directly unit and include:
Multiplex roles test subelement, for calling each institute respectively when the quantity of the transmitted test interface is multiple It states transmitted test interface and the code coverage test is carried out to the object code section;
Corresponding, the test report receiving unit includes:
More test report receiving subelements, for receiving each code coverage testing tool respectively in the code The test report for generating and returning after the completion of coverage rate test.
Optionally, the test macro further include:
Code coverage extracts and comparing unit, for receiving each code coverage testing tool respectively in institute After stating the test report that code coverage test is generated and returned after the completion, the code for including in each test report is extracted The numerical value of coverage rate, and compare to obtain maximum code coverage rate;
Target detection, which is reported, determines subelement, for that will include the test report of the maximum code coverage rate as target Test report.
Optionally, the test macro further include:
Statistic unit, for will include that the test report of the maximum code coverage rate reports it as target detection Afterwards, the number that the test report that each code coverage testing tool generates is reported as the target detection is counted, Obtain testing tool statistical form.
To achieve the above object, present invention also provides a kind of test devices of code coverage, comprising:
Memory, for storing computer program;
Processor realizes the test of the code coverage as described in above content when for executing the computer program The step of method.
To achieve the above object, described computer-readable to deposit present invention also provides a kind of computer readable storage medium It is stored with computer program on storage media, the generation as described in above content is realized when the computer program is executed by processor The step of test method of code coverage rate.
Obviously, the test method of a kind of code coverage provided herein needs to carry out code coverage in determination After the object code section of test, tester only need successively to call preset automatic forwarding script and automatic test script this two A operating procedure completes the test operation for originally needing much complex step that could complete, simple just as clicking two buttons Single, convenient, the degree of automation is higher.The application method for grasping testing tool in advance also without tester simultaneously, can be by it It is directly used as black box, ease for use is higher, and more humanized, testing efficiency also will be enhanced.The application also mentions simultaneously Test macro, device and the computer readable storage medium of a kind of code coverage have been supplied, there is above-mentioned beneficial effect, herein not It repeats again.
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 The embodiment of application for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow chart of the test method of code coverage provided by the embodiments of the present application;
Fig. 2 is the flow chart of the test method of another code coverage provided by the embodiments of the present application;
Fig. 3 is that the same target code segment in test method provided by the embodiments of the present application under a kind of pair of different times is corresponding The flow chart of method that compares of multiple test report;
Fig. 4 is a kind of structural block diagram of the test macro of code coverage provided by the embodiments of the present application.
Specific embodiment
The core of the application is to provide a kind of test method of code coverage, needs to carry out code coverage survey in determination After the object code section of examination, tester only need successively to call preset automatic forwarding script and automatic test script the two Operating procedure completes the test operation for originally needing much complex step that could complete, simple just as clicking two buttons, Convenient, the degree of automation is higher.Grasp the application method of testing tool in advance also without tester simultaneously, it can be as Black box directly uses, and ease for use is higher, and more humanized, testing efficiency also will be enhanced.
To keep the purposes, technical schemes and advantages of the embodiment of the present application clearer, below in conjunction with the embodiment of the present application In attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is Some embodiments of the present application, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art All other embodiment obtained without making creative work, shall fall in the protection scope of this application.
Embodiment one
Referring to Figure 1, Fig. 1 is a kind of flow chart of the test method of code coverage provided by the embodiments of the present application, The following steps are included:
S101: object code section to be tested is determined;
This step is intended to determine the object code section for needing to carry out code coverage test, wherein method of determination can root It is different forms according to the different manifestations of written in code software, such as can be determined by way of choosing, can also be passed through Be copied to written in code application in some dedicated information collection window in etc., herein and be not specifically limited, mesh Be determine the subsequent object that code coverage testing tool will be used to test.
S102: it calls preset automatic forwarding script that object code section is transmitted to corresponding code coverage and tests work Tool;
On the basis of S101, this step is intended to call preset automatic forwarding script will be in written in code application to realize The object code section of middle determination is sent to code coverage testing tool.For existing implementation, it is not required to tester Member manually completes to execute object code section copy function, opens code coverage test work by an at least beans-and bullets shooter selection operation Tool pastes behaviour by the test code typing window at least beans-and bullets shooter selection operation opening code coverage testing tool, execution Make.In the one-touch target generation that will automatically determine in written in code is applied, can be achieved to by preset automatic forwarding script Code section is sent to the step of being tested in code coverage testing tool, reduces operating procedure, the degree of automation is higher, has Help promote testing efficiency.
A method of the generation automatic forwarding script for including but is not limited to are as follows:
Obtain the information RX path that code coverage testing tool is used to receive code segment to be measured;
The automatic forwarding script is generated according to information RX path, specifically, the initial address due to forwarding has defined, Therefore the destination address for only needing clearly to forward, it is believed that forward the initial address of operation to be determined by written in code application, Destination address is determined by corresponding code coverage testing tool, and address above mentioned will be solidificated in the automatic forwarding script.
S103: it calls preset automatic test script to carry out control routine coverage rate test tool and generation is carried out to object code section Code coverage rate test;
S102 completes the how convenient object code section that will be present in written in code application and is sent to code coverage The purpose of testing tool, this step will provide the convenient and fast code for controlling and receiving object code section of one kind and cover on this basis The method of lid rate testing tool completion code coverage rate test, that is, call preset automatic test script to carry out control routine coverage rate Testing tool carries out code coverage test to object code section.It should be noted that the automatic test script is similar to from turn Send out script, only its be by code coverage testing tool execute code coverage test when each step by execution sequence It is obtained after progress scripting processing, function is different from the automatic forwarding script for realizing forwarding.
It should be noted that automatic forwarding script and automatic test script that S102 and S103 are referred to only need once to compile Write, it is subsequent when reusing directly according to the rule order being written in automatic perform script execute can, so passing through The use of the automatic perform script, tester will no longer need to spend additional time into carried out duplicate execution forwarding behaviour originally The usage mode for making and learning different code coverage rate test tool, can directly be considered as a black box, it is only necessary to simple Call instruction can normal use.
Further, in order to enable the automatic perform script for writing completion can really realize purpose when being executed, especially It is that automatic test script really is able to execute corresponding operation to code coverage testing tool, it is also necessary to establish it and be covered with code Link adduction relationship between lid rate testing tool, so that can all pass through when executing each order in automatic perform script The link adduction relationship executes corresponding operation, and then completion code coverage rate test to the code coverage testing tool.
For existing implementation, test is needed in the operational version for grasping the code coverage testing tool Afterwards, the point selection operation for carrying out multistep on the code coverage testing tool according to the operating instruction of standard, finally makes the generation Code coverage rate test tool carries out the code coverage test operation to object code section, and due to the complexity of operation and manually The unstability of operation, in operating procedure of the multistep there are dependence, from the beginning the operation error of any step all will lead to The possibility to do it again, therefore, this step are realized by the automatic test script that preparatory code is handled from craft to certainly The transformation of dynamicization, and delivering by other testers of can be convenient completes similarly to operate, he will not operation code in time The mode of operation of coverage rate test function.
S104: the test report that code coverage testing tool is generated and returned after the completion of code coverage is tested is received It accuses.
On the basis of S103, this step is intended to receive code coverage testing tool after the completion of code coverage test The test report for generating and returning, i.e. code coverage testing tool are executing generation to object code section by automatic test script After code coverage rate test, the code coverage test report of generation, and the test report is back to written in code application, make it Personnel can be tested to get.
Further, can also the above-mentioned automatic forwarding script referred to and automatic test script be encapsulated as transmitted test and connect Mouthful, and embedded code is write in application in the form of plug-in unit by transmitted test interface, to pass through encapsulation operation, by S102 and S103 It is integrated into a step: transmitted test interface being called to carry out code coverage test to object code section, is i.e. the transmitted test interface is The solid of automatic forwarding script and automatic test script, and there are executing sequence, but pass through and further integrate, it can be further It reduces operator and the step of required execution, further improves testing efficiency in completion code coverage rate test.
Further, the quantity of the transmitted test interface can be with more than one, because different developers will use not Development scheme together, different test use cases run hair jointly and obtain different code coverage testing tools, just as being equally all Antivirus software, all different software suppliers will provide antivirus effect different antivirus software, code coverage testing tool It is such.It should be understood that each different transmitted test interface will use corresponding different code coverage testing tool Automatic forwarding script and automatic test script encapsulate to obtain.And based on there are the actual conditions of multiple transmitted test interfaces, Object code section is tested, can selectively choose according to the actual situation one, it is several or all carry out respectively Test, when choosing multiple (at least two), can also the computing resource that can occupy of basis choose serial test mode or simultaneously Capable test mode.
On this basis, some post-processings can be carried out according to the multiple test report returned respectively, it is more credible to obtain Test result.
Based on the above-mentioned technical proposal, the test method of a kind of code coverage provided by the embodiments of the present application is needed determining After the object code section for carrying out code coverage test, tester only need successively to call preset automatic forwarding script and Automatic the two operating procedures of test script complete the test operation for originally needing much complex step that could complete, just as clicking Two buttons are equally simple, convenient, and the degree of automation is higher.Grasp the use of testing tool in advance also without tester simultaneously Method can directly be used as black box, and ease for use is higher, and more humanized, testing efficiency also will be enhanced.
Embodiment two
Fig. 2 is referred to, Fig. 2 is the flow chart of the test method of another code coverage provided by the embodiments of the present application, On the basis of example 1, S102 and the S103 automatic forwarding script used and automatic test script are encapsulated as by the present embodiment Transmitted test interface, and it has been embedded in written in code application in the form of plug-in unit, and exist simultaneously it is multiple right respectively Answer the transmitted test interface of different code coverage rate test tool, it is intended to a kind of concrete implementation mode is provided under this situation, Include the following steps:
S201: object code section to be tested is determined;
S202: each transmitted test interface is called to carry out code coverage test to object code section respectively;
Specifically, can be according to current system conditions, remaining cpu resource, free memory resource etc. in serial or parallel mode Between select suitable multiplex roles test mode.In the case where not special influence factor, parallel form will substantially shorten Selectable transmitted test interface completion code coverage rate test time, serial manner then can be with lesser resource Number is occupied to complete, system performance is influenced smaller.
S203: receive what each code coverage testing tool was generated and returned after the completion of code coverage test respectively Test report;
S204: extracting the numerical value for the code coverage for including in each test report, and compares to obtain maximum code coverage rate;
S205: it is reported the test report comprising maximum code coverage rate as target detection.
On the basis of S203, the numerical value for the code coverage for including in each test report is extracted first, then passes through ratio Maximum code coverage rate is relatively obtained, is then reported again using the test report comprising the maximum code coverage rate as target detection. Why reported the test report comprising the maximum code coverage rate as target detection, is because code coverage is tested just It is that the test case possessed in code coverage testing tool to be utilized to carry out code as much as possible in object code section The control to code tester quality is realized in test.And some code coverage testing tool can according to it includes test Use-case after carrying out code coverage test, obtains the generation more than other all code coverage testing tools to object code section Code coverage rate test as a result, explanation is for the object code section, survey by code coverage corresponding with target detection report Trial work has used test case more comprehensively.
Further, this can count the test report of each code coverage testing tool generation by as target detection The number of report obtains testing tool statistical form.Further, can also be joined according to the statistics in the testing tool statistical form Number determines the superiority and inferiority of each code coverage testing tool, and the in due course some poor code coverage testing tools of taking-up are corresponding Interface, to reduce to the occupancy of system resource.
Embodiment three
Fig. 3 is referred to, Fig. 3 is the same target in test method provided by the embodiments of the present application under a kind of pair of different times The flow chart for the method that the corresponding multiple test report of code segment compare, includes the following steps:
S301: it calls the preset same period to compare interface and code coverage is executed respectively under different times to object code section The multiple test report obtained after test are compared;
This step is intended to execute object code section respectively under different times by calling the preset same period to compare interface The multiple test report obtained after code coverage test are compared.It should be noted that the same period compares the generation of interface Mode is substantially the same with transmitted test interface, and the automatic perform script only encapsulated is different, the mesh of the function of used realization Difference.
It should also be noted that, signified object code section is not necessarily referring to the code being made of identical code herein Section, but present position is identical, function realization is identical, but it constitutes the code segment that code is not necessarily identical, because may It can be modified.For convenience of understanding, for example, it is assumed that the purpose of third section code be realize to light a cold light source, but in order to Realize this function, the whole story may be by repeatedly modification, but it is in this position of third section, and function remains unchanged It is constant, therefore the whole story may carry out excessive code coverage rate test, this implementation in different times to third section code The purpose of example is intended to for the test report of each modified third section code being compared using preset comparison tool, to increase Add ease for use, mitigates and manually compare spent workload.
S302: the comparison result of return is received.
Embodiment three
Fig. 4 is referred to below, and Fig. 4 is a kind of structural frames of the test macro of code coverage provided by the embodiments of the present application Figure, the test macro may include:
Object code section determination unit 100, for determining object code section to be tested;
Automatic forwarding script call unit 200, for calling preset automatic forwarding script to turn the object code section Issue corresponding code coverage testing tool;
Automatic test script call unit 300, controls the code coverage for calling preset automatic test script Rate testing tool carries out code coverage test to the object code section;Wherein, the automatic test script is by the generation Each step when code coverage rate test tool executes code coverage test obtains after carrying out scripting processing in order;
Test report receiving unit 400 is surveyed for receiving the code coverage testing tool in the code coverage The test report for generating and returning after the completion of examination.
Further, which can also include:
Information RX path acquiring unit, for calling preset automatic forwarding script to forward the object code section Before corresponding code coverage testing tool, the code coverage testing tool is obtained for receiving code segment to be measured Information RX path;
Automatic forwarding script generation unit, for generating the automatic forwarding script according to the information RX path.
Further, which can also include:
Script encapsulation and interface call directly unit, for sealing the automatic forwarding script and the automatic test script Dress is transmitted test interface, and transmitted test interface embedded code in the form of plug-in unit is write in application, is adjusted with passing through The code coverage test is carried out to the object code section with the mode of the transmitted test interface.
Wherein, script encapsulation and interface call directly unit and may include:
Multiplex roles test subelement, for calling each institute respectively when the quantity of the transmitted test interface is multiple It states transmitted test interface and the code coverage test is carried out to the object code section;
Corresponding, which may include:
More test report receiving subelements, for receiving each code coverage testing tool respectively in the code The test report for generating and returning after the completion of coverage rate test.
Further, which can also include:
Code coverage extracts and comparing unit, for receiving each code coverage testing tool respectively in institute After stating the test report that code coverage test is generated and returned after the completion, the code for including in each test report is extracted The numerical value of coverage rate, and compare to obtain maximum code coverage rate;
Target detection, which is reported, determines subelement, for that will include the test report of the maximum code coverage rate as target Test report.
Further, which can also include:
Statistic unit, for will include that the test report of the maximum code coverage rate reports it as target detection Afterwards, the number that the test report that each code coverage testing tool generates is reported as the target detection is counted, Obtain testing tool statistical form.
The test macro of the code coverage and the test method of code coverage are corresponding, the present embodiment as one with The corresponding product embodiments of embodiment of the method exist, and have beneficial effect identical with embodiment of the method, details are not described herein.
Based on the above embodiment, present invention also provides a kind of test device of code coverage, the apparatus may include Memory and processor, wherein have computer program in the memory, which calls the computer journey in the memory When sequence, step provided by above-described embodiment may be implemented.Certainly, the device can also include various necessary network interfaces, Power supply and other components etc..
Present invention also provides a kind of computer readable storage mediums, have computer program thereon, the computer program Step provided by above-described embodiment may be implemented when being performed terminal or processor execution.The storage medium may include: U Disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), the various media that can store program code such as magnetic or disk.
Specific examples are used herein to illustrate the principle and implementation manner of the present application, and between each embodiment For progressive relationship, each embodiment focuses on the differences from other embodiments, identical between each embodiment Similar portion may refer to each other.For the device disclosed in the embodiment, reference can be made to corresponding method part illustration.The above reality The explanation for applying example is merely used to help understand the present processes and its core concept.For the ordinary skill people of the art Member for, under the premise of not departing from the application principle, can also to the application, some improvement and modification can also be carried out, these improve and Modification is also fallen into the protection scope of the claim of this application.
It should also be noted that, in the present specification, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning Covering non-exclusive inclusion, so that the process, method, article or equipment for including a series of elements not only includes that A little elements, but also other elements including being not explicitly listed, or further include for this process, method, article or The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged Except there is also other identical elements in the process, method, article or equipment for including element.

Claims (10)

1. a kind of test method of code coverage characterized by comprising
Determine object code section to be tested;
Call preset automatic forwarding script that the object code section is transmitted to corresponding code coverage testing tool;
Preset automatic test script is called to control the code coverage testing tool to the object code section and carry out generation Code coverage rate test;Wherein, the automatic test script is that the code coverage testing tool is executed the code coverage Each step when rate is tested obtains after carrying out scripting processing in order;
Receive the test report that the code coverage testing tool is generated and returned after the completion of the code coverage is tested.
2. test method according to claim 1, which is characterized in that call preset automatic forwarding script by the mesh Mark code segment is transmitted to before corresponding code coverage testing tool, further includes:
The code coverage testing tool is obtained for receiving the information RX path of code segment to be measured;
The automatic forwarding script is generated according to the information RX path.
3. test method according to claim 1 or 2, which is characterized in that further include:
The automatic forwarding script and the automatic test script are encapsulated as transmitted test interface, and the transmitted test is connect Mouth embedded code in the form of plug-in unit is write in application, to the target generation in a manner of by calling the transmitted test interface Code section carries out the code coverage test.
4. test method according to claim 3, which is characterized in that by way of calling the transmitted test interface pair The object code section carries out the code coverage test, comprising:
When the quantity of the transmitted test interface is multiple, call each transmitted test interface to the target generation respectively Code section carries out the code coverage test;
It is corresponding, receive the survey that the code coverage testing tool is generated and returned after the completion of the code coverage is tested Examination report, comprising:
Receive what each code coverage testing tool was generated and returned after the completion of the code coverage is tested respectively Test report.
5. test method according to claim 4, which is characterized in that receiving each code coverage test respectively After the test report that tool is generated and returned after the completion of the code coverage is tested, further includes:
The numerical value for the code coverage for including in each test report is extracted, and compares to obtain maximum code coverage rate;
It is reported the test report comprising the maximum code coverage rate as target detection.
6. test method according to claim 5, which is characterized in that will include the test of the maximum code coverage rate After report is as target detection report, further includes:
The number that the test report that each code coverage testing tool generates is reported as the target detection is counted, Obtain testing tool statistical form.
7. a kind of test macro of code coverage characterized by comprising
Object code section determination unit, for determining object code section to be tested;
Automatic forwarding script call unit, for calling preset automatic forwarding script that the object code section is transmitted to correspondence Code coverage testing tool;
Automatic test script call unit controls the code coverage test work for calling preset automatic test script Tool carries out code coverage test to the object code section;Wherein, the automatic test script is by the code coverage Each step when testing tool executes code coverage test obtains after carrying out scripting processing in order;
Test report receiving unit, for receiving the code coverage testing tool after the completion of code coverage is tested The test report for generating and returning.
8. test macro according to claim 7, which is characterized in that further include:
Information RX path acquiring unit, for calling preset automatic forwarding script to be transmitted to the object code section pair Before the code coverage testing tool answered, the code coverage testing tool is obtained for receiving the information of code segment to be measured RX path;
Automatic forwarding script generation unit, for generating the automatic forwarding script according to the information RX path.
9. a kind of test device of code coverage characterized by comprising
Memory, for storing computer program;
Processor is realized when for executing the computer program such as code coverage as claimed in any one of claims 1 to 6 Test method.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium Program realizes the survey such as code coverage as claimed in any one of claims 1 to 6 when the computer program is executed by processor Method for testing.
CN201811475944.9A 2018-12-04 2018-12-04 Method, system and device for testing code coverage rate and readable storage medium Active CN109558328B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811475944.9A CN109558328B (en) 2018-12-04 2018-12-04 Method, system and device for testing code coverage rate and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811475944.9A CN109558328B (en) 2018-12-04 2018-12-04 Method, system and device for testing code coverage rate and readable storage medium

Publications (2)

Publication Number Publication Date
CN109558328A true CN109558328A (en) 2019-04-02
CN109558328B CN109558328B (en) 2022-04-22

Family

ID=65869140

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811475944.9A Active CN109558328B (en) 2018-12-04 2018-12-04 Method, system and device for testing code coverage rate and readable storage medium

Country Status (1)

Country Link
CN (1) CN109558328B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110515829A (en) * 2019-07-10 2019-11-29 平安普惠企业管理有限公司 Application testing method, device, equipment and computer readable storage medium
CN112306862A (en) * 2020-10-14 2021-02-02 北京健康之家科技有限公司 Front-end automatic test system and method, storage medium and computing equipment
CN112395203A (en) * 2020-11-30 2021-02-23 京东数字科技控股股份有限公司 Program testing method, device and storage medium
CN113468073A (en) * 2021-08-02 2021-10-01 在线途游(北京)科技有限公司 Automatic testing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080222609A1 (en) * 2002-05-11 2008-09-11 Accenture Global Services Gmbh Automated software testing system
CN101464831A (en) * 2009-01-09 2009-06-24 西安邮电学院 Reduction technology for test use cases
CN103678130A (en) * 2013-12-17 2014-03-26 中国联合网络通信集团有限公司 Automated performance test method and platform
CN105335293A (en) * 2015-11-30 2016-02-17 努比亚技术有限公司 Automatic testing system and method based on parallel ports
CN107832231A (en) * 2017-12-05 2018-03-23 郑州云海信息技术有限公司 A kind of system detection method, device and medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080222609A1 (en) * 2002-05-11 2008-09-11 Accenture Global Services Gmbh Automated software testing system
CN101464831A (en) * 2009-01-09 2009-06-24 西安邮电学院 Reduction technology for test use cases
CN103678130A (en) * 2013-12-17 2014-03-26 中国联合网络通信集团有限公司 Automated performance test method and platform
CN105335293A (en) * 2015-11-30 2016-02-17 努比亚技术有限公司 Automatic testing system and method based on parallel ports
CN107832231A (en) * 2017-12-05 2018-03-23 郑州云海信息技术有限公司 A kind of system detection method, device and medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110515829A (en) * 2019-07-10 2019-11-29 平安普惠企业管理有限公司 Application testing method, device, equipment and computer readable storage medium
CN112306862A (en) * 2020-10-14 2021-02-02 北京健康之家科技有限公司 Front-end automatic test system and method, storage medium and computing equipment
CN112395203A (en) * 2020-11-30 2021-02-23 京东数字科技控股股份有限公司 Program testing method, device and storage medium
CN113468073A (en) * 2021-08-02 2021-10-01 在线途游(北京)科技有限公司 Automatic testing method

Also Published As

Publication number Publication date
CN109558328B (en) 2022-04-22

Similar Documents

Publication Publication Date Title
CN107908541B (en) Interface testing method and device, computer equipment and storage medium
CN109558328A (en) A kind of test method of code coverage, system, device and readable storage medium storing program for executing
CN104407980B (en) Mobile solution automatic test device and method
CN103425574B (en) A kind of method and device of test application program
CN105760296B (en) Automatic test control method, device and terminal
CN107018523A (en) WIFI module method of testing and device
CN105094783A (en) Method and device for testing Android application stability
CN111124919A (en) User interface testing method, device, equipment and storage medium
CN104820640A (en) Webpage testing method and device
CN110134612A (en) UI test data generating method, device, equipment and readable storage medium storing program for executing
CN110457211A (en) Script performance test methods, device and equipment and computer storage medium
CN105653946A (en) Android malicious behavior detection system based on combined event behavior triggering and detection method of Android malicious behavior detection system
CN115080398A (en) Automatic interface test system and method
CN108874649A (en) Generation method, device and its computer equipment of automatic test script
CN102707712B (en) Electronic equipment fault diagnosis method and system
Panigrahi et al. An approach to prioritize the regression test cases of object-oriented programs
CN108256322A (en) Safety detecting method, device, computer equipment and storage medium
CN110162453A (en) Test method, device, computer readable storage medium and computer equipment
CN103049374B (en) Automatic testing method and device
CN107608873A (en) Method for testing software and system and test platform
CN105760300B (en) A kind of automated testing method and test macro of STK/UTK business
CN107741909A (en) A kind of automated testing method and system for distributed block storage
CN104063307A (en) Software testing method and system
CN110267215A (en) A kind of data detection method, equipment and storage medium
CN109426612B (en) Automatic use case development system based on intelligent machine learning

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
GR01 Patent grant
GR01 Patent grant