CN105404585A - Method and apparatus for acquiring code coverage rate - Google Patents

Method and apparatus for acquiring code coverage rate Download PDF

Info

Publication number
CN105404585A
CN105404585A CN201510864686.3A CN201510864686A CN105404585A CN 105404585 A CN105404585 A CN 105404585A CN 201510864686 A CN201510864686 A CN 201510864686A CN 105404585 A CN105404585 A CN 105404585A
Authority
CN
China
Prior art keywords
app
code
code coverage
coverage information
compiling
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
CN201510864686.3A
Other languages
Chinese (zh)
Other versions
CN105404585B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201510864686.3A priority Critical patent/CN105404585B/en
Publication of CN105404585A publication Critical patent/CN105404585A/en
Application granted granted Critical
Publication of CN105404585B publication Critical patent/CN105404585B/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

Abstract

The present invention discloses a method and an apparatus for acquiring a code coverage rate, and belongs to the field of communication. The method comprises: a testing device acquiring compilation results and compilation numbers of m APPs; the testing device acquiring a testing case, configured by a user, of each of the m APPs; the testing device testing each compilation result according to the testing case of each APP, and generating a first code coverage information file; and the testing device sending the first code coverage information file to a server, so that the server calculates a code coverage rate according to the first code coverage information file. The method and apparatus solve the problem that a valid code coverage rate cannot be accurately acquired in the case that a parallel crossed test is performed on multiple users, multiple testing devices or multiple versions of APPs, thereby enhancing convenience of acquiring the code coverage rate and improving working efficiency of testers.

Description

Obtain method and the device of code coverage
Technical field
The present invention relates to the communications field, particularly a kind of method and device obtaining code coverage.
Background technology
Code coverage is the one tolerance in software test, and it describes ratio and degree that the source code in program is performed.Whether, at present, in software test field, technician needs the code coverage of acquisition program, effectively tested according to this code coverage determination program by complete.
Current exist a kind of method obtaining code coverage, comprise: user can to the application program (Application of server input needs test, APP) version number, server obtains the source code of corresponding version according to this version number, pitching pile compiling is carried out to this source code, obtain compiling result and part of effectively composing a piece of writing, effectively style of writing part comprises effective code line in this source code; This compiling result is arranged in testing apparatus by user again, testing apparatus is tested this compiling result according to test case, and after test terminates, produce code coverage message file, this code coverage message file comprises the line number of the code line be performed in this source code, and this code coverage message file is sent to server; Server according to this code coverage message file and this part of effectively composing a piece of writing, Accounting Legend Code coverage rate.
Realizing in process of the present invention, inventor finds that prior art at least exists following problem:
The APP that prior art is only limited to a user corresponding version in a testing apparatus tests, and can not realize multi-user, the APP of multiple stage testing apparatus or multiple version walks abreast cross-beta.
Summary of the invention
In order to solve the problem of prior art, embodiments provide a kind of method and the device that obtain code coverage.Described technical scheme is as follows:
First aspect, provide a kind of method obtaining code coverage, it is characterized in that, described method comprises:
Testing apparatus obtains compiling result and the compiling number of m APP, m be more than or equal to 1 integer, the compiling result of described APP and compiling number carry out pitching pile compiling to the source code of described APP to obtain, and described compiling number is for the version of the version and described source code that identify described APP;
Described testing apparatus obtains the test case of each APP in a user configured described m APP;
Described testing apparatus is tested each described compiling result respectively according to the test case of described each APP, and generating first code coverage information file, described first code coverage information file comprises the device identification of described testing apparatus, the user ID of described user, the compiling number of described each APP and the compiling number corresponding code line coverage information of described each APP;
Described testing apparatus sends described first code coverage information file to server, makes described server according to described first code coverage information file Accounting Legend Code coverage rate.
Second aspect, provide a kind of method obtaining code coverage, it is characterized in that, described method comprises:
Receive n first code coverage information file, first code coverage information file comprises the compiling number of each APP in device identification, user ID, a m APP and the compiling number corresponding code line coverage information of described each APP, m and n is the integer being more than or equal to 1;
Obtain initial conditions, described initial conditions comprises at least one in the compiling number of device identification to be analyzed, user ID and APP;
Merge the code coverage information meeting described initial conditions in described n first code coverage information file and obtain second code coverage information file;
According to described second code coverage information file Accounting Legend Code coverage rate.
The third aspect, provide a kind of device obtaining code coverage, it is characterized in that, described device comprises:
First acquisition module, for obtaining compiling result and the compiling number of m APP, m be more than or equal to 1 integer, the compiling result of described APP and compiling number carry out pitching pile compiling to the source code of described APP to obtain, and described compiling number is for the version of the version and described source code that identify described APP;
Second acquisition module, for obtaining the test case of each APP in user configured described m APP;
Self-adaptive module, test case for the described each APP got according to described second acquisition module is tested the described compiling result that each described first acquisition module gets respectively, and generating first code coverage information file, described first code coverage information file comprises the device identification of described testing apparatus, the user ID of described user, the compiling number of described each APP and the compiling number corresponding code line coverage information of described each APP;
Sending module, sends the described first code coverage information file of described Self-adaptive CMOS macro cell to server for described device, make described server according to described first code coverage information file Accounting Legend Code coverage rate.
Fourth aspect, provide a kind of device obtaining code coverage, it is characterized in that, described device comprises:
Receiver module, for receiving n first code coverage information file, first code coverage information file comprise the compiling of the compiling number of each APP in device identification, user ID, a m APP and described each APP number corresponding be performed code line coverage information, m and n is the integer being more than or equal to 1;
Acquisition module, for obtaining initial conditions, described initial conditions comprises at least one in the compiling number of device identification to be analyzed, user ID and APP;
Merging module, obtaining second code coverage information file for merging the code coverage information meeting the described initial conditions that described acquisition module gets in described n first code coverage information file that described receiver module receives;
Computing module, for the described second code coverage information file Accounting Legend Code coverage rate obtained according to described merging module.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is:
By testing apparatus obtain m APP compiling result, compile number and test case, and according to the test case of each APP, each described compiling result is tested, and generate first code coverage information file, then send this first code coverage information file to server, make server according to this first code coverage information file Accounting Legend Code coverage rate; Solving under multi-user, multiple stage testing apparatus or multiple version APP walk abreast cross-beta situation can not the problem of the effective code coverage of Obtaining Accurate; Reach the effect improving and obtain code coverage convenience and improve tester's work efficiency.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme in the embodiment of the present invention, below the accompanying drawing used required in describing embodiment is briefly described, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the network architecture diagram of embodiment of the present invention application;
Fig. 2 is a kind of process flow diagram obtaining code coverage method that one embodiment of the invention provides;
Fig. 3 is a kind of process flow diagram obtaining code coverage method that another embodiment of the present invention provides;
Fig. 4 is a kind of process flow diagram obtaining code coverage method that another embodiment of the present invention provides;
A kind of block diagram obtaining code coverage device that Fig. 5 A one embodiment of the invention provides;
The one test APP that Fig. 5 B one embodiment of the invention provides, and generate the block diagram of the first code coverage information file device corresponding with this APP;
Fig. 6 A is a kind of block diagram obtaining code coverage device that another embodiment of the present invention provides;
Fig. 6 B is the block diagram that the code coverage information meeting initial conditions in a kind of n of merging first code coverage information file providing of one embodiment of the invention obtains second code coverage information file device;
The block diagram of the Accounting Legend Code coverage rate device that Fig. 6 C one embodiment of the invention provides;
Fig. 7 is a kind of block diagram obtaining code coverage device that another embodiment of the present invention provides;
Fig. 8 is the structural representation of the electronic equipment that one embodiment of the invention provides;
Fig. 9 is the structural representation of the server that one embodiment of the invention provides.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
See the network architecture diagram that Fig. 1, Fig. 1 are embodiment of the present invention application, this network architecture can comprise at least one server 120 and terminal 140.
Server 120 for storing first code coverage information file, this first code coverage information file can comprise the device identification of terminal 140, the user ID of user performing test, the compiling number of tested each APP and each APP compiling number corresponding be performed code line coverage information.
Server 120 also can be used for obtaining at least one in the information such as compiling number of above-mentioned device identification, user ID and APP.
At least one information that server 120 also can be used for obtaining according to server 120 merges first code coverage information and obtains second code coverage information file, and according to this second code coverage information file Accounting Legend Code coverage rate.
Terminal 140 can be used for obtaining server to the compiling result produced after APP compiling and compiling number.
It is the test case that each APP configures that terminal 140 also can be used for obtaining user.
Terminal 140 also can be used for testing each described compiling result according to the test case of above-mentioned each APP, and generates first code coverage information file, and this first code coverage information file is sent to server 120.
Optionally, terminal 140 can be smart mobile phone, panel computer, intelligent television, E-book reader, multimedia player, pocket computer on knee and desk-top computer etc.Can be connected by wireless network or cable network between terminal 140 with server 120.
Fig. 2 is a kind of process flow diagram obtaining code coverage method that one embodiment of the invention provides, and the method comprises:
In step 201, testing apparatus obtains compiling result and the compiling number of m APP, m be more than or equal to 1 integer, the compiling result of this APP and compiling number carry out pitching pile compiling to the source code of this APP to obtain, and this compiling number is for the version of the version He this source code that identify this APP.
In step 202., this testing apparatus obtains the test case of each APP in user configured this m APP.
In step 203, this testing apparatus is tested each described compiling result according to the test case of this each APP, and generating first code coverage information file, this first code coverage information file comprises the device identification of this testing apparatus, the user ID of this user, the compiling number of this each APP and the compiling number corresponding code line coverage information of this each APP.
In step 204, this testing apparatus sends this first code coverage information file to server, makes this server according to this first code coverage information file Accounting Legend Code coverage rate.
In sum, the acquisition code coverage method that the present embodiment provides, by testing apparatus obtain m APP compiling result, compile number and test case, and according to the test case of each APP, each described compiling result is tested, and generate first code coverage information file, then send this first code coverage information file to server, make server according to this first code coverage information file Accounting Legend Code coverage rate; Solving under multi-user, multiple stage testing apparatus or multiple version APP walk abreast cross-beta situation can not the problem of the effective code coverage of Obtaining Accurate; Reach the effect improving and obtain code coverage convenience and improve tester's work efficiency.
Fig. 3 is a kind of process flow diagram obtaining code coverage method that another embodiment of the present invention provides, and the method comprises:
In step 301, receive n first code coverage information file, first code coverage information file comprises the compiling number of each APP in device identification, user ID, a m APP and the compiling number corresponding code line coverage information of this each APP, m and n is the integer being more than or equal to 1.
In step 302, obtain initial conditions, this initial conditions comprises at least one in the compiling number of device identification to be analyzed, user ID and APP.
In step 303, merge the code coverage information meeting this initial conditions in this n first code coverage information file and obtain second code coverage information file.
In step 304, according to this second code coverage information file Accounting Legend Code coverage rate.
In sum, the acquisition code coverage method that the present embodiment provides, receive n first code coverage information file by server and obtain initial conditions, then merge the code coverage information meeting this initial conditions in this n first code coverage information file and obtain second code coverage information file, according to this second code coverage information file Accounting Legend Code coverage rate; Solving under multi-user, multiple stage testing apparatus or multiple version APP walk abreast cross-beta situation can not the problem of the effective code coverage of Obtaining Accurate; Reach the effect improving and obtain code coverage convenience and improve tester's work efficiency.
Fig. 4 is a kind of process flow diagram obtaining code coverage method that another embodiment of the present invention provides, the method carries out pitching pile compiling by server to the source code of APP to be compiled, obtain the compiling result of APP to be tested, effective style of writing part and compiling number, and store the corresponding relation of this compiling number and this part of effectively composing a piece of writing, testing apparatus obtains the compiling result of m APP, compiling number and test case, and according to the test case of each APP, each described compiling result is tested, become first code coverage information file, then this first code coverage information file is sent to server, server receives n first code coverage information file and obtains initial conditions, then merge the code coverage information meeting this initial conditions in this n first code coverage information file and obtain second code coverage information file, according to this second code coverage information file and part Accounting Legend Code coverage rate of effectively composing a piece of writing.See Fig. 4, the method comprises:
In step 401, server receives APP to be compiled and identifies and APP version number, pulls and the source code that APP to be compiled identifies and APP version number is corresponding from code library.
APP mark to be compiled and APP version number are that tester sends to server by testing apparatus, when developing certain redaction APP, tester can input the APP mark of this APP to testing apparatus and need this APP version number of test, testing apparatus is identified by the APP of this APP and APP version number identifies and APP version number as APP to be compiled, and sends to server.
APP mark is used for unique identification APP, can by being numbered the mark as APP to APP all in terminal, such as APP1, APP2.
Code library is for storing the source code set of at least one APP, the source code set of this APP comprises source code subclass corresponding at least one this APP version, and the source code subclass that this APP version is corresponding comprises at least one source code corresponding to this APP version.
For this APP, source code in the source code subclass that each APP version of this APP is corresponding is all that technician develops, be specially: technician is when developing certain APP version of this APP, first the source code of first version corresponding to this APP version is write out, the version of this source code is first version, and is stored by the source code of first version in source code subclass corresponding to this APP version; Then the source code of first version is tested, if test out the defect existed in the source code of first version, again the source code of first version is modified and obtain the source code of the second edition, the version of this source code is the second edition, is stored in by the source code of the second edition in source code subclass corresponding to this APP version; The source code of the second edition is tested, repeats said process, until not the source code of existing defects as ultimate source code corresponding to this APP version.So there is the source code of at least one version corresponding to this APP version in code library.
Such as, for APP1, when developer develops 3.0 version of APP1, first the source code 3.01 of first version corresponding to version 3 .01 is write, the version of source code 3.01 is 3.01, then the source code of 3.01 versions is tested, if test out the defect existed in the source code of 3.01 versions, again the source code of 3.01 versions is modified and obtain the source code of 3.02 versions, the version of this source code is 3.02, is stored in by the source code of 3.02 versions in source code subclass corresponding to this APP version; Test the source code of 3.02 versions, repeat said process, until the source code of not existing defects, such as, 3.04 version source codes, then 3.04 version source codes are as ultimate source code corresponding to this APP3.0 version.
Wherein, also need to illustrate: each source code in code library comprises APP mark and APP version and the source code version of self of the APP that this source code belongs to.Such as, for the source code 3.01 of APP1, source code 3.01 comprises APP mark, the APP version 3 .0 and source code version 3 .01 of APP1.
This step can be: server receives APP mark to be compiled and the APP version number of testing apparatus transmission, search from code library and comprise APP mark to be compiled and the source code of APP version number, from the source code searched, obtain the source code that source code version is up-to-date.For above-mentioned APP1 and 3.0 versions, server receives APP mark to be compiled that testing apparatus sends and APP version number is respectively APP1 and 3.0, so search the source code comprising APP1 to be compiled and 3.0 version numbers from code library, from the source code searched, obtain 3.04 source codes that source code version is up-to-date.
In step 402, server carries out pitching pile compiling to the source code of APP to be compiled, obtains the compiling result of APP to be tested, effectively style of writing part and compiling number.
This step can be: the compilation of source code of APP to be compiled is become binary executable code by server, in the process of compiling, the line number of the valid code row in this source code is marked, the invalid code such as comment line and null ignored in source code is capable, after having compiled this source code, the line number of the valid code row of mark is stored in and effectively composes a piece of writing in part, the version number for the APP version number He this source code identifying APP to be compiled is set.
This binary executable code is the compiling result of pitching pile compiling, and this compiling result is designated as build_result.This compiling result can tested recognition of devices, can be installed to and testing apparatus make testing apparatus complete test to this APP.
Effective line code in source code is marked, the line number of all effective line codes marked in source code is recorded in identical file, is part of effectively composing a piece of writing, is designated as linemap.txt.This effectively style of writing part also can record the information such as the version number of APP, the version number of source code, the version number of the line number of valid code row, the version number of APP and source code is all called valid code row information.Such as, the source code for the APP1 to be compiled obtained in step 401 is 3.04 version source codes, carries out pitching pile compiling to 3.04 version source codes, the effective style of writing part obtained after pitching pile compiling comprises the version 3 .0 of APP1 to be compiled, the version number 3.04 of 3.04 version source codes, and the line number 1,2 of valid code row, 3,4,5,6,7,8,18,19,20.Arrange a compiling number, this compiling is number corresponding with the version number 3.04 of the version number 3.0 and 3.04 version source code of this APP to be compiled, and be designated as build_id, its content can be the version number 3.04 of the version number 3.0+3.04 version source code of APP to be compiled.
In step 403, the corresponding relation of this compiling of server stores number and this part of effectively composing a piece of writing.
Still for above-mentioned example, after server obtains compiling result build_result, effectively the style of writing part linemap.txt and compiling 3.0+3.04 of APP1 to be tested, store the corresponding relation of this compiling 3.0+3.04 and this part linemap.txt that effectively composes a piece of writing, to obtain with then convenient.
Tester can also repeat the process of above-mentioned 300 to 302, other versions of APP to be compiled or each version of other APP are compiled, so server comprises compiling result, effectively style of writing part and the compiling number of multiple APP in the present embodiment, accounting server comprises compiling result, effectively style of writing part and the compiling number of M APP, M be more than or equal to 1 integer.
To APP to be compiled carry out compiling complete after, tester can test APP in testing apparatus, and specific implementation process is as follows:
In step 404, testing apparatus obtains compiling result and the compiling number of m APP, and m is the integer being more than or equal to 1 and being less than or equal to M.
The APP mark of each APP in m the APP that tester inputs in testing apparatus and version number, testing apparatus identifies according to each APP that tester inputs and version number obtains compiling result and the compiling number of each APP from server.
Still for above-mentioned example, tester tester_1 inputs APP and identifies APP1 and APP version number 3.0 on testing apparatus device_1, and testing apparatus identifies APP1 and APP version number 3.0 according to this APP and obtains compiling result build_result and compiling 3.0+3.04.
In step 405, this testing apparatus obtains the test case of each APP in this m APP of tester's configuration.
Each APP test case tester configuration and input to testing apparatus.Accordingly, this step can be: testing apparatus obtains the test case of each APP of tester's input.
Still for above-mentioned example, this step can: testing apparatus device_1 receives the test case of the APP1 of tester tester_1 input.
In a step 406, testing apparatus is tested each described compiling result according to the test case of each APP, and generates first code coverage information file.
Wherein, first code coverage information file comprise the device identification of testing apparatus, the user ID of tester, the compiling number of each APP and each APP compiling number corresponding be performed code line coverage information.
This step can be: to any one APP in m APP, for convenience of explanation this APP is called an APP, test case according to an APP is tested the first compiling result, and obtain the code line coverage information of the code line be performed in the source code of an APP, and whenever getting code line coverage information, the compiling of an APP number is stored in first code coverage information file with the corresponding relation of the code line coverage information obtained; For m remaining APP, all press above-mentioned process, illustrate no longer one by one at this; After processing each APP, the device identification of this testing apparatus, the user ID of tester are stored in first code coverage information file.
Optionally, the device identification of this testing apparatus, the user ID of tester are stored in the filename of first code coverage information file.
Optionally, the code line coverage information of the code line be performed can comprise the information such as the line number of the code line be performed.
Such as, suppose that 2.0 versions of APP1 to be installed on testing apparatus device_1 and to be tested by tester tester_1 and tester_2, the line number obtaining the code line be performed in the source code of this tested APP1 is: 2,4,5,6,8,10,18 and 2,4,5,7,8,9,10,18; 3.0 versions of this APP1 to be installed on testing apparatus device_2 and to be tested by tester tester_1 and tester_2, and the line number obtaining the code line be performed in the source code of this tested APP is: 2,4,5,6,8,10,15,19,20 and 1,2,4,5,6,8,10,15,19,20.
Optionally, the filename of this first code coverage information file comprises the device identification of this testing apparatus and the user ID of this user.Such as, file designation tester tester_1 and tester_2 can being tested on testing apparatus device_1 the first code coverage information file obtained is respectively tester_1_device_1.txt and tester_2_device_1.txt, and file designation tester tester_1 and tester_2 being tested on testing apparatus device_2 the first code coverage information file obtained is tester_1_device_2.txt and tester_2_device_2.txt etc.
So the content in tester_1_device_1.txt can be: 2.0+2.012,4,5,6,8,10,18.
Content in tester_2_device_1.txt can be: 2.0+2.012,4,5,7,8,9,10,18.
Content in tester_1_device_2.txt can be: 3.0+3.042,4,5,6,8,10,15,19,20.
Content in tester_2_device_2.txt can be: 3.0+3.041,2,4,5,6,8,10,15,19,20.
Wherein, 2.0+2.01 and 3.0+3.04 is compiling number, and 2,4,5,6,8,10,18 is the line number of the code line be performed in the source code of this tested APP.
In step 407, this testing apparatus sends this first code coverage information file to server.
Still for above-mentioned example, this step can be: testing apparatus device_1 sends first code coverage information file tester_1_device_1 and tester_2_device_1 to server, and testing apparatus device_2 sends first code coverage information file tester_1_device_2 and tester_2_device_2 to server.
In the present embodiment, have at least one testing apparatus to perform the step of above-mentioned 404 to 407, suppose there be n testing apparatus, namely this n testing apparatus sends the first code coverage information file obtained separately respectively to server, and detailed process is as follows:
In a step 408, server receives the first code coverage information file that n testing apparatus sends.
Still for above-mentioned example, the first code coverage information file that server receives is tester_1_device_1, tester_2_device_1, tester_1_device_2 and tester_2_device_2.
In step 409, server obtains initial conditions, and this initial conditions comprises at least one in the compiling number of device identification to be analyzed, user ID and APP.
Optionally, this initial conditions can input to server for tester, and namely server obtains the initial conditions of tester's input.
Initial conditions is the testing apparatus wanting to analyze inputted according to different demand, at least one in the information such as tester and APP version.Such as, can input device_1, the initial conditions that 2.0+2.01 so gets is device_1,2.0+2.01.
In step 410, server selects k the first code coverage information file comprising this device identification to be analyzed and/or user ID from this n first code coverage information file.
If the filename of each first code coverage information file in this n first code coverage information file comprises the device identification of testing apparatus and the user ID of tester, then this step can be: server is according at least one information in device identification to be analyzed and/or user ID, the first code coverage information file that filename includes device identification to be analyzed and/or user ID is filtered out from n first code coverage information file, by the first code coverage information file composing document list obtained, be designated as file_list, the number of the first code coverage information file that listed files file_list comprises is designated as k.
Such as, if the first code coverage information file that server is preserved has: tester_1_device_1, tester_2_device_1, tester_1_device_2 and tester_2_device_2.When the initial conditions that server gets is for being tester_1, the file_list selected is tester_1_device_1 and tester_1_device_2; When the initial conditions that server gets is tester_2, the file_list selected is tester_2_device_1 and tester_2_device_2; When the initial conditions that server gets is for being device_1, the file_list selected is tester_1_device_1 and tester_2_device_1; When the initial conditions that server gets is tester_1,2.0+2.01, the file_list selected is tester_1_device_1 and tester_1_device_2; When the initial conditions that server gets is tester_2,3.0+3.04, the file_list selected is tester_2_device_1 and tester_2_device_2.
In step 411, server obtain from this k first code coverage information file the compiling of this APP to be analyzed number corresponding be performed code line coverage information, and to be stored in second code coverage information file.
This step can be: for the arbitrary first code coverage information file in this k first code coverage information file, server is according to the compiling number of APP to be analyzed, the compiling of preserving from this first code coverage information file is number with the corresponding relation of code coverage information, obtain the compiling number corresponding code coverage information of APP to be analyzed, the code coverage information of acquisition is stored in second code coverage information file; For its k-1 first code coverage information file, perform aforesaid operations respectively, just do not illustrate one by one.
Still for above-mentioned example, the initial conditions got when server is tester_1,2.0+2.01 time, this step can be: from tester_1_device_1 and tester_1_device_2, obtain relevant 2.0 versions, source code version is the code coverage information of 2.01, and the relevant code coverage information of acquisition is merged in second code coverage information file, is designated as cov.txt.Now the content of cov.txt is 2.0+2.012,4,5,6,8,18.
The initial conditions got when server is tester_2,3.0+3.04 time, this step can be: from tester_2_device_1 and tester_2_device_2, obtain relevant 3.0 versions, source code version is the code coverage information of 3.04, and the relevant code line coverage information of acquisition is merged in second code coverage information file, be designated as cov.txt.Now the content of cov.txt is: 3.0+3.041,2,4,5,6,7,8,9,10,15,18,19,20.
In step 412, server is according to the compiling number of this APP to be analyzed, and from compiling number and the corresponding relation of effective part of composing a piece of writing, obtain effective style of writing part of this APP to be analyzed, this part of effectively composing a piece of writing comprises valid code row information in this APP to be analyzed.
Still for above-mentioned example, as the compiling 2.0+2.01 that server gets, this step can be: from compiling number and the corresponding relation of effective part of composing a piece of writing, get part of effectively composing a piece of writing, this content of effectively composing a piece of writing in part is: 2.0+2.011,2,3,4,5,6,7,8 ..., 18,19,20.As the compiling 3.0+3.04 that server gets, this step can be: from compiling number and the corresponding relation of effective part of composing a piece of writing, get part of effectively composing a piece of writing, this content of effectively composing a piece of writing in part is: 3.0+3.041,2,3,4,5,6,7,8 ..., 18,19,20.
Optionally, when obtaining with this compiling number corresponding effective style of writing part, effective style of writing part of this version source code of this APP and last revision source code can be obtained simultaneously and effectively to compose a piece of writing part.This source code version compares the row only travelled this source code last revision with this source code last revision, is the variance codes row of this source code version.The code be expert at is variance codes.
For 2.0 versions in above-mentioned example, 2.01 source code versions are compared only has 2,4,5,6,8,11 with 2.0 source code one versions, 13,15,18,20 row are revised, and so above-mentioned 2,4,5,6,8,11,13,15,18, the variance codes row of this source code version of 20 behaviors.The code be expert at is variance codes.
In step 413, server according to this second code coverage information file and this part of effectively composing a piece of writing, Accounting Legend Code coverage rate.
Whether code coverage is used for ratio that the source code in description program is performed and degree, effectively tested according to this code coverage determination program by complete.The code coverage line number sum being performed code in this APP source code represents with the ratio of total line number of effective row in this source code.
Optionally, this code coverage can be overall code coverage rate, also can be variance codes coverage rate.Overall coverage rate is the code coverage of this source code version.Variance codes coverage rate is the code coverage of the variance codes of this source code version and this source code last revision.
For overall code coverage rate, its computation process is specially: according in second code coverage information file, determine the code line be performed in APP to be analyzed, add up the code line be performed and obtain the first line number, the valid code row that APP to be analyzed comprises is determined according to part of effectively composing a piece of writing, add up the valid code row determined and obtain the second line number, calculate the ratio between the first line number and the second line number, obtain the overall code coverage rate of APP to be analyzed.
For variance codes code coverage, its computation process is specially: according to the compiling number of APP to be analyzed, determine the version of APP to be analyzed, according to APP identification information and the version of APP to be analyzed, the source code subclass that this version is corresponding from code library, the source code of two up-to-date versions is selected, the different information between the source code calculating these two versions from this source code subclass; According to this second code coverage information file, determine the code line be performed in this different information, and the code line that statistics is determined obtains the first line number, according to part of effectively composing a piece of writing, determine the valid code row that this different information comprises, and the valid code row that statistics is determined obtains the second line number, calculates the ratio between the first line number and the second line number, obtains the variance codes coverage rate of APP to be analyzed.
Still for above-mentioned example, overall coverage rate when being tester_1,2.0+2.01 for initial conditions, this step can be: server is according to the content in second code row coverage information file: 2.0+2.012,4,5,6,8,18 and content effectively in style of writing part: 2.0+2.011,2,3,4,5,6,7,8,, 18,19,20 Accounting Legend Code coverage rates, being specifically calculated as the ratio of total line number in the line number in second code row coverage information file and part of effectively composing a piece of writing, is also 6/20.
Overall coverage rate when being tester_2,3.0+3.04 for initial conditions, this step can be: server is according to the content in second code row coverage information file: 3.0+3.041,2,4,5,6,7,8,9,10,15,18,19,20 and content effectively in style of writing part: 3.0+3.041,2,3,4,5,6,7,8 ..., 18,19,20 Accounting Legend Code coverage rates, being specifically calculated as the ratio of total line number in the line number in second code row coverage information file and part of effectively composing a piece of writing, is also 13/20.
For difference coverage rate, for 2.0+2.01 version, this step can be: with the ratio of variance codes line number, also, 8/10.
In step 414, server is according to the code coverage generating code coverage rate report calculated.
Code coverage report, for showing the code coverage of this test, is designated as reprot.html, can certainly generates the file of other form as required, such as, and .txt .pdf etc.
Optionally, the report of this code coverage can be reported for overall code coverage rate, also can be variance codes coverage rate.
The content of code coverage report can generate different reports according to different demands, and still for above-mentioned example, if only need to generate overall code coverage rate, then the content of code coverage report is: total, line, %:65%.If only need to generate variance codes coverage rate, then the content of code coverage report is: diff, line, %:80%.
In sum, the acquisition code coverage method that the present embodiment provides, by server, pitching pile compiling is carried out to the source code of APP to be compiled, obtain the compiling result of APP to be tested, effective style of writing part and compiling number, and store the corresponding relation of this compiling number and this part of effectively composing a piece of writing, testing apparatus obtains the compiling result of m APP, compiling number and test case, and according to the test case of each APP, each described compiling result is tested, become first code coverage information file, then this first code coverage information file is sent to server, server receives n first code coverage information file and obtains initial conditions, then merge the code coverage information meeting this initial conditions in this n first code coverage information file and obtain second code coverage information file, solve multi-user according to this second code coverage information file and part Accounting Legend Code coverage rate of effectively composing a piece of writing, multiple stage testing apparatus or multiple version APP walk abreast in cross-beta situation can not the problem of the effective code coverage of Obtaining Accurate, reach the effect improving and obtain code coverage convenience and improve tester's work efficiency.
Following is apparatus of the present invention embodiment, may be used for performing the inventive method embodiment.For the details do not disclosed in apparatus of the present invention embodiment, please refer to the inventive method embodiment.
A kind of block diagram obtaining code coverage device that Fig. 5 A one embodiment of the invention provides, see Fig. 5 A, this device comprises: the first acquisition module 501, second acquisition module 502, Self-adaptive module 503 and sending module 504.
First acquisition module 501, for obtaining compiling result and the compiling number of m APP, m be more than or equal to 1 integer, the compiling result of this APP and compiling number carry out pitching pile compiling to the source code of this APP to obtain, and this compiling number is for the version of the version He this source code that identify this APP.
Second acquisition module 502, for obtaining the test case of each APP in user configured this m APP.
Self-adaptive module 503, test case for this each APP got according to this second acquisition module 502 is tested this compiling result each that this first acquisition module 501 gets, and generating first code coverage information file, this first code coverage information file comprises the device identification of this testing apparatus, the user ID of this user, the compiling number of this each APP and the compiling number corresponding code line coverage information of this each APP.
Sending module 504, sends this first code coverage information file of this Self-adaptive module 503 generation, makes this server according to this first code coverage information file Accounting Legend Code coverage rate to server for this device.
Optionally, see Fig. 5 B, this Self-adaptive module 503, comprising:
Test obtains submodule 5031, and test the first compiling result for the test case according to an APP, and obtain the code line coverage information of the code line be performed in the source code of an APP, an APP is the arbitrary APP in this m APP;
Sub module stored 5032, the corresponding relation for the compiling number this test being obtained this code line coverage information of obtaining of submodule 5031 and an APP is stored in first code coverage information file.
Optionally, the filename of this first code coverage information file comprises the device identification of this testing apparatus and the user ID of this user.
In sum, the acquisition code coverage device that the present embodiment provides, by testing apparatus obtain m APP compiling result, compile number and test case, and according to the test case of each APP, each described compiling result is tested, and generate first code coverage information file, then send this first code coverage information file to server, make server according to this first code coverage information file Accounting Legend Code coverage rate; Solving under multi-user, multiple stage testing apparatus or multiple version APP walk abreast cross-beta situation can not the problem of the effective code coverage of Obtaining Accurate; Reach the effect improving and obtain code coverage convenience and improve tester's work efficiency.
Fig. 6 A is a kind of block diagram obtaining code coverage device that another embodiment of the present invention provides, and see Fig. 6 A, this device comprises: receiver module 601, acquisition module 602, merging module 603 and computing module 604.
Receiver module 601, for receiving n first code coverage information file, first code coverage information file comprise the compiling of the compiling number of each APP in device identification, user ID, a m APP and this each APP number corresponding be performed code line coverage information, m and n is the integer being more than or equal to 1.
Acquisition module 602, for obtaining initial conditions, this initial conditions comprises at least one in the compiling number of device identification to be analyzed, user ID and APP.
Merging module 603, obtaining second code coverage information file for merging the code coverage information meeting this initial conditions that this acquisition module 602 gets in this n first code coverage information file that this receiver module 601 receives.
Computing module 604, for this second code coverage information file Accounting Legend Code coverage rate obtained according to this merging module 603.
Optionally, see Fig. 6 B, this merging module 603, comprising:
Chooser module 6031, for selecting k the first code coverage information file comprising this device identification to be analyzed and/or user ID in this n first code coverage information file receiving from this receiver module 601.
Obtain sub module stored 6032, what the compiling for obtaining this APP to be analyzed in this k first code coverage information file choosing from this chooser module 6031 was number corresponding is performed code line coverage information, and is stored in second code coverage information file.
Optionally, refer to Fig. 6 C, this computing module 604, comprising:
Obtain submodule 6041, for the compiling number of this APP to be analyzed got according to this acquisition sub module stored, from compiling number and the corresponding relation of effective part of composing a piece of writing, obtain effective style of writing part of this APP to be analyzed, this part of effectively composing a piece of writing comprises valid code row information in this APP to be analyzed.
Calculating sub module 6042, for according to this second code coverage information file and this part of effectively composing a piece of writing, Accounting Legend Code coverage rate.
Optionally, refer to and see Fig. 7, this device, also comprises:
Pitching pile compiling memory module 605, for carrying out pitching pile compiling to the source code of APP to be tested, obtains the compiling result of this APP to be tested, effectively style of writing part and compiling number; And store the corresponding relation of this compiling number and this part of effectively composing a piece of writing.
Optionally, the filename of this first code coverage information file comprises this device identification and this user ID.
In sum, the acquisition code coverage device that the present embodiment provides, receive n first code coverage information file by server and obtain initial conditions, then merge the code coverage information meeting this initial conditions in this n first code coverage information file and obtain second code coverage information file, according to this second code coverage information file Accounting Legend Code coverage rate; Solving under multi-user, multiple stage testing apparatus or multiple version APP walk abreast cross-beta situation can not the problem of the effective code coverage of Obtaining Accurate; Reach the effect improving and obtain code coverage convenience and improve tester's work efficiency.
It should be noted that: the acquisition code coverage device that above-described embodiment provides, only be illustrated with the division of above-mentioned each functional module, in practical application, can distribute as required and by above-mentioned functions and be completed by different functional modules, inner structure by equipment is divided into different functional modules, to complete all or part of function described above.In addition, the acquisition code coverage device that above-described embodiment provides belongs to same design with the embodiment of the method obtaining code coverage method, and its specific implementation process refers to embodiment of the method, repeats no more here.
Please refer to Fig. 8, it illustrates the structural representation of the electronic equipment that one embodiment of the invention provides.This electronic equipment is for implementing the acquisition code coverage method provided in above-described embodiment.Specifically:
Electronic equipment 800 can comprise RF (RadioFrequency, radio frequency) circuit 810, the storer 820 including one or more computer-readable recording mediums, input block 830, display unit 840, sensor 850, voicefrequency circuit 860, WiFi (wirelessfidelity, Wireless Fidelity) module 870, include the parts such as processor 880 and power supply 890 that more than or processes core.It will be understood by those skilled in the art that the electronic devices structure shown in Fig. 8 does not form the restriction to electronic equipment, the parts more more or less than diagram can be comprised, or combine some parts, or different parts are arranged.Wherein:
RF circuit 810 can be used for receiving and sending messages or in communication process, the reception of signal and transmission, especially, after being received by the downlink information of base station, transfer to more than one or one processor 880 to process; In addition, base station is sent to by relating to up data.Usually, RF circuit 810 includes but not limited to antenna, at least one amplifier, tuner, one or more oscillator, subscriber identity module (SIM) card, transceiver, coupling mechanism, LNA (LowNoiseAmplifier, low noise amplifier), diplexer etc.In addition, RF circuit 810 can also by radio communication and network and other devices communicatings.Described radio communication can use arbitrary communication standard or agreement, include but not limited to GSM (GlobalSystemofMobilecommunication, global system for mobile communications), GPRS (GeneralPacketRadioService, general packet radio service), CDMA (CodeDivisionMultipleAccess, CDMA), WCDMA (WidebandCodeDivisionMultipleAccess, Wideband Code Division Multiple Access (WCDMA)), LTE (LongTermEvolution, Long Term Evolution), Email, SMS (ShortMessagingService, Short Message Service) etc.
Storer 820 can be used for storing software program and module, and processor 880 is stored in software program and the module of storer 820 by running, thus performs the application of various function and data processing.Storer 820 mainly can comprise storage program district and store data field, and wherein, storage program district can store operating system, application program (such as sound-playing function, image player function etc.) etc. needed at least one function; Store data field and can store the data (such as voice data, phone directory etc.) etc. created according to the use of electronic equipment 800.In addition, storer 820 can comprise high-speed random access memory, can also comprise nonvolatile memory, such as at least one disk memory, flush memory device or other volatile solid-state parts.Correspondingly, storer 820 can also comprise Memory Controller, to provide the access of processor 880 and input block 830 pairs of storeies 820.
Input block 830 can be used for the numeral or the character information that receive input, and produces and to arrange with user and function controls relevant keyboard, mouse, control lever, optics or trace ball signal and inputs.Particularly, input block 830 can comprise image input device 831 and other input equipments 832.Image input device 831 can be camera, also can be photoelectric scanning device.Except image input device 831, input block 830 can also comprise other input equipments 832.Particularly, other input equipments 832 can include but not limited to one or more in physical keyboard, function key (such as volume control button, switch key etc.), trace ball, mouse, control lever etc.
Display unit 840 can be used for the various graphical user interface showing information or the information being supplied to user and the electronic equipment 800 inputted by user, and these graphical user interface can be made up of figure, text, icon, video and its combination in any.Display unit 840 can comprise display panel 841, optionally, the form such as LCD (LiquidCrystalDisplay, liquid crystal display), OLED (OrganicLight-EmittingDiode, Organic Light Emitting Diode) can be adopted to configure display panel 841.
Electronic equipment 800 also can comprise at least one sensor 850, such as optical sensor, motion sensor and other sensors.Particularly, optical sensor can comprise ambient light sensor and proximity transducer, and wherein, ambient light sensor the light and shade of environmentally light can regulate the brightness of display panel 841, proximity transducer when electronic equipment 800 moves in one's ear, can cut out display panel 841 and/or backlight.As the one of motion sensor, Gravity accelerometer can detect the size of all directions (are generally three axles) acceleration, size and the direction of gravity can be detected time static, can be used for identifying the application (such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating) of mobile phone attitude, Vibration identification correlation function (such as passometer, knock) etc.; As for electronic equipment 800 also other sensors such as configurable gyroscope, barometer, hygrometer, thermometer, infrared ray sensor, do not repeat them here.
Voicefrequency circuit 860, loudspeaker 861, microphone 862 can provide the audio interface between user and electronic equipment 800.Voicefrequency circuit 860 can by receive voice data conversion after electric signal, be transferred to loudspeaker 861, by loudspeaker 861 be converted to voice signal export; On the other hand, the voice signal of collection is converted to electric signal by microphone 862, voice data is converted to after being received by voicefrequency circuit 860, after again voice data output processor 880 being processed, through RF circuit 810 to send to such as another electronic equipment, or export voice data to storer 820 to process further.Voicefrequency circuit 860 also may comprise earphone jack, to provide the communication of peripheral hardware earphone and electronic equipment 800.
WiFi belongs to short range wireless transmission technology, and electronic equipment 800 can help user to send and receive e-mail by WiFi module 870, browse webpage and access streaming video etc., and its broadband internet wireless for user provides is accessed.Although Fig. 8 shows WiFi module 870, be understandable that, it does not belong to must forming of electronic equipment 800, can omit in the scope of essence not changing invention as required completely.
Processor 880 is control centers of electronic equipment 800, utilize the various piece of various interface and the whole mobile phone of connection, software program in storer 820 and/or module is stored in by running or performing, and call the data be stored in storer 820, perform various function and the process data of electronic equipment 800, thus integral monitoring is carried out to mobile phone.Optionally, processor 880 can comprise one or more process core; Preferably, processor 880 accessible site application processor and modem processor, wherein, application processor mainly processes operating system, user interface and application program etc., and modem processor mainly processes radio communication.Be understandable that, above-mentioned modem processor also can not be integrated in processor 880.
Electronic equipment 800 also comprises the power supply 890 (such as battery) of powering to all parts, preferably, power supply can be connected with processor 880 logic by power-supply management system, thus realizes the functions such as management charging, electric discharge and power managed by power-supply management system.Power supply 890 can also comprise one or more direct current or AC power, recharging system, power failure detection circuit, power supply changeover device or the random component such as inverter, power supply status indicator.
Although not shown, electronic equipment 800 can also comprise bluetooth module etc., does not repeat them here.
Concrete electronic equipment 800 also includes storer, and one or more than one program, and one of them or more than one program are stored in storer in the present embodiment, and is configured to be performed by more than one or one processor.Above-mentioned more than one or one routine package is containing the instruction for carrying out following operation:
Testing apparatus obtains compiling result and the compiling number of m application A PP, m be more than or equal to 1 integer, the compiling result of described APP and compiling number carry out pitching pile compiling to the source code of described APP to obtain, and described compiling number is for the version of the version and described source code that identify described APP;
Described testing apparatus obtains the test case of each APP in a user configured described m APP;
Described testing apparatus is tested each described compiling result according to the test case of described each APP, and generating first code coverage information file, described first code coverage information file comprises the device identification of described testing apparatus, the user ID of described user, the compiling number of described each APP and the compiling number corresponding code line coverage information of described each APP;
Described testing apparatus sends described first code coverage information file to server, makes described server according to described first code coverage information file Accounting Legend Code coverage rate.
Suppose that above-mentioned is the first possible embodiment, then, in the embodiment that the second provided based on the embodiment that the first is possible is possible, in the storer of described electronic equipment, also comprise the instruction for performing following operation:
Test case according to an APP is tested the first compiling result, and obtains the code line coverage information of the code line be performed in the source code of a described APP, and a described APP is the arbitrary APP in a described m APP;
The corresponding relation of the compiling of the code line coverage information of described acquisition and a described APP number is stored in first code coverage information file.
Fig. 9 shows the structural representation of the server that one embodiment of the invention provides.This server is for implementing the acquisition code coverage method provided in above-described embodiment.Specifically:
Described server 900 comprises CPU (central processing unit) (CPU) 901, comprises the system storage 904 of random access memory (RAM) 902 and ROM (read-only memory) (ROM) 903, and the system bus 905 of connected system storer 904 and CPU (central processing unit) 901.Described server 900 also comprises the basic input/output (I/O system) 906 of transmission information between each device in help computing machine, and for storing the mass-memory unit 907 of operating system 913, application program 914 and other program modules 915.
Described basic input/output 906 includes the input equipment 909 of the display 908 for showing information and the such as mouse, keyboard and so on for user's input information.Wherein said display 908 and input equipment 909 are all connected to CPU (central processing unit) 901 by the input/output control unit 910 being connected to system bus 905.Described basic input/output 906 can also comprise input/output control unit 910 for receiving and processing the input from other equipment multiple such as keyboard, mouse or electronic touch pens.Similarly, input/output control unit 910 also provides the output device outputting to display screen, printer or other types.
Described mass-memory unit 907 is connected to CPU (central processing unit) 901 by the bulk memory controller (not shown) being connected to system bus 905.Described mass-memory unit 907 and the computer-readable medium that is associated thereof provide non-volatile memories for server 900.That is, described mass-memory unit 907 can comprise the computer-readable medium (not shown) of such as hard disk or CD-ROM drive and so on.
Without loss of generality, described computer-readable medium can comprise computer-readable storage medium and communication media.Computer-readable storage medium comprises the volatibility and non-volatile, removable and irremovable medium that realize for any method or technology that store the information such as such as computer-readable instruction, data structure, program module or other data.Computer-readable storage medium comprises RAM, ROM, EPROM, EEPROM, flash memory or its technology of other solid-state storage, CD-ROM, DVD or other optical memory, tape cassete, tape, disk storage or other magnetic storage apparatus.Certainly, the known described computer-readable storage medium of those skilled in the art is not limited to above-mentioned several.Above-mentioned system storage 904 and mass-memory unit 907 can be referred to as storer.
According to various embodiments of the present invention, the remote computer that described server 900 can also be connected on network by networks such as such as the Internets runs.Also namely server 900 can be connected to network 912 by the network interface unit 911 be connected on described system bus 905, in other words, network interface unit 911 also can be used to be connected to network or the remote computer system (not shown) of other types.
Described storer also comprises one or more than one program, and described more than one or one program is stored in storer, and is configured to be performed by more than one or one processor.Above-mentioned more than one or one routine package is containing the instruction for carrying out following operation:
Receive n first code coverage information file, first code coverage information file comprises the compiling number of each APP in device identification, user ID, a m APP and the compiling number corresponding code line coverage information of described each APP, m and n is the integer being more than or equal to 1;
Obtain initial conditions, described initial conditions comprises at least one in the compiling number of device identification to be analyzed, user ID and APP;
Merge the code coverage information meeting described initial conditions in described n first code coverage information file and obtain second code coverage information file;
According to described second code coverage information file Accounting Legend Code coverage rate.
Suppose that above-mentioned is the first possible embodiment, then, in the embodiment that the second provided based on the embodiment that the first is possible is possible, in the storer of described server, also comprise the instruction for performing following operation:
K the first code coverage information file comprising described device identification to be analyzed and/or user ID is selected from described n first code coverage information file;
Obtain from described k first code coverage information file the compiling of described APP to be analyzed number corresponding be performed code line coverage information, and to be stored in second code coverage information file.
Suppose that above-mentioned is the first possible embodiment, then, in the third the possible embodiment provided based on the embodiment that the first is possible, in the storer of described server, also comprise the instruction for performing following operation:
According to the compiling number of described APP to be analyzed, from compiling number and the corresponding relation of effective part of composing a piece of writing, obtain effective style of writing part of described APP to be analyzed, described effective style of writing part comprises valid code row information in described APP to be analyzed;
According to described second code coverage information file and described effective style of writing part, Accounting Legend Code coverage rate.
Suppose that above-mentioned is the first possible embodiment, then, in the 4th kind of possible embodiment provided based on the embodiment that the first is possible, in the storer of described server, also comprise the instruction for performing following operation:
Pitching pile compiling is carried out to the source code of APP to be tested, obtains the compiling result of described APP to be tested, effectively style of writing part and compiling number; And store the corresponding relation of described compiling number and described effective style of writing part.
Should be understood that, use in this article, unless context clearly supports exception, singulative " " (" a ", " an ", " the ") is intended to also comprise plural form.It is to be further understood that the "and/or" used in this article refers to comprise any of more than one or one project listed explicitly and likely combine.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be ROM (read-only memory), disk or CD etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, 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 (16)

1. obtain a method for code coverage, it is characterized in that, described method comprises:
Testing apparatus obtains compiling result and the compiling number of m application A PP, m be more than or equal to 1 integer, the compiling result of described APP and compiling number carry out pitching pile compiling to the source code of described APP to obtain, and described compiling number is for the version of the version and described source code that identify described APP;
Described testing apparatus obtains the test case of each APP in a user configured described m APP;
Described testing apparatus is tested described each compiling result respectively according to the test case of described each APP, and generating first code coverage information file, described first code coverage information file comprises the device identification of described testing apparatus, the user ID of described user, the compiling number of described each APP and the compiling number corresponding code line coverage information of described each APP;
Described testing apparatus sends described first code coverage information file to server, makes described server according to described first code coverage information file Accounting Legend Code coverage rate.
2. the method for claim 1, is characterized in that, described testing apparatus is tested described each compiling result respectively according to the test case of described each APP, and generates first code coverage information file, comprising:
Test case according to an APP is tested the first compiling result, and obtains the code line coverage information of the code line be performed in the source code of a described APP, and a described APP is the arbitrary APP in a described m APP;
The corresponding relation of the compiling of the code line coverage information of described acquisition and a described APP number is stored in first code coverage information file.
3. method as claimed in claim 1 or 2, it is characterized in that, the filename of described first code coverage information file comprises the device identification of described testing apparatus and the user ID of described user.
4. obtain a method for code coverage, it is characterized in that, described method comprises:
Receive n first code coverage information file, first code coverage information file comprises the compiling number of each APP in device identification, user ID, a m APP and the compiling number corresponding code line coverage information of described each APP, m and n is the integer being more than or equal to 1;
Obtain initial conditions, described initial conditions comprises at least one in the compiling number of device identification to be analyzed, user ID and APP;
Merge the code coverage information meeting described initial conditions in described n first code coverage information file and obtain second code coverage information file;
According to described second code coverage information file Accounting Legend Code coverage rate.
5. method as claimed in claim 4, it is characterized in that, the code coverage information meeting described initial conditions in the described n of described merging first code coverage information file obtains second code coverage information file, comprising:
K the first code coverage information file comprising described device identification to be analyzed and/or user ID is selected from described n first code coverage information file;
Obtain from described k first code coverage information file the compiling of described APP to be analyzed number corresponding be performed code line coverage information, and to be stored in second code coverage information file.
6. method as claimed in claim 4, is characterized in that, described according to described second code coverage information file Accounting Legend Code coverage rate, comprising:
According to the compiling number of described APP to be analyzed, from compiling number and the corresponding relation of effective part of composing a piece of writing, obtain effective style of writing part of described APP to be analyzed, described effective style of writing part comprises valid code row information in described APP to be analyzed;
According to described second code coverage information file and described effective style of writing part, Accounting Legend Code coverage rate.
7. method as claimed in claim 6, is characterized in that, before described reception n first code coverage information file, also comprise:
Pitching pile compiling is carried out to the source code of APP to be tested, obtains the compiling result of described APP to be tested, effectively style of writing part and compiling number; And store the corresponding relation of described compiling number and described effective style of writing part.
8. the method as described in any one of claim 4 to 7 claim, is characterized in that, the filename of described first code coverage information file comprises described device identification and described user ID.
9. obtain a device for code coverage, it is characterized in that, described device comprises:
First acquisition module, for obtaining compiling result and the compiling number of m application A PP, m be more than or equal to 1 integer, the compiling result of described APP and compiling number carry out pitching pile compiling to the source code of described APP to obtain, and described compiling number is for the version of the version and described source code that identify described APP;
Second acquisition module, for obtaining the test case of each APP in user configured described m APP;
Self-adaptive module, the described compiling result got for the test case of described each APP that gets according to described second acquisition module and described first acquisition module is tested described each APP respectively, and generating first code coverage information file, described first code coverage information file comprises the device identification of described testing apparatus, the user ID of described user, the compiling number of described each APP and the compiling number corresponding code line coverage information of described each APP;
Sending module, sends the described first code coverage information file of described Self-adaptive CMOS macro cell to server for described device, make described server according to described first code coverage information file Accounting Legend Code coverage rate.
10. device as claimed in claim 9, it is characterized in that, described Self-adaptive module, comprising:
Test obtains submodule, and test the first compiling result for the test case according to an APP, and obtain the code line coverage information of the code line be performed in the source code of a described APP, a described APP is the arbitrary APP in a described m APP;
Sub module stored, the corresponding relation for the compiling number described test being obtained described code line coverage information that submodule obtains and a described APP is stored in first code coverage information file.
11. devices as described in claim 9 or 10, it is characterized in that, the filename of described first code coverage information file comprises the device identification of described testing apparatus and the user ID of described user.
12. 1 kinds of devices obtaining code coverage, it is characterized in that, described device comprises:
Receiver module, for receiving n first code coverage information file, first code coverage information file comprise the compiling of the compiling number of each APP in device identification, user ID, a m APP and described each APP number corresponding be performed code line coverage information, m and n is the integer being more than or equal to 1;
Acquisition module, for obtaining initial conditions, described initial conditions comprises at least one in the compiling number of device identification to be analyzed, user ID and APP;
Merging module, obtaining second code coverage information file for merging the code coverage information meeting the described initial conditions that described acquisition module gets in described n first code coverage information file that described receiver module receives;
Computing module, for the described second code coverage information file Accounting Legend Code coverage rate obtained according to described merging module.
13. devices as claimed in claim 12, it is characterized in that, described merging module, comprising:
Chooser module, for selecting k the first code coverage information file comprising described device identification to be analyzed and/or user ID in described n first code coverage information file receiving from described receiver module;
Obtain sub module stored, for from described chooser model choice to described k first code coverage information file in obtain the compiling of described APP to be analyzed number corresponding be performed code line coverage information, and to be stored in second code coverage information file.
14. devices as claimed in claim 12, it is characterized in that, described computing module, comprising:
Obtain submodule, for the compiling number of APP described to be analyzed got according to described acquisition sub module stored, from compiling number and the corresponding relation of effective part of composing a piece of writing, obtain effective style of writing part of described APP to be analyzed, described effective style of writing part comprises valid code row information in described APP to be analyzed;
Calculating sub module, for according to described second code coverage information file and described effective style of writing part, Accounting Legend Code coverage rate.
15. devices as claimed in claim 14, it is characterized in that, described device, also comprises:
Pitching pile compiling memory module, for carrying out pitching pile compiling to the source code of APP to be tested, obtains the compiling result of described APP to be tested, effectively style of writing part and compiling number; And store the corresponding relation of described compiling number and described effective style of writing part.
16. devices as described in any one of claim 12 to 15 claim, it is characterized in that, the filename of described first code coverage information file comprises described device identification and described user ID.
CN201510864686.3A 2015-12-01 2015-12-01 Obtain the method and device of code coverage Active CN105404585B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510864686.3A CN105404585B (en) 2015-12-01 2015-12-01 Obtain the method and device of code coverage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510864686.3A CN105404585B (en) 2015-12-01 2015-12-01 Obtain the method and device of code coverage

Publications (2)

Publication Number Publication Date
CN105404585A true CN105404585A (en) 2016-03-16
CN105404585B CN105404585B (en) 2018-09-04

Family

ID=55470083

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510864686.3A Active CN105404585B (en) 2015-12-01 2015-12-01 Obtain the method and device of code coverage

Country Status (1)

Country Link
CN (1) CN105404585B (en)

Cited By (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294183A (en) * 2016-08-25 2017-01-04 网易(杭州)网络有限公司 Coverage rate detection method, device and equipment
CN106326118A (en) * 2016-08-19 2017-01-11 东软集团股份有限公司 Method and device for determining code test coverage
CN106326124A (en) * 2016-08-25 2017-01-11 网易(杭州)网络有限公司 Coverage rate detecting method, device and equipment
CN106339317A (en) * 2016-08-25 2017-01-18 网易(杭州)网络有限公司 Method, device and equipment for detecting coverage rate
CN106502901A (en) * 2016-10-24 2017-03-15 网易(杭州)网络有限公司 Coverage rate detection method, device and equipment
CN107329888A (en) * 2017-05-31 2017-11-07 深圳前海微众银行股份有限公司 Intelligent contract command code coverage rate computational methods and system
CN109388566A (en) * 2018-09-27 2019-02-26 北京城市网邻信息技术有限公司 A kind of code coverage rate analysis method, apparatus, equipment and storage medium
CN109783344A (en) * 2017-11-14 2019-05-21 中国航发商用航空发动机有限责任公司 The method for choosing the minimum sub-set of codes of covering institute's source code structure
CN110221963A (en) * 2019-04-29 2019-09-10 北京三快在线科技有限公司 Code coverage acquisition methods and device
CN110245073A (en) * 2019-05-21 2019-09-17 北京字节跳动网络技术有限公司 Client code coverage rate monitoring method, system, medium and electronic equipment
CN110471829A (en) * 2018-05-09 2019-11-19 阿里巴巴集团控股有限公司 The inspection method and device of software code test coverage
CN110580214A (en) * 2018-06-07 2019-12-17 百度在线网络技术(北京)有限公司 application program test evaluation method and device, storage medium and terminal equipment
CN110781071A (en) * 2019-09-09 2020-02-11 中国平安财产保险股份有限公司 Method and device for testing application program upgrade version and computer equipment
CN110888817A (en) * 2019-12-18 2020-03-17 广州唯品会研究院有限公司 Method and device for generating code coverage rate report and readable storage medium
CN110908915A (en) * 2019-11-27 2020-03-24 广州品唯软件有限公司 Test coverage rate display method and device and computer system
CN110968507A (en) * 2019-11-20 2020-04-07 北京创鑫旅程网络技术有限公司 Coverage rate statistical method and device
CN111008138A (en) * 2019-12-06 2020-04-14 广州品唯软件有限公司 Code coverage rate processing method and device and computer equipment
CN111078560A (en) * 2019-12-18 2020-04-28 北京嘀嘀无限科技发展有限公司 Test method and device based on flow pruning, electronic equipment and storage medium
CN111078549A (en) * 2019-12-06 2020-04-28 广州品唯软件有限公司 Code coverage rate processing method and device and computer equipment
CN111090583A (en) * 2019-11-25 2020-05-01 广州品唯软件有限公司 Method and device for generating code coverage rate report and computer equipment
CN111124894A (en) * 2019-12-06 2020-05-08 广州品唯软件有限公司 Code coverage rate processing method and device and computer equipment
CN112100055A (en) * 2020-08-13 2020-12-18 浙江大学 Gray scale release measurement method based on code coverage rate
CN112395204A (en) * 2020-12-04 2021-02-23 京东数科海益信息科技有限公司 Method, apparatus, system, electronic device, and medium for obtaining test coverage
CN115658534A (en) * 2022-11-04 2023-01-31 上海安般信息科技有限公司 Distributed fuzzy test method and device based on multi-engine fusion

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080301813A1 (en) * 2007-05-31 2008-12-04 Microsoft Corporation Testing Software Applications with Schema-based Fuzzing
CN103207828A (en) * 2012-01-12 2013-07-17 上海盛霄云计算技术有限公司 Code testing method and system
CN104298587A (en) * 2013-07-15 2015-01-21 腾讯科技(深圳)有限公司 Code coverage test method, device and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080301813A1 (en) * 2007-05-31 2008-12-04 Microsoft Corporation Testing Software Applications with Schema-based Fuzzing
CN103207828A (en) * 2012-01-12 2013-07-17 上海盛霄云计算技术有限公司 Code testing method and system
CN104298587A (en) * 2013-07-15 2015-01-21 腾讯科技(深圳)有限公司 Code coverage test method, device and system

Cited By (39)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106326118A (en) * 2016-08-19 2017-01-11 东软集团股份有限公司 Method and device for determining code test coverage
CN106326118B (en) * 2016-08-19 2019-03-15 东软集团股份有限公司 Code tester coverage rate determines method and apparatus
CN106339317B (en) * 2016-08-25 2019-06-25 网易(杭州)网络有限公司 Coverage rate detection method, device and equipment
CN106326124A (en) * 2016-08-25 2017-01-11 网易(杭州)网络有限公司 Coverage rate detecting method, device and equipment
CN106339317A (en) * 2016-08-25 2017-01-18 网易(杭州)网络有限公司 Method, device and equipment for detecting coverage rate
CN106294183A (en) * 2016-08-25 2017-01-04 网易(杭州)网络有限公司 Coverage rate detection method, device and equipment
CN106294183B (en) * 2016-08-25 2019-03-08 网易(杭州)网络有限公司 Coverage rate detection method, device and equipment
CN106502901A (en) * 2016-10-24 2017-03-15 网易(杭州)网络有限公司 Coverage rate detection method, device and equipment
CN107329888A (en) * 2017-05-31 2017-11-07 深圳前海微众银行股份有限公司 Intelligent contract command code coverage rate computational methods and system
CN107329888B (en) * 2017-05-31 2019-10-18 深圳前海微众银行股份有限公司 Intelligent contract operation code coverage rate calculation method and system
CN109783344B (en) * 2017-11-14 2022-02-18 中国航发商用航空发动机有限责任公司 Method for selecting minimum code subset covering all source code structure
CN109783344A (en) * 2017-11-14 2019-05-21 中国航发商用航空发动机有限责任公司 The method for choosing the minimum sub-set of codes of covering institute's source code structure
CN110471829A (en) * 2018-05-09 2019-11-19 阿里巴巴集团控股有限公司 The inspection method and device of software code test coverage
CN110580214B (en) * 2018-06-07 2023-05-05 百度在线网络技术(北京)有限公司 Evaluation method and device for application program test, storage medium and terminal equipment
CN110580214A (en) * 2018-06-07 2019-12-17 百度在线网络技术(北京)有限公司 application program test evaluation method and device, storage medium and terminal equipment
CN109388566A (en) * 2018-09-27 2019-02-26 北京城市网邻信息技术有限公司 A kind of code coverage rate analysis method, apparatus, equipment and storage medium
CN109388566B (en) * 2018-09-27 2022-07-29 北京城市网邻信息技术有限公司 Code coverage rate analysis method, device, equipment and storage medium
CN110221963A (en) * 2019-04-29 2019-09-10 北京三快在线科技有限公司 Code coverage acquisition methods and device
CN110245073A (en) * 2019-05-21 2019-09-17 北京字节跳动网络技术有限公司 Client code coverage rate monitoring method, system, medium and electronic equipment
CN110781071A (en) * 2019-09-09 2020-02-11 中国平安财产保险股份有限公司 Method and device for testing application program upgrade version and computer equipment
CN110781071B (en) * 2019-09-09 2022-10-14 中国平安财产保险股份有限公司 Method and device for testing application program upgrade version and computer equipment
CN110968507A (en) * 2019-11-20 2020-04-07 北京创鑫旅程网络技术有限公司 Coverage rate statistical method and device
CN111090583B (en) * 2019-11-25 2023-04-07 广州品唯软件有限公司 Method and device for generating code coverage rate report and computer equipment
CN111090583A (en) * 2019-11-25 2020-05-01 广州品唯软件有限公司 Method and device for generating code coverage rate report and computer equipment
CN110908915A (en) * 2019-11-27 2020-03-24 广州品唯软件有限公司 Test coverage rate display method and device and computer system
CN110908915B (en) * 2019-11-27 2023-04-14 广州品唯软件有限公司 Test coverage rate display method and device and computer system
CN111008138B (en) * 2019-12-06 2023-03-17 广州品唯软件有限公司 Method and device for processing code coverage rate and computer equipment
CN111124894A (en) * 2019-12-06 2020-05-08 广州品唯软件有限公司 Code coverage rate processing method and device and computer equipment
CN111078549B (en) * 2019-12-06 2023-03-17 广州品唯软件有限公司 Code coverage rate processing method and device and computer equipment
CN111078549A (en) * 2019-12-06 2020-04-28 广州品唯软件有限公司 Code coverage rate processing method and device and computer equipment
CN111008138A (en) * 2019-12-06 2020-04-14 广州品唯软件有限公司 Code coverage rate processing method and device and computer equipment
CN111078560A (en) * 2019-12-18 2020-04-28 北京嘀嘀无限科技发展有限公司 Test method and device based on flow pruning, electronic equipment and storage medium
CN110888817A (en) * 2019-12-18 2020-03-17 广州唯品会研究院有限公司 Method and device for generating code coverage rate report and readable storage medium
CN110888817B (en) * 2019-12-18 2023-10-24 广州品唯软件有限公司 Code coverage rate report generation method, device and readable storage medium
CN112100055A (en) * 2020-08-13 2020-12-18 浙江大学 Gray scale release measurement method based on code coverage rate
CN112395204A (en) * 2020-12-04 2021-02-23 京东数科海益信息科技有限公司 Method, apparatus, system, electronic device, and medium for obtaining test coverage
CN112395204B (en) * 2020-12-04 2024-04-16 京东科技信息技术有限公司 Method, system, related device and medium for obtaining test coverage rate
CN115658534A (en) * 2022-11-04 2023-01-31 上海安般信息科技有限公司 Distributed fuzzy test method and device based on multi-engine fusion
CN115658534B (en) * 2022-11-04 2024-01-19 上海安般信息科技有限公司 Distributed fuzzy test method and device based on multi-engine fusion

Also Published As

Publication number Publication date
CN105404585B (en) 2018-09-04

Similar Documents

Publication Publication Date Title
CN105404585A (en) Method and apparatus for acquiring code coverage rate
CN108415739B (en) Hook method and device for dynamic link library function and storage medium
CN106502906B (en) A kind of method and apparatus of test application program
CN106502703B (en) Function calling method and device
CN105630685A (en) Method and device for testing program interface
CN104516812A (en) Method and device for testing software
CN104123218B (en) Method, device and system for code coverage test
CN104572046B (en) A kind of storehouse restoring method and computer system
CN104834529A (en) Method and device for optimizing performance of application
CN103164322A (en) Signature method and signature device for program crashing
CN104572430A (en) Method, device and system for testing terminal application interface
CN104298587A (en) Code coverage test method, device and system
CN103455330A (en) Application program management method, terminal, equipment and system
CN108073495B (en) Method and device for positioning crash reason of application program
CN111723002A (en) Code debugging method and device, electronic equipment and storage medium
CN105302452A (en) Gesture interaction-based operation method and device
CN104133761A (en) Memory usage analysis method, device and system of mobile terminal
CN106294108A (en) Applied program testing method and device
CN103607431B (en) Mobile terminal resource processing method, device and equipment
CN104536782A (en) Guide content display method, and file generation method and device
CN105550316A (en) Pushing method and device of audio list
CN110046497A (en) A kind of function hook implementation method, device and storage medium
CN104063400A (en) Data search method and data search device
CN106708555B (en) A kind of method and apparatus loading plug-in unit
CN104239316A (en) Method and device for finding object

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant