CN106155897A - A kind of method for processing business and device - Google Patents

A kind of method for processing business and device Download PDF

Info

Publication number
CN106155897A
CN106155897A CN201510180527.1A CN201510180527A CN106155897A CN 106155897 A CN106155897 A CN 106155897A CN 201510180527 A CN201510180527 A CN 201510180527A CN 106155897 A CN106155897 A CN 106155897A
Authority
CN
China
Prior art keywords
function
code
business
source code
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510180527.1A
Other languages
Chinese (zh)
Other versions
CN106155897B (en
Inventor
张峰
马云
张少峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201510180527.1A priority Critical patent/CN106155897B/en
Publication of CN106155897A publication Critical patent/CN106155897A/en
Application granted granted Critical
Publication of CN106155897B publication Critical patent/CN106155897B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the present invention provides a kind of method for processing business and device, and method therein mays include: that the source code to pending business resolves, it is thus achieved that the key message of at least one function that described source code is comprised;Key message according at least one function described carries out pitching pile process to described source code, it is thus achieved that object code;Run described object code, and gather function call information in running for the described object code;According to described function call information, calculate the covering parameter of described business.The present invention can calculate the covering parameter of business based on function, promotes the computational accuracy of the covering parameter of business, promotes the degree of accuracy that the integrality to business is passed judgment on.

Description

A kind of method for processing business and device
Technical field
The present invention relates to Internet technical field, be specifically related to Internet service technical field, particularly relate to one Plant method for processing business and device.
Background technology
Cover the important indicator that parameter is the integrality weighing Internet service, prior art is generally adopted Represent the covering parameter of business with code coverage, for example: in the test business of internet works software, generally Need to calculate the code coverage of test business, to understand the scheme integrality of test business;Usually, may be used Use GCov/LCov (code coverage testing tool) or EMMA (a kind of code coverage test work Tool) etc. statistical tool calculate the code coverage of business;But, above-mentioned statistical tool uses " base The calculation of the code coverage in row ", i.e. obtains code coverage according to the situation of calling of each code line, Each code line that its code coverage is accurate in the source code of business, due to business iteration demand, business The code line of source code often changes, thus reduces in prior art " based on the code coverage of row " Computational accuracy, traffic affecting integrality pass judgment on.
Content of the invention
The embodiment of the present invention provides a kind of method for processing business and device, can calculate covering of business based on function Lid parameter, promotes the computational accuracy of the covering parameter of business, promotes the degree of accuracy that the integrality to business is passed judgment on.
Embodiment of the present invention first aspect provides a kind of method for processing business, it may include:
The source code of pending business is resolved, it is thus achieved that at least one function that described source code is comprised Key message;
Key message according at least one function described carries out pitching pile process to described source code, it is thus achieved that target Code;
Run described object code, and gather function call information in running for the described object code;
According to described function call information, calculate the covering parameter of described business.
Embodiment of the present invention second aspect provides a kind of business processing device, it may include:
Resolution unit, for resolving to the source code of pending business, it is thus achieved that described source code is comprised The key message of at least one function;
Pitching pile processing unit, for carrying out to described source code according to the key message of at least one function described Pitching pile process, it is thus achieved that object code;
Running unit, is used for running described object code;
Collecting unit, for gathering function call information in running for the described object code;
Computing unit, for according to described function call information, calculates the covering parameter of described business.
Implement the embodiment of the present invention, have the advantages that
In the embodiment of the present invention, the crucial letter of at least one function that can be comprised according to the source code of business Breath, carries out pitching pile process acquisition object code to the source code of business, gathers in object code running Function call information, and the covering parameter of business is calculated based on function call information, this makes the covering of business The change that parameter can be accurate to the function in source code and be not only restricted to code line, improves the covering of business The computational accuracy of parameter, promotes the degree of accuracy that the integrality to business is passed judgment on.
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 enforcement In example or description of the prior art, the accompanying drawing of required use is briefly described, it should be apparent that, describe below In accompanying drawing be only some embodiments of the present invention, for those of ordinary skill in the art, do not paying On the premise of going out creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
The flow chart of a kind of method for processing business that Fig. 1 provides for the embodiment of the present invention;
The flow chart of the another kind of method for processing business that Fig. 2 provides for the embodiment of the present invention;
Fig. 3 is the concrete refinement step of step S210 of embodiment illustrated in fig. 2;
The structural representation of a kind of business processing device that Fig. 4 provides for the embodiment of the present invention;
The structural representation of a kind of resolution unit that Fig. 5 provides for the embodiment of the present invention;
The structural representation of a kind of pitching pile processing unit that Fig. 6 provides for the embodiment of the present invention;
The structural representation of a kind of collecting unit that Fig. 7 provides for the embodiment of the present invention;
The structural representation of a kind of computing unit 105 that Fig. 8 provides for the embodiment of the present invention;
Fig. 9 is the structural representation of the embodiment of the coverage rate computing unit shown in Fig. 8.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clearly It Chu, is fully described by, it is clear that described embodiment is only 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 are not making creation Property work under the premise of the every other embodiment that obtained, broadly fall into the scope of protection of the invention.
Below in conjunction with accompanying drawing 1-accompanying drawing 3, the method for processing business providing the embodiment of the present invention is situated between in detail Continue.
Refer to Fig. 1, for the flow chart of a kind of method for processing business that the embodiment of the present invention provides;The method can Comprise the following steps S101-step S105.
S101, resolves to the source code of pending business, it is thus achieved that described source code comprised at least one The key message of individual function.
The business of the embodiment of the present invention refers to Internet service, it may include but be not limited to: the test of internet works software Business, the detection business etc. of application program, business realizes corresponding business function by source code, for example: The source code of the test business of internet works software is capable of the test function to internet works software.Generally, source Code includes at least one function, source code in running as desired Selection and call its comprised At least one function realizes corresponding business function.
In the embodiment of the present invention, the key message of a function includes: the globally unique title of function and function Original position, the original position of described function includes the initial code row of described function and initial code row. Wherein, the globally unique title of function refers to use globally unique naming rule to be named being obtained to function , can be used in identifying the unique name of this function;In implementing, to the function of object oriented language Globally unique naming rule can comprise four partial contents, comprising: bag name, class name, function name and function parameter Type name, for example: function globally unique entitled of certain object oriented language compiling Com.sample.class1.func1 (int, int), includes 4 according to this globally unique title of globally unique naming rule Partial content, Part I content is bag name com.sample, and the second part is class name class1, the 3rd Partial content is function name func1, and Part IV content is function parameter type name (int, int).To not face pair As the globally unique naming rule of the function of language can comprise three partial contents, comprising: file path, file Name and function name.In this step, the source code of pending business can be resolved, including to source code Morphology and/or syntactic analysis, it is thus achieved that the key message of each function that described source code is comprised.
S102, the key message according at least one function described carries out pitching pile process to described source code, obtains Obtain object code.
Carry out pitching pile process to described source code and refer to insert stake code in described source code, by stake code Execution obtain the operation informations such as control stream in running for the source code, data stream.Pitching pile is processed It is critical only that the insertion position determining stake code, the original position of each function can be determined by this step For the insertion position of stake code, thus pitching pile process is carried out to described source code, complete the source after pitching pile is processed Code is referred to alternatively as object code.
S103, runs described object code.This step needs to run described object code, i.e. runs with stake The source code of code.
S104, gathers function call information in running for the described object code.
Described object code is the source code with stake code, and described object code is often adjusted in running With a function, then the stake code of this function original position is performed thus exports the recalls information of this function, In this step, can gather and add up calling of all functions that described object code called in running Information;Function call information preferably includes the globally unique title of called function, further, function call Information may also include other information such as the use-case mark of called function, called number of times, called time.
S105, according to described function call information, calculates the covering parameter of described business.
Cover the important indicator that parameter is the integrality weighing Internet service, prior art uses generation Code coverage rate represents the covering parameter of business;The embodiment of the present invention can use function coverage rate to represent covering of business Lid parameter.Described function call information preferably includes the globally unique title of called function, i.e. the present embodiment In the covering parametric procedure of the business of calculating, only focus on the globally unique title of called function, and no longer Pay close attention to the code line in called function, hence in so that the covering parameter of business can be accurate to function and can The change of unrestricted code line, promotes the computational accuracy of the covering parameter of business.
In the embodiment of the present invention, the crucial letter of at least one function that can be comprised according to the source code of business Breath, carries out pitching pile process acquisition object code to the source code of business, gathers in object code running Function call information, and the covering parameter of business is calculated based on function call information, this makes the covering of business The change that parameter can be accurate to the function in source code and be not only restricted to code line, improves the covering of business The computational accuracy of parameter, promotes the degree of accuracy that the integrality to business is passed judgment on.
Refer to Fig. 2, for the flow chart of the another kind of method for processing business that the embodiment of the present invention provides;The method S201-step S210 can be comprised the following steps.
S201, obtains the source code of pending business.
The business of the embodiment of the present invention refers to Internet service, it may include but be not limited to: the test of internet works software Business, the detection business etc. of application program, business realizes corresponding business function by source code, for example: The source code of the test business of internet works software is capable of the test function to internet works software.This step needs Obtain the source code of pending business, in implementing, can be from the business configuration file of pending business The middle source code obtaining described business.
S202, carries out static parsing, it is thus achieved that at least one letter that described source code is comprised to described source code Number.
Generally, source code includes at least one function, and source code selects to adjust in running as desired Realize corresponding business function with its at least one being comprised function.In this step, can be to pending industry The source code of business carries out static parsing, including to the morphology of source code and/or syntactic analysis, it is thus achieved that described source generation At least one function that code is comprised.
S203, reads the key message of at least one function described.
The key message of one function includes: the globally unique title of function and the original position of function, described The original position of function includes initial code row and the initial code row of described function.Wherein, the overall situation of function Unique name refer to use that function is named being obtained by globally unique naming rule, can be used in mark The unique name of this function;Globally unique naming rule in implementing, to the function of object oriented language Four partial contents can be comprised, comprising: bag name, class name, function name and function parameter type name, for example: certain The globally unique entitled com.sample.class1.func1 (int, int) of the function of object oriented language compiling, presses Including 4 partial contents according to this globally unique title of globally unique naming rule, Part I content is bag name Com.sample, the second part is class name class1, and Part III content is function name func1, the 4th Partial content is function parameter type name (int, int).Globally unique name to the function of not face object language Rule can comprise three partial contents, comprising: file path, filename and function name.In this step, foundation Step S202 resolves at least one function obtaining, and can read the key message of each function.
Step S201-step S203 of the present embodiment can be the concrete of step S101 of embodiment illustrated in fig. 1 Refinement step.
S204, according to the globally unique title of each function at least one function described, at described each function Original position inserts a code respectively.
One globally unique title can be used for uniquely identifying a function;In this step, can according to described extremely The globally unique title of each function in a few function, at original position one stake code of insertion of each function, I.e. one function one stake code of correspondence.Wherein, the concrete form of stake code can determine according to actual conditions, For example: stake code can be log (funcname), and its concrete form can be identical with the concrete form of source code, Etc..
The source code comprising described stake code is defined as object code by S205.
Insert stake code in described source code, source code can be obtained by the execution of stake code and run The operation informations such as the control stream in journey, data stream.This step is referred to as completing the source code after pitching pile is processed Object code.
Step S204-step S205 of the present embodiment can be the concrete of step S102 of embodiment illustrated in fig. 1 Refinement step.
S206, runs described object code.This step needs to run described object code, i.e. runs with stake The source code of code.
S207, exports the object function that described object code is called in the running of described object code Globally unique title.
Described object code is the source code with stake code, and described object code is often adjusted in running With a function, then the stake code of this function original position is performed thus exports the recalls information of this function, The globally unique title of each object function that exportable described object code is called in this step.
S208, according to the globally unique title of described object function, generates and calls function set.
According to the globally unique title of each object function, can generate and call function set, for example: assume Step S207 exports globally unique title a1, a2 and a3 altogether, and this step can generate calls function set A, This calls in function set A and comprises a1, a2 and a3, shows described object code invoked object function bag Include the function that the function, a2 that a1 identified identified and the function that a3 is identified.
S209, according to the globally unique title of at least one function included in described source code, generates former Function set.
According to the globally unique title of each function included in described source code, original function set can be generated, For example: assume described source code comprises four functions that globally unique title is respectively a1, a2, a3 and b1, This step can generate original function set B, and this calls in function set B and comprises a1, a2, a3 and b1, shows The function comprising in described source code includes that function, a3 that function, a2 that a1 identified identified are identified The function that function and b1 are identified.
S210, calls function set and described original function set according to described, uses the coverage rate preset to calculate Rule calculates the function coverage rate of described business.
Cover the important indicator that parameter is the integrality weighing Internet service, prior art uses generation Code coverage rate represents the covering parameter of business;The embodiment of the present invention can use function coverage rate to represent covering of business Lid parameter.
It please also refer to Fig. 3, is the concrete refinement step of step S210 of embodiment illustrated in fig. 2;This step S210 specifically can comprise the following steps s11-step s13.
S11, ask for described in call function set and described original function intersection of sets collection.
According to example shown in step S208-step S209, it is assumed that the described function set that calls is A, described former Function set is B, this step s11 need ask for described in call function set A and the friendship of original function set B Collection A&B, wherein, & represents the computing that seeks common ground.
S12, calculates described common factor relative to the function percentage of described original function set.
According to the example of step s11, it is former relative to described that this step s12 calculates the described common factor A&B obtaining The function percentage of function set B is represented by ((A&B)/B) * 100%.
The described function percentage calculating acquisition is defined as the function coverage rate of described business by s13.This step S13 can determine that the function coverage rate of described business is ((A&B)/B) * 100%.
In the embodiment of the present invention, the crucial letter of at least one function that can be comprised according to the source code of business Breath, carries out pitching pile process acquisition object code to the source code of business, gathers in object code running Function call information, and the covering parameter of business is calculated based on function call information, this makes the covering of business The change that parameter can be accurate to the function in source code and be not only restricted to code line, improves the covering of business The computational accuracy of parameter, promotes the degree of accuracy that the integrality to business is passed judgment on.
Below in conjunction with accompanying drawing 4-accompanying drawing 9, structure and the work(to the business processing device that the embodiment of the present invention provides Can describe in detail.It should be noted that following business processing device can apply to perform above-mentioned attached Method shown in Fig. 1-accompanying drawing 3.
Refer to Fig. 4, for the structural representation of a kind of business processing device that the embodiment of the present invention provides;This dress Put and may include: resolution unit the 101st, pitching pile processing unit the 102nd, running unit the 103rd, collecting unit 104 and Computing unit 105.
Resolution unit 101, for resolving to the source code of pending business, it is thus achieved that described source code is wrapped The key message of at least one function containing.
The business of the embodiment of the present invention refers to Internet service, it may include but be not limited to: the test of internet works software Business, the detection business etc. of application program, business realizes corresponding business function by source code, for example: The source code of the test business of internet works software is capable of the test function to internet works software.Generally, source Code includes at least one function, source code in running as desired Selection and call its comprised At least one function realizes corresponding business function.
In the embodiment of the present invention, the key message of a function includes: the globally unique title of function and function Original position, the original position of described function includes the initial code row of described function and initial code row. Wherein, the globally unique title of function refers to use globally unique naming rule to be named being obtained to function , can be used in identifying the unique name of this function;In implementing, to the function of object oriented language Globally unique naming rule can comprise four partial contents, comprising: bag name, class name, function name and function parameter Type name, for example: function globally unique entitled of certain object oriented language compiling Com.sample.class1.func1 (int, int), includes 4 according to this globally unique title of globally unique naming rule Partial content, Part I content is bag name com.sample, and the second part is class name class1, the 3rd Partial content is function name func1, and Part IV content is function parameter type name (int, int).To not face pair As the globally unique naming rule of the function of language can comprise three partial contents, comprising: file path, file Name and function name.The source code of pending business can be resolved by described resolution unit 101, including to source The morphology of code and/or syntactic analysis, it is thus achieved that the key message of each function that described source code is comprised.
Pitching pile processing unit 102, for entering to described source code according to the key message of at least one function described Row pitching pile process, it is thus achieved that object code.
Carry out pitching pile process to described source code and refer to insert stake code in described source code, by stake code Execution obtain the operation informations such as control stream in running for the source code, data stream.Pitching pile is processed It is critical only that the insertion position determining stake code, described pitching pile processing unit 102 can be by each function Original position is defined as the insertion position of a code, thus carries out pitching pile process to described source code, completes to insert Source code after stake is processed is referred to alternatively as object code.
Running unit 103, is used for running described object code.Described running unit 103 needs to run described mesh Mark code, i.e. runs the source code with stake code.
Collecting unit 104, for gathering function call information in running for the described object code.
Described object code is the source code with stake code, and described object code is often adjusted in running With a function, then the stake code of this function original position is performed thus exports the recalls information of this function, Described collecting unit 104 can gather and add up all functions that described object code is called in running Recalls information;Function call information preferably includes the globally unique title of called function, further, letter Number recalls information may also include the use-case mark of called function, called number of times, called time etc. other Information.
Computing unit 105, for according to described function call information, calculates the covering parameter of described business.
Cover the important indicator that parameter is the integrality weighing Internet service, prior art uses generation Code coverage rate represents the covering parameter of business;The embodiment of the present invention can use function coverage rate to represent covering of business Lid parameter.Described function call information preferably includes the globally unique title of called function, i.e. the present embodiment In the covering parametric procedure of the business of calculating, only focus on the globally unique title of called function, and no longer Pay close attention to the code line in called function, hence in so that the covering parameter of business can be accurate to function and can The change of unrestricted code line, promotes the computational accuracy of the covering parameter of business.
In the embodiment of the present invention, the crucial letter of at least one function that can be comprised according to the source code of business Breath, carries out pitching pile process acquisition object code to the source code of business, gathers in object code running Function call information, and the covering parameter of business is calculated based on function call information, this makes the covering of business The change that parameter can be accurate to the function in source code and be not only restricted to code line, improves the covering of business The computational accuracy of parameter, promotes the degree of accuracy that the integrality to business is passed judgment on.
Refer to Fig. 5, for the structural representation of a kind of resolution unit that the embodiment of the present invention provides;This parsing list Unit 101 mays include: that source code acquiring unit the 1001st, static resolution unit 1002 and key message read unit 1003。
Source code acquiring unit 1001, for obtaining the source code of pending business.
The business of the embodiment of the present invention refers to Internet service, it may include but be not limited to: the test of internet works software Business, the detection business etc. of application program, business realizes corresponding business function by source code, for example: The source code of the test business of internet works software is capable of the test function to internet works software.Described source generation Code acquiring unit 1001 needs to obtain the source code of pending business, in implementing, and can be from pending industry The business configuration file of business obtains the source code of described business.
Static resolution unit 1002, for carrying out static parsing, it is thus achieved that described source code institute to described source code At least one function comprising.
Generally, source code includes at least one function, and source code selects to adjust in running as desired Realize corresponding business function with its at least one being comprised function.Described static resolution unit 1002 can Carry out static parsing to the source code of pending business, including to the morphology of source code and/or syntactic analysis, obtain Obtain at least one function that described source code is comprised.
Key message reads unit 1003, for reading the key message of at least one function described.
The key message of one function includes: the globally unique title of function and the original position of function, described The original position of function includes initial code row and the initial code row of described function.Wherein, the overall situation of function Unique name refer to use that function is named being obtained by globally unique naming rule, can be used in mark The unique name of this function;Globally unique naming rule in implementing, to the function of object oriented language Four partial contents can be comprised, comprising: bag name, class name, function name and function parameter type name, for example: certain The globally unique entitled com.sample.class1.func1 (int, int) of the function of object oriented language compiling, presses Including 4 partial contents according to this globally unique title of globally unique naming rule, Part I content is bag name Com.sample, the second part is class name class1, and Part III content is function name func1, the 4th Partial content is function parameter type name (int, int).Globally unique name to the function of not face object language Rule can comprise three partial contents, comprising: file path, filename and function name.Key message reads single Unit 1003, according to resolving at least one function obtaining, can read the key message of each function.
In the embodiment of the present invention, the crucial letter of at least one function that can be comprised according to the source code of business Breath, carries out pitching pile process acquisition object code to the source code of business, gathers in object code running Function call information, and the covering parameter of business is calculated based on function call information, this makes the covering of business The change that parameter can be accurate to the function in source code and be not only restricted to code line, improves the covering of business The computational accuracy of parameter, promotes the degree of accuracy that the integrality to business is passed judgment on.
Refer to Fig. 6, for the structural representation of a kind of pitching pile processing unit that the embodiment of the present invention provides;This is inserted Stake processing unit 102 mays include: a code insertion unit 2001 and object code determining unit 2002.
Stake code insertion unit 2001, for the globally unique name according to each function at least one function described Claiming, the original position at described each function inserts a code respectively.
One globally unique title can be used for uniquely identifying a function;Described stake code insertion unit 2001 can With the globally unique title according to each function at least one function described, the original position at each function is inserted Enter a stake code, i.e. one function one stake code of correspondence.Wherein, the concrete form of stake code can root Determine according to actual conditions, for example: stake code can be log (funcname), and its concrete form can be with source generation The concrete form of code is identical, etc..
Object code determining unit 2002, for being defined as object code by the source code comprising described stake code.
Insert stake code in described source code, source code can be obtained by the execution of stake code and run The operation informations such as the control stream in journey, data stream.Described object code determining unit 2002 will complete at pitching pile Source code after reason is referred to as object code.
In the embodiment of the present invention, the crucial letter of at least one function that can be comprised according to the source code of business Breath, carries out pitching pile process acquisition object code to the source code of business, gathers in object code running Function call information, and the covering parameter of business is calculated based on function call information, this makes the covering of business The change that parameter can be accurate to the function in source code and be not only restricted to code line, improves the covering of business The computational accuracy of parameter, promotes the degree of accuracy that the integrality to business is passed judgment on.
Refer to Fig. 7, for the structural representation of a kind of collecting unit that the embodiment of the present invention provides;This collection list Unit 104 mays include: output unit 3001 and calls function set signal generating unit 3002.
Output unit 3001, is adjusted for exporting described object code in the running of described object code The globally unique title of object function.
Described object code is the source code with stake code, and described object code is often adjusted in running With a function, then the stake code of this function original position is performed thus exports the recalls information of this function, The globally unique name of each object function that the exportable described object code of described output unit 3001 is called Claim.
Call function set signal generating unit 3002, for the globally unique title according to described object function, raw Become to call function set.
According to the globally unique title of each object function, can generate and call function set, for example: assume Exporting globally unique title a1, a2 and a3 altogether, described function set signal generating unit 3002 of calling can generate tune Using function set A, this calls in function set A and comprises a1, a2 and a3, shows that described object code is adjusted Object function include function that function, a2 that a1 identified identified and the function that a3 is identified.
In the embodiment of the present invention, the crucial letter of at least one function that can be comprised according to the source code of business Breath, carries out pitching pile process acquisition object code to the source code of business, gathers in object code running Function call information, and the covering parameter of business is calculated based on function call information, this makes the covering of business The change that parameter can be accurate to the function in source code and be not only restricted to code line, improves the covering of business The computational accuracy of parameter, promotes the degree of accuracy that the integrality to business is passed judgment on.
Refer to Fig. 8, for the structural representation of a kind of computing unit 105 that the embodiment of the present invention provides;This meter Calculate unit 105 and may include: original function set signal generating unit 4001 and coverage rate computing unit 4002.
Original function set signal generating unit 4004, for according at least one function included in described source code Globally unique title, generate original function set.
According to the globally unique title of each function included in described source code, original function set can be generated, For example: assume described source code comprises four functions that globally unique title is respectively a1, a2, a3 and b1, Described original function set signal generating unit 4004 can generate original function set B, and this calls in function set B and comprises A1, a2, a3 and b1, show function, a2 institute that the function comprising in described source code includes that a1 is identified The function that the function of mark, the function that identified of a3 and b1 are identified.
Coverage rate computing unit 4002, for calling function set and described original function set according to described, adopts Calculate the function coverage rate of described business with default coverage rate computation rule.
Cover the important indicator that parameter is the integrality weighing Internet service, prior art uses generation Code coverage rate represents the covering parameter of business;The embodiment of the present invention can use function coverage rate to represent covering of business Lid parameter.
Please also refer to Fig. 9, the structural representation of the embodiment of the coverage rate computing unit shown in Fig. 8;Institute State coverage rate computing unit 4002 to include: occur simultaneously and ask for unit the 5001st, percentage computing unit 5002 and cover Lid rate computing unit 5003.
Occur simultaneously and ask for unit 5001, be used for asking for described in call function set and described original function intersection of sets collection.
According to the example in embodiment illustrated in fig. 8, it is assumed that the described function set that calls is A, described original function Collection be combined into B, described common factor ask for unit 5001 need ask for described in call function set A and original function set The common factor A&B of B, wherein, & represents the computing that seeks common ground.
Percentage computing unit 5002, for calculating described common factor relative to the function hundred of described original function set Proportion by subtraction.
According to example shown in the present embodiment, described percentage computing unit 5002 calculates the described common factor obtaining The function percentage relative to described original function set B for the A&B is represented by ((A&B)/B) * 100%.
Coverage rate determining unit 5003, for being defined as described business by calculating the described function percentage obtaining Function coverage rate.Described coverage rate determining unit 5003 can determine that the function coverage rate of described business is ((A&B)/B) * 100%.
In the embodiment of the present invention, the crucial letter of at least one function that can be comprised according to the source code of business Breath, carries out pitching pile process acquisition object code to the source code of business, gathers in object code running Function call information, and the covering parameter of business is calculated based on function call information, this makes the covering of business The change that parameter can be accurate to the function in source code and be not only restricted to code line, improves the covering of business The computational accuracy of parameter, promotes the degree of accuracy that the integrality to business is passed judgment on.
One of ordinary skill in the art will appreciate that all or part of flow process realizing in above-described embodiment method, Can be by computer program and complete to instruct related hardware, described program can be stored in a calculating In machine read/write memory medium, this program is upon execution, it may include such as the flow process of the embodiment of above-mentioned each method. Wherein, described storage medium can for magnetic disc, CD, read-only store-memory body (Read-Only Memory, Or random store-memory body (Random Access Memory, RAM) etc. ROM).
Above disclosed be only present pre-ferred embodiments, certainly can not with this limit the present invention it Interest field, the equivalent variations therefore made according to the claims in the present invention, still belong to the scope that the present invention is covered.

Claims (12)

1. a method for processing business, it is characterised in that include:
The source code of pending business is resolved, it is thus achieved that at least one function that described source code is comprised Key message;
Key message according at least one function described carries out pitching pile process to described source code, it is thus achieved that target Code;
Run described object code, and gather function call information in running for the described object code;
According to described function call information, calculate the covering parameter of described business.
2. the method for claim 1, it is characterised in that the described source code to pending business enters Row resolves, it is thus achieved that the key message of at least one function that described source code is comprised, comprising:
Obtain the source code of pending business;
Carry out static parsing to described source code, it is thus achieved that at least one function that described source code is comprised;
Reading the key message of at least one function described, wherein, the key message of a function includes: letter The globally unique title of number and the original position of function, the original position of described function includes rising of described function Beginning code line and initial code row.
3. method as claimed in claim 2, it is characterised in that at least one function described in described basis Key message carries out pitching pile process to described source code, it is thus achieved that object code, comprising:
According to the globally unique title of each function at least one function described, in the start bit of described each function Put insertion stake code respectively;
The source code comprising described stake code is defined as object code.
4. the method as described in any one of claim 1-3, it is characterised in that described collection described target generation Function call information in running for the code, comprising:
The overall situation of the object function that described object code is called is exported in the running of described object code Unique name;
According to the globally unique title of described object function, generate and call function set.
5. method as claimed in claim 4, it is characterised in that described according to described function call information, Calculate the covering parameter of described business, comprising:
According to the globally unique title of at least one function included in described source code, generate original function collection Close;
Call function set and described original function set according to described, use the coverage rate computation rule meter preset Calculate the function coverage rate of described business.
6. method as claimed in claim 5, it is characterised in that call described in described basis function set and Described original function set, uses the coverage rate computation rule preset to calculate the function coverage rate of described business, bag Include:
Function set and described original function intersection of sets collection is called described in asking for;
Calculate described common factor relative to the function percentage of described original function set;
The described function percentage calculating acquisition is defined as the function coverage rate of described business.
7. a business processing device, it is characterised in that include:
Resolution unit, for resolving to the source code of pending business, it is thus achieved that described source code is comprised The key message of at least one function;
Pitching pile processing unit, for carrying out to described source code according to the key message of at least one function described Pitching pile process, it is thus achieved that object code;
Running unit, is used for running described object code;
Collecting unit, for gathering function call information in running for the described object code;
Computing unit, for according to described function call information, calculates the covering parameter of described business.
8. device as claimed in claim 7, it is characterised in that described resolution unit includes:
Source code acquiring unit, for obtaining the source code of pending business;
Static resolution unit, for carrying out static parsing, it is thus achieved that described source code is comprised to described source code At least one function;
Key message reads unit, for reading the key message of at least one function described, wherein, one The key message of function includes: the globally unique title of function and the original position of function, rising of described function Beginning position includes initial code row and the initial code row of described function.
9. device as claimed in claim 8, it is characterised in that described pitching pile processing unit includes:
Stake code insertion unit, for the globally unique title according to each function at least one function described, Original position at described each function inserts a code respectively;
Object code determining unit, for being defined as object code by the source code comprising described stake code.
10. the device as described in any one of claim 7-9, it is characterised in that described collecting unit includes:
Output unit, for exporting what described object code was called in the running of described object code The globally unique title of object function;
Call function set signal generating unit, for the globally unique title according to described object function, generate and adjust Use function set.
11. devices as claimed in claim 10, it is characterised in that described computing unit includes:
Original function set signal generating unit, complete for according at least one function included in described source code Office's unique name, generates original function set;
Coverage rate computing unit, for calling function set and described original function set according to described, uses pre- If coverage rate computation rule calculate the function coverage rate of described business.
12. devices as claimed in claim 11, it is characterised in that described coverage rate computing unit includes:
Occur simultaneously and ask for unit, be used for asking for described in call function set and described original function intersection of sets collection;
Percentage computing unit, for calculating described common factor relative to the function percentage of described original function set;
Coverage rate determining unit, for being defined as the letter of described business by the described function percentage calculating acquisition Number coverage rate.
CN201510180527.1A 2015-04-16 2015-04-16 Service processing method and device Active CN106155897B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510180527.1A CN106155897B (en) 2015-04-16 2015-04-16 Service processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510180527.1A CN106155897B (en) 2015-04-16 2015-04-16 Service processing method and device

Publications (2)

Publication Number Publication Date
CN106155897A true CN106155897A (en) 2016-11-23
CN106155897B CN106155897B (en) 2020-12-08

Family

ID=58058698

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510180527.1A Active CN106155897B (en) 2015-04-16 2015-04-16 Service processing method and device

Country Status (1)

Country Link
CN (1) CN106155897B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108073513A (en) * 2017-04-21 2018-05-25 富士通株式会社 The apparatus and method tested the intelligent contract based on block chain
CN109325900A (en) * 2018-09-19 2019-02-12 北京润科通用技术有限公司 A kind of dispositions method and system of algorithm
CN110196801A (en) * 2018-02-24 2019-09-03 武汉斗鱼网络科技有限公司 A kind of test method and device based on code coverage
CN110705715A (en) * 2019-09-27 2020-01-17 北京迈格威科技有限公司 Hyper-parameter management method and device and electronic equipment
WO2023116003A1 (en) * 2021-12-24 2023-06-29 北京百度网讯科技有限公司 Data processing method and apparatus, device, storage medium and computer program product
CN116991751A (en) * 2023-09-28 2023-11-03 英诺达(成都)电子科技有限公司 Code testing method and device, electronic equipment and storage medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0767430A2 (en) * 1995-09-11 1997-04-09 Applied Microsystems, Inc. Method and apparatus for analyzing software executed in embedded systems
CN101464829A (en) * 2007-12-18 2009-06-24 珠海金山软件股份有限公司 Method and test device for confirming code coverage rate
CN101561777A (en) * 2008-04-14 2009-10-21 中兴通讯股份有限公司 System and method for realizing coverage rate test
CN101833500A (en) * 2010-04-07 2010-09-15 南京航空航天大学 Embedded software intelligent testing method based on Agent
CN102346710A (en) * 2011-10-13 2012-02-08 北京航空航天大学 Dynamic stubbing technology based time-delay analysis method for data packet processing
CN102419728A (en) * 2011-11-01 2012-04-18 北京邮电大学 Method for determining software test process sufficiency based on coverage rate quantitative indicators
US20120167059A1 (en) * 2010-12-24 2012-06-28 International Business Machines Corporation Evaluating Coverage of a Software Test
CN103473171A (en) * 2013-08-28 2013-12-25 北京信息科技大学 Coverage rate dynamic tracking method and device based on function call paths
CN103617120A (en) * 2013-12-05 2014-03-05 北京奇虎科技有限公司 Unit testing method and device
CN103699476A (en) * 2012-09-27 2014-04-02 腾讯科技(深圳)有限公司 Coverage rate testing method and system
CN104199773A (en) * 2014-09-03 2014-12-10 腾讯科技(深圳)有限公司 Method and device for obtaining code coverage information
CN104317723A (en) * 2014-11-14 2015-01-28 清华大学 Method and system for tracking running information of drive program

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0767430A2 (en) * 1995-09-11 1997-04-09 Applied Microsystems, Inc. Method and apparatus for analyzing software executed in embedded systems
CN101464829A (en) * 2007-12-18 2009-06-24 珠海金山软件股份有限公司 Method and test device for confirming code coverage rate
CN101561777A (en) * 2008-04-14 2009-10-21 中兴通讯股份有限公司 System and method for realizing coverage rate test
CN101833500A (en) * 2010-04-07 2010-09-15 南京航空航天大学 Embedded software intelligent testing method based on Agent
US20120167059A1 (en) * 2010-12-24 2012-06-28 International Business Machines Corporation Evaluating Coverage of a Software Test
CN102346710A (en) * 2011-10-13 2012-02-08 北京航空航天大学 Dynamic stubbing technology based time-delay analysis method for data packet processing
CN102419728A (en) * 2011-11-01 2012-04-18 北京邮电大学 Method for determining software test process sufficiency based on coverage rate quantitative indicators
CN103699476A (en) * 2012-09-27 2014-04-02 腾讯科技(深圳)有限公司 Coverage rate testing method and system
CN103473171A (en) * 2013-08-28 2013-12-25 北京信息科技大学 Coverage rate dynamic tracking method and device based on function call paths
CN103617120A (en) * 2013-12-05 2014-03-05 北京奇虎科技有限公司 Unit testing method and device
CN104199773A (en) * 2014-09-03 2014-12-10 腾讯科技(深圳)有限公司 Method and device for obtaining code coverage information
CN104317723A (en) * 2014-11-14 2015-01-28 清华大学 Method and system for tracking running information of drive program

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
孙陇平: "嵌入式软件覆盖率测试的研究与应用", 《现代电子技术 计算机应用技术》 *
边耐政等: "一种基于Selenium的Web自动化测试低耦合框架", 《计算机应用与软件 软件技术与研究》 *
韦涛: "基于http服务器的嵌入式软件自动化测试框架的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108073513A (en) * 2017-04-21 2018-05-25 富士通株式会社 The apparatus and method tested the intelligent contract based on block chain
CN110196801A (en) * 2018-02-24 2019-09-03 武汉斗鱼网络科技有限公司 A kind of test method and device based on code coverage
CN109325900A (en) * 2018-09-19 2019-02-12 北京润科通用技术有限公司 A kind of dispositions method and system of algorithm
CN110705715A (en) * 2019-09-27 2020-01-17 北京迈格威科技有限公司 Hyper-parameter management method and device and electronic equipment
CN110705715B (en) * 2019-09-27 2023-04-18 北京迈格威科技有限公司 Hyper-parameter management method and device and electronic equipment
WO2023116003A1 (en) * 2021-12-24 2023-06-29 北京百度网讯科技有限公司 Data processing method and apparatus, device, storage medium and computer program product
CN116991751A (en) * 2023-09-28 2023-11-03 英诺达(成都)电子科技有限公司 Code testing method and device, electronic equipment and storage medium
CN116991751B (en) * 2023-09-28 2023-12-22 英诺达(成都)电子科技有限公司 Code testing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN106155897B (en) 2020-12-08

Similar Documents

Publication Publication Date Title
CN106155897A (en) A kind of method for processing business and device
CN101261604B (en) Software quality evaluation apparatus and software quality evaluation quantitative analysis method
CN108897724B (en) Function completion progress determining method and device
CN107480039B (en) Small file read-write performance test method and device for distributed storage system
CN109542789B (en) Code coverage rate statistical method and device
CN106294134A (en) The collapse localization method of code and device
CN111241214B (en) Water quality remote online detection method and device for hydraulic engineering and electronic equipment
JP2019512126A (en) Method and system for training a machine learning system
CN107451112B (en) Form tool data checking method, device, terminal equipment and storage medium
CN106302776A (en) A kind of cloud platform processing continuous data and method
CN110874702A (en) Model training method and device in logistics sorting scene and electronic equipment
CN110334012B (en) Risk assessment method and device
Kattwinkel et al. Preparing GIS data for analysis of stream monitoring data: The R package openSTARS
CN111414619A (en) Data security detection method, device, equipment and readable storage medium
CN107944731A (en) The method for building up and device of typical project cost template
CN103235757B (en) Several apparatus and method that input domain tested object is tested are made based on robotization
CN111986552B (en) Map data quality freshness acquisition method, device and storage medium
CN108267613B (en) Wind measurement data processing method and related equipment
CN110213123A (en) A kind of flux monitoring method, device and equipment
CN112559313A (en) Test case setting method and device, storage medium and electronic equipment
CN116468436A (en) Charging rule generation method and device
CN105302691A (en) Metadata performance monitoring method and system
CN110955760A (en) Evaluation method of judgment result and related device
CN114817209A (en) Monitoring rule processing method and device, processor and electronic equipment
CN110019196A (en) Data processing method and device

Legal Events

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