CN103455421B - The regression test case guided based on program control dependence generates method - Google Patents
The regression test case guided based on program control dependence generates method Download PDFInfo
- Publication number
- CN103455421B CN103455421B CN201310362303.3A CN201310362303A CN103455421B CN 103455421 B CN103455421 B CN 103455421B CN 201310362303 A CN201310362303 A CN 201310362303A CN 103455421 B CN103455421 B CN 103455421B
- Authority
- CN
- China
- Prior art keywords
- branch
- test
- probability
- test cases
- program
- 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
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 144
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000004458 analytical method Methods 0.000 claims description 29
- 239000012634 fragment Substances 0.000 claims description 20
- 230000008569 process Effects 0.000 claims description 12
- 230000000903 blocking effect Effects 0.000 claims description 5
- 230000003068 static effect Effects 0.000 claims description 5
- 238000000205 computational method Methods 0.000 claims description 2
- 238000013101 initial test Methods 0.000 claims description 2
- 230000004048 modification Effects 0.000 abstract description 3
- 238000012986 modification Methods 0.000 abstract description 2
- 230000008859 change Effects 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 2
- KRTSDMXIXPKRQR-AATRIKPKSA-N monocrotophos Chemical compound CNC(=O)\C=C(/C)OP(=O)(OC)OC KRTSDMXIXPKRQR-AATRIKPKSA-N 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000013138 pruning Methods 0.000 description 1
- 238000013102 re-test Methods 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The present invention proposes a kind of regression test case guided based on program control dependence and generates method, can automatically generate the test cases that modification of program part carries out Validity Test.The method, to occur the program code revised as test target, by analyzing control stream and the flow of information of program, sets up program control dependence figure;Calculating each branch statement and arrive the probability (arrival probability) of test target code, aiming symbol performs to generate and can ensure that the test cases that object code is performed;The object code that may make calculating all branch statements performs the probability (blocking-up probability) that result cannot travel to export, and aiming symbol performs to generate and can ensure that object code performs the test cases that result impact exports.Comparing existing regression testing method, this method can ensure that the effectiveness of test cases, significantly improves the efficiency that test cases generates simultaneously.
Description
Technical field
The present invention relates to trusted software and software test field, generate method particularly to regression test case.
Background technology
After software regression testing refers to software code amendment, re-start test to confirm that amendment does not introduce new mistake
Or cause other codes to produce mistake.The effectively amendment of software being needed to meet two conditions: 1) amendment of program meets expection
Behavior, i.e. can be correct by part amendment to be modified;2) amendment of program does not interferes with other unexpected behavior and becomes
Change, i.e. amendment part does not interferes with other program behavior that need not amendment.Regression test is to ensure that software modification meets expection
Important means, carrying out regression test the most efficiently is also the major issue in software test.Existing thinking be broadly divided into
Lower two kinds: 1) follow-on test, utilizes existing test cases to retest the program developed, and it is main that the method exists
Problem is that efficiency is low, and its overwhelming majority test cases is all invalid test cases for being modified program.2) for program
Amendment Partial Incremental generates new test cases, and its difficult point is to automatically generate the most efficiently to meet desired test cases.
For solving the problem of follow-on test inefficiency, research worker proposes two kinds of improved methods, and test cases selects
Sort with test cases.Both approaches is all to select most suitable by the relation analyzing test cases and Evolution Programs
Test cases.Although test cases selects and test cases sorts solves the inefficiency problem of follow-on test, but does not has
Solve the validity problem of follow-on test, because existing test cases can't be in view of the change of program in the future when creating
Change, it is possible to these test cases all can not cover the program part being modified.
For solving the low problem of test cases collection coverage rate, the focus of research is to be formalization mould by program abstraction at present
Type, uses test cases automatic generating calculation to extract the various information in formalized model, generate a complete survey
Examination casebook.The method of most common of which is semiology analysis, and semiology analysis is a kind of program verification that 20 century 70s propose
Method, is a kind of Model Checking based on symbolization.It is widely used in symbolic debugging, test cases generation etc..Its core is thought
Think it is to use value of symbol to replace concrete variable input, and use character expression to carry out the value of each variable in representation program.Finally,
The output valve of program is converted into one using value of symbol as the function of input.Program abstraction is semiology analysis by semiology analysis
Tree, wherein sequential statement correspond to the calculating node of tree, and branch statement correspond to branch node, and for Do statement, by it
Semantically equivalent branch statement is expanded into by cycle-index.Typically, a corresponding group of branches node of Do statement.Can recognize
For, in Symbolic Execution, program only order and two kinds of structures of branch.
It it is the construction process of path condition on the process nature of semiology analysis.Path condition refers to for performing this path
Test cases, the mathematical constraint met required for program input value.Thus a path condition correspondence one uniquely
Execution route.One path condition is made up of one group of sub-condition (sub-condition), and each condition being performed branch is made
It it is a sub-condition.When initial, path condition is true, during heuristic routine, often runs into a branch statement, just
Updating path condition, join in path condition by the condition being performed branch, formula is PC=PC^new sub-
condition.Owing to each branch statement correspond to true and false Liang Ge branch, and semiology analysis divides based on static state
Analysis, variable does not has concrete numerical value, thus cannot determine which bar branch of execution.(search so Liang Tiao branch is all explored
Suo Shunxu can on-demand define, depth-first, breadth First etc.), the condition using Liang Ge branch updates as sub-condition the most respectively
Path condition.Two new path conditions, corresponding two different execution routes are thus obtained.Afterwards, continue to this two
Paths is explored respectively.Semiology analysis achieves the complete trails to program and explores.Just obtain at the end of program is explored
The path condition of all execution routes of tested program.Finally, check all path conditions obtained, if path condition is cannot
Be satisfied, then illustrate this path be one can not execution route, if path condition can be satisfied, then illustrate that this path is
Article one, can execution route.Path condition input constraint solver can be solved the test cases of correspondence.
There are two obstructions in semiology analysis so that it is difficult to large-scale use.1) semiology analysis is a kind of based on search
Ergodic algorithm, needs to travel through all branches of program, although can be optimized by some additional beta pruning conditions,
But the complexity of its algorithm is the highest, for O (2n), wherein n is that tested program conditional statement (including branch, circulation, transport by logic
Calculate) number;2) semiology analysis can not solve the problem that test cases collection updates well, after each code is modified, only
Can again travel through a semiology analysis tree and generate a new test cases collection.From analysis above, regenerate one
The time overhead of individual test cases collection is bigger, and a software may frequently change, if the most logical after changing every time
Crossing semiology analysis and generate a new test cases collection, the efficiency of test will be affected.
Summary of the invention
It is an object of the invention to provide a kind of regression test case guided based on program control dependence and generate method, with
Improve testing efficiency.
To achieve these goals, the present invention adopts the following technical scheme that
The regression test case guided based on program control dependence generates method, comprises the steps:
S101), utilize Program Static Analysis method, analyze control stream and the flow of information of test program, set up test program
Control dependency graph;
S102), for the object code of test program of input, according to step S101) in the control dependency graph set up
Calculate the arrival probability of each branch;
S103), use based on branching to the constraint generating algorithm that probability guides, iterative search and negate test cases and hold
Arrive the branch condition of maximum probability on walking along the street footpath, generate new constraint, utilize symbolic excution methodology to solve, if can give birth to
Become the test cases of a performance objective code, proceed to step S104);Can be with performance objective generation if test cases cannot be generated
Code, then it represents that test target code will not be performed in a program, proceeds to step S107);
S104), for the object code of test program, according to program information stream, detect whether each branch statement blocks
Object code performs the impact that program is exported by result, if changing, is labeled as blocking branch;Then, the resistance of each branch is calculated
Disconnected probability;
S105), use and block, based on branch, the constraint generating algorithm that probability guides, iterative search and negate test cases and hold
Block the branch condition that probability is minimum on walking along the street footpath, generate new constraint, utilize symbolic excution methodology to solve, if can give birth to
Object code performs result impact output to become a test cases to ensure, proceeds to step S106);If test cases cannot be generated,
Proceed to step S103);
S106) output Validity Test case, flow process terminates;Described Validity Test case refers to that this test cases can ensure that
Test target code is performed, and execution result affects program output result;
S107) for output test program and test target code, it is impossible to generate Validity Test case.
The present invention is further improved by: step S103) described in branch to probability and be: for some branch,
It is branched off into object code, the inverse of the minimum dependence number of branches of required process from this.
The present invention is further improved by: step S103) described in based on branch to probability guide constraint generate
Algorithm specifically includes:
S1031), perform test cases, perform initial testing case for the first time;Start to perform a cycle step from second time
Rapid S10310) test cases that generates;
S1032), check whether object code is performed;If test cases can go to the object code that expectation performs,
Then go to step S10312);If test cases can not go to object code, then go to step S1033);
S1033), check whether there is the branch that can negate, if it has, then go to step S1034 on execution route);If
No, then step S1035 is gone to);
S1034), negate all branches negated to generate a series of extensions path fragment for the treatment of, and extensions path will be treated
Last branch of fragment branches to the probit probability as this path segments energy coverage goal code, is stored in first not
In detection set;
S1035), do not detect whether set is empty, if it is empty, go to step S10311), if not empty, go to step
S10316);
S1036), from first do not detect set select a maximum probability treat extensions path fragment, based on this path
Fragment carries out semiology analysis;
S1037), this path segments of semiology analysis, and record path constraint Cnew;
S1038), utilize constraint solver to solve Cnew, if can solve, then go to step S10310);If intangibility, then turn
To step S1039);
S1039), discard this path segments, jump to step S1033 simultaneously);
S10310), generate new test cases Tnew, then jump to step S1031);
S10311), export without Validity Test case;
S10312) this Validity Test case that can go to the object code that expectation performs, is exported.
The present invention is further improved by: step S104) described in block branch into object code perform after, cause mesh
Mark code performs result cannot be delivered to the branch of output statement.
The present invention is further improved by: step S104) described in branch block probability be: for object code it
Some branch of rear execution, will perform to block the probability of branch after performing this branch;Span is 0%-100%.
The present invention is further improved by: branch blocks the computing formula of probability and is:
BP=1–Nb/Np
Wherein the computational methods of branch's blocking-up probability include: first all branches of program to be measured are divided into Ep, Eb two
Set, Ep is the set of all branches, and Eb is the set blocking branch;For some branch, from two set, select son
Collection Ep ', Eb ', all branches performed after being illustrated respectively in this branch and all blocking-up branches, it is then based on Ep ', Eb ' structure
Build 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
Substitute into formula and i.e. can get branch's blocking-up probit BP of a certain branch.
The present invention is further improved by: step S105) described in based on branch block probability guide constraint generate
Algorithm includes:
S1051), test cases is performed;Perform for the first time step S103) step S10312) the Validity Test case that generates
Example, starts to perform cycle step S10510 from second time) test cases that generates;
S1052), check that object code performs whether result is delivered to output statement: if object code performs result and passes
It is delivered to output statement, has then gone to step S10512);Otherwise, then step S1053 is gone to);
S1053), check whether there is the branch that can negate, if it has, then go to step S1054 on execution route);If
No, then step S1055 is gone to);
S1054), negate all branches negated to generate a series of extensions path fragment for the treatment of, and extensions path will be treated
The branch of last branch of fragment blocks probit as this path segments by performing to block the probit of branch, is stored in second
Do not detect in set;
S1055), whether second not detect set be empty, if it is empty, goes to step S10511;If not empty, step is gone to
S1056);
S1056), do not detect from second set selects one block probability minimum treat extensions path fragment, based on this
Path segments carries out semiology analysis;
S1057), this path segments of semiology analysis, and record path constraint Cnew;
S1058), utilize constraint solver to solve Cnew, if can solve, then go to step S10510);If intangibility, then turn
To step S1059);
S1059), discard this path segments, jump to step S1053);
S10510), generate new test cases Tnew, then jump to step S1051);
S10511), export without Validity Test case;
S10512) export this and can go to the object code that expectation performs, and execution result affects program output result
Validity Test case.
Relative to prior art, the method have the advantages that the present invention proposes a kind of based on program control dependence
Guide regression test case generate method, the method with occur amendment program code as test target, by analyze program
Control stream and flow of information, set up program control dependence figure;The probability calculating each branch statement arrival test target code (arrives
Reach probability), aiming symbol performs to generate and can ensure that the test cases that object code is performed;Calculate all branch statements can
Object code can be made to perform result and cannot travel to the probability (blocking-up probability) of output, aiming symbol performs generation and can ensure that
Object code performs the test cases of result impact output;The inventive method can automatically generate to be had modification of program part
The test cases of effect test;Comparing existing regression testing method, this method can ensure that the effectiveness of test cases, the most notable
Improve the efficiency that test cases generates.
Accompanying drawing explanation
Fig. 1 is the overall flow figure of the inventive method;
Fig. 2 is the test cases product process figure that test target code arrives;
Fig. 3 is the test cases product process figure that test target performs impact output;
Fig. 4 is example programme diagram to be tested;
Fig. 5 is the control dependency graph of example procedure.
Detailed description of the invention
Below in conjunction with accompanying drawing and example in detail embodiments of the present invention.Program to be measured as shown in Figure 4, for perform
Path, we represent with the branch statement of process on path.Assume that a certain execution route have passed through 2F, 3T the two branch language
Sentence, then it is expressed as [2F, 3T].
Step S101: analyze control stream and the flow of information of test program based on Static Analysis Method, generate test program
Control dependency graph, control dependency graph as it is shown in figure 5, object code is the 19th row;
Step S102: for the object code of the test program of input, in the control dependency graph set up in step S101
Calculate the arrival probability of each branch;Result is as shown in the table.
Branch | Branch pattern | Branch to probability | Branch | Branch pattern | Branch to probability |
2T | Forward controls branch | 25% | 2F | Forward controls branch | 20% |
3T | Forward controls branch | 33.3% | 3F | Reverse Turning Control branch | 0% |
4T | Non-controlling branch | 33.3% | 4F | Non-controlling branch | 33.3% |
9T | Forward controls branch | 25% | 9F | Reverse Turning Control branch | 0% |
10T | Forward controls branch | 33.3% | 10F | Reverse Turning Control branch | 0% |
11T | Non-controlling branch | 33.3% | 11F | Non-controlling branch | 33.3% |
17T | Forward controls branch | 50% | 17F | Reverse Turning Control branch | 0% |
18T | Forward controls branch | 100% | 18F | Reverse Turning Control branch | 0% |
20T | Non-controlling branch | 0% | 20F | Non-controlling branch | 0% |
22T | Non-controlling branch | 0% | 20F | Non-controlling branch | 0% |
With 2T, as a example by 3F, 4T, 20T.2T be forward control branch, from 2T go to object code 19 need to through 2T, 3T,
These four forwards of 17T, 18T control branch, and therefore it branches to probability is 25%.3F is Reverse Turning Control branch, performs this branch
The most forever cannot arrive 19, therefore it branches to probability is 0%.4T is non-controlling branch, controls branch away from its nearest forward
For 3T, so it branches to probability is 33.3%.20T is non-controlling branch, after being positioned at object code because of it, to target generation
The execution of code does not affect, and it branches to probability is 0%.
Step S103, use based on branching to the constraint generating algorithm that probability guides, iterative search and negate test case
Arrive the branch condition of maximum probability on example execution route, generate new constraint, utilize symbolic excution methodology to solve, if can
To generate the test cases of a performance objective code, proceed to step S104;Can be with performance objective if test cases cannot be generated
Code, then it represents that test target code will not be performed in a program, proceeds to step S107;
Wherein branching to probability is: for some branch, be branched off into object code from this, required process minimum
Rely on the inverse of number of branches;
Branch to probability the least, illustrate that the dependence branch of experience is the most needed for this is branched off into object code.Rely on and divide
Zhi Yue is many, and path condition is the most complicated, and the probability that path condition cannot be satisfied is the biggest.When probability is 1, as long as performing
This branch, goes to object code surely with regard to one.So, branching to probability the biggest, then branch is more " outstanding ", should when negating
The branch of maximum probability is branched to after all branches of this selection negate.
The value branching to probability is relevant to branch pattern, and the type of branch can be divided into following three kinds.
1. forward controls branch: after selecting to perform this branch, object code can be performed to.
2. Reverse Turning Control branch: after selecting to perform this branch, object code is performed to never.
3. non-controlling branch: cannot determine whether to go to object code, this point of side light after selecting to perform this branch
The front Dominator that branch node is object code belonging to.
Controlling branch for forward, because of its likely performance objective code, it branches to parameter probability valuing scope is 0% to arrive
Between 100%, for Reverse Turning Control branch, after performing this branch, forever cannot go to object code, therefore, it branches to
Probit is 0%.The distance of this Liang Lei branch has only to static dependencies information and just can obtain, so, at initial phase, these are two years old
The distance of class branch has been determined.For non-controlling branch, can be divided into again two classes, a class performs before object code
Non-controlling branch, the branch node belonging to this branch is the front Dominator of object code, therefore being branched off into of this branch
Reach probit and branch to probit equal to control branch away from its nearest forward.Another kind of execution after object code
Non-controlling branch.There is not control dependence in these branches, thus branching to probit is 0% to object code.
Step S103 specifically includes based on the constraint generating algorithm branching to probability guiding:
Step S1031: set existing test cases as (5,0,0,0, false, false), perform this test cases, held
Walking along the street footpath [2T, 3F].
Step S1032: this test cases is not carried out object code, turns S1033.
Step S1033: have 2T, 3F to negate on the execution route of this test cases, turn S1034.
Step S1034: 2T, 3F are negated respectively, generates [2F], and [2T, 3T] the two treats extensions path fragment.Probability divides
It is not 20%, 33.3%.Insert first and do not detect set.
Step S1035: do not detect set not for empty, turn S1036.
Step S1036: from first do not detect set select [2F, 3T] this treat extensions path fragment.
Step S1037: carry out semiology analysis.Assume that the execution route generated is [2T, 3T, 4F, 17F, 22F], Cnew=(x
==5)^(n==20)^(z<=10)^(indices!=true)^(index!=true)。
Step S1038: use constraint solver to solve Cnew, can solve, turn S10310.
Step S10310: solve test cases (5,0,20,10, false, false).
Step S1031: perform the test cases (5,0,20,10, false, false) that a upper cycle rapid S10310 generates.
Step S1032: this test cases is not carried out object code, turns S1033.
Step S1033: have 4F on the execution route of this test cases, 17F, 22F can negate, and turn S1034.
Step S1034: by 4F, 17F, 22F negate respectively, generate [2T, 3T, 4T], [2T, 3T, 4F, 17T], [2T, 3T,
4F, 17F, 22T] these three treats extensions path fragment, probability is respectively 33%, and 0%, 0%.Insert first and do not detect set.
Step S1035: first does not detects set not for empty, turns S1036.
Step S1036: from first do not detect set select [2T, 3T, 4T] this treat extensions path fragment.
Step S1037: carry out semiology analysis, it is assumed that the execution route of generation be [2T, 3T, 4T, 17T, 18F, 20T,
22T], Cnew=(x==5) ^ (n==20) ^ (z > 10) ^ (indices==true) ^ (sig1!=true)^(sig2==true)^
(index==true)。
Step S1038: use constraint solver to solve Cnew, can solve, turn S10310.
Step S10310: solve test cases (5,0,20,11, false, true).
Step S1031: perform the test cases (5,0,20,11, false, true) that a upper cycle rapid S10310 generates.
Step S1032: this test cases is not carried out object code, turns S1033.
Step S1033: have 17T on the execution route of this test cases, 18F, 20T, 22T can negate, and turn 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 treats extensions path fragment, generally
Rate is respectively 0%, and 100%, 0%, 0%.Insert first and do not detect set.
Step S1035: do not detect set not for empty, turn S1036.
Step S1036: from first do not detect set select [2T, 3T, 4T, 17T, 18T] this treat extensions path fragment.
Step S1037: carry out semiology analysis, it is assumed that the execution route of generation be [2T, 3T, 4T, 17T, 18T, 20T,
22T], Cnew=(x==5) ^ (n==20) ^ (z > 10) ^ (indices==true) ^ (sig1==true) ^ (sig2==true) ^
(index==true)。
Step S1038: use constraint solver to solve Cnew, can solve, turn S10310.
Step S10310: solve test cases (5,0,20,20, true, true).
Step S1031: perform the test cases (5,0,20,20, true, true) that a upper cycle rapid S10310 generates.
Step S1032: this test cases performs object code, turns S10312.
Step S10312: exporting this Validity Test case, flow process terminates.
Step S104: block branch and find and branch's blocking-up probability calculation.Four branches are had, respectively after object code
For 20T, 20F, 22T, 22F.Blocking-up branches into 22T.It is 50%, 50%, 100%, 0% that the branch of these four branches blocks probability.
Step S104) described in block branch into object code perform after, cause object code perform result cannot transmit
Branch to output statement.Performing the reason that cannot transmit of result is to there is some statement again to have modified object code and revised
Variable, and these statements with block branch exist control dependence.In order to ensure that the output of program reflects object code pair
The impact of variable, after performance objective code, should avoid performing to block branch.
S105), use and block, based on branch, the constraint generating algorithm that probability guides, iterative search and negate test cases and hold
Block the branch condition that probability is minimum on walking along the street footpath, generate new constraint, utilize symbolic excution methodology to solve, if can give birth to
Object code performs result impact output to become a test cases to ensure, proceeds to step S106);If test cases cannot be generated,
Proceed to step S103);
Step S105) described in based on branch block probability guide constraint generating algorithm include:
Step S1051: perform step S103) the Validity Test case (5,0,20,20, true, true) that generates.
Step S1052: object code is not performed result and is delivered to output statement by this test cases, turns S1053.
Step S1053: have 20T, 22T to negate on the execution route of this test cases, turn S1034.
Step S1054: 20T, 22T are negated respectively, generates [2T, 3T, 4T, 17T, 18T, 20F], [2T, 3T, 4T, 17T,
18T, 20T, 22F] the two path segments, probability is respectively 50%, and 0.Insert second and do not detect set.
Step S1055: do not detect set not for empty, turn S1056.
Step S1056: from second do not detect set select [2T, 3T, 4T, 17T, 18T, 20T, 22F] this wait to extend
Path segments.
Step S1057: carry out semiology analysis.Assume generate execution route for [2T, 3T, 4T, 17T, 18T, 20T,
22F], Cnew=(x==5) ^ (n==20) ^ (z > 10) ^ (indices==true) ^ (sig1==true) ^ (sig2==true) ^
(index!=true)。
Step S1058: use constraint solver to solve Cnew, can solve, turn S10510.
Step S10510: solve test cases (5,0,20,20, true, false).
Step S1051: perform test cases (5,0,20,20, true, false).
Step S1052: object code is performed result and is delivered to output statement by this test cases, turns S10511.
Step S10512: export this Validity Test case that can go to the object code that expectation performs.
Step S106: the Validity Test case that the object code that expectation performs can be gone to of output step S10512 output
(5,0,20,20, true, false), flow process terminates.
Claims (5)
1. the regression test case guided based on program control dependence generates method, it is characterised in that comprise the steps:
S101), utilize Program Static Analysis method, analyze control stream and the flow of information of test program, set up the control of test program
Dependency graph processed;
S102), for the object code of test program of input, according to step S101) in the control dependency graph set up calculates
The arrival probability of each branch;
S103), using based on branching to the constraint generating algorithm that probability guides, iterative search performs road with negating test cases
Arrive the branch condition of maximum probability on footpath, generate new constraint, utilize symbolic excution methodology to solve, if one can be generated
The test cases of individual performance objective code, proceeds to step S104);Can be with performance objective code if test cases cannot be generated, then
Represent that test target code will not be performed in a program, proceed to step S107);
S104), for the object code of test program, according to program information stream, detect whether each branch statement blocks target
Code performs the impact that program is exported by result, if changing, is labeled as blocking branch;Then, the blocking-up calculating each branch is general
Rate;
S105), using the constraint generating algorithm blocking probability guiding based on branch, iterative search performs road with negating test cases
Block the branch condition that probability is minimum on footpath, generate new constraint, utilize symbolic excution methodology to solve, if one can be generated
Individual test cases ensures that object code performs result impact output, proceeds to step S106);If test cases cannot be generated, proceed to
Step S103);
S106) output Validity Test case, flow process terminates;Described Validity Test case refers to that this test cases can ensure that test
Object code is performed, and execution result affects program output result;
S107) for output test program and test target code, it is impossible to generate Validity Test case;
Step S103) described in based on branch to probability guide constraint generating algorithm specifically include:
S1031), perform test cases, perform initial testing case for the first time;Start to perform a cycle step from second time
S10310) test cases generated;
S1032), check whether object code is performed;If test cases can go to the object code that expectation performs, then turn
To step S10312);If test cases can not go to object code, then go to step S1033);
S1033), check whether there is the branch that can negate, if it has, then go to step S1034 on execution route);If it did not,
Then go to step S1035);
S1034), negate all branches negated to generate a series of extensions path fragment for the treatment of, and extensions path fragment will be treated
Last branch branches to the probit probability as this path segments energy coverage goal code, is stored in first and does not detects
In set;
S1035), do not detect whether set is empty, if it is empty, go to step S10311), if not empty, go to step S1036);
S1036), from first do not detect set select a maximum probability treat extensions path fragment, based on this path segments
Carry out semiology analysis;
S1037), this path segments of semiology analysis, and record path constraint Cnew;
S1038), utilize constraint solver to solve Cnew, if can solve, then go to step S10310);If intangibility, then go to step
Rapid S1039);
S1039), discard this path segments, jump to step S1033 simultaneously);
S10310), generate new test cases Tnew, then jump to step S1031);
S10311), export without Validity Test case;
S10312) this Validity Test case that can go to the object code that expectation performs, is exported;
Step S105) described in based on branch block probability guide constraint generating algorithm include:
S1051), test cases is performed;Perform for the first time step S103) step S10312) the Validity Test case that generates, from
Second time starts to perform upper cycle step S10510) test cases that generates;
S1052), check that object code performs whether result is delivered to output statement: if object code performs result and is delivered to
Output statement, then go to step S10512);Otherwise, then step S1053 is gone to);
S1053), check whether there is the branch that can negate, if it has, then go to step S1054 on execution route);If it did not,
Then go to step S1055);
S1054), negate all branches negated to generate a series of extensions path fragment for the treatment of, and extensions path fragment will be treated
The branch of last branch blocks probit as this path segments by performing to block the probit of branch, is stored in second and does not visits
Survey in set;
S1055), whether second not detect set be empty, if it is empty, goes to step S10511;If not empty, step is gone to
S1056);
S1056), do not detect from second set selects one block probability minimum treat extensions path fragment, based on this path
Fragment carries out semiology analysis;
S1057), this path segments of semiology analysis, and record path constraint Cnew;
S1058), utilize constraint solver to solve Cnew, if can solve, then go to step S10510);If intangibility, then go to step
Rapid S1059);
S1059), discard this path segments, jump to step S1053);
S10510), generate new test cases Tnew, then jump to step S1051);
S10511), export without Validity Test case;
S10512) output can go to the object code that expectation performs, and execution result affects effective survey of program output result
Examination case.
Method the most according to claim 1, it is characterised in that step S103) described in branch to probability and be: for a certain
Individual branch, is branched off into object code from this, the inverse of the minimum dependence number of branches of required process.
Method the most according to claim 1, it is characterised in that step S104) described in block branch into object code perform
After, cause object code to perform result and cannot be delivered to the branch of output statement.
Method the most according to claim 1, it is characterised in that step S104) described in branch block probability be: at mesh
Some branch performed after mark code, will perform to block the probability of branch after performing this branch;Span is 0%-
100%.
5. according to method described in claim 1 or 4, it is characterised in that branch blocks the computing formula of probability and is:
BP=1 Nb/Np
Wherein the computational methods of branch's blocking-up probability include: first all branches of program to be measured are divided into Ep, Eb two set,
Ep is the set of all branches, and Eb is the set blocking branch;For some branch, from two set, select subset Ep ',
Eb ', all branches performed after being illustrated respectively in this branch and all blocking-up branches, it is then based on Ep ', Eb ' and 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, substitute into public affairs
Formula i.e. can get the branch of a certain branch and blocks probit BP.
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 CN103455421A (en) | 2013-12-18 |
CN103455421B true 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) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
CN116383070B (en) * | 2023-04-07 | 2023-12-05 | 南京航空航天大学 | Symbol execution method for high MC/DC |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101901188A (en) * | 2010-07-23 | 2010-12-01 | 哈尔滨工程大学 | Reachable path-based software testing method |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8020148B2 (en) * | 2002-09-23 | 2011-09-13 | Telefonaktiebolaget L M Ericsson (Publ) | Bi-directional probing and testing of software |
-
2013
- 2013-08-19 CN CN201310362303.3A patent/CN103455421B/en not_active Expired - Fee Related
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101901188A (en) * | 2010-07-23 | 2010-12-01 | 哈尔滨工程大学 | Reachable path-based software testing method |
Non-Patent Citations (1)
Title |
---|
基于分支概率引导的回归测试案例生成方法;俞乐晨等;《中南大学学报(自然科学版)》;20130731;第44卷(第S2期);第317-322页 * |
Also Published As
Publication number | Publication date |
---|---|
CN103455421A (en) | 2013-12-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105786715B (en) | A kind of program static state automatic analysis method | |
CN103455421B (en) | The regression test case guided based on program control dependence generates method | |
CN102231134A (en) | Method for detecting redundant code defects based on static analysis | |
CN103116540B (en) | Dynamic symbol execution method based on global superblock domination graph | |
CN103559122A (en) | Test case reduction method based on program behavior slices | |
CN104794401B (en) | A kind of semiology analysis leak detection method of static analysis auxiliary | |
CN102521123B (en) | A kind of embedded software test pile pitching method of logic-based execution block | |
CN105868116A (en) | Semantic mutation operator based test case generation and optimization method | |
CN103713933B (en) | Focus function, the assemblage method of variable, apparatus and system in computer program | |
CN102915271A (en) | Method for optimizing unit regression test case set based on control flow diagram | |
CN107193745B (en) | Automated construction method of the PLC program to NuSMV input model | |
CN107367686B (en) | A kind of generation method of RTL hardware Trojan horse test vector | |
CN103678110A (en) | Method and device for providing modification related information | |
CN108647146B (en) | Test case generation method for judging combination coverage based on correction condition | |
CN107844415A (en) | A kind of model inspection path reduction method, computer based on interpolation | |
CN104503901A (en) | Guiding symbol execution method based on static path analysis | |
CN103914379B (en) | Fault is automatically injected the method with fault detect and system thereof | |
CN102968369B (en) | Method and system for automatically generating dynamic breakpoints | |
CN103559131B (en) | Effective layering error locating method | |
CN110321458A (en) | A kind of dataflow analysis method and device based on controlling stream graph | |
CN102622334B (en) | Parallel XSLT (Extensible Style-sheet Language Transformation) conversion method and device for use in multi-thread environment | |
US6691079B1 (en) | Method and system for analyzing test coverage | |
CN102968515A (en) | Method and equipment for calculating verification coverage of integrated computer circuit model | |
CN108629124B (en) | Method for automatically generating simulation parameter data based on active graph path | |
TW201218008A (en) | Intelligent architecture creator |
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 |