CN105808438B - A kind of Reuse of Test Cases method based on function call path - Google Patents

A kind of Reuse of Test Cases method based on function call path Download PDF

Info

Publication number
CN105808438B
CN105808438B CN201610140764.XA CN201610140764A CN105808438B CN 105808438 B CN105808438 B CN 105808438B CN 201610140764 A CN201610140764 A CN 201610140764A CN 105808438 B CN105808438 B CN 105808438B
Authority
CN
China
Prior art keywords
function
path
alternative routing
change
similarity
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.)
Expired - Fee Related
Application number
CN201610140764.XA
Other languages
Chinese (zh)
Other versions
CN105808438A (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.)
Beijing Information Science and Technology University
Original Assignee
Beijing Information Science and Technology University
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 Beijing Information Science and Technology University filed Critical Beijing Information Science and Technology University
Priority to CN201610140764.XA priority Critical patent/CN105808438B/en
Publication of CN105808438A publication Critical patent/CN105808438A/en
Application granted granted Critical
Publication of CN105808438B publication Critical patent/CN105808438B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/368Test management for test version control, e.g. updating test cases to a new software version

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention provides a kind of Reuse of Test Cases method based on function call path, including:Step 1 determines that method determines to need the alternative routing collection tested in new version software using alternative routing to be measured, and the alternative routing to be measured determines that method includes:Acquisition change function information, and selection alternative routing is concentrated from alternative routing, so that it is determined that finally needing the alternative routing collection tested;Step 2, the test case of generation multiplexing.The embodiment of the present invention can be multiplexed test case to reduce the workload of test, improve testing efficiency.

Description

A kind of Reuse of Test Cases method based on function call path
Technical field
The present invention relates to technical field of measurement and test, particularly relate to a kind of Reuse of Test Cases side based on function call path Method.
Background technology
It when software version is upgraded, is bound to carry out various tests after code has been write, and the workload tested It is usually very big.When being tested, it usually needs write test case, the input using test case as software comes to software It is tested.For the stability and reliability of software, it usually needs write a large amount of test case in test, cause in this way Software test usually requires to expend a large amount of manpower and materials.
Invention content
For needing to write the problem of a large amount of test cases are to test software in the prior art, the embodiment of the present invention carries Go out a kind of Reuse of Test Cases method based on function call path, test case can be multiplexed, improve work effect Rate simultaneously reduces workload.
In order to achieve the above object, the embodiment of the present invention proposes a kind of Reuse of Test Cases based on function call path Method, including:
Step 1 determines that method determines to need the alternative routing collection tested, institute in new version software using alternative routing to be measured It states alternative routing to be measured and determines that method includes:Acquisition change function information, and selection alternative routing is concentrated from alternative routing, so as to It determines finally to need the alternative routing collection tested;;
Step 2, the test case of generation multiplexing.
Wherein, the step 1 specifically includes:
Step 11, analysis change partial code, determine the function there are dependence with change function;
Step 12, the dependence function according to change function determine the correlation function of change function;
Step 13, the correlation function pair formed by changing function and correlation function, from all of new version software program Alternative routing is selected in alternative routing, determines finally to need the alternative routing collection tested.
Wherein, step 2 specifically includes:
Step 21 calls path Algorithms of Selecting according to similarity of paths computational methods and similar function, calculates change to be measured The similarity in path is called in path with original function, is chosen the high original function of similarity and is called path;
Step 22 classifies to alternative routing according to the result of calculation of similarity, i.e. the alternative routing and structure of structure change Unchanged alternative routing;
Step 23, the change function for analyzing alternative routing, and according to the correlation function of change function, modification cannot cover pair The test case of alternative routing to be measured is answered, so that it is determined that final reusable test use cases.
Wherein, the step 2 further includes:
Step 24 modifies to test case.
The embodiment of the present invention can be multiplexed test case to reduce the workload of test, improve testing efficiency.
Description of the drawings
Fig. 1 is the flow diagram that alternative routing to be measured determines method in the embodiment of the present invention;
Fig. 2 is the flow diagram that reusable test case is generated in the embodiment of the present invention;
Fig. 3 is alternative routing to be measured and the correspondence of test case in the embodiment of the present invention;
Fig. 4 a are original version program function call graph, and Fig. 4 b are the modified change program function of new version software Call graph;
Fig. 5 is the schematic diagram of the structure change of alternative routing;
Fig. 6 for illustrative C programmer before changing with its corresponding function call relationship graph of source code after change.
Specific embodiment
To make the technical problem to be solved in the present invention, technical solution and advantage clearer, below in conjunction with attached drawing and tool Body embodiment is described in detail.
Several concepts in the embodiment of the present invention are illustrated first.
1st, the correlation function of function is changed:Refer to the function that there is incidence relation with change function fc, i.e., with changing function In fc change partial code there are dependence function, meanwhile, the correlation function for changing function is by manual analysis What mode determined.In order to ensure changing the integrality and correctness of program, changing unit can be analyzed after some function is changed The program code divided determines and changes function of the part there are dependence, that is, changes the correlation function of part place function, with Just tester verifies whether correlation function is influenced by programing change.In a program, dependence be divided into data according to The relationship of relying and control dependence, for data dependence relation as caused by same data, control dependence decides function Perform sequence.2nd, function calling relationship:Reflect the relationship between two functions in software program, program comprehension with analysis, Software test is with safeguarding, compiling optimizes, suffers from being widely applied in data-flow analysis and many other field of software engineering. In the thought in function call path, a function call path path={ f0, f1, f2……fnIn two neighboring function f1 And f2Between relationship there are two types of:Function calling relationship and sequence perform relationship.If in function f1Program code in have invoked Function f2,
It would be possible that there is following four situation:
(1) function f2Formal parameter value at least one be by function f1In variable transferring;
(2) function f2Execution and function f1In variable or with pass through function f1Processed variable is related;
(3) function f2Execution and function f1Control condition it is related, control condition may be if-else, while, for, The condition of any one sentence in the sentences such as switch-case;
(4) two or three of three cases above.
More than occur during any one of four kinds of possible situations, then function f1And f2There are dependences.When occurring the During a kind of or the second situation, function f1And f2There are data dependence relations;When there is the third situation, function f1And f2It deposits In control dependence;But when there is the 4th kind of situation, function f1And f2It there may be data dependence relation, it is possible to In the presence of control dependence, it is also possible to not only there are data dependence relation but also in the presence of control dependence.
Other than function calling relationship can make two functions generate dependence, the global variable in program can make two A function there is no function calling relationship generates data dependence relation.Known function fcWith function fdThere is no function call passes System, but function fcWith function fdIt is required for when being executed using global variable g, and variable g passes through function fcAfter processing, by letter Number fdIt uses, then function fcAnd function fdThere are data dependence relations.
Correlation function is to referring to function fcIt is associated with function frThe number formed is 2 function set, and form is (fc, fr).Function fr1、fr2It is function fcCorrelation function, then (fc, fr1)、(fc, fr2) it is correlation function pair.
In embodiments of the present invention, original version software refers to have software, and new version software refers in original version software On the basis of upgraded, changed or other obtained softwares of operation.Due to new version software original version software has been carried out it is various Modification, it is therefore necessary to be tested new version software to determine whether new version software can normal operation.
A kind of Reuse of Test Cases method based on function call path that the embodiment of the present invention proposes, including:
Step 1 determines that method determines the alternative routing collection of original version software and new version software using alternative routing to be measured, It is described to determine that method includes according to alternative routing to be measured:Acquisition change functional dependence information, and selection is concentrated to become from alternative routing More path, so that it is determined that finally needing the alternative routing collection tested;
As shown in Figure 1, it specifically includes:
Step 11, analysis change partial code, determine the function there are dependence with change function;
Step 12, the dependence function according to change function determine the correlation function of change function;
Step 13, the correlation function pair formed by changing function and correlation function, from all of new version software program Alternative routing is selected in alternative routing, determines final alternative routing collection.
In embodiments of the present invention, alternative routing to be measured determines that the basic ideas of method are:First, analysis change part generation Code determines the function there are dependence with change function;Then, according to the dependence function of change function, change function is determined Correlation function;Finally, the correlation function pair formed by changing function and correlation function, from all of new version software program Alternative routing is selected in alternative routing, determines the alternative routing collection that final needs are tested.
The selection method of alternative routing to be measured be on the basis of all alternative routings of new version program have determined into Capable.All alternative routings of new version program refer to include all function call paths of change function.In new version program Part alternative routing in, in addition to changing function, change part can't perform production to other functions in this kind of alternative routing Raw to influence, this kind of alternative routing does not need to carry out regression test, and therefore, it is necessary to from all alternative routings in new version program Alternative routing comprising change function and its correlation function is chosen, formation finally needs the alternative routing collection tested.
Alternative routing selection method to be measured will change function and its correlation function composition correlation function pair, then according to composition Correlation function pair, from all alternative routings of new version program, the alternative routing comprising correlation function pair is selected successively Alternative routing collection is out formed, which is exactly the alternative routing collection for finally needing to test.Alternative routing selection to be measured Method can reduce the range of regression test, reduce the quantity of regression test case.
Step 2, the test case of generation multiplexing.
As shown in Figure 2, the basic ideas of Reuse of Test Cases are in the embodiment of the present invention:
Step 21 calls path Algorithms of Selecting according to similarity of paths computational methods and similar function, calculates change to be measured The similarity in path is called in path with original function, is chosen the high original function of similarity and is called path;
Step 22 classifies to alternative routing according to the result of calculation of similarity, i.e. the alternative routing and structure of structure change Unchanged alternative routing;
Step 23, the change function for analyzing alternative routing, and according to the correlation function of change function, modification
The test case of corresponding alternative routing to be measured cannot be covered
, so that it is determined that final reusable test use cases.
Further, the step 2 further includes:
Step 24 modifies to test case.
The basic ideas of Reuse of Test Cases method in step 2 are as shown in Figure 2.
Wherein, in the thought of function call path, there is a kind of correspondence in function call path with test case, according to this Kind correspondence and the similar function chosen call path, are concentrated from former test case and select test case.Alternative routing to be measured It is as shown in Figure 3 with the correspondence of test case.
It makes and illustrating respectively below for step 21- steps 23:
Step 21 calls path Algorithms of Selecting according to similarity of paths computational methods and similar function, calculates change to be measured The similarity in path is called in path with original function, is chosen the high original function of similarity and is called path.
This step is to determine the premise of reusable former test case.In original function calls path set, may have a plurality of Original function calls path that can be converted to alternative routing to be measured by the operation of addition function, deletion function.Therefore the present invention is real It applies and a kind of similarity of paths method is proposed in example, can be called in path set and chosen and change to be measured from original function by this method The most like original function in more path calls path.In the embodiment of the present invention using similarity of paths represent original function call path with The size of alternative routing similarity degree to be measured.
Wherein, similarity of paths refers to that original function calls path and the similarity degree of alternative routing to be measured, is primarily referred to as letter Number calls number, the structure in path of function etc. in path.
This method is specially:
Alternative routing to be measured and original function are called path as one section of character string by step 21, by each letter in path It is several to be referred to as an entirety, and this entirety is a character in character string;
Step 22 calls path integration to need to grasp for alternative routing to be measured using Levenshtein distance calculating original functions The number of work;Wherein Levenshtein distances refer to the edit operation as required for a character string is converted into another character string The minimum value of number, edit operation refer to replacement operation, addition operation and delete operation;
Step 23 calculates function call path and the similarity Dsimilar of alternative routing to be measured using formula (2.1), Dsimilar is bigger, and representative function calls the similarity of path and alternative routing higher:
Wherein, levenshitein (pathoriginal,pathchange) it is that original function calls path pathoriginalAnd change Path pathchangeBetween Levenshtein distances,
/pathchange/ it is alternative routing pathchangeIn function number;
If the alternative routing compared calls path identical with original function, the similarity of the two is 1, and similarity reaches maximum Value, otherwise, similarity are less than 1;
Function call path path1={ main, f1,f2,f3,f4,f5,f7, path2={ main, f1,f2,f3,f6,f5, f8, alternative routing pathc={ main, f1,f2,f3,f5,f8, by path path1And path2Regard one section of character string as, it will path1And path2In function (main, f1Deng) regard an entirety as, path is calculated according to formula (2.1) respectively1、path2With The similarity of alternative routing, path1And pathcLevenshtein distances be 2, then path1With alternative routing pathcIt is similar Degree is 0.71;path2And pathcLevenshtein distances be 1, then path1With alternative routing pathcSimilarity be 0.86。
In practical development project, software change be mostly because change some or certain function internal codes, It adds function, delete caused by the operation such as function.Therefore the similarity of paths calculation formula that the embodiment of the present invention is proposed is fitted For calculating under this software alteration, alternative routing to be measured calls the similarity in path with original function.
Step 22 classifies to alternative routing according to the result of calculation of similarity, i.e. the alternative routing and structure of structure change Unchanged alternative routing.
Since software change is that there are three types of modification situations mostly:Modification growth function internal code, deletes function at addition function. Function alteration in software changes function information by acquisition, determines alternative routing, alternative routing can be divided into two Class:The unchanged alternative routing of the alternative routing of structure change, structure.The change of signified structure change in the embodiment of the present invention Path refers to path addition or deletes function, it is impossible to the alternative routing found in path set is called in original function;Structure is not The alternative routing of variation refers to not have an impact the number and path structure of function in path the modification of function, i.e. road The structure of diameter does not change, and the alternative routing that can be found in original function calling path set.With round-robin queue For program, it is assumed that be added to function PrintMg, and modify to function DeQueue.If Fig. 4 a and Fig. 4 b are example progress Explanation:Fig. 4 a are original version program function call graph, and Fig. 4 b are the modified change program function tune of new version software Use relational graph.
According to Fig. 4 a original programs function calling relationships it is found that original program has 3 function call paths;And according to Fig. 4 b's Change program function call relation is it is found that change program has 2 alternative routings.The function call path set of original program can be summarized For as shown in table 2.1;And the alternative routing collection for changing program can be summarized as shown in table 2.2.
2.1 original function of table calls path set
Number/i Function call path/pathi
1 main,Initial,EnQueue,IsFull,end
2 main,Initial,EnQueue,IsFull,Front,IsEmpty,end
3 main,Initial,EnQueue,IsFull,Front,IsEmpty,DeQueue,IsEmpty,end
2.2 alternative routing collection of table
Number/i Alternative routing/pathci
1 main,Initial,EnQueue,IsFull,printMg,end
2 main,Initial,EnQueue,IsFull,Front,IsEmpty,DeQueue,IsEmpty,end
Due to being modified to function DeQueue, and function PrintMg is added to, therefore function DeQueue and function PrintMg is change function, then the function call path where them is alternative routing, i.e. pathc1, pathc2.Road will be changed Diameter pathc1, pathc2 and original function call the function call path in path set to be compared, and can call road in original function Diameter concentration finds the function call path identical with alternative routing pathc2, and path3, then pathc2 is the unchanged change of structure More path;The function call path identical with alternative routing pathc1 is not found in original function calls path set, then Pathc1 is the alternative routing of structure change.
The alternative routing of structure change is because when changing program, adds, some function has been deleted or modified, make change Node number in path is changed.The structure change of alternative routing has following several situations, as shown in Figure 5.
Step 23, the change function for analyzing alternative routing, and according to the correlation function of change function, modification control logic becomes Test case corresponding to the alternative routing of change, so that it is determined that final reusable test use cases.
After determining alternative routing, need with original function call path set in function call path matched, choose with The similar function call path of alternative routing.In the matching process, it needs to calculate original function calling path and the phase of alternative routing Like degree, classified by the result of calculation of similarity to alternative routing.If it can be found in original function calls path set The function call path identical with alternative routing, then similarity is 1, this alternative routing is the unchanged alternative routing of structure.It is right In the alternative routing that cannot find same functions calling path in original function calls path set, need to list in analysis chart 5 Alternative routing structure change several situations, and be compared, found and alternative routing by the result to similarity calculation The highest original function of similarity calls path.
In Figure 5, after alternative routing structure changes, there are four types of situations.How to be looked into for the alternative routing of structure change Similar function is looked for call path, is one of the research emphasis that similar function calls path selecting method.With secondary series in Fig. 5 (2) f is deleted2Alternative routing for, during choosing similar function and calling path, when traversing function f1Later, former letter Number calls the f in path1Next function f2With the f in alternative routing1Next function f3It differs, then needs to traverse Function f2Next function, until finding the function f with alternative routing3Identical function traverses original function and calls path The last one function until.During choosing similar function and calling path, need to consider four kinds of situations in Fig. 5, And the alternative routing in path is called to find a not only similar function, it calculates similar function and calls path and the phase of alternative routing Like degree, choose the highest original function of similarity and path is called to call path as the similar function of alternative routing.
Similar function calls path Algorithms of Selecting to need storage organization-adjacency list using linear linked list and figure.Linear chain Table is the Linked Storage Structure of linear list, and adjacency list is a kind of storage organization of chain type of figure.
The storage organization of linear linked list is as follows:
The storage organization of adjacency list is as follows.
Similar function calls the Algorithms of Selecting in path to be described as follows:
Input:pointSet_Ch:Change collection of functions
pathSet_Ch:The set of alternative routing head node
headArr:The head node of each node of original function call graph
index:The head node of first node of original function call graph
Output:Same functions call the unchanged alternative routing FCPS_Same of path set-structure
Similar function calls the alternative routing FCPS_Similar of path set-structure change
Variable:path_point:Current lookup similar function calls the node of the alternative routing in path
point_Ch:Current lookup similar function calls the variation point corresponding to the alternative routing in path
point_AdjacNode:Table node
point_VertexNode:Head node
FCP_Similar:The similar function found calls path
index_Ch:The index value of the set of alternative routing head node
Begin
/ * initialization FCPS_Same, FCPS_Similar and FCP_Similar*/
FCPS_Same=Null;
FCPS_Similar=Null;
FCP_Similar=Null;
ExecuteFirst=false;
/ * initialization index_Ch*/
Index_Ch=0;
/ * for path_point and point_Ch assignment */
Path_point=pathSet_Ch [index_Ch];
Point_Ch=pointSet_Ch [index_Ch];
/ * for alternative routing search similar FCP*/
while(index_Ch≠pathSet_Ch.length)do
/ * original function call path set in search similar function call path */
Point_VertexNode=headArr [index];
Point_VertexNodeLast=point_VertexNode;
Point_AdjacNode=point_VertexNode.first_adjac;
while(point_AdjacNode≠Null)do
if(executeFirst)then
Point_VertexNode=headArr [point_AdjacNode.adjac_vertex];
If (point_VertexNode.data_vertex==path_point.data) then
Point_AdjacNode=point_VertexNode.first_adjac;
FCP_Similar+=path_point.data;
Path_point=path_point.nextnode;
Point_VertexNodeLast=point_VertexNode;
end if
else
Point_AdjacNode=point_AdjacNode.nextadjac;
end while
If (path_point.nextnode==Null) then
FCPS_Same+=FCP_Similar;
end if
else
/ * be structure change alternative routing search the highest original function of similarity call path */
FCPS_Similar+=findHighSimilar (path_point, point_Ch, FCP_Similar);
index_Ch++;
end while
First, since the first head node in the set of alternative routing head node, path is called with original function successively Each node be compared, the to the last head node of an alternative routing.If it can be looked into original function calls path set It finds the original function identical with alternative routing and calls path, it is the unchanged alternative routing of structure to illustrate this alternative routing, then will The original function found calls path to be added to same functions and calls in path set FCPS_Same;If it cannot be called in original function The function call path identical with alternative routing is found in path set, it is the change road of structure change to illustrate this alternative routing Diameter, then application method findHighSimilar (), which does alternative routing, is further handled, and compares alternative routing and original function The similarity in function call path in path set is called, path is called to be added to the original function of obtained highest similarity similar In function call path set FCPS_Similar.
During using similar function that path Algorithms of Selecting is called to choose similar function calling path for alternative routing, It sometimes appear that the original function that an alternative routing has a plurality of high similarity calls path, then this alternative routing will correspond to more A original test case.In this case, the concrete condition that tester is needed to be changed according to software, from multiple former surveys of selection The test case of most suitable alternative routing is selected in example on probation.
Step 24 modifies to test case.
Correspondence between path and the similar function calling path set of selection are called according to test case and function It closes, concentrates selection test case from former test case, determine multiplexing test use cases.In new version program, due to function The operation deleted, add or changed has been carried out, then when performing the multiplexing test case chosen, may can not cover correspondence Alternative routing to be measured, therefore, before the test case for performing multiplexing, manual analysis change function and its correlation function, hand Dynamic modification cannot cover the multiplexing test case of alternative routing to be measured.
Correspondence between path and the similar function calling path set of selection are called according to test case and function It closes, concentrates selection test case from former test case, determine multiplexing test use cases.In new version program, due to function The operation deleted, add or changed has been carried out, then when performing the multiplexing test case chosen, may can not cover correspondence Alternative routing to be measured, therefore, before the test case for performing multiplexing, manual analysis change function and its correlation function, hand Dynamic modification cannot cover the multiplexing test case of alternative routing to be measured.
During the selection for calling path in similar function, software test budget can be considered, design test case is opened The factors such as pin and modification test case expense, set similarity of paths threshold value, similar for the maximum path of alternative routing to be measured Angle value needs to design new test case for such alternative routing to be measured, to reach still less than the situation of similarity of paths threshold value To the effect for covering alternative routing to be measured.
Fig. 6 be one section of C programmer before changing with its corresponding function call relationship graph of source code after change, according to Fig. 6 does further analytic explanation to how to change test case.
According to original program and the function call relationship graph of change program, original program can be obtained with changing the function tune of program Use path;By analyzing the source code of original program and according to function call relationship graph, designing former test case.The function of original program Path and test case are called as shown in table 2.3;It changes the alternative routing of program and changes function as shown in table 2.4.
The function call path of 2.3 original program of table and test case
Number/i Function call path/pathi Test case/ti
1 main,funF,funS,end F=5, s=3;
2 main,funF,funS,funT,end F=5, s=4;
2.4 alternative routing of table and change function
Number/i Function call path/pathci Change function
1 main,funF,funS,end funS
2 main,funF,funS,funT,end funS
3 main,funF,funS,funE,end funS,funE
Because function funS is changed, and is added to new function funE, so funS and funE are the changes for changing program More function.It is { path according to the final alternative routing collection to be measured that alternative routing selection method to be measured determinesc1、pathc2、 pathc3, it is alternative routing path to be measured to call path Algorithms of Selecting by similar functionc1、pathc2And pathc3The phase of selection It is path respectively like function call path1、path2And path1, according to the similar function of selection call path and test case with The correspondence in function call path, alternative routing path to be measuredc1、pathc2And pathc3Corresponding multiplexing test case point It is not t1、t2And t1, it is determined that multiplexing test use cases be { t1, t2}.In function funS is changed, the if controls of funS are had modified The condition of sentence processed, and function funE is had invoked, therefore, corresponding change road to be measured cannot be covered by performing multiplexing test case The code that part is changed in function funS is changed in diameter, analysis, to that cannot cover the multiplexing test case of corresponding alternative routing to be measured It modifies.
Modified multiplexing test case and corresponding alternative routing to be measured are as shown in table 2.5.
2.5 alternative routing of table and test case
Number/i Function call path/pathci Test case/tci
1 main,funF,funS,end F=5, s=4;
2 main,funF,funS,funT,end F=5, s=5;
3 main,funF,funS,funE,end F=5, s=6;
pathc1Similar function call path be path1, corresponding multiplexing test case is t1.Path path1Corresponding control Condition processed is " sa%2==0 ", alternative routing path to be measuredc1Corresponding control condition is " sa%3==0 ", due to control strip Part changes, and performs multiplexing test case t1(f=5, s=3) cannot cover alternative routing path to be measuredc1, therefore, it is necessary to from Function funS starts, modification multiplexing test case t1, by t1(f=5, s=3) is revised as test case tc1(f=5, s=4), holds Row tc1After can cover alternative routing path to be measuredc1.Similarly, by alternative routing path to be measuredc2And pathc3Corresponding multiplexing is surveyed Example t on probation2(f=5, s=4) and t1(f=5, s=3) is revised as tc2(f=5, s=5) and tc3(f=5, s=6), after making modification Multiplexing test case can cover corresponding alternative routing to be measured.
The above is the preferred embodiment of the present invention, it is noted that for those skilled in the art For, without departing from the principles of the present invention, several improvements and modifications can also be made, these improvements and modifications It should be regarded as protection scope of the present invention.

Claims (2)

  1. A kind of 1. Reuse of Test Cases method based on function call path, which is characterized in that including:
    Step 1 determines that method determines to need the alternative routing collection tested in new version software using alternative routing to be measured, described to treat It surveys alternative routing and determines that method includes:Acquisition change function information, and selection alternative routing is concentrated from alternative routing, so that it is determined that Finally need the alternative routing collection tested;
    Step 2, the test case of generation multiplexing;
    Wherein described step 2 specifically includes:
    Step 21 calls path Algorithms of Selecting according to similarity of paths computational methods and similar function, calculates alternative routing to be measured The similarity in path is called with original function, the high original function of similarity is chosen and calls path;
    Step 22 classifies to alternative routing according to the result of calculation of similarity, i.e., the alternative routing of structure change and structure are unchanged The alternative routing of change;
    Step 23, the change function for analyzing alternative routing, and according to the correlation function of change function, modification cannot cover correspondence and treat The test case of alternative routing is surveyed, so that it is determined that final reusable test use cases;
    Step 24 modifies to test case;
    Wherein step 21 is specially:
    Alternative routing to be measured and original function are called path as one section of character string by step 211, by each function name in path A referred to as entirety, and this entirety is a character in character string;
    Step 212 calls path integration alternative routing needs to be measured to operate using Levenshtein distance calculating original functions Number;Wherein Levenshtein distances refer to the edit operation number as required for a character string is converted into another character string Minimum value, edit operation refer to replacement operation, addition operation and delete operation;
    Step 213 calculates function call path and the similarity Dsimilar of alternative routing to be measured using formula (2.1), Dsimilar is bigger, and representative function calls the similarity of path and alternative routing higher:
    Wherein, levenshitein (pathoriginal,pathchange) it is that original function calls path pathoriginalAnd alternative routing pathchangeBetween Levenshtein distances,
    |pathchange| it is alternative routing pathchangeIn function number;
    If the alternative routing compared calls path identical with original function, the similarity of the two is 1, and similarity reaches maximum value, Otherwise, similarity is less than 1.
  2. 2. the Reuse of Test Cases method according to claim 1 based on function call path, which is characterized in that the step Rapid 1 specifically includes:
    Step 11, analysis change partial code, determine the function there are dependence with change function;
    Step 12, the dependence function according to change function determine the correlation function of change function;
    Step 13, the correlation function pair formed by changing function and correlation function, from being had altered for new version software program Alternative routing is selected in path, determines finally to need the alternative routing collection tested.
CN201610140764.XA 2016-03-11 2016-03-11 A kind of Reuse of Test Cases method based on function call path Expired - Fee Related CN105808438B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610140764.XA CN105808438B (en) 2016-03-11 2016-03-11 A kind of Reuse of Test Cases method based on function call path

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610140764.XA CN105808438B (en) 2016-03-11 2016-03-11 A kind of Reuse of Test Cases method based on function call path

Publications (2)

Publication Number Publication Date
CN105808438A CN105808438A (en) 2016-07-27
CN105808438B true CN105808438B (en) 2018-07-10

Family

ID=56468241

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610140764.XA Expired - Fee Related CN105808438B (en) 2016-03-11 2016-03-11 A kind of Reuse of Test Cases method based on function call path

Country Status (1)

Country Link
CN (1) CN105808438B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776348B (en) * 2017-02-06 2022-09-09 腾讯科技(深圳)有限公司 Test case management method and device
CN108446220B (en) * 2018-03-02 2022-04-05 国网吉林省电力有限公司信息通信公司 Test case generation method and device
CN109828909A (en) * 2018-12-21 2019-05-31 北京城市网邻信息技术有限公司 Regression test case determines method, apparatus, electronic equipment and storage medium
CN110262957B (en) * 2019-04-12 2022-12-27 江西财经大学 Reuse method of test cases among similar programs and implementation system thereof
CN110389753B (en) * 2019-06-06 2024-01-23 五八有限公司 Chained calling method and device of native application, electronic equipment and storage medium
CN114780439B (en) * 2022-06-13 2022-09-27 江西财经大学 Reuse method of test cases among similar programs facing parameter path flow graph
CN116383092B (en) * 2023-05-31 2023-08-01 北京中科卓信软件测评技术中心 Effective test case multiplexing method and device for software fuzzy test

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253889A (en) * 2011-08-07 2011-11-23 南京大学 Method for dividing priorities of test cases in regression test based on distribution
CN102831060A (en) * 2012-08-24 2012-12-19 东南大学 Modification influence analysis based regression test case updating method of part software
CN102915271A (en) * 2012-10-31 2013-02-06 北京邮电大学 Method for optimizing unit regression test case set based on control flow diagram
CN103092748A (en) * 2011-11-07 2013-05-08 阿里巴巴集团控股有限公司 Method and system of test cases surely needing to perform regression testing
CN104536896A (en) * 2015-01-12 2015-04-22 牟永敏 Regression test case selecting and ranking method and system oriented to function call path

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253889A (en) * 2011-08-07 2011-11-23 南京大学 Method for dividing priorities of test cases in regression test based on distribution
CN103092748A (en) * 2011-11-07 2013-05-08 阿里巴巴集团控股有限公司 Method and system of test cases surely needing to perform regression testing
CN102831060A (en) * 2012-08-24 2012-12-19 东南大学 Modification influence analysis based regression test case updating method of part software
CN102915271A (en) * 2012-10-31 2013-02-06 北京邮电大学 Method for optimizing unit regression test case set based on control flow diagram
CN104536896A (en) * 2015-01-12 2015-04-22 牟永敏 Regression test case selecting and ranking method and system oriented to function call path

Also Published As

Publication number Publication date
CN105808438A (en) 2016-07-27

Similar Documents

Publication Publication Date Title
CN105808438B (en) A kind of Reuse of Test Cases method based on function call path
US8793674B2 (en) Computer-guided holistic optimization of MapReduce applications
US10423522B2 (en) System and method for detecting an error in software
CN109144882B (en) Software fault positioning method and device based on program invariants
US10445657B2 (en) General framework for cross-validation of machine learning algorithms using SQL on distributed systems
US7971193B2 (en) Methods for performining cross module context-sensitive security analysis
CN104899147B (en) A kind of code Static Analysis Method towards safety inspection
EP3674918B1 (en) Column lineage and metadata propagation
CN109426614A (en) Defect inspection method, equipment, system and computer readable storage medium
WO2019201225A1 (en) Deep learning for software defect identification
CN104636256A (en) Memory access abnormity detecting method and memory access abnormity detecting device
CN112364352A (en) Interpretable software vulnerability detection and recommendation method and system
CN109388573B (en) Error detection method and system during running of interrupt-driven program without false alarm
CN112765031A (en) Decomposition method of crowd-sourcing vulnerability mining task
CN105487983A (en) Sensitive point approximation method based on intelligent route guidance
CN107247663B (en) Redundancy variant identification method
CN117591913A (en) Statement level software defect prediction method based on improved R-transducer
Khoshgoftaar et al. Attribute selection using rough sets in software quality classification
Zhou et al. Deeptle: Learning code-level features to predict code performance before it runs
Rajbahadur et al. Pitfalls analyzer: quality control for model-driven data science pipelines
CN106021401A (en) Extensible entity analysis algorithm based on reverse indices
CN101807225A (en) Thickened oil numerical reservoir simulation method and device
CN114996705A (en) Cross-software vulnerability detection method and system based on vulnerability type and Bi-LSTM
Vert et al. Detection of incorrect pointer dereferences for C/C++ programs using static code analysis and logical inference
CN109976802B (en) Mode-oriented software architecture reconstruction method

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
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180710

Termination date: 20200311