CN103455421A - Regression testing case generation method based on program control dependence guide - Google Patents
Regression testing case generation method based on program control dependence guide Download PDFInfo
- Publication number
- CN103455421A CN103455421A CN2013103623033A CN201310362303A CN103455421A CN 103455421 A CN103455421 A CN 103455421A CN 2013103623033 A CN2013103623033 A CN 2013103623033A CN 201310362303 A CN201310362303 A CN 201310362303A CN 103455421 A CN103455421 A CN 103455421A
- Authority
- CN
- China
- Prior art keywords
- branch
- probability
- test
- blocking
- object code
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 145
- 238000000034 method Methods 0.000 title claims abstract description 47
- 239000012634 fragment Substances 0.000 claims description 19
- 238000010998 test method Methods 0.000 claims description 10
- 238000004458 analytical method Methods 0.000 claims description 6
- 230000003068 static effect Effects 0.000 claims description 5
- 238000004364 calculation method Methods 0.000 claims description 4
- 230000000903 blocking effect Effects 0.000 claims description 2
- 238000013101 initial test Methods 0.000 claims description 2
- 238000006467 substitution reaction Methods 0.000 claims description 2
- 238000010586 diagram Methods 0.000 abstract 1
- 230000000644 propagated effect Effects 0.000 abstract 1
- 230000004048 modification Effects 0.000 description 6
- 238000012986 modification Methods 0.000 description 5
- KRTSDMXIXPKRQR-AATRIKPKSA-N monocrotophos Chemical compound CNC(=O)\C=C(/C)OP(=O)(OC)OC KRTSDMXIXPKRQR-AATRIKPKSA-N 0.000 description 2
- 230000000454 anti-cipatory effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 238000013138 pruning Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention provides a regression testing case generation method based on program control dependence guide. According to the method, testing cases for effectively testing modified parts of a program can be generated automatically. The method comprises the steps of taking modified program codes as test targets, and establishing a program control dependence diagram through analyzing the control flow and information flow of the program; calculating the probability (arrival probability) that each branch statement reaches a test target code, and guiding symbolic execution, so as to generate a testing case which can guarantee that the target code is executed; calculating the probability (interruption probability) that target code execution results cannot be propagated to output of all branch statements, and guiding symbolic execution, so as to generate a testing case which can guarantee that the output is affected by the target code execution results. Compared with the existing regression testing methods, the method has the advantages that the effectiveness of the testing cases can be guaranteed, and meanwhile, the efficiency of testing case generation is increased remarkably.
Description
Technical field
The present invention relates to trusted software and software test field, particularly regression test case generation method.
Background technology
After software regression testing refers to that software code is revised, re-start test and do not introduce new mistake or cause other codes to produce mistake to confirm to revise.Effective modification to software need to meet two conditions: 1) modification of program meets anticipatory behavior, part to be modified can be revised correct; 2) modification of program can not affect other unexpected behavior and changes, and revising part can not affect other and do not need the program behavior of revising.Regression test is to guarantee that software modification meets the important means of expection, and how carrying out efficiently regression test is also the major issue in software test.Existing thinking mainly is divided into following two kinds: 1) follow-on test, utilize existing test cases to be retested the program developed, the subject matter that the method exists is that efficiency is low, and its most test cases are all invalid test cases concerning being modified program.2) generate new test cases for modification of program part increment, its difficult point is how automatically to generate efficiently the test cases that meets expectation.
For solving the problem of follow-on test inefficiency, the researchist has proposed two kinds and has improved one's methods, and test cases is selected and the test cases sequence.These two kinds of methods are all to select most suitable test cases by the relation of analytical test case and Evolution Programs.Solved the inefficiency problem of follow-on test although test cases is selected and test cases sorts, but do not solve the validity problem of follow-on test, because existing test cases can't be considered the variation of program in the future when creating, so likely these test cases all can not cover the program part be modified.
For solving the low problem of test cases collection coverage rate, the focus of research is to be formalized model by program abstraction at present, adopts the test cases automatic generating calculation to be extracted, generate a complete test cases collection to the various information in formalized model.Wherein the most frequently used method is-symbol is carried out, and it is a kind of program verification method that 20 century 70s propose that symbol is carried out, and is a kind of Model Checking of symbol-based.Be widely used in symbolic debugging, test cases generation etc.Its core concept is to use value of symbol to replace concrete variable input, and carrys out the value of each variable in representation program with character expression.Finally, the output valve of program be converted into one using value of symbol as the input function.It is that symbol is carried out tree that symbol is carried out program abstraction, and wherein order statement correspondence the computing node of tree, and the branch statement correspondence branch node, and, for loop statement, it is expanded into to branch statement semantically of equal value by cycle index.Generally, a corresponding group of branches node of loop statement.Can think, in Symbolic Execution, program only has order and two kinds of structures of branch.
The process that symbol is carried out is the construction process of path condition in essence.Path condition refers to for the test cases of carrying out this path, the required satisfied mathematics constraint condition of program input value.Thereby path condition corresponding execution route uniquely.A path condition is comprised of one group of sub-condition (sub-condition), and each is performed the condition of branch as a sub-condition.When initial, path condition is true, in the process of heuristic routine, often runs into a branch statement, just upgrades path condition, and the condition that is performed branch is joined in path condition, and formula is PC=PC^new sub-condition.Due to each branch statement corresponding true and two branches of false, and symbol is carried out based on static analysis, variable does not have concrete numerical value, thereby can't determine and carry out which bar branch.So (search order can define as required, depth-first, breadth First etc.) all explored to by two branches, the condition of two branches of usining is respectively upgraded path condition as sub-condition.Two new path conditions have so just been obtained, corresponding two different execution routes.Afterwards, continue this two paths is explored respectively.Symbol is carried out the complete trails of having realized program and is explored.When exploring end, program just obtained the path condition of all execution routes of tested program.Finally, check all path conditions that obtain, if path condition can't be satisfied, illustrate this path be one can not execution route, if path condition can be satisfied, but illustrate that this path is an execution route.Path condition input constraint solver can be solved to corresponding test cases.
Symbol is carried out and is had two obstructions, makes it be difficult to extensive use.1) the symbol execution is a kind of ergodic algorithm based on search, need to all branches of program be traveled through, although beta pruning condition that can be additional by some is optimized, but the complexity of its algorithm is very high, for O (2n), wherein n is the tested program conditional statement number of (comprising branch, circulation, logical operation); 2) symbol is carried out and can not be solved well the problem that the test cases collection upgrades, and after each code is modified, can only again travel through a sub-symbol execution tree and generate a new test cases collection.Analysis from front, the time overhead that regenerates a test cases collection is larger, and a software may frequently change, if all by symbol, carries out a new test cases collection of generation after each change, the efficiency of test will be affected.
Summary of the invention
The object of the present invention is to provide a kind of regression test case generation method that relies on guiding based on programmed control, to improve testing efficiency.
To achieve these goals, the present invention adopts following technical scheme:
Rely on the regression test case generation method of guiding based on programmed control, comprise the steps:
S101), utilize the Program Static Analysis method, control stream and the information flow of analytical test program, set up the control dependency graph of test procedure;
S102), for the object code of test procedure of input, according to step S101) in calculate the arrival probability of each branch in the control dependency graph set up;
S103), adopt the constraint generating algorithm that arrives the probability guiding based on branch, arrive the branch condition of maximum probability on iterative search and negate test cases execution route, generate new constraint, utilize symbolic excution methodology to be solved, if can generate the test cases of a performance objective code, proceed to step S104); If can't creating test case can the performance objective code, mean that the test target code can not be performed in program, proceeds to step S107);
S104), for the object code of test procedure, according to program information stream, detect each branch statement and whether block the impact of object code execution result on program output, be labeled as blocking-up branch if change; Then, calculate the blocking-up probability of each branch;
S105), adopt the constraint generating algorithm based on branch's blocking-up probability guiding, the branch condition of blocking-up probability minimum on iterative search and negate test cases execution route, generate new constraint, utilize symbolic excution methodology to be solved, guarantee object code execution result impact output if can generate a test cases, proceed to step S106); If can't creating test case, proceed to step S103);
S106) output Validity Test case, flow process finishes; Described Validity Test case refers to that this test cases can guarantee that the test target code is performed, and execution result affects the program Output rusults;
S107) for output test procedure and test target code, can't generate the Validity Test case.
The present invention further improves and is: branch step S103) arrives probability and is: for some branches, from this, be branched off into object code, the inverse of the minimum dependence number of branches of required process.
The present invention further improves and is: the constraint generating algorithm based on branch's arrival probability guiding step S103) specifically comprises:
S1031), carry out test cases, carry out for the first time the initial testing case; A cycle step S10310 from starting for the second time execution) test cases generated;
S1032), check whether object code is performed; If test cases can be carried out the object code that expectation is carried out, go to step S10312); If test cases can not be carried out object code, go to step S1033);
S1033) but, check on execution route whether the branch of negate is arranged, if having, go to step S1034); If no, go to step S1035);
S1034) but, the branch of all negates of negate generates a series of extensions path fragments for the treatment of, and will treat that the branch of last branch of extensions path fragment arrives the probability of probable value as this path segments energy coverage goal code, deposits first in and surveys in set;
Whether be empty, if it is empty, go to step S10311 if S1035), not surveying set), if not empty, go to step S10316);
S1036), from first survey set select a maximum probability treat the extensions path fragment, carry out the symbol execution based on this path segments;
S1037), symbol carries out this path segments, and record path constraint Cnew;
S1038), utilize constraint solver to solve Cnew, if can separate, go to step S10310); If intangibility, go to step S1039);
S1039), discarded this path segments, jump to step S1033 simultaneously);
S10310), generate new test cases Tnew, then jump to step S1031);
S10311), without the Validity Test case, export;
S10312), export the Validity Test case that this can carry out the object code of expectation execution.
The present invention further improves and is: blocking-up step S104) causes the object code execution result can't be delivered to the branch of output statement after branching into the object code execution.
The present invention further improves and is: the blocking-up probability of branch step S104) is: for the some branches that carry out object code after, will carry out the probability of blocking branch after carrying out this branch; Span is 0%-100%.
The present invention further improves and is: the computing formula of branch's blocking-up probability is:
BP=1–Nb/Np
Wherein the computing method of branch's blocking-up probability comprise: all branches that at first will treat measuring program are divided into Ep, two set of Eb, and the set that Ep is all branches, Eb is the set of blocking-up branch; For some branches, select subset Ep ' from two set, Eb ', be illustrated respectively in all branches of carrying out after this branch and all blocking-up branch, and then based on Ep ', Eb ' builds possible execution route; Np is the number of path built based on Ep ', and Nb is the number of path built based on Eb '; Obtain Nb, after Np, the substitution formula can obtain the blocking-up probable value BP of branch of a certain branch.
The present invention further improves and is: the constraint generating algorithm based on branch's blocking-up probability guiding step S105) comprises:
S1051), carry out test cases; Perform step for the first time S103) step S10312) the Validity Test case that generates, from starting for the second time to carry out cycle step S10510) test cases of generation;
S1052), check whether the object code execution result is delivered to output statement: if the object code execution result has been delivered to output statement, go to step S10512); Otherwise, go to step S1053);
S1053) but, check on execution route whether the branch of negate is arranged, if having, go to step S1054); If no, go to step S1055);
S1054) but, the branch of all negates of negate generates a series of extensions path fragments for the treatment of, and the branch blocking-up probable value that will treat last branch of extensions path fragment will carry out the probable value of blocking-up branch as this path segments, deposit second in and survey and gather;
S1055), whether second to survey set be empty, if it is empty, goes to step S10511; If not empty, go to step S1056);
S1056), from second survey set select a blocking-up probability minimum treat the extensions path fragment, carry out the symbol execution based on this path segments;
S1057), symbol carries out this path segments, and record path constraint Cnew;
S1058), utilize constraint solver to solve Cnew, if can separate, go to step S10510); If intangibility, go to step S1059);
S1059), discarded this path segments, jump to step S1053);
S10510), generate new test cases Tnew, then jump to step S1051);
S10511), without the Validity Test case, export;
S10512) export this and can carry out the object code that expectation is carried out, and execution result affects the Validity Test case of program Output rusults.
With respect to prior art, the present invention has following beneficial effect: the present invention proposes a kind of regression test case generation method that relies on guiding based on programmed control, it is test target that the method be take the program code of occur revising, by control stream and the information flow of routine analyzer, creation facilities program (CFP) is controlled dependency graph; Calculate the probability (arrival probability) that each branch statement arrives the test target code, aiming symbol is carried out to generate and can be guaranteed the test cases that object code is performed; The object code execution result that may make that calculates all branch statements can't propagate into the probability (blocking-up probability) of output, and aiming symbol is carried out and generated the test cases that can guarantee object code execution result impact output; The inventive method can generate automatically partly carries out the test cases of Validity Test to modification of program; Compare existing regression testing method, this method can guarantee the validity of test cases, significantly improves the efficiency that test cases generates simultaneously.
The accompanying drawing explanation
The overall flow figure that Fig. 1 is the inventive method;
Fig. 2 is the test cases product process figure that the test target code arrives;
Fig. 3 is the test cases product process figure that test target is carried out impact output;
Fig. 4 is example procedure chart to be tested;
The control dependency graph that Fig. 5 is example procedure.
Embodiment
Below in conjunction with accompanying drawing and example in detail embodiments of the present invention.Treat measuring program as shown in Figure 4, for execution route, we mean with the branch statement of process on path.Suppose that a certain execution route has passed through 2F, these two branch statements of 3T, it is expressed as [2F, 3T].
Step S101: control stream and information flow based on Static Analysis Method analytical test program, the control dependency graph of generation test procedure, control dependency graph as shown in Figure 5, and object code is the 19th row;
Step S102: for the object code of the test procedure of inputting, calculate the arrival probability of each branch in the control dependency graph of setting up in step S101; Result is as shown in the table.
Branch | Branch pattern | Branch arrives probability | Branch's branch pattern | Branch arrives probability |
2T | Forward is controlled branch | 25% | The 2F forward is controlled branch | 20% |
3T | Forward is controlled branch | 33.3% | 3F | Oppositely control branch | 0% |
4T | Non-control branch | 33.3% | 4F | Non-control branch | 33.3% |
9T | Forward is controlled branch | 25% | 9F | Oppositely control branch | 0% |
10T | Forward is controlled branch | 33.3% | 10F | Oppositely control branch | 0% |
11T | Non-control branch | 33.3% | 11F | Non-control branch | 33.3% |
17T | Forward is controlled branch | 50% | 17F | Oppositely control branch | 0% |
18T | Forward is controlled branch | 100% | 18F | Oppositely control branch | 0% |
20T | Non-control branch | 0% | 20F | Non-control branch | 0% |
22T | Non-control branch | 0% | 20F | Non-control branch | 0% |
With 2T, 3F, 4T, 20T is example.2T is that forward is controlled branch, and carrying out object code 19 from 2T needs through 2T, 3T, and 17T, these four forwards of 18T are controlled branch, so its branch's arrival probability is 25%.3F oppositely controls branch, forever can't arrive 19 after carrying out this branch, thus its branch to arrive probability be 0%.4T is non-control branch, and apart from it, nearest forward is controlled and branched into 3T, so its branch arrives probability, is 33.3%.20T is non-control branch, and because of after it is positioned at object code, on the not impact of execution of object code, it is 0% that its branch arrives probability.
Step S103, employing arrive the constraint generating algorithm of probability guiding based on branch, arrive the branch condition of maximum probability on iterative search and negate test cases execution route, generate new constraint, utilize symbolic excution methodology to be solved, if can generate the test cases of a performance objective code, proceed to step S104; If can't creating test case can the performance objective code, mean that the test target code can not be performed in program, proceeds to step S107;
Wherein branch's arrival probability is: for some branches, from this, be branched off into object code, the inverse of the minimum dependence number of branches of required process;
It is less that branch arrives probability, illustrates that the dependence branch that is branched off into the required experience of object code from this is more.Rely on branch more, path condition is just more complicated, and the possibility that path condition can't be satisfied is also larger.When probability is 1, as long as carry out this branch, with regard to one, carry out surely object code.So it is larger that branch arrives probability, branch just more " outstanding ", should select in all branches branch after negate to arrive the branch of maximum probability during negate.
The value that branch arrives probability is relevant to branch pattern, and the type of branch can be divided into following three kinds.
1. forward is controlled branch: after selecting to carry out this branch, object code can be performed.
2. oppositely control branch: after selecting to carry out this branch, object code is performed never.
3. non-control branch: select to carry out after this branch and can't determine and can carry out object code, the front Dominator that the branch node under this branch of side light is object code.
Control branch for forward, because of its performance objective code likely, it is between 0% to 100% that its branch arrives parameter probability valuing scope, for reverse controls branch, after carrying out this branch, forever can't carry out object code, and therefore, its branch's arrival probable value is 0%.The distance of this two classes branch only needs static dependencies information just can obtain, so, at initial phase, the distance of this two classes branch is determined.For non-control branch, can be divided into two classes again, one class is the non-control branch carried out before object code, due to the front Dominator that is object code of the branch node under this branch, so the branch of this branch arrives probable value and equals the forward nearest apart from it and control the branch of branch and arrive probable value.Another kind of is the non-control branch carried out after object code.There is not the control dependence in these branches to object code, thereby branch's arrival probable value is 0%.
Constraint generating algorithm based on branch's arrival probability guiding in step S103 specifically comprises:
Step S1031: establish existing test cases for (5,0,0,0, false, false), carry out this test cases, obtain execution route [2T, 3F].
Step S1032: this test cases is the performance objective code not, turns S1033.
Step S1033: on the execution route of this test cases, 2T is arranged, but the 3F negate turns S1034.
Step S1034: by 2T, 3F negate respectively, generate [2F], and [2T, 3T] these two treats the extensions path fragment.Probability is respectively 20%, 33.3%.Insert first and do not survey set.
Step S1035: it is not empty not surveying set, turns S1036.
Step S1036: from first, survey and select [2F, 3T] set this treats the extensions path fragment.
Step S1037: carry out the symbol execution.The execution route of hypotheses creation is [2T, 3T, 4F, 17F, 22F], Cnew=(x==5) ^ (n==20) ^ (z<=10) ^ (indices unequal to true) ^ (index unequal to true).
Step S1038: use constraint solver to solve Cnew, can separate, turn S10310.
Step S10310: solve test cases (5,0,20,10, false, false).
Step S1031: carry out the test cases (5,0,20,10, false, false) that a upper rapid S10310 of cycle generates.
Step S1032: this test cases is the performance objective code not, turns S1033.
Step S1033: on the execution route of this test cases, 4F is arranged, 17F, but the 22F negate turns S1034.
Step S1034: by 4F, 17F, 22F negate respectively, generate [2T, 3T, 4T], [2T, 3T, 4F, 17T], and [2T, 3T, 4F, 17F, 22T] these three treats the extensions path fragment, probability is respectively 33%, 0%, and 0%.Insert first and do not survey set.
Step S1035: first to survey set be sky, turns S1036.
Step S1036: from first, survey and select [2T, 3T, 4T] set this treats the extensions path fragment.
Step S1037: carry out the symbol execution, the execution route of hypotheses creation is [2T, 3T, 4T, 17T, 18F, 20T, 22T], and Cnew=(x==5) ^ (n==20) ^ (z > 10) ^ (indices==true) ^ (sig1 unequal to true) ^ (sig2==true) ^ (index==true).
Step S1038: use constraint solver to solve Cnew, can separate, turn S10310.
Step S10310: solve test cases (5,0,20,11, false, true).
Step S1031: carry out the test cases (5,0,20,11, false, true) that a upper rapid S10310 of cycle generates.
Step S1032: this test cases is the performance objective code not, turns S1033.
Step S1033: on the execution route of this test cases, 17T is arranged, 18F, 20T, but the 22T negate turns S1034.
Step S1034: by 17T, 18F, 20T, 22T negate respectively, generate [2T, 3T, 4T, 17F] [2T, 3T, 4T, 17T, 18T], [2T, 3T, 4T, 17T, 18F, 20F], [2T, 3T, 4T, 17T, 18F, 20T, 22F] these four treat the extensions path fragment, probability is respectively 0%, 100%, 0%, 0%.Insert first and do not survey set.
Step S1035: it is not empty not surveying set, turns S1036.
Step S1036: from first, survey and select [2T, 3T, 4T, 17T, 18T] set this treats the extensions path fragment.
Step S1037: carry out the symbol execution, the execution route of hypotheses creation is [2T, 3T, 4T, 17T, 18T, 20T, 22T], and Cnew=(x==5) ^ (n==20) ^ (z > 10) ^ (indices==true) ^ (sig1==true) ^ (sig2==true) ^ (index==true).
Step S1038: use constraint solver to solve Cnew, can separate, turn S10310.
Step S10310: solve test cases (5,0,20,20, true, true).
Step S1031: carry out the test cases (5,0,20,20, true, true) that a upper rapid S10310 of cycle generates.
Step S1032: this test cases has been carried out object code, turns S10312.
Step S10312: export this Validity Test case, flow process finishes.
Step S104: blocking-up branch finds and branch's blocking-up probability calculation.Have four branches after object code, be respectively 20T, 20F, 22T, 22F.Blocking-up branches into 22T.Branch's blocking-up probability of these four branches is 50%, 50%, 100%, 0%.
Step S104) blocking-up described in causes the object code execution result can't be delivered to the branch of output statement after branching into the object code execution.The reason that execution result can't transmit is to exist some statement again to revise the variable that object code was revised, and these statements exist and control dependence with blocking-up branch.For the output that guarantees program reflects the impact of object code on variable, after the performance objective code, should avoid carrying out blocking-up branch.
S105), adopt the constraint generating algorithm based on branch's blocking-up probability guiding, the branch condition of blocking-up probability minimum on iterative search and negate test cases execution route, generate new constraint, utilize symbolic excution methodology to be solved, guarantee object code execution result impact output if can generate a test cases, proceed to step S106); If can't creating test case, proceed to step S103);
Step S105) the constraint generating algorithm based on branch's blocking-up probability guiding described in comprises:
Step S1051: the Validity Test case (5,0,20,20, true, true) execution step S103) generated.
Step S1052: this test cases is not delivered to output statement by the object code execution result, turns S1053.
Step S1053: on the execution route of this test cases, 20T is arranged, but the 22T negate turns S1034.
Step S1054: by 20T, 22T negate respectively, generate [2T, 3T, 4T, 17T, 18T, 20F], [2T, 3T, 4T, 17T, 18T, 20T, 22F] these two path segments, and probability is respectively 50%, 0.Insert second and do not survey set.
Step S1055: it is not empty not surveying set, turns S1056.
Step S1056: from second, survey and select [2T, 3T, 4T, 17T, 18T, 20T, 22F] set this treats the extensions path fragment.
Step S1057: carry out the symbol execution.The execution route of hypotheses creation is [2T, 3T, 4T, 17T, 18T, 20T, 22F], and Cnew=(x==5) ^ (n==20) ^ (z > 10) ^ (indices==true) ^ (sig1==true) ^ (sig2==true) ^ (index unequal to true).
Step S1058: use constraint solver to solve Cnew, can separate, turn S10510.
Step S10510: solve test cases (5,0,20,20, true, false).
Step S1051: carry out test cases (5,0,20,20, true, false).
Step S1052: this test cases is delivered to output statement by the object code execution result, turns S10511.
Step S10512: export the Validity Test case that this can carry out the object code of expectation execution.
Step S106: the Validity Test case (5,0,20,20, true, false) of the object code that can carry out the expectation execution of output step S10512 output, flow process finishes.
Claims (7)
1. rely on the regression test case generation method of guiding based on programmed control, it is characterized in that, comprise the steps:
S101), utilize the Program Static Analysis method, control stream and the information flow of analytical test program, set up the control dependency graph of test procedure;
S102), for the object code of test procedure of input, according to step S101) in calculate the arrival probability of each branch in the control dependency graph set up;
S103), adopt the constraint generating algorithm that arrives the probability guiding based on branch, arrive the branch condition of maximum probability on iterative search and negate test cases execution route, generate new constraint, utilize symbolic excution methodology to be solved, if can generate the test cases of a performance objective code, proceed to step S104); If can't creating test case can the performance objective code, mean that the test target code can not be performed in program, proceeds to step S107);
S104), for the object code of test procedure, according to program information stream, detect each branch statement and whether block the impact of object code execution result on program output, be labeled as blocking-up branch if change; Then, calculate the blocking-up probability of each branch;
S105), adopt the constraint generating algorithm based on branch's blocking-up probability guiding, the branch condition of blocking-up probability minimum on iterative search and negate test cases execution route, generate new constraint, utilize symbolic excution methodology to be solved, guarantee object code execution result impact output if can generate a test cases, proceed to step S106); If can't creating test case, proceed to step S103);
S106) output Validity Test case, flow process finishes; Described Validity Test case refers to that this test cases can guarantee that the test target code is performed, and execution result affects the program Output rusults;
S107) for output test procedure and test target code, can't generate the Validity Test case.
2. method according to claim 1, is characterized in that step S103) described in branch arrive probability and be: for some branches, from this, be branched off into object code, the inverse of the minimum dependence number of branches of required process.
3. method according to claim 1, is characterized in that step S103) described in arrive the probability guiding based on branch the constraint generating algorithm specifically comprise:
S1031), carry out test cases, carry out for the first time the initial testing case; A cycle step S10310 from starting for the second time execution) test cases generated;
S1032), check whether object code is performed; If test cases can be carried out the object code that expectation is carried out, go to step S10312); If test cases can not be carried out object code, go to step S1033);
S1033) but, check on execution route whether the branch of negate is arranged, if having, go to step S1034); If no, go to step S1035);
S1034) but, the branch of all negates of negate generates a series of extensions path fragments for the treatment of, and will treat that the branch of last branch of extensions path fragment arrives the probability of probable value as this path segments energy coverage goal code, deposits first in and surveys in set;
Whether be empty, if it is empty, go to step S10311 if S1035), not surveying set), if not empty, go to step S10316);
S1036), from first survey set select a maximum probability treat the extensions path fragment, carry out the symbol execution based on this path segments;
S1037), symbol carries out this path segments, and record path constraint Cnew;
S1038), utilize constraint solver to solve Cnew, if can separate, go to step S10310); If intangibility, go to step S1039);
S1039), discarded this path segments, jump to step S1033 simultaneously);
S10310), generate new test cases Tnew, then jump to step S1031);
S10311), without the Validity Test case, export;
S10312), export the Validity Test case that this can carry out the object code of expectation execution.
4. method according to claim 1, is characterized in that step S104) described in after blocking-up branches into object code and carries out, cause the object code execution result can't be delivered to the branch of output statement.
5. method according to claim 1, is characterized in that step S104) described in branch's blocking-up probability be: for the some branches that carry out, will carry out the probability of blocking branch after carrying out this branch object code after; Span is 0%-100%.
6. according to the described method of claim 1 or 5, it is characterized in that, the computing formula of branch's blocking-up probability is:
BP=1–Nb/Np
Wherein the computing method of branch's blocking-up probability comprise: all branches that at first will treat measuring program are divided into Ep, two set of Eb, and the set that Ep is all branches, Eb is the set of blocking-up branch; For some branches, select subset Ep ' from two set, Eb ', be illustrated respectively in all branches of carrying out after this branch and all blocking-up branch, and then based on Ep ', Eb ' builds possible execution route; Np is the number of path built based on Ep ', and Nb is the number of path built based on Eb '; Obtain Nb, after Np, the substitution formula can obtain the blocking-up probable value BP of branch of a certain branch.
7. method according to claim 1, is characterized in that step S105) described in constraint generating algorithm based on branch's blocking-up probability guiding comprise:
S1051), carry out test cases; Perform step for the first time S103) step S10312) the Validity Test case that generates, from starting for the second time to carry out cycle step S10510) test cases of generation;
S1052), check whether the object code execution result is delivered to output statement: if the object code execution result has been delivered to output statement, go to step S10512); Otherwise, go to step S1053);
S1053) but, check on execution route whether the branch of negate is arranged, if having, go to step S1054); If no, go to step S1055);
S1054) but, the branch of all negates of negate generates a series of extensions path fragments for the treatment of, and the branch blocking-up probable value that will treat last branch of extensions path fragment will carry out the probable value of blocking-up branch as this path segments, deposit second in and survey and gather;
S1055), whether second to survey set be empty, if it is empty, goes to step S10511; If not empty, go to step S1056);
S1056), from second survey set select a blocking-up probability minimum treat the extensions path fragment, carry out the symbol execution based on this path segments;
S1057), symbol carries out this path segments, and record path constraint Cnew;
S1058), utilize constraint solver to solve Cnew, if can separate, go to step S10510); If intangibility, go to step S1059);
S1059), discarded this path segments, jump to step S1053);
S10510), generate new test cases Tnew, then jump to step S1051);
S10511), without the Validity Test case, export;
S10512) export this and can carry out the object code that expectation is carried out, and execution result affects the Validity Test case of program Output rusults.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310362303.3A CN103455421B (en) | 2013-08-19 | 2013-08-19 | The regression test case guided based on program control dependence generates method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310362303.3A CN103455421B (en) | 2013-08-19 | 2013-08-19 | The regression test case guided based on program control dependence generates method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103455421A true CN103455421A (en) | 2013-12-18 |
CN103455421B CN103455421B (en) | 2016-08-10 |
Family
ID=49737821
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310362303.3A Expired - Fee Related CN103455421B (en) | 2013-08-19 | 2013-08-19 | The regression test case guided based on program control dependence generates method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103455421B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104834603A (en) * | 2015-05-26 | 2015-08-12 | 牟永敏 | Regression-testing-oriented control flow change influence domain analyzing method and system |
CN108874656A (en) * | 2017-05-16 | 2018-11-23 | 北京京东尚科信息技术有限公司 | Code test method, device, readable storage medium storing program for executing and computer equipment |
CN109547405A (en) * | 2018-10-11 | 2019-03-29 | 上海交通大学 | Automated network attack traffic acquisition methods and system based on Python |
CN116383070A (en) * | 2023-04-07 | 2023-07-04 | 南京航空航天大学 | Symbol execution method for high MC/DC |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101901188A (en) * | 2010-07-23 | 2010-12-01 | 哈尔滨工程大学 | Reachable path-based software testing method |
US20110271256A1 (en) * | 2002-09-23 | 2011-11-03 | Per-Ola Robertsson | Bi-directional probing of software |
-
2013
- 2013-08-19 CN CN201310362303.3A patent/CN103455421B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110271256A1 (en) * | 2002-09-23 | 2011-11-03 | Per-Ola Robertsson | Bi-directional probing of software |
CN101901188A (en) * | 2010-07-23 | 2010-12-01 | 哈尔滨工程大学 | Reachable path-based software testing method |
Non-Patent Citations (1)
Title |
---|
俞乐晨等: "基于分支概率引导的回归测试案例生成方法", 《中南大学学报(自然科学版)》, vol. 44, no. 2, 31 July 2013 (2013-07-31), pages 317 - 322 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104834603A (en) * | 2015-05-26 | 2015-08-12 | 牟永敏 | Regression-testing-oriented control flow change influence domain analyzing method and system |
CN104834603B (en) * | 2015-05-26 | 2017-12-01 | 牟永敏 | A kind of controlling stream towards regression test changes domain of influence analysis method and system |
CN108874656A (en) * | 2017-05-16 | 2018-11-23 | 北京京东尚科信息技术有限公司 | Code test method, device, readable storage medium storing program for executing and computer equipment |
CN109547405A (en) * | 2018-10-11 | 2019-03-29 | 上海交通大学 | Automated network attack traffic acquisition methods and system based on Python |
CN116383070A (en) * | 2023-04-07 | 2023-07-04 | 南京航空航天大学 | Symbol execution method for high MC/DC |
CN116383070B (en) * | 2023-04-07 | 2023-12-05 | 南京航空航天大学 | Symbol execution method for high MC/DC |
Also Published As
Publication number | Publication date |
---|---|
CN103455421B (en) | 2016-08-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105786715B (en) | A kind of program static state automatic analysis method | |
CN104969179B (en) | For that will have the method and system of the scalar computer program cyclic vector of the dependence of loop-carried | |
CN103559122A (en) | Test case reduction method based on program behavior slices | |
CN102708045B (en) | Dynamic symbol executing method for relieving path explosion | |
CN103678110A (en) | Method and device for providing modification related information | |
CN105868116A (en) | Semantic mutation operator based test case generation and optimization method | |
CN102231134A (en) | Method for detecting redundant code defects based on static analysis | |
CN103455421A (en) | Regression testing case generation method based on program control dependence guide | |
CN103713933B (en) | Focus function, the assemblage method of variable, apparatus and system in computer program | |
CN107367686B (en) | A kind of generation method of RTL hardware Trojan horse test vector | |
CN104794401A (en) | Static-analysis-assisted symbolic execution vulnerability detection method | |
CN101714118A (en) | Detector for binary-code buffer-zone overflow bugs, and detection method thereof | |
Tulsian et al. | MUX: algorithm selection for software model checkers | |
CN108647146B (en) | Test case generation method for judging combination coverage based on correction condition | |
US10902130B2 (en) | Guiding automated testing of binary programs | |
CN105117336A (en) | Method for processing control dependence employing dynamic marking | |
CN108932137A (en) | A kind of assembly level interprocedual pointer analysis method based on speculative multithreading | |
US6691079B1 (en) | Method and system for analyzing test coverage | |
CN102968515A (en) | Method and equipment for calculating verification coverage of integrated computer circuit model | |
Wang et al. | Global optimization of numerical programs via prioritized stochastic algebraic transformations | |
CN110321458A (en) | A kind of dataflow analysis method and device based on controlling stream graph | |
CN105260222B (en) | Start spacing optimization method between cycle flowing water iteration in a kind of reconfigurable compiling device | |
CN116383070B (en) | Symbol execution method for high MC/DC | |
Romdhana et al. | IFRIT: Focused Testing through Deep Reinforcement Learning | |
CN111221731B (en) | Method for quickly acquiring test cases reaching specified points of program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
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: 20160810 |