CN104699596A - Method and device for processing code coverage rate - Google Patents

Method and device for processing code coverage rate Download PDF

Info

Publication number
CN104699596A
CN104699596A CN201310656105.8A CN201310656105A CN104699596A CN 104699596 A CN104699596 A CN 104699596A CN 201310656105 A CN201310656105 A CN 201310656105A CN 104699596 A CN104699596 A CN 104699596A
Authority
CN
China
Prior art keywords
test
code coverage
software unit
unit
testing
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
CN201310656105.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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201310656105.8A priority Critical patent/CN104699596A/en
Priority to PCT/CN2014/078560 priority patent/WO2014180396A1/en
Publication of CN104699596A publication Critical patent/CN104699596A/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

Abstract

The invention provides a method and a device for processing code coverage rate. The method comprises the following steps: scanning software units; testing the code coverage rate of one or more scanned software units; generating the test result of the code coverage rate of one or more software units. Through the method, the problems of much human intervention, complex process and low test efficiency existing in the test of the code coverage rate in correlation technique are solved, and then the effects of completely automating the test of the code coverage rate, reducing the complexity of the process and effectively improving the test efficiency are achieved.

Description

Code coverage disposal route and device
Technical field
The present invention relates to the communications field, in particular to a kind of code coverage disposal route and device.
Background technology
Along with the development of telecommunication service, increasing of the kind of value-added telecom services, provides the software of service and equipment progressively to increase, and the test of software becomes increasingly complex and loaded down with trivial details.Code coverage is used to means of measuring test completeness.The coverage rate of software can be divided into Logic coverage (code coverage and structuring cover) and functional coverage generally.Whether, by coverage data, can know and test abundant, the weakness of test in which, and then can go out the test case that can increase coverage rate by design.Therefore, code coverage, as an important measurement index of software test, more and more comes into one's own.But in the related, the test of code coverage is needed to the object manually determining to test, and can only test for an object during test, not only human intervention is many, and flow process is miscellaneous, and testing efficiency is not high yet.
Therefore, in the related, there is human intervention to the test of code coverage many, flow process is miscellaneous, and the problem that testing efficiency is not high.
Summary of the invention
The invention provides a kind of code coverage disposal route and device, at least to solve in the related, there is human intervention to the test of code coverage many, flow process is miscellaneous, and the problem that testing efficiency is not high.
According to an aspect of the present invention, provide a kind of code coverage disposal route, comprising: software unit is scanned; The code coverage of the one or more software units scanned is tested; Generate the code coverage test result of described one or more software unit.
Preferably, carry out scanning to described software unit to comprise: determine the predetermined condition of scanning scanned described software unit; According to the described predetermined condition of scanning determined, described software unit is scanned.
Preferably, carry out test to the described code coverage of the described one or more software unit scanned to comprise: select test case, testing tool and the test environment corresponding with described test case and testing tool tested the described code coverage of described one or more software unit; Under described test environment, described testing tool and the code coverage of described test case to the described one or more software unit scanned is adopted to test.
Preferably, after the described code coverage of the described one or more software unit scanned is tested, also comprise: generate the one or more software unit testing results when code coverage of described one or more software unit is tested.
Preferably, after one or more code coverage test result and described one or more software unit testing result of the described one or more software unit generated, also comprise: described one or more code coverage test result and/or described one or more software unit testing result are shown.
According to a further aspect in the invention, provide a kind of code coverage treating apparatus, comprising: scan module, for scanning software unit; Test module, for testing the code coverage of the described one or more software unit scanned; First generation module, for generating the code coverage test result of described one or more software unit.
Preferably, described scan module comprises: determining unit, for determining the predetermined condition of scanning scanned described software unit; Scanning element, for scanning described software unit according to the described predetermined condition of scanning determined.
Preferably, described test module comprises: selection unit, for selecting test case, testing tool and the test environment corresponding with described test case and testing tool tested the described code coverage of described one or more software unit; Test cell, under described test environment, adopts described testing tool and the code coverage of described test case to the described one or more software unit scanned to test.
Preferably, this device also comprises: the second generation module, for generating one or more software unit testing results when testing the code coverage of described one or more software unit.
Preferably, this device also comprises: display module, for showing described one or more code coverage test result and/or described one or more software unit testing result.
By the present invention, adopt and software unit is scanned; The code coverage of the described one or more software unit scanned is tested; Generate the code coverage test result of described one or more software unit, solve in the related, human intervention is existed to the test of code coverage many, flow process is miscellaneous, and the problem that testing efficiency is not high, and then reach full-automation is tested to code coverage, not only reduce miscellaneous property of flow process, and effectively improve the effect of testing efficiency.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide a further understanding of the present invention, and form a application's part, schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the process flow diagram of the code coverage disposal route according to the embodiment of the present invention;
Fig. 2 is the structured flowchart of the code coverage treating apparatus according to the embodiment of the present invention;
Fig. 3 is the preferred structure block diagram of scan module 22 in the code coverage treating apparatus according to the embodiment of the present invention;
Fig. 4 is the preferred structure block diagram of test module 24 in the code coverage treating apparatus according to the embodiment of the present invention;
Fig. 5 is the preferred structure block diagram one of the code coverage treating apparatus according to the embodiment of the present invention;
Fig. 6 is the preferred structure block diagram two of the code coverage treating apparatus according to the embodiment of the present invention;
Fig. 7 is the structured flowchart of code coverage automatization test system according to the preferred embodiment of the present invention;
Fig. 8 is the process flow diagram of the code coverage automated testing method according to the embodiment of the present invention;
Fig. 9 is the process flow diagram of unit automatic test module 76 test according to the preferred embodiment of the present invention.
Embodiment
Hereinafter also describe the present invention in detail with reference to accompanying drawing in conjunction with the embodiments.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.
Provide a kind of code coverage disposal route in the present embodiment, Fig. 1 is the process flow diagram of the code coverage disposal route according to the embodiment of the present invention, and as shown in Figure 1, this flow process comprises the steps:
Step S102, scans software unit, it should be noted that, this software unit can be the tested object of code coverage.The software code referring to a functional module under normal circumstances;
Step S104, tests the code coverage of the one or more software units scanned;
Step S106, generates the code coverage test result of one or more software unit.
Pass through above-mentioned steps, adopt and software unit is scanned, the one or more software units scanned are tested, after needing to determine software unit artificially in correlation technique, by artificially arranging test parameter, software unit is tested, cause that human intervention is existed to the test of code coverage many, flow process is miscellaneous, and the problem that testing efficiency is not high, adopt above-mentioned scanning, the software unit scanned is tested automatically, achieve and full-automation is tested to code coverage, not only reduce miscellaneous property of flow process, and effectively improve the effect of testing efficiency.
When software unit is scanned, difference according to the target software unit needing test can arrange the different predetermined conditions of scanning, also according to the difference of the frequency to test, can be set (such as the different scanning periods, can timing scan be set), such as, before software unit is scanned, first determine the predetermined condition of scanning (such as, to some screening conditions of software unit) that software unit is scanned; According to the predetermined condition of scanning determined, software unit is scanned.
When the code coverage of the one or more software units upgraded is tested, realize the test each software unit scanned being realized to robotization, in the process of test, first select test case, testing tool and the test environment corresponding with test case and testing tool that the code coverage of one or more software unit is tested; Under the test environment, testing tool and the code coverage of test case to the one or more software units scanned is adopted to test.It should be noted that, said process is all triggered by robotization, and robotization is selected, what what robotization was built pre-set, wherein, do not need artificial intervention, not only for the test of a software unit, the test to multiple software unit can also be realized simultaneously.
Test detail involved in the process that the code coverage of software unit is tested is informed in order to clearer, after the code coverage of the one or more software units scanned is tested, the one or more software unit testing results when code coverage of one or more software unit is tested can be generated.This software unit testing result can comprise plurality of kinds of contents, such as, the following can be comprised one of at least: the unit title of test, the testing tool of use, the test case number altogether tested, test result are be successfully failed number of cases etc. by number of cases, test result.
In order to show code coverage test result and/or software unit testing result intuitively, after one or more code coverage test result and one or more software unit testing result of the one or more software units generated, can also show one or more code coverage test result and/or one or more software unit testing result.
Additionally provide a kind of code coverage treating apparatus in the present embodiment, this device is used for realizing above-described embodiment and preferred implementation, has carried out repeating no more of explanation.As used below, term " module " can realize the software of predetermined function and/or the combination of hardware.Although the device described by following examples preferably realizes with software, hardware, or the realization of the combination of software and hardware also may and conceived.
Fig. 2 is the structured flowchart of the code coverage treating apparatus according to the embodiment of the present invention, and as shown in Figure 2, this device comprises scan module 22, test module 24 and the first generation module 26, is described below to this device.
Scan module 22, for scanning software unit; Test module 24, is connected to above-mentioned scan module 22, for testing the code coverage of the one or more software units scanned; First generation module 26, is connected to above-mentioned test module 24, for generating the code coverage test result of one or more software unit.
Fig. 3 is the preferred structure block diagram of scan module 22 in the code coverage treating apparatus according to the embodiment of the present invention, and as shown in Figure 3, this scan module 22 comprises determining unit 32 and scanning element 34, is described below to this scan module 22.
Determining unit 32, for determining the predetermined condition of scanning scanned software unit; Scanning element 34, is connected to above-mentioned determining unit 32, for scanning software unit according to the predetermined condition of scanning determined.
Fig. 4 is the preferred structure block diagram of test module 24 in the code coverage treating apparatus according to the embodiment of the present invention, and as shown in Figure 4, this test module 24 comprises selection unit 42 and test cell 44, is described below to this test module 24.
Selection unit 42, for selecting test case, testing tool and the test environment corresponding with test case and testing tool tested the code coverage of one or more software unit; Test cell 44, is connected to above-mentioned selection unit 42, under the test environment, adopts testing tool and the code coverage of test case to the one or more software units scanned to test.
Fig. 5 is the preferred structure block diagram one of the code coverage treating apparatus according to the embodiment of the present invention, and as shown in Figure 5, this device, except comprising all modules shown in Fig. 2, also comprises: the second generation module 52, is described below to this second generation module 52.
This second generation module 52, is connected to above-mentioned test module 24, for generating one or more software unit testing results when testing the code coverage of one or more software unit.
Fig. 6 is the preferred structure block diagram two of the code coverage treating apparatus according to the embodiment of the present invention, and as shown in Figure 6, this device, except comprising all modules shown in Fig. 5, also comprises display module 62, is described below to this display module 62.
Display module 62, is connected to above-mentioned first generation module 26 and/or the second generation module 52, for showing one or more code coverage test result and/or one or more software unit testing result.
For cannot the automatic test of code coverage rate in correlation technique, provide a kind of scheme of code coverage rate automatic test in the present embodiment, the program comprises: the unit that timing scan upgrades, to the unit scanning renewal, call unit automatic test function carries out automatic test, and the code coverage result of unit testing result and unit testing is uploaded to given server.Be supplied to interface, in order to show all previous test process of each unit and result intuitively, all previous destination file of comparison upgrades simultaneously.
Below in conjunction with accompanying drawing, the preferred embodiment for the present invention is described.
Fig. 7 is the structured flowchart of code coverage automatization test system according to the preferred embodiment of the present invention, as shown in Figure 7, this system comprises: interface module 70(function is with above-mentioned display module 62), task scan module 72(function is with above-mentioned scan module 22), results server 74 and unit automatic test module 76(function be with above-mentioned test module 24).
Interface module 70, for showing all previous test process of each unit and result, browses test result file, browses the code coverage result of test, and the function that all previous destination file of comparison upgrades.
Task scan module 72, for the task condition according to setting, the unit that timing scan upgrades, call unit automatic test module 76, uploads to the results server 74 of specifying by test result.
Results server 74, in order to preserve the destination file produced in task scan module 72.
Unit automatic test module 76(can be multiple, and such as, module is surveyed in unit 1 automatic test module ~ unit n robotization) build test environment, send test post, carry out the test of nominative testing example.
Unit automatic test module 76, for realizing the object of each unit being carried out to automatic test, automatically building test environment, automatically sending test post, automatically the test of nominative testing use-case is carried out, the code coverage destination file of automatically generating unit test destination file and unit testing.
Unit automatic test module 76, starts testing tool automatically, and uploaded in the results server of specifying by the unit of needs test, remote activation test platform, builds test environment.
Unit automatic test module 76, can also start one and wake test procedure up, and this program sends one and wakes test post up to testing tool, and testing tool starts to send test post to test cell after receiving and waking test post up.Wherein, this testing tool can be tested test cell according to nominative testing use-case.
Whether unit automatic test module 76, also generate for automated security scan file, generating, stopping testing tool, closing test environment when scanning destination file.Wherein, the destination file of this unit automatic test CMOS macro cell comprises the code coverage destination file of unit testing destination file and test.
Preferably, the unit testing destination file that this unit automatic test module 76 generates can be the file of a general specified format, comprise the unit title of test, the testing tool used, the test case number altogether tested, test result is successful number of cases, and test result is failed use number of cases.The code coverage test result file that unit automatic test module 76 generates can comprise the code file name of test, the total line number of code, the lines of code of test.
Fig. 8 is the process flow diagram of the code coverage automated testing method according to the embodiment of the present invention, and as shown in Figure 8, this flow process comprises the steps:
Step S802, each unit of time timing scan configured according to task by task scan module 72;
By task scan module 72, step S804, judges whether active cell has renewal, if there is renewal to enter step S806, otherwise enter step S808;
Step S806, by task scan module 72 call unit automatic test module 76, starts automatic test;
Step S808, when scanning one or more software unit of renewal, testing the code coverage of the one or more software units upgraded, and by task scan module 72, destination file being uploaded to the results server 74 of specifying;
Step S810, shows this unit testing result by interface module 70.
Step S812, the code coverage test result of being tested by interface module 70 display unit.
Step S814, scans next unit by task scan module 72;
Step S816, all unit scan complete.
Fig. 9 is the process flow diagram of unit automatic test module 76 test according to the preferred embodiment of the present invention, and as shown in Figure 9, this flow process comprises the steps:
Step S902, to be uploaded to the test cell of specifying by File Transfer Protocol by unit automatic test module 76 in the results server of specifying;
Step S904, starts test platform by unit automatic test module 76 by TELNET protocol remote;
Step S906, starts wake up procedure by unit automatic test module 76, sends and wakes test post up to unit test tool;
Step S908, unit test tool receives and wakes test post up, starts to test;
Step S910, whether unit automatic test module 76 scanning result file generates;
Step S912, wait timeout when unit automatic test module 76 judged result file does not generate;
Step S914, unit destination file has generated or time-out, stops testing tool, long-range stopping test platform.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of calculation element, thus, they can be stored and be performed by calculation element in the storage device, and in some cases, step shown or described by can performing with the order be different from herein, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. a code coverage disposal route, is characterized in that, comprising:
Software unit is scanned;
The code coverage of the one or more software units scanned is tested;
Generate the code coverage test result of described one or more software unit.
2. method according to claim 1, is characterized in that, carries out scanning comprise described software unit:
Determine the predetermined condition of scanning that described software unit is scanned;
According to the described predetermined condition of scanning determined, described software unit is scanned.
3. method according to claim 1, is characterized in that, carries out test comprise the described code coverage of the described one or more software unit scanned:
Select test case, testing tool and the test environment corresponding with described test case and testing tool that the described code coverage of described one or more software unit is tested;
Under described test environment, described testing tool and the code coverage of described test case to the described one or more software unit scanned is adopted to test.
4. method according to claim 1, is characterized in that, after testing the described code coverage of the described one or more software unit scanned, also comprises:
Generate the one or more software unit testing results when code coverage of described one or more software unit is tested.
5. method according to claim 4, is characterized in that, after one or more code coverage test result and described one or more software unit testing result of the described one or more software unit generated, also comprises:
Described one or more code coverage test result and/or described one or more software unit testing result are shown.
6. a code coverage treating apparatus, is characterized in that, comprising:
Scan module, for scanning software unit;
Test module, for testing the code coverage of the one or more software units scanned;
First generation module, for generating the code coverage test result of described one or more software unit.
7. device according to claim 6, is characterized in that, described scan module comprises:
Determining unit, for determining the predetermined condition of scanning scanned described software unit;
Scanning element, for scanning described software unit according to the described predetermined condition of scanning determined.
8. device according to claim 6, is characterized in that, described test module comprises:
Selection unit, for selecting test case, testing tool and the test environment corresponding with described test case and testing tool tested the described code coverage of described one or more software unit;
Test cell, under described test environment, adopts described testing tool and the code coverage of described test case to the described one or more software unit scanned to test.
9. device according to claim 6, is characterized in that, also comprises:
Second generation module, for generating one or more software unit testing results when testing the code coverage of described one or more software unit.
10. device according to claim 9, is characterized in that, also comprises:
Display module, for showing described one or more code coverage test result and/or described one or more software unit testing result.
CN201310656105.8A 2013-12-06 2013-12-06 Method and device for processing code coverage rate Pending CN104699596A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201310656105.8A CN104699596A (en) 2013-12-06 2013-12-06 Method and device for processing code coverage rate
PCT/CN2014/078560 WO2014180396A1 (en) 2013-12-06 2014-05-27 Code coverage rate processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310656105.8A CN104699596A (en) 2013-12-06 2013-12-06 Method and device for processing code coverage rate

Publications (1)

Publication Number Publication Date
CN104699596A true CN104699596A (en) 2015-06-10

Family

ID=51866776

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310656105.8A Pending CN104699596A (en) 2013-12-06 2013-12-06 Method and device for processing code coverage rate

Country Status (2)

Country Link
CN (1) CN104699596A (en)
WO (1) WO2014180396A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111104333A (en) * 2019-12-20 2020-05-05 广州品唯软件有限公司 Coverage rate test method, test device and computer readable storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294129A (en) * 2016-07-27 2017-01-04 北京小米移动软件有限公司 Code coverage method of testing and device
CN106294182B (en) * 2016-08-24 2021-02-09 腾讯科技(深圳)有限公司 Method, test equipment and system for determining public test feedback effectiveness
CN109460357B (en) * 2018-10-19 2021-10-29 北京新能源汽车股份有限公司 Method, device and equipment for testing code coverage rate

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060236156A1 (en) * 2005-04-15 2006-10-19 Microsoft Corporation Methods and apparatus for handling code coverage data
CN101706751A (en) * 2009-11-23 2010-05-12 中兴通讯股份有限公司 Method and system for calculating coverage rate of service functions of software
CN103425573A (en) * 2012-05-24 2013-12-04 腾讯科技(深圳)有限公司 Code testing information collecting method and system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100370465C (en) * 2004-09-04 2008-02-20 华为技术有限公司 Method and system for automatic schedule logic simulation and code coverage rate analysis
CN100487667C (en) * 2005-12-14 2009-05-13 中兴通讯股份有限公司 System and method for automatically testing software unit
CN103365771B (en) * 2012-04-10 2016-02-17 阿里巴巴集团控股有限公司 A kind of preparation method of code coverage and equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060236156A1 (en) * 2005-04-15 2006-10-19 Microsoft Corporation Methods and apparatus for handling code coverage data
CN101706751A (en) * 2009-11-23 2010-05-12 中兴通讯股份有限公司 Method and system for calculating coverage rate of service functions of software
CN103425573A (en) * 2012-05-24 2013-12-04 腾讯科技(深圳)有限公司 Code testing information collecting method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111104333A (en) * 2019-12-20 2020-05-05 广州品唯软件有限公司 Coverage rate test method, test device and computer readable storage medium

Also Published As

Publication number Publication date
WO2014180396A1 (en) 2014-11-13

Similar Documents

Publication Publication Date Title
CN102355500B (en) Service push method and device
EP2437524A1 (en) M2m service platform and work method thereof
CN105701000B (en) Service test method and device
CN105303112B (en) The detection method and device of component call loophole
CN103761178B (en) A kind of method realized using unloading investigation
CN104796302A (en) Method and system for testing network element simulators
CN104699596A (en) Method and device for processing code coverage rate
US20090036115A1 (en) System and method for testing gsm modules
CN110297640A (en) Method, apparatus, storage medium and the electronic equipment of model deployment
CN110515855B (en) Simulation control method, server and system for application program
CN102752770B (en) Method and device for polling service system
CN104239114A (en) Application compiling method and device
CN109976724A (en) Development approach, device, equipment and the computer readable storage medium of leasing system
CN105577463A (en) Testing method and testing device based on communication protocol
CN109614164A (en) Realize plug-in unit configurable method, apparatus, equipment and readable storage medium storing program for executing
CN115514667A (en) Access service processing method, system, device, electronic equipment and storage medium
CN106792784A (en) A kind of method, server and system that data check is carried out in server side
CN106201852A (en) A kind of distributed test method and test system
CN106708688B (en) Module test method and terminal
CN102841843B (en) Compatible determination methods and device
CN106294119A (en) Test dispatching system, method and terminal unit
CN103618789A (en) Method and equipment for building connection between client sides
CN103197665A (en) Remote control testing device and remote control method for carrying out controlling on electronic equipment
CN103036911A (en) Business data processing system and business data processing method
CN112650815B (en) Method and device for synchronizing environment data, storage medium and electronic device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20150610