CN106407126B - Processing method, device and the server of coverage data - Google Patents
Processing method, device and the server of coverage data Download PDFInfo
- Publication number
- CN106407126B CN106407126B CN201611083736.5A CN201611083736A CN106407126B CN 106407126 B CN106407126 B CN 106407126B CN 201611083736 A CN201611083736 A CN 201611083736A CN 106407126 B CN106407126 B CN 106407126B
- Authority
- CN
- China
- Prior art keywords
- coverage
- data
- child node
- node
- code
- 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.)
- Active
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 present invention provides processing method, device and the server of a kind of coverage data, this method comprises: receiving the execution data that server is sent;The execution data include being carrying out the file name and coverage data of file;Every layer of node in the Storage Structure of Tree pre-established is inquired, the first child node corresponding with the file name is obtained;Obtain according to the coverage data and in advance with the first child node other child nodes of same layer coverage rate, calculate the overall coverage for obtaining the server, by the way that the file on the same server is carried out tree structure storage according to catalogue, when coverage data sends and modifies, querying node only modifies to the coverage data of the node one by one, it only needs to recalculate the node changed, it effectively reduces global data modification and coverage rate calculates bring performance consumption, improve testing efficiency.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of processing methods of coverage data, device and service
Device.
Background technique
Code coverage test, be in software test procedure most important test method and test effect measurement standard it
One, coverage rate refers to ratio and degree that covered code is tested in source code implementation procedure, usually uses percentage table
Show.
For different programming languages, there is the method for corresponding detection code coverage.It is being directed to game server
Python code coverage detection during, usually used technical solution using python carry
Sys.settrace function carries out data collection and processing, after stopping acquisition, disposably exports coverage data report.
Since the requirement of real-time of code coverage detection needs code to be tested with the increase of game scale and the development of project
Measure higher and higher, how preferably to safeguard and store the coverage data obtained in coverage rate test becomes asking of must solving
Topic.In general, coverage data includes file coverage data and catalogue coverage data, the execution of each file
The code line number set crossed, the total executable code line number set etc. of this document, and whenever there is new coverage data to arrive,
For example some codes of some file are performed, then the catalogue where just needing to recalculate current file, current file is very
As for overall coverage data.The specific mode for obtaining coverage data a kind of at present is the sys module using python
Middle offer settrace function, tracks the executive condition of code, by coverage data storage in the Stack into Collector.
Whenever starting acquisition, Collector constantly executes stack-incoming operation, when stopping acquisition, can be obtained and adopted by Pop operations
The coverage data of collection.
However, whenever there is new data arrival, needing to store and recalculate covering when needing size of code to be tested larger
Rate brings very big burden to memory and calculated performance, or even influences whether the operation of tested program, reduces to a certain extent
The efficiency and quality of test.
Summary of the invention
The embodiment of the present invention provides processing method, device and the server of a kind of coverage data, current for solving
In scheme, when needing size of code to be tested larger, whenever there is new data arrival, needs to store and recalculate coverage rate, give
Memory and calculated performance bring very big burden, or even influence whether the operation of tested program, reduce survey to a certain extent
The problem of efficiency and quality of examination.
First aspect present invention provides a kind of processing method of coverage data, comprising:
Receive the execution data that server is sent;The execution data include being carrying out the file name and covering of file
Rate data;
Every layer of node in the Storage Structure of Tree pre-established is inquired, obtains corresponding with the file name first
Child node;
Obtain according to the coverage data and in advance with the first child node other child nodes of same layer covering
Rate data calculate the overall coverage for obtaining the server.
Optionally, after the acquisition the first child node corresponding with the file name, the method also includes:
The data stored under first child node are updated to the coverage data.
Optionally, before the execution data for receiving server transmission, which comprises
The Storage Structure of Tree is established according to the file name of each file and directory information;Wherein, described tree-like to deposit
It include at least one layer of child node successively established with directory information and file name under the root node of storage structure;
It is calculated according to the execution data of the file under each child node and obtains coverage rate corresponding with the child node.
Optionally, it is described it is obtaining according to the coverage data and in advance with the first child node in other sons of same layer
The coverage data of node calculates the overall coverage for obtaining the server, comprising:
By the coverage data and the corresponding source code file of the file name, first child node is calculated
The total code line number at place and the line number for having executed code;
According to the total code line number at first child node and the line number of code is executed, and each with described first
Child node other child nodes of same layer total code line number and executed the line number of code, calculate and obtain the first son section
It puts the total code line number at an affiliated upper node layer and has executed lines of code, by upper one layer belonging to first child node
Node repeats this step until calculating the total code row at the place of the root node of the Storage Structure of Tree as the first child node
It counts and has executed lines of code;
According to the total code line number at the root node and lines of code has been executed, has calculated and obtains the described of the server
Overall coverage.
Optionally, by the coverage data and the corresponding source code file of the file name, described the is calculated
Total code line number at one child node and after having executed the line number of code, further includes:
First child node is calculated according to the total code line number at first child node and the line number for having executed code
Coverage rate;
The coverage rate of first child node is updated and is shown.
Second aspect of the present invention provides a kind of coverage rate detection device, comprising:
Receiving module, for receiving the execution data of server transmission;The execution data include being carrying out file
File name and coverage data;
Processing module, every layer of the node for inquiring in the Storage Structure of Tree pre-established obtain and the file
Corresponding first child node of title;
The processing module be also used to obtain according to the coverage data and in advance with the first child node in same layer
Other child nodes coverage data, calculate the overall coverage for obtaining the server.
Optionally, described device further include:
Memory module, for the data stored under first child node to be updated to the coverage data.
Optionally, before the receiving module receives the execution data that server is sent, the processing module is also used to:
The Storage Structure of Tree is established according to the file name of each file and directory information;Wherein, described tree-like to deposit
It include at least one layer of child node successively established with directory information and file name under the root node of storage structure;
It is calculated according to the execution data of the file under each child node and obtains coverage rate corresponding with the child node.
Optionally, the processing module is specifically used for:
By the coverage data and the corresponding source code file of the file name, first child node is calculated
The total code line number at place and the line number for having executed code;
According to the total code line number at first child node and the line number of code is executed, and each with described first
Child node other child nodes of same layer total code line number and executed the line number of code, calculate and obtain the first son section
It puts the total code line number at an affiliated upper node layer and has executed lines of code, by upper one layer belonging to first child node
Node repeats this step until calculating the total code row at the place of the root node of the Storage Structure of Tree as the first child node
It counts and has executed lines of code;
According to the total code line number at the root node and lines of code has been executed, has calculated and obtains the described of the server
Overall coverage.
Optionally, the processing module is also used to:
First child node is calculated according to the total code line number at first child node and the line number for having executed code
Coverage rate;
The coverage rate of first child node is updated and is shown by control.
Third aspect present invention provides a kind of server, comprising: is stored with the memory of program instruction, receiver and is used for
Control the processor that program instruction executes;
The receiver is used to receive the execution data of server transmission;The execution data include being carrying out file
File name and coverage data;
The processor is used for:
Every layer of node in the Storage Structure of Tree pre-established is inquired, obtains corresponding with the file name first
Child node;
Obtain according to the coverage data and in advance with the first child node other child nodes of same layer covering
Rate data calculate the overall coverage for obtaining the server.
Processing method, device and the server of coverage data provided in an embodiment of the present invention, in coverage rate server side
Storage Structure of Tree is established to the data of each server received, receive server transmission include file name and
When corresponding coverage data, according to file name, querying node only modifies to the coverage data of the node one by one,
It only needs to recalculate the node that coverage data changes, be calculated then in conjunction with the known data on other nodes
The overall coverage of the server does not need to traverse statistics to All Files, effectively reduces global data modification and coverage rate meter
Bring performance consumption is calculated, testing efficiency is improved.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is this hair
Bright some embodiments for those of ordinary skill in the art without any creative labor, can be with
Other attached drawings are obtained according to these attached 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 be coverage data provided in an embodiment of the present invention processing method coverage rate server side example stream
Cheng Tu;
Fig. 5 is the structural schematic diagram of the processing device embodiment one of coverage data provided in an embodiment of the present invention;
Fig. 6 is the structural schematic diagram of the processing device embodiment two of coverage data provided in an embodiment of the present invention;
Fig. 7 is the structural schematic diagram of server example one provided in an embodiment of the present invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
All other embodiment obtained without creative efforts, shall fall within the protection scope of the present 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 executing subject of the program is server (i.e. coverage rate server) for detecting coverage rate, or detection coverage rate other
Equipment, the specific implementation step of the coverage rate detection method are as follows:
Step S101 receives the execution data that server is sent;The execution data include the file for being carrying out file
Title and coverage data.
In the present embodiment, sending here and executing the server of data is the server for executing the program of this document, such as:
The server of running game program.The server of execution document code in the program needs to obtain the file for the file being performed
Title and coverage data, the coverage data include at least the letter for the line number that can indicate that the file being performed has executed
Breath, such as: currently performed line number, or the line number executed etc..
Step S102 inquires the node of every layer in the Storage Structure of Tree pre-established, obtains and the file name
Corresponding first child node.
In the program, the execution data for the All Files that coverage rate server end sends the above-mentioned server received
It is stored according to Storage Structure of Tree, the title that file can be used in each node is named, and stores this document under node
The coverage data of the corresponding file of title.
After the execution data that the subsequently received server is sent, carried out according to the layer-by-layer node of file name therein
Inquiry, the first child node corresponding with this document title that will be inquired.
Optionally, the data which stores can be updated to execute the coverage data in data.
Step S103, obtain according to the coverage data and in advance with the first child node same layer other sub- sections
The coverage data of point calculates the overall coverage for obtaining the server.
In the present solution, to get the overall coverage of above-mentioned server, the All Files solution to the server is not needed
Analysis one time, it is only necessary to the source code of the corresponding coverage data of file name and this document in the execution data received
File carries out dissection process and obtains this then in conjunction with the coverage data of other child nodes with the first child node same layer
The summation of the source code line number of the lines of code executed and All Files of layer, then successively adds up according to which,
The lines of code of execution and source code head office, institute overall on the server is obtained, it then can according to the calculating of coverage rate formula
Obtain the overall coverage of the server.
The processing method of coverage data provided in this embodiment, in each service of the coverage rate server side to receiving
The data of device establish Storage Structure of Tree, when receive server transmission includes file name and corresponding coverage data
It waits, according to file name, querying node only modifies to the coverage data of the node one by one, it is only necessary to coverage data
The node changed recalculates, and calculates the overall of the server then in conjunction with the known data on other nodes and covers
Rate does not need to traverse statistics to All Files, effectively reduces global data modification and coverage rate calculates bring performance consumption, mention
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 the above embodiments, according to file name inquire Storage Structure of Tree in every layer of node, obtain with it is described
Before corresponding first child node of file name, the processing method of the coverage data further include:
Step S201 establishes the Storage Structure of Tree according to the file name of each file and directory information;Wherein, institute
Stating under the root node of Storage Structure of Tree includes at least one layer of child node successively established with directory information and file name.
Step S202 is calculated according to the execution data of the file under each child node and is obtained cover corresponding with the child node
Lid rate.
In scheme, in coverage rate server end, the file data etc. of each server is needed to pre-establish tree-like
Storage organization, the mode specifically established is: root (Root) node indicates root, and the data stored under root node include: total
Lines of code (is got) by the lines of code addition of the file of all child nodes, has always executed lines of code (by all child nodes
Coverage data get the line number of execution addition get) and total coverage data (by total execution code line
Number is obtained divided by total code line number).
Child node under root node including one layer or multilayer, other child nodes are broadly divided into two classes, and one kind is file
Node represents the coverage data of some file (such as: the py file of Python), the code executed including this document
The covering rate score of the total line number of executable code and this document in line number and this document source code.
Another kind of is directory node, and include is under the catalogue, the respective items of All Files and catalogue coverage data it
With, i.e., the total lines of code of execution and total executable code line number of All Files and catalogue under the catalogue, and by this
The covering rate score that two item datas calculate.
Whenever having data arrival, corresponding node is successively added and modified according to bibliographic structure, if some file covers
Lid rate data send variation, then all nodes can be successively inquired according to file name, more by the coverage data of this document
The new coverage data for after variation, then recalculates the coverage rate of this document.
Under this storage mode, either modifies update to the coverage data of some file, still obtain some
The coverage rate of file, or overall coverage rate is obtained, it does not need that the data deduplication for traversing all files is gone newly to calculate again,
Only need the node changed is recalculated, solve size of code it is bigger when, global data modification and covering
Calculation amount larger problem when rate data recalculate reduces performance consumption.
On the basis of above-mentioned two embodiment, below to coverage rate provided by the invention in a manner of a kind of concrete implementation
The processing method of data is illustrated.
Likewise, the program is related to the server end of operating file code in the concrete realization (by taking game server as an example)
And coverage rate server end, it specifically includes data acquisition, data storage and coverage data and recalculates three parts.
1, initialization procedure
Initialization procedure is divided into starting coverage data processing server and insertion coverage rate acquires client to game garment
Two parts in business device script.
The framework of coverage rate server side is constructed based on Tornado, and major function is to be received by websocket from logical
The data of the client of certain regular (the process identification (PID) step in seeing below) mark are crossed, and periodically by same game server
Data merge and processing.Game server starting test before, first starting coverage rate server, wait client connection and
Collect data.
For client, in the script that starts different processes in game server, addition is started using thread
The code of websocket connection, specific as follows:
Ws=websocket.WebSocket (" ws: //websocket_address/ ")
Thread_ws=threading.Thread (target=ws.run)
thread_ws.start()
The thread is used for after each game server process starts websocket and is connected to coverage rate server, into
The data of row timing are sent.
2, data acquisition, the process are realized in game server
It is embedded in the client of game server, main to realize data acquisition by adding following code:
The sys.settrace method carried using python, in game server script operational process, Mei Dangfa
It has given birth to code and has executed event (event), trace method will be called to be tracked, wherein frame indicates python operational process
In stack frame, event indicates the event (such as perform certain line code, or have invoked some function etc.) occurred.It uses
Frame.f_code.co_filename obtains the file name fliename being performed, and is worked as using frame.f_lineno acquisition
The code line number of preceding execution, then calls collect method to carry out data collection, and this method has mainly used dictionary
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 that the form of value stores, and is exemplified below:
Wherein root/directory1/.../file1 indicates the path of tested code file, set
([lineno11, lineno12, lineno13...]) indicates that a set, the member in the set are known as lineno11,
Lineno12, lineno13 etc., when carrying out coverage rate test in each element representation file1, the line number that was performed
(lineno)。
Game server needs to be sent to after getting above-mentioned data coverage rate server, i.e. coverage rate server
Above-mentioned data are got by the client in insertion game server, need to be stored and processed locally, it is specific real
Existing process is as follows.
It initially sets up Storage Structure of Tree to store data, 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 indicates root, data wherein included have total code line number (by all sons
The data addition of node is got), always execute lines of code (being got by the data addition of all child nodes) and total covering
Rate data (are obtained by total lines of code of execution divided by total code line number).
Other nodes are broadly divided into two classes, and one kind is file node, represent some file (such as py file of Python)
Coverage data, the total line number of executable code in the lines of code executed including this document and this document source code,
And the covering rate score of this document.
Another kind of is directory node, and include is under the catalogue, the respective items of All Files and catalogue coverage data it
With, i.e., the total lines of code of execution and total executable code line number of All Files and catalogue under the catalogue, and by this
The covering rate score that two item datas calculate.
Fig. 4 be coverage data provided in an embodiment of the present invention processing method coverage rate server side example stream
Cheng Tu;As shown in figure 4, storage and processing process is specific as follows in coverage rate server side:
Step S301 receives the execution data that server is sent;The execution data include the file for being carrying out file
Title and coverage data.
Step S302 inquires the node of every layer in the Storage Structure of Tree pre-established, obtains and the file name
Corresponding first child node.
The data stored under first child node are updated to the coverage data by step S303.
It is similar with embodiment one kind in the specific implementation of above-mentioned several steps.
Specifically, structure as shown in Figure 3 is successively added and is repaired according to bibliographic structure whenever having execution data to reach
Change corresponding node, i.e., be updated the data for executing the corresponding node of data, for example, certain file name is directory01/
File11.py is then searched for since root first, finds directory01 node, is then proceeded to search for downwards, be found
File11 node, the format of coverage data, the lines of code executed as described in upper section (' root/directory1/.../
File1':set ([lineno11, lineno12, lineno13...])) it indicates.
It, then after the above steps, can be according to step S304- if necessary to obtain the overall coverage of the server
Step shown in S306 is executed.
Step S304, by the coverage data and the corresponding source code file of the file name, described in calculating
Total code line number at first child node and the line number for having executed code.
Step S305 according to the total code line number at first child node and has executed the line number of code, and each
The total code line number of other child nodes with first child node in same layer and the line number for having executed code calculate and obtain institute
It states the total code line number at a upper node layer belonging to the first child node and has executed lines of code, by the first child node institute
The upper node layer belonged to repeats this step until calculating the place of the root node of the Storage Structure of Tree as the first child node
Total code line number and executed lines of code.
After this step, optionally, since the coverage data at the first child node changes, first son
The coverage rate of file at node also changes, in the concrete realization can be according to the total code at the first obtained child node
Line number and the line number for having executed code recalculate the coverage rate at first child node, and will store originally at the first child node
Coverage rate be updated to the coverage rate recalculated, and can be shown according to inquiry request, or be exposed directly to
User.
Step S306 according to the total code line number at the root node and has executed lines of code, calculates and obtains the clothes
The overall coverage of business device.
Above-mentioned several steps are meant that: each file child node records the execution line number in coverage data respectively
It needs data summarization will be carried out with node (root), successively by each node when calculating total coverage rate with source code line number
The line number of execution be added, then all generation source code line numbers are added, then using the line number of execution at root node divided by total generation
Code line number obtains total coverage rate.
For each child node, although root node does not use respective coverage rate directly, but it can count respectively
The coverage rate of itself is calculated, and the coverage rate at obtained node is stored, is 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 be obtained, and executable code line number then by sound code file parsing from, comprise the concrete steps that according in data
Filename, find corresponding local sound code file and parsed, the process of parsing is removal blank line and comment line, to calculate
The sum of real executable lines of codes out.By above-mentioned steps, the code line number of the currently performed mistake of each file is obtained
Set, it is known that coverage rate calculation formula are as follows:
Wherein, Rate indicates coverage rate, lineexecuteIndicate the lines of code executed,
linetotalExecutable lines of codes sum.
According to total line number of executable code in All Files and the line number executed, the server is calculated
Total coverage rate.
In the above scheme, whenever new data arrival, after being successively modified to file child node, child node is become first
The father node (directory node) of change, which recalculates, has executed lines of code, total code line number and covering rate score;Then according to
Identity logic is otherwise constant if the son node number of some node is recalculated according to being changed.Finally in root node
Again total coverage data is settled accounts.
As shown in figure 3, the data of the brotgher of node remain unchanged if the data of node " file Nk " are changed,
Only need to recalculate the data of file Nk node, catalogue 0N node and root node.
The processing method of coverage data provided by the invention, by by the file on the same server according to catalogue into
The storage of row tree structure, when coverage data sends and modifies, querying node only carries out the coverage data of the node one by one
Modification, it is only necessary to the node changed be recalculated, global data modification is effectively reduced and coverage rate calculates bring performance
Consumption improves testing efficiency.Solve size of code it is larger when, global data modification and coverage data are recalculated and are brought
The higher problem of performance consumption.
Fig. 5 is the structural schematic diagram of the processing device embodiment one of coverage data provided in an embodiment of the present invention, such as Fig. 5
Shown, the processing unit 10 of coverage data provided in this embodiment includes:
Receiving module 11, for receiving the execution data of server transmission;The execution data include being carrying out file
File name and coverage data;
Processing module 12, every layer of the node for inquiring in the Storage Structure of Tree pre-established obtain and the text
Corresponding first child node of part title;
The processing module 12 be also used to obtain according to the coverage data and in advance with the first child node same
The coverage data of other child nodes of layer calculates the overall coverage for obtaining the server.
The processing unit of coverage data provided in this embodiment, for executing in the method that aforementioned any embodiment provides
The technical solution of coverage rate server, it is similar that the realization principle and technical effect are similar, and details are not described herein.
In the embodiment two of the processing unit of coverage data of the present invention, Fig. 6 is covering provided in an embodiment of the present invention
The structural schematic diagram of the processing device embodiment two of rate data, as shown in fig. 6, on the basis of the above embodiment 1, the covering
The processing unit 10 of rate data further include:
Memory module 13, for the data stored under first child node to be updated to the coverage data.
Based on any of the above embodiments, optionally, the receiving module 11 receives the execution number that server is sent
According to before, the processing module 12 is also used to:
The Storage Structure of Tree is established according to the file name of each file and directory information;Wherein, described tree-like to deposit
It include at least one layer of child node successively established with directory information and file name under the root node of storage structure;
It is calculated according to the execution data of the file under each child node and obtains coverage rate corresponding with the child node.
Optionally, the processing module 12 is specifically used for:
By the coverage data and the corresponding source code file of the file name, first child node is calculated
The total code line number at place and the line number for having executed code;
According to the total code line number at first child node and the line number of code is executed, and each with described first
Child node other child nodes of same layer total code line number and executed the line number of code, calculate and obtain the first son section
It puts the total code line number at an affiliated upper node layer and has executed lines of code, by upper one layer belonging to first child node
Node repeats this step until calculating the total code row at the place of the root node of the Storage Structure of Tree as the first child node
It counts and has executed lines of code;
According to the total code line number at the root node and lines of code has been executed, has calculated and obtains the described of the server
Overall coverage.
Optionally, the processing module 12 is also used to:
First child node is calculated according to the total code line number at first child node and the line number for having executed code
Coverage rate;
The coverage rate of first child node is updated and is shown by control.
The processing unit of coverage data provided in this embodiment, for executing in the method that aforementioned any embodiment provides
The technical solution of coverage rate server, it is similar that the realization principle and technical effect are similar, and details are not described herein.
Fig. 7 is the structural schematic diagram of server example one provided in an embodiment of the present invention, as shown in fig. 7, the server
It can be embodied in methods that: being stored with the memory 21, receiver 22 and the place for controlling program instruction execution of program instruction
Manage device 23;
The receiver 22 is used to receive the execution data of server transmission;The execution data include being carrying out file
File name and coverage data;
The processor 23 is used for:
Every layer of node in the Storage Structure of Tree pre-established is inquired, obtains corresponding with the file name first
Child node;
Obtain according to the coverage data and in advance with the first child node other child nodes of same layer covering
Rate data calculate the overall coverage for obtaining the server.
Optionally, the memory 21 is also used to the data stored under first child node being updated to the coverage rate
Data.
Optionally, before the receiver 22 receives the execution data that server is sent, the processor 23 is also used to:
The Storage Structure of Tree is established according to the file name of each file and directory information;Wherein, described tree-like to deposit
It include at least one layer of child node successively established with directory information and file name under the root node of storage structure;
It is calculated according to the execution data of the file under each child node and obtains coverage rate corresponding with the child node.
Optionally, the processor 23 is specifically used for:
By the coverage data and the corresponding source code file of the file name, first child node is calculated
The total code line number at place and the line number for having executed code;
According to the total code line number at first child node and the line number of code is executed, and each with described first
Child node other child nodes of same layer total code line number and executed the line number of code, calculate and obtain the first son section
It puts the total code line number at an affiliated upper node layer and has executed lines of code, by upper one layer belonging to first child node
Node repeats this step until calculating the total code row at the place of the root node of the Storage Structure of Tree as the first child node
It counts and has executed lines of code;
According to the total code line number at the root node and lines of code has been executed, has calculated and obtains the described of the server
Overall coverage.
Optionally, the processor 23 is also used to:
First child node is calculated according to the total code line number at first child node and the line number for having executed code
Coverage rate;
The coverage rate of first child node is updated and is shown by control.
Server provided in this embodiment is coverage rate server, for executing method that aforementioned any embodiment provides
Technical solution, it is similar that the realization principle and technical effect are similar, and details are not described herein.
In the embodiment of any of the above-described server, it should be appreciated that processor can be central processing unit (English:
Central Processing Unit, referred to as: CPU), can also be other general processors, digital signal processor (English:
Digital Signal Processor, referred to as: DSP), specific integrated circuit (English: Application Specific
Integrated Circuit, referred to as: ASIC) etc..General processor can be microprocessor or the processor is also possible to
Any conventional processor etc..The step of method in conjunction with disclosed in the embodiment of the present invention, can be embodied directly in hardware processor
Execute completion, or in processor hardware and software module combination execute completion.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above-mentioned each method embodiment can lead to
The relevant hardware of program instruction is crossed to complete.Program above-mentioned can be stored in a computer readable storage medium.The journey
When being executed, execution includes the steps that above-mentioned each method embodiment to sequence;And storage medium above-mentioned includes: read-only memory (English
Text: read-only memory, abbreviation: ROM), RAM, flash memory, hard disk, solid state hard disk, tape (English: magnetic
Tape), floppy disk (English: floppy disk), CD (English: optical disc) and any combination thereof.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent
Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to
So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into
Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution
The range of scheme.
Claims (11)
1. a kind of processing method of coverage data characterized by comprising
Receive the execution data that server is sent;The execution data include being carrying out the file name and coverage rate number of file
According to;
Every layer of node in the Storage Structure of Tree pre-established is inquired, the first son section corresponding with the file name is obtained
Point;
Obtain according to the coverage data and in advance with the first child node other child nodes of same layer coverage rate number
According to calculating obtains the overall coverage of the server.
2. the method according to claim 1, wherein described obtain the first son section corresponding with the file name
After point, the method also includes:
The data stored under first child node are updated to the coverage data.
3. method according to claim 1 or 2, which is characterized in that before the execution data for receiving server transmission,
The described method includes:
The Storage Structure of Tree is established according to the file name of each file and directory information;Wherein, the tree-like storage knot
It include at least one layer of child node successively established with directory information and file name under the root node of structure;
It is calculated according to the execution data of the file under each child node and obtains coverage rate corresponding with the child node.
4. according to the method described in claim 3, it is characterized in that, it is described it is obtaining according to the coverage data and in advance with
First child node calculates the overall coverage for obtaining the server, packet in the coverage data of other child nodes of same layer
It includes:
By the coverage data and the corresponding source code file of the file name, calculate at first child node
Total code line number and the line number for having executed code;
According to the total code line number at first child node and the line number of code has been executed, and has each been saved with first son
Point other child nodes of same layer total code line number and executed the line number of code, calculate acquisition the first child node institute
Belong to a upper node layer at total code line number and executed lines of code, by a upper node layer belonging to first child node
As the first child node, repeat this step until calculate the place of the root node of the Storage Structure of Tree total code line number and
Lines of code is executed;
According to the total code line number at the root node and lines of code has been executed, has calculated the totality for obtaining the server
Coverage rate.
5. according to the method described in claim 4, it is characterized in that, passing through the coverage data and the file name pair
The source code file answered, after calculating the total code line number at first child node and having executed the line number of code, further includes:
Covering for first child node is calculated according to the total code line number at first child node and the line number for having executed code
Lid rate;
The coverage rate of first child node is updated and is shown.
6. a kind of coverage rate detection device characterized by comprising
Receiving module, for receiving the execution data of server transmission;The execution data include the file for being carrying out file
Title and coverage data;
Processing module, every layer of the node for inquiring in the Storage Structure of Tree pre-established obtain and the file name
Corresponding first child node;
The processing module be also used to obtain according to the coverage data and in advance with the first child node same layer its
The coverage data of his child node calculates the overall coverage for obtaining the server.
7. device according to claim 6, which is characterized in that described device further include:
Memory module, for the data stored under first child node to be updated to the coverage data.
8. device according to claim 6 or 7, which is characterized in that the receiving module receives the execution that server is sent
Before data, the processing module is also used to:
The Storage Structure of Tree is established according to the file name of each file and directory information;Wherein, the tree-like storage knot
It include at least one layer of child node successively established with directory information and file name under the root node of structure;
It is calculated according to the execution data of the file under each child node and obtains coverage rate corresponding with the child node.
9. device according to claim 8, which is characterized in that the processing module is specifically used for:
By the coverage data and the corresponding source code file of the file name, calculate at first child node
Total code line number and the line number for having executed code;
According to the total code line number at first child node and the line number of code has been executed, and has each been saved with first son
Point other child nodes of same layer total code line number and executed the line number of code, calculate acquisition the first child node institute
Belong to a upper node layer at total code line number and executed lines of code, by a upper node layer belonging to first child node
As the first child node, repeat this step until calculate the place of the root node of the Storage Structure of Tree total code line number and
Lines of code is executed;
According to the total code line number at the root node and lines of code has been executed, has calculated the totality for obtaining the server
Coverage rate.
10. device according to claim 9, which is characterized in that the processing module is also used to:
Covering for first child node is calculated according to the total code line number at first child node and the line number for having executed code
Lid rate;
The coverage rate of first child node is updated and is shown by control.
11. a kind of server characterized by comprising be stored with the memory of program instruction, receiver and for controlling program
The processor of instruction execution;
The receiver is used to receive the execution data of server transmission;The execution data include the file for being carrying out file
Title and coverage data;
The processor is used for:
Every layer of node in the Storage Structure of Tree pre-established is inquired, the first son section corresponding with the file name is obtained
Point;
Obtain according to the coverage data and in advance with the first child node other child nodes of same layer coverage rate number
According to calculating obtains the overall coverage of the 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 CN106407126A (en) | 2017-02-15 |
CN106407126B true 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) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111813697B (en) * | 2020-08-26 | 2021-07-16 | 四川新网银行股份有限公司 | Test coverage rate statistical method based on test object calling mark |
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 |
CN116627974B (en) * | 2023-05-25 | 2024-02-09 | 成都融见软件科技有限公司 | Coverage rate storage system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4657912B2 (en) * | 2005-12-26 | 2011-03-23 | 富士通セミコンダクター株式会社 | Design apparatus, design method and program thereof |
-
2016
- 2016-11-30 CN CN201611083736.5A patent/CN106407126B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
Also Published As
Publication number | Publication date |
---|---|
CN106407126A (en) | 2017-02-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7230083B2 (en) | Method and apparatus for map service testing | |
CN110928772B (en) | Test method and device | |
US9734005B2 (en) | Log analytics for problem diagnosis | |
JP5978401B2 (en) | Method and system for monitoring the execution of user requests in a distributed system | |
CN106815254B (en) | Data processing method and device | |
JP6365195B2 (en) | Instruction history analysis program, instruction history analysis apparatus, and instruction history analysis method | |
WO2015020922A1 (en) | Dynamic collection analysis and reporting of telemetry data | |
US20130073536A1 (en) | Indexing of urls with fragments | |
CN106407126B (en) | Processing method, device and the server of coverage data | |
CN110362544A (en) | Log processing system, log processing method, terminal and storage medium | |
US10871918B2 (en) | Writing composite objects to a data store | |
JP2014081811A (en) | Log management system and log management method | |
CN106354566B (en) | A kind of method and server of command process | |
EP2913752A1 (en) | Rule distribution server, as well as event processing system, method, and program | |
CN102893261B (en) | The idle conversion method of sampling and system thereof | |
CN106502901A (en) | Coverage rate detection method, device and equipment | |
US11630716B2 (en) | Error handling during asynchronous processing of sequential data blocks | |
CN106528411A (en) | Method and device for coverage rate detection and equipment | |
US10749802B2 (en) | Channeling elements in an analytics engine environment | |
US20150301866A1 (en) | Analysis method, analysis apparatus and computer-readable recording medium having stored therein analysis program | |
CA2788100C (en) | Crawling of generated server-side content | |
US11695803B2 (en) | Extension framework for an information technology and security operations application | |
US20150067303A1 (en) | Input data aggregation processing apparatus, system and method | |
CN106294183B (en) | Coverage rate detection method, device and equipment | |
CN106339317B (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 |