CN106407126A - Coverage rate data processing method, coverage rate data detection device and server - Google Patents
Coverage rate data processing method, coverage rate data detection device and server Download PDFInfo
- Publication number
- CN106407126A CN106407126A CN201611083736.5A CN201611083736A CN106407126A CN 106407126 A CN106407126 A CN 106407126A CN 201611083736 A CN201611083736 A CN 201611083736A CN 106407126 A CN106407126 A CN 106407126A
- Authority
- CN
- China
- Prior art keywords
- data
- child node
- coverage
- line number
- node
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the invention provides a coverage rate data processing method, a coverage rate data detection device and a server. The method comprises the steps of receiving performance data sent by the server, wherein the performance data comprises a file name of a currently performed file and coverage rate data; querying each layer of nodes in a pre-established tree-shaped storage structure, and obtaining a first sub-node corresponding to the file name; and calculating a total coverage rate of the server according to the coverage rate data and pre-obtained coverage rates of other sub-nodes, wherein the first sub-node and the other nodes are in the same layer. Tree-shaped structure storage is carried out on files on the same server according to catalogues, when the coverage rate data is sent for modification, the nodes are queried one by one, only the coverage rate data of the node is modified, and only the coverage rate of the changed node is recalculated, so the performance consumption resulting from global data modification and coverage rate calculation is effectively reduced, and the test efficiency is improved.
Description
Technical field
The present invention relates to field of computer technology, more particularly, to a kind of processing method of coverage data, device and service
Device.
Background technology
Code coverage test, be in software test procedure most important method of testing and test performance measures standard it
One, coverage rate refers to the ratio of tested covered code and degree in source code implementation procedure, generally uses percentage ratio table
Show.
For different programming languages, there is the corresponding method detecting code coverage.For game server
Python code coverage detection during, the technical scheme being usually used is carried using python
Sys.settrace function carries out data collection and process, after stopping collection, disposably derives coverage data report.
Due to the requirement of real-time of code coverage detection, with the game increase of scale and the development of project, need the code of test
Amount more and more higher, how preferably to safeguard and store the coverage data obtaining in coverage rate test becomes asking of must solving
Topic.In general, coverage data, includes file coverage data and catalogue coverage data, the executed of each file
The code line number set crossed, total executable code line number set of this document etc., and whenever there being new coverage data to arrive,
Some codes of such as certain file are performed, then be accomplished by recalculating current file, catalogue that current file is located very
As for overall coverage data.The mode of a kind of at present specific acquisition coverage data is the sys module using python
Middle offer settrace function, follows the tracks of the implementation status of code, coverage data is stored in the Stack in Collector.
Whenever starting collection, Collector constantly executes stack-incoming operation, when stopping collection, can be obtained by Pop operations and adopt
The coverage data of collection.
However, when the size of code needing test is larger, whenever there being new data to arrive, needing storage and recalculate covering
Rate, to internal memory with calculate performance and bring very big burden, or even influences whether the operation of tested program, reduces to a certain extent
The efficiency of test and quality.
Content of the invention
The embodiment of the present invention provides a kind of processing method of coverage data, device server, current for solving
In scheme, when the size of code needing test is larger, whenever there being new data to arrive, needs storage and recalculate coverage rate, give
Internal memory and calculate performance and bring very big burden, or even influence whether the operation of tested program, reduce survey to a certain extent
The efficiency of examination and the problem of quality.
First aspect present invention provides a kind of processing method of coverage data, including:
The execution data that the reception server sends;Described execution data includes file name and the covering being carrying out file
Rate data;
Inquire about the node of every layer in the Storage Structure of Tree pre-building, obtain corresponding with described file name first
Child node;
Covering according to described coverage data and other child nodes with the first child node in same layer obtaining in advance
Rate data, calculates the overall coverage obtaining described server.
Optionally, after described acquisition the first child node corresponding with described file name, methods described also includes:
The data of storage under described first child node is updated to described coverage data.
Optionally, before the execution data that described the reception server sends, methods described includes:
File name according to each file and directory information set up described Storage Structure of Tree;Wherein, described tree-like deposit
The child node that at least one of which is successively set up is included with directory information and file name under the root node of storage structure;
Execution data according to the file under each child node calculates and obtains coverage rate corresponding with described child node.
Optionally, described according to described coverage data and obtain in advance with the first child node same layer other son
The coverage data of node, calculates the overall coverage obtaining described server, including:
By described coverage data and the corresponding source code file of described file name, calculate described first child node
The total code line number at place and the line number of executed code;
According to the line number of the total code line number at described first child node and executed code, and each and described first
The total code line number of other child nodes in same layer for the child node and the line number of executed code, calculate and obtain described first son section
The total code line number at last layer node belonging to point and executed lines of code, by the last layer belonging to described first child node
Node, as the first child node, repeats this step until calculating the total code row at the place of root node of described Storage Structure of Tree
Number and executed lines of code;
According to the total code line number at described root node and executed lines of code, calculate and obtain the described of described server
Overall coverage.
Optionally, by described coverage data and the corresponding source code file of described file name, calculate described the
After the line number of the total code line number at one child node and executed code, also include:
Line number according to the total code line number at described first child node and executed code calculates described first child node
Coverage rate;
The coverage rate of described first child node is updated and is shown.
Second aspect present invention provides a kind of coverage rate detection means, including:
Receiver module, the execution data sending for the reception server;Described execution data includes being carrying out file
File name and coverage data;
Processing module, for inquiring about every layer in the Storage Structure of Tree pre-building of node, obtains and described file
Corresponding first child node of title;
Described processing module be additionally operable to according to described coverage data and obtain in advance with the first child node in same layer
Other child nodes coverage data, calculate obtain described server overall coverage.
Optionally, described device also includes:
Memory module, for being updated to described coverage data by the data of storage under described first child node.
Optionally, before the execution data that described receiver module the reception server sends, described processing module is additionally operable to:
File name according to each file and directory information set up described Storage Structure of Tree;Wherein, described tree-like deposit
The child node that at least one of which is successively set up is included with directory information and file name under the root node of storage structure;
Execution data according to the file under each child node calculates and obtains coverage rate corresponding with described child node.
Optionally, described processing module specifically for:
By described coverage data and the corresponding source code file of described file name, calculate described first child node
The total code line number at place and the line number of executed code;
According to the line number of the total code line number at described first child node and executed code, and each and described first
The total code line number of other child nodes in same layer for the child node and the line number of executed code, calculate and obtain described first son section
The total code line number at last layer node belonging to point and executed lines of code, by the last layer belonging to described first child node
Node, as the first child node, repeats this step until calculating the total code row at the place of root node of described Storage Structure of Tree
Number and executed lines of code;
According to the total code line number at described root node and executed lines of code, calculate and obtain the described of described server
Overall coverage.
Optionally, described processing module is additionally operable to:
Line number according to the total code line number at described first child node and executed code calculates described first child node
Coverage rate;
Control and the coverage rate of described first child node is updated and is shown.
Third aspect present invention provides a kind of server, including:Have program stored therein the memorizer of instruction, receptor and be used for
The processor of control program instruction execution;
Described receptor is used for the execution data that the reception server sends;Described execution data includes being carrying out file
File name and coverage data;
Described processor is used for:
Inquire about the node of every layer in the Storage Structure of Tree pre-building, obtain corresponding with described file name first
Child node;
Covering according to described coverage data and other child nodes with the first child node in same layer obtaining in advance
Rate data, calculates the overall coverage obtaining described server.
The processing method of coverage data provided in an embodiment of the present invention, device server, in coverage rate server side
Storage Structure of Tree is set up to the data of each server receiving, receive server transmission inclusion file name and
When corresponding coverage data, according to file name, querying node is only modified to the coverage data of this node one by one,
Only need to the node that coverage data changes is recalculated, calculate then in conjunction with the known data on other nodes
The overall coverage of this server, it is not necessary to travel through statistics to All Files, effectively reduces global data modification and coverage rate meter
The performance consumption brought, improves testing efficiency.
Brief description
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
Have technology description in required use accompanying drawing be briefly described it should be apparent that, drawings in the following description are these
Some bright embodiments, for those of ordinary skill in the art, without having to pay creative labor, acceptable
Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is the flow chart of the processing method example one of coverage data provided in an embodiment of the present invention;
Fig. 2 is the flow chart of the processing method example two of coverage data provided in an embodiment of the present invention;
Fig. 3 is the example schematic of Storage Structure of Tree provided in an embodiment of the present invention;
Fig. 4 is the stream of the example in coverage rate server side for the processing method of coverage data provided in an embodiment of the present invention
Cheng Tu;
Fig. 5 is the structural representation of the processing meanss embodiment one of coverage data provided in an embodiment of the present invention;
Fig. 6 is the structural representation of the processing meanss embodiment two of coverage data provided in an embodiment of the present invention;
Fig. 7 is the structural representation of server example one provided in an embodiment of the present invention.
Specific embodiment
Purpose, technical scheme and advantage for making the embodiment of the present invention are clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described it is clear that described embodiment is
The a part of embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art
The all other embodiment being obtained under the premise of not making creative work, broadly falls into the scope of protection of the invention.
Fig. 1 is the flow chart of the processing method example one of coverage data provided in an embodiment of the present invention, as shown in figure 1,
The executive agent of the program is for detecting the server of coverage rate (i.e. coverage rate server), or detection coverage rate other
Equipment, the step that implements of this coverage rate detection method is:
Step S101, the execution data that the reception server sends;Described execution data includes the file being carrying out file
Title and coverage data.
In the present embodiment, the server sending execution data here is the server of the program executing this document, for example:
The server of running game program.The server of the execution document code in the program needs to obtain the file of the file being performed
Title and coverage data, the letter of the line number that this coverage data at least includes can indicate that the file being performed has executed
Breath, for example:The line number of current execution, or the line number having executed etc..
Step S102, inquires about the node of every layer in the Storage Structure of Tree pre-building, obtains and described file name
Corresponding first child node.
In the program, the execution data of the All Files that the above-mentioned server receiving is sent by coverage rate server end
Stored according to Storage Structure of Tree, each node can be named using the title of file, under node, stored this document
The coverage data of the corresponding file of title.
After the execution data that this server subsequently received sends, according to file name therein, successively node is carried out
Inquiry, will inquire first child node corresponding with this document title.
Optionally, the data of this first child node storage can be updated to execute the coverage data in data.
Step S103, according to described coverage data and obtain in advance with the first child node same layer other sub- sections
The coverage data of point, calculates the overall coverage obtaining described server.
In this programme, the overall coverage of above-mentioned server to be got it is not necessary to All Files solution to this server
Analyse the source code it is only necessary to the corresponding coverage data of file name in the execution data receiving and this document one time
File carries out dissection process, then in conjunction with the coverage data with other child nodes of the first child node same layer, obtains this
The summation of the source code line number of the lines of code having executed of layer and All Files, then successively adds up according to which,
Obtain overall executed lines of code on this server and source code head office of institute, then calculating according to coverage rate formula can
Obtain the overall coverage of this server.
The processing method of the coverage data that the present embodiment provides, in coverage rate server side to each service receiving
The data of device sets up Storage Structure of Tree, in the inclusion file name receiving server transmission and corresponding coverage data
Wait, according to file name, querying node is only modified it is only necessary to coverage data to the coverage data of this node one by one
The node changing recalculates, and calculates the overall covering of this server then in conjunction with the known data on other nodes
Rate, it is not necessary to travel through statistics to All Files, effectively reduces the performance consumption that global data modification and coverage rate calculating bring, carries
High testing efficiency.
Fig. 2 is the flow chart of the processing method example two of coverage data provided in an embodiment of the present invention, as shown in Fig. 2
On the basis of above-described embodiment, inquiring about every layer of node in Storage Structure of Tree according to file name, obtain with described
Before corresponding first child node of file name, the processing method of this coverage data also includes:
Step S201, the file name according to each file and directory information set up described Storage Structure of Tree;Wherein, institute
State and under the root node of Storage Structure of Tree, include the child node that at least one of which is successively set up with directory information and file name.
Step S202, the execution data according to the file under each child node calculates and obtains cover corresponding with described child node
Lid rate.
In scheme, in coverage rate server end, for each server file data etc. need to pre-build tree-like
Storage organization, the specific mode set up is:Root (Root) node represents root, and under root node, the data of storage includes:Always
Lines of code (is added by the lines of code of the file of all child nodes and gets), and total executed lines of code is (by all child nodes
The executed line number that gets of coverage data be added get), and total coverage data is (by total executed code line
Number obtains divided by total code line number).
Include the child node of a layer or multilamellar under root node, other child nodes are broadly divided into two classes, and a class is file
Node, represents certain file (for example:The py file of Python) coverage data, the code having executed including this document
The total line number of executable code in line number, and this document source code, and the covering rate score of this document.
Another kind of is directory node, and comprise is under this catalogue, the respective items of All Files and catalogue coverage data it
With, that is, under this catalogue All Files and catalogue total executed lines of code, and total executable code line number, and by this
The covering rate score that two item data calculate.
Whenever having data to reach, added successively according to bibliographic structure and change corresponding node, if the covering of certain file
Lid rate data is activation changes, then can successively inquire about all of node according to file name, by the coverage data of this document more
It is newly the coverage data after changing, then recalculate the coverage rate of this document.
Under this storage mode, renewal of either coverage data of certain file being modified, still obtain certain
The coverage rate of file, or obtain overall coverage rate, all do not need the data deduplication removing to travel through all of file newly to calculate,
Only need to the node having changed is carried out recalculating, solve size of code than larger when, global data modification and cover
Amount of calculation larger problem when rate data recalculates, reduces performance consumption.
On the basis of above-mentioned two embodiment, a kind of in concrete implementation mode, the present invention is provided below coverage rate
The processing method of data illustrates.
Likewise, the program is related to the server end () of operating file code in implementing taking game server as a example
And coverage rate server end, specifically include data acquisition, data storage and coverage data and recalculate three parts.
1st, initialization procedure
Initialization procedure is divided into startup coverage data processing server and embedded coverage rate collection client to game garment
Two parts in business device script.
The framework of coverage rate server side is based on Tornado and builds, and major function is to be received from logical by websocket
Cross the data of necessarily regular (the process identification (PID) step in the seeing below) client identifying, and regularly by same game server
Data merges and processes.Game server start test before, first start coverage rate server, wait client connect and
Collect data.
For client, start in game server in the script of different processes, add and started using thread
The code that websocket connects, specific as follows:
Ws=websocket.WebSocket (" ws://websocket_address/")
Thread_ws=threading.Thread (target=ws.run)
thread_ws.start()
This thread is used for, after each game server process starts websocket and is connected to coverage rate server, entering
The data is activation of row timing.
2nd, data acquisition, this process is realized in game server
The client of embedded game server, mainly realizes data acquisition by adding following code:
The sys.settrace method being carried using python, in game server script running, Mei Dangfa
Give birth to code execution event (event), trace method will have been called to be tracked, wherein frame represents python running
In stack frame, event represents event (for example perform certain line code, or have invoked certain function etc.).Use
File name fliename that frame.f_code.co_filename acquisition is performed, is obtained using frame.f_lineno and works as
The code line number of front execution, then calls collect method to carry out data collection, the method is mainly the use of dictionary
In the form of (a kind of onboard data structure of python, with key-value to format memory data), by data with the entitled key of file, with
The code line number set being performed is the form storage of value, is exemplified below:
Wherein root/directory1/.../file1 represents the path being test for code file, set
([lineno11, lineno12, lineno13...]) represents a set, and the unit in this set have lineno11,
Lineno12, lineno13 etc., when carrying out coverage rate test in each element representation file1, the line number being performed
(lineno).
Game server needs to be sent to coverage rate server after getting above-mentioned data, i.e. coverage rate server
Above-mentioned data is got by the client in embedded game server, needs locally stored and processing, specifically real
Existing process is as follows.
Initially set up Storage Structure of Tree data is stored, Fig. 3 is tree-like storage knot provided in an embodiment of the present invention
The example schematic of structure, as shown in figure 3, root node represents root, the data wherein comprising has total code line number (by all sons
The data of node is added and gets), total executed lines of code (be added by the data of all child nodes and get), and total covering
Rate data (is obtained divided by total code line number by total executed lines of code).
Other nodes are broadly divided into two classes, and a class is file node, represent certain file (the py file of such as Python)
Coverage data, the total line number of the executable code in the lines of code having executed including this document, and this document source code,
And the covering rate score of this document.
Another kind of is directory node, and comprise is under this catalogue, the respective items of All Files and catalogue coverage data it
With, that is, under this catalogue All Files and catalogue total executed lines of code, and total executable code line number, and by this
The covering rate score that two item data calculate.
Fig. 4 is the stream of the example in coverage rate server side for the processing method of coverage data provided in an embodiment of the present invention
Cheng Tu;As shown in figure 4, in coverage rate server side, storage and processing procedure are specific as follows:
Step S301, the execution data that the reception server sends;Described execution data includes the file being carrying out file
Title and coverage data.
Step S302, inquires about the node of every layer in the Storage Structure of Tree pre-building, obtains and described file name
Corresponding first child node.
Step S303, the data of storage under described first child node is updated to described coverage data.
A kind of similar with embodiment in implementing of above-mentioned several steps.
Specifically, structure as shown in Figure 3, whenever having execution data to reach, adds successively according to bibliographic structure and repaiies
Change corresponding node, the data that will execute the corresponding node of data is updated, for example, certain file name is directory01/
File11.py, then start to search for from root first, find directory01 node, then proceed to search for downwards, find
File11 node, the form of coverage data, executed lines of code by upper section described (' root/directory1/.../
file1':Set ([lineno11, lineno12, lineno13...])) represent.
Obtain the overall coverage of this server if necessary, then after the above steps, can be according to step S304-
Step shown in S306 is executed.
Step S304, by described coverage data and the corresponding source code file of described file name, calculates described
Total code line number at first child node and the line number of executed code.
Step S305, according to the line number of the total code line number at described first child node and executed code, and each
With the total code line number of other child nodes in same layer for described first child node and the line number of executed code, calculate and obtain institute
State the total code line number at the last layer node belonging to the first child node and executed lines of code, by described first child node institute
The last layer node belonging to, as the first child node, repeats this step until calculating the place of the root node of described Storage Structure of Tree
Total code line number and executed lines of code.
After this step, optionally, because the coverage data at the first child node changes, therefore this first son
The coverage rate of the file at node also changes, can be according to the total code at the first child node obtaining in implementing
The line number of line number and executed code recalculates the coverage rate at this first child node, and originally stores at the first child node
Coverage rate be updated to recalculate the coverage rate obtaining it is possible to be shown according to inquiry request, or be exposed directly to
User.
Step S306, according to the total code line number at described root node and executed lines of code, calculates and obtains described clothes
The described overall coverage of business device.
Above-mentioned several step is meant that:Each file child node records the executed line number in coverage data respectively
With source code line number, when calculating total coverage rate, needs will carry out data summarization with node (root), successively by each node
Executed line number be added, then by all generation source code line numbers be added, then using the executed line number at root node divided by total generation
Code line number obtains total coverage rate.
Although root node is not directly using respective coverage rate for each child node, but can count respectively
Calculate the coverage rate of itself, and the coverage rate at the node obtaining is stored, be shown according to inquiry request.
Example as shown in Figure 3, can calculate line number by len (set ([lineno11, lineno12, lineno13...]))
The size of set can get, and executable code line number is then parsed by sound code file, comprises the concrete steps that according in data
Filename, find corresponding local sound code file and parsed, the process of parsing is to remove blank line and comment line, thus calculating
Go out the sum of real executable lines of codes.By above-mentioned steps, obtain the code line number of the currently performed mistake of each file
Set is it is known that coverage rate computing formula is:
Wherein, Rate represents coverage rate, lineexecuteRepresent the lines of code having executed,
linetotalExecutable lines of codes sum.
Total line number according to executable code in All Files and the line number having executed, are calculated this server
Total coverage rate.
In such scheme, whenever new data arrives, after being modified to file child node successively, first child node is become
The father node (directory node) changed recalculates executed lines of code, total code line number and covers rate score;Then according to
Identity logic is if the son node number of certain node, according to there occurs change, recalculates, otherwise constant.Finally in root node
Again settle accounts total coverage data.
If as shown in figure 3, the data of node " file Nk " there occurs change, the data of its brotgher of node keeps constant,
Only need to recalculate the data of file Nk node, catalogue 0N node and root node.
The processing method of the coverage data that the present invention provides, by entering the file on same server according to catalogue
Row tree structure stores, and when coverage data sends modification, querying node is only carried out to the coverage data of this node one by one
Modification, it is only necessary to recalculate to the node changing, effectively reduces the performance that global data modification and coverage rate calculating bring
Consume, improve testing efficiency.Solve size of code larger when, the overall situation data modification and coverage data recalculate and bring
The higher problem of performance consumption.
Fig. 5 is the structural representation of the processing meanss embodiment one of coverage data provided in an embodiment of the present invention, such as Fig. 5
Shown, the processing meanss 10 of the coverage data that the present embodiment provides include:
Receiver module 11, the execution data sending for the reception server;Described execution data includes being carrying out file
File name and coverage data;
Processing module 12, for inquiring about every layer in the Storage Structure of Tree pre-building of node, obtains and described literary composition
Corresponding first child node of part title;
Described processing module 12 be additionally operable to according to described coverage data and obtain in advance with the first child node same
The coverage data of other child nodes of layer, calculates the overall coverage obtaining described server.
The processing meanss of the coverage data that the present embodiment provides, for executing in the method that aforementioned any embodiment provides
The technical scheme of coverage rate server, it is similar with technique effect that it realizes principle, will not be described here.
In the embodiment two of the processing meanss of coverage data of the present invention, Fig. 6 is covering provided in an embodiment of the present invention
The structural representation of the processing meanss embodiment two of rate data, as shown in fig. 6, on the basis of above-described embodiment one, this covering
The processing meanss 10 of rate data also include:
Memory module 13, for being updated to described coverage data by the data of storage under described first child node.
On the basis of any of the above-described embodiment, optionally, the execution number that described receiver module 11 the reception server sends
According to before, described processing module 12 is additionally operable to:
File name according to each file and directory information set up described Storage Structure of Tree;Wherein, described tree-like deposit
The child node that at least one of which is successively set up is included with directory information and file name under the root node of storage structure;
Execution data according to the file under each child node calculates and obtains coverage rate corresponding with described child node.
Optionally, described processing module 12 specifically for:
By described coverage data and the corresponding source code file of described file name, calculate described first child node
The total code line number at place and the line number of executed code;
According to the line number of the total code line number at described first child node and executed code, and each and described first
The total code line number of other child nodes in same layer for the child node and the line number of executed code, calculate and obtain described first son section
The total code line number at last layer node belonging to point and executed lines of code, by the last layer belonging to described first child node
Node, as the first child node, repeats this step until calculating the total code row at the place of root node of described Storage Structure of Tree
Number and executed lines of code;
According to the total code line number at described root node and executed lines of code, calculate and obtain the described of described server
Overall coverage.
Optionally, described processing module 12 is additionally operable to:
Line number according to the total code line number at described first child node and executed code calculates described first child node
Coverage rate;
Control and the coverage rate of described first child node is updated and is shown.
The processing meanss of the coverage data that the present embodiment provides, for executing in the method that aforementioned any embodiment provides
The technical scheme of coverage rate server, it is similar with technique effect that it realizes principle, will not be described here.
Fig. 7 is the structural representation of server example one provided in an embodiment of the present invention, as shown in fig. 7, this server
Can be embodied in methods that:Have program stored therein the memorizer 21 of instruction, receptor 22 and the place for control program instruction execution
Reason device 23;
Described receptor 22 is used for the execution data that the reception server sends;Described execution data includes being carrying out file
File name and coverage data;
Described processor 23 is used for:
Inquire about the node of every layer in the Storage Structure of Tree pre-building, obtain corresponding with described file name first
Child node;
Covering according to described coverage data and other child nodes with the first child node in same layer obtaining in advance
Rate data, calculates the overall coverage obtaining described server.
Optionally, described memorizer 21 is additionally operable to for the data of storage under described first child node to be updated to described coverage rate
Data.
Optionally, before the execution data that described receptor 22 the reception server sends, described processor 23 is additionally operable to:
File name according to each file and directory information set up described Storage Structure of Tree;Wherein, described tree-like deposit
The child node that at least one of which is successively set up is included with directory information and file name under the root node of storage structure;
Execution data according to the file under each child node calculates and obtains coverage rate corresponding with described child node.
Optionally, described processor 23 specifically for:
By described coverage data and the corresponding source code file of described file name, calculate described first child node
The total code line number at place and the line number of executed code;
According to the line number of the total code line number at described first child node and executed code, and each and described first
The total code line number of other child nodes in same layer for the child node and the line number of executed code, calculate and obtain described first son section
The total code line number at last layer node belonging to point and executed lines of code, by the last layer belonging to described first child node
Node, as the first child node, repeats this step until calculating the total code row at the place of root node of described Storage Structure of Tree
Number and executed lines of code;
According to the total code line number at described root node and executed lines of code, calculate and obtain the described of described server
Overall coverage.
Optionally, described processor 23 is additionally operable to:
Line number according to the total code line number at described first child node and executed code calculates described first child node
Coverage rate;
Control and the coverage rate of described first child node is updated and is shown.
The server that the present embodiment provides is coverage rate server, for executing the method that aforementioned any embodiment provides
Technical scheme, it is similar with technique effect that it realizes principle, will not be described here.
It should be appreciated that processor can be CPU (English in the embodiment of any of the above-described server:
Central Processing Unit, referred to as:CPU), can also be other general processors, digital signal processor (English:
Digital Signal Processor, referred to as:DSP), special IC (English:Application Specific
Integrated Circuit, referred to as:ASIC) etc..General processor can be microprocessor or this processor can also be
Any conventional processor etc..Step in conjunction with the method disclosed in the embodiment of the present invention can be embodied directly in hardware processor
Execution completes, or is completed with the hardware in processor and software module combination execution.
One of ordinary skill in the art will appreciate that:The all or part of step realizing above-mentioned each method embodiment can be led to
Cross the related hardware of programmed instruction to complete.Aforesaid program can be stored in a computer read/write memory medium.This journey
Sequence upon execution, executes the step including above-mentioned each method embodiment;And aforesaid storage medium includes:Read only memory (English
Literary composition:Read-only memory, abbreviation:ROM), RAM, flash memory, hard disk, solid state hard disc, tape (English:magnetic
Tape), floppy disk (English:Floppy disk), CD (English:Optical disc) and its combination in any.
Finally it should be noted that:Various embodiments above only in order to technical scheme to be described, is not intended to limit;To the greatest extent
Pipe has been described in detail to the present invention with reference to foregoing embodiments, it will be understood by those within the art that:Its according to
So the technical scheme described in foregoing embodiments can be modified, or wherein some or all of technical characteristic is entered
Row equivalent;And these modifications or replacement, do not make the essence of appropriate technical solution depart from various embodiments of the present invention technology
The scope of scheme.
Claims (11)
1. a kind of processing method of coverage data is it is characterised in that include:
The execution data that the reception server sends;Described execution data includes file name and the coverage rate number being carrying out file
According to;
Inquire about the node of every layer in the Storage Structure of Tree pre-building, obtain first son section corresponding with described file name
Point;
Coverage rate number according to described coverage data and other child nodes with the first child node in same layer obtaining in advance
According to calculating obtains the overall coverage of described server.
2. method according to claim 1 is it is characterised in that described acquisition first son corresponding with described file name saves
After point, methods described also includes:
The data of storage under described first child node is updated to described coverage data.
3. method according to claim 1 and 2 it is characterised in that described the reception server send execution data before,
Methods described includes:
File name according to each file and directory information set up described Storage Structure of Tree;Wherein, described tree-like storage knot
The child node that at least one of which is successively set up is included with directory information and file name under the root node of structure;
Execution data according to the file under each child node calculates and obtains coverage rate corresponding with described child node.
4. method according to claim 3 it is characterised in that described according to described coverage data and obtain in advance with
The coverage data of other child nodes in same layer for first child node, calculates the overall coverage obtaining described server, bag
Include:
By described coverage data and the corresponding source code file of described file name, calculate at described first child node
Total code line number and the line number of executed code;
According to the line number of the total code line number at described first child node and executed code, and each and described first son section
Point, in the total code line number of other child nodes of same layer and the line number of executed code, calculates and obtains described first child node institute
The total code line number at last layer node belonging to and executed lines of code, by the last layer node belonging to described first child node
As the first child node, repeat this step until calculate described Storage Structure of Tree the total code line number at the place of root node and
Executed lines of code;
According to the total code line number at described root node and executed lines of code, calculate and obtain the described overall of described server
Coverage rate.
5. method according to claim 4 is it is characterised in that by described coverage data and described file name pair
The source code file answered, after the total code line number at described first child node of calculating and the line number of executed code, also includes:
Line number according to the total code line number at described first child node and executed code calculates covering of described first child node
Lid rate;
The coverage rate of described first child node is updated and is shown.
6. a kind of coverage rate detection means is it is characterised in that include:
Receiver module, the execution data sending for the reception server;Described execution data includes the file being carrying out file
Title and coverage data;
Processing module, for inquiring about every layer in the Storage Structure of Tree pre-building of node, obtains and described file name
Corresponding first child node;
Described processing module be additionally operable to according to described coverage data and obtain in advance with the first child node same layer its
The coverage data of his child node, calculates the overall coverage obtaining described server.
7. device according to claim 6 is it is characterised in that described device also includes:
Memory module, for being updated to described coverage data by the data of storage under described first child node.
8. the device according to claim 6 or 7 it is characterised in that described receiver module the reception server send execution
Before data, described processing module is additionally operable to:
File name according to each file and directory information set up described Storage Structure of Tree;Wherein, described tree-like storage knot
The child node that at least one of which is successively set up is included with directory information and file name under the root node of structure;
Execution data according to the file under each child node calculates and obtains coverage rate corresponding with described child node.
9. device according to claim 8 it is characterised in that described processing module specifically for:
By described coverage data and the corresponding source code file of described file name, calculate at described first child node
Total code line number and the line number of executed code;
According to the line number of the total code line number at described first child node and executed code, and each and described first son section
Point, in the total code line number of other child nodes of same layer and the line number of executed code, calculates and obtains described first child node institute
The total code line number at last layer node belonging to and executed lines of code, by the last layer node belonging to described first child node
As the first child node, repeat this step until calculate described Storage Structure of Tree the total code line number at the place of root node and
Executed lines of code;
According to the total code line number at described root node and executed lines of code, calculate and obtain the described overall of described server
Coverage rate.
10. device according to claim 9 is it is characterised in that described processing module is additionally operable to:
Line number according to the total code line number at described first child node and executed code calculates covering of described first child node
Lid rate;
Control and the coverage rate of described first child node is updated and is shown.
A kind of 11. servers are it is characterised in that include:Have program stored therein the memorizer of instruction, receptor and be used for control program
The processor of instruction execution;
Described receptor is used for the execution data that the reception server sends;Described execution data includes the file being carrying out file
Title and coverage data;
Described processor is used for:
Inquire about the node of every layer in the Storage Structure of Tree pre-building, obtain first son section corresponding with described file name
Point;
Coverage rate number according to described coverage data and other child nodes with the first child node in same layer obtaining in advance
According to calculating obtains the overall coverage of described server.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611083736.5A CN106407126B (en) | 2016-11-30 | 2016-11-30 | Processing method, device and the server of coverage data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611083736.5A CN106407126B (en) | 2016-11-30 | 2016-11-30 | Processing method, device and the server of coverage data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106407126A true CN106407126A (en) | 2017-02-15 |
CN106407126B CN106407126B (en) | 2019-04-30 |
Family
ID=58084152
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611083736.5A Active CN106407126B (en) | 2016-11-30 | 2016-11-30 | Processing method, device and the server of coverage data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106407126B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111813697A (en) * | 2020-08-26 | 2020-10-23 | 四川新网银行股份有限公司 | Test coverage rate statistical method based on test object calling mark |
CN116627974A (en) * | 2023-05-25 | 2023-08-22 | 成都融见软件科技有限公司 | Coverage rate storage system |
CN116701182A (en) * | 2023-05-10 | 2023-09-05 | 合芯科技有限公司 | Coverage rate mark file updating method, coverage rate mark file updating device, coverage rate mark file updating equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070150845A1 (en) * | 2005-12-26 | 2007-06-28 | Fujitsu Limited | Designing apparatus, designing method, and program thereof |
CN102236600A (en) * | 2010-05-06 | 2011-11-09 | 无锡中星微电子有限公司 | Method and device for obtaining code coverage rate |
CN103365771A (en) * | 2012-04-10 | 2013-10-23 | 阿里巴巴集团控股有限公司 | Method and equipment for obtaining code coverage rate |
CN103473171A (en) * | 2013-08-28 | 2013-12-25 | 北京信息科技大学 | Coverage rate dynamic tracking method and device based on function call paths |
CN103838666A (en) * | 2012-11-27 | 2014-06-04 | 百度在线网络技术(北京)有限公司 | Method and device for determining code execution coverage rate |
-
2016
- 2016-11-30 CN CN201611083736.5A patent/CN106407126B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070150845A1 (en) * | 2005-12-26 | 2007-06-28 | Fujitsu Limited | Designing apparatus, designing method, and program thereof |
CN102236600A (en) * | 2010-05-06 | 2011-11-09 | 无锡中星微电子有限公司 | Method and device for obtaining code coverage rate |
CN103365771A (en) * | 2012-04-10 | 2013-10-23 | 阿里巴巴集团控股有限公司 | Method and equipment for obtaining code coverage rate |
CN103838666A (en) * | 2012-11-27 | 2014-06-04 | 百度在线网络技术(北京)有限公司 | Method and device for determining code execution coverage rate |
CN103473171A (en) * | 2013-08-28 | 2013-12-25 | 北京信息科技大学 | Coverage rate dynamic tracking method and device based on function call paths |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111813697A (en) * | 2020-08-26 | 2020-10-23 | 四川新网银行股份有限公司 | Test coverage rate statistical method based on test object calling mark |
CN116701182A (en) * | 2023-05-10 | 2023-09-05 | 合芯科技有限公司 | Coverage rate mark file updating method, coverage rate mark file updating device, coverage rate mark file updating equipment and storage medium |
CN116701182B (en) * | 2023-05-10 | 2024-06-04 | 合芯科技有限公司 | Coverage rate mark file updating method, coverage rate mark file updating device, coverage rate mark file updating equipment and storage medium |
CN116627974A (en) * | 2023-05-25 | 2023-08-22 | 成都融见软件科技有限公司 | Coverage rate storage system |
CN116627974B (en) * | 2023-05-25 | 2024-02-09 | 成都融见软件科技有限公司 | Coverage rate storage system |
Also Published As
Publication number | Publication date |
---|---|
CN106407126B (en) | 2019-04-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020233015A1 (en) | Link tracking method and apparatus | |
JP5978401B2 (en) | Method and system for monitoring the execution of user requests in a distributed system | |
CN110928772B (en) | Test method and device | |
JP7230083B2 (en) | Method and apparatus for map service testing | |
US8468145B2 (en) | Indexing of URLs with fragments | |
US8738682B2 (en) | Monitoring a path of a transaction across a composite application | |
CN106815254B (en) | Data processing method and device | |
CN108632111A (en) | Service link monitoring method based on log | |
CN113067883A (en) | Data transmission method and device, computer equipment and storage medium | |
US11394527B2 (en) | Blockchain program and blockchain method | |
CN106407126A (en) | Coverage rate data processing method, coverage rate data detection device and server | |
CN106713396A (en) | Server scheduling method and system | |
CN106502901A (en) | Coverage rate detection method, device and equipment | |
CN102893261B (en) | The idle conversion method of sampling and system thereof | |
Du et al. | Hawkeye: Adaptive straggler identification on heterogeneous spark cluster with reinforcement learning | |
CN116016628A (en) | API gateway buried point analysis method and device | |
CN110430083A (en) | A kind of location processing method and server of agency's forwarding request | |
CN106528411A (en) | Method and device for coverage rate detection and equipment | |
JP4973738B2 (en) | Business flow processing program, method and apparatus | |
JP5928165B2 (en) | Abnormal transition pattern detection method, program, and apparatus | |
CN107480189A (en) | A kind of various dimensions real-time analyzer and method | |
CN115269519A (en) | Log detection method and device and electronic equipment | |
US9356843B2 (en) | Flow systems and methods | |
CN111782443B (en) | Data processing method and device and electronic equipment | |
CN106294183B (en) | Coverage rate detection method, device and equipment |
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 |