CN104035864B - A kind of path generating method based on contradiction fragment schema - Google Patents

A kind of path generating method based on contradiction fragment schema Download PDF

Info

Publication number
CN104035864B
CN104035864B CN201310693444.3A CN201310693444A CN104035864B CN 104035864 B CN104035864 B CN 104035864B CN 201310693444 A CN201310693444 A CN 201310693444A CN 104035864 B CN104035864 B CN 104035864B
Authority
CN
China
Prior art keywords
point
contradiction
predicate
fragment
path
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310693444.3A
Other languages
Chinese (zh)
Other versions
CN104035864A (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 University of Posts and Telecommunications
Original Assignee
Beijing University of Posts and Telecommunications
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 University of Posts and Telecommunications filed Critical Beijing University of Posts and Telecommunications
Priority to CN201310693444.3A priority Critical patent/CN104035864B/en
Publication of CN104035864A publication Critical patent/CN104035864A/en
Application granted granted Critical
Publication of CN104035864B publication Critical patent/CN104035864B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a kind of path generating method based on contradiction fragment schema, including:Then A, the starting point for selecting from controlling stream graph this coordinates measurement perform step B as current point;B, the follow-up point of selection, then perform step C;If C, successfully choosing follow-up point, step G is performed;Otherwise step D is performed;D, also previous point is checked whether, have and then perform step E;Otherwise step F is performed;E, previous point is set to current point, then performs step B;F, due to having return back to starting point, so generation path failure;G, check follow-up point whether be path terminal, be to be successfully generated path;Otherwise step H is performed;H, latter point be set to current point, then perform step B.Can quick detection current path fragment be infeasible paths in path using the inventive method, so as to greatly improve the efficiency for judging infeasible paths.

Description

A kind of path generating method based on contradiction fragment schema
Technical field
The present invention relates to software testing technology, more particularly to a kind of path generating method based on contradiction fragment schema.
Background technology
In order to which the completeness to software test is weighed, industry proposes a variety of Testing criterias.No matter which is used A kind of coverage criterion, is all to generate path using controlling stream graph to reach that covering is required.It fact proved, according to controlling stream graph generation Path there are many infeasible paths.
The reason for causing a large amount of infeasible paths occur, mainly have:1)Infeasible paths are necessarily due to some predicate section Some branch of point(The branch that infeasible paths pass through)It can not perform;2)The current branch of predicate node can not be performed necessarily Some node before path have impact on the judgement of current predicate node, i.e., any one predicate all certainty and path on path Some node before is relevant.
At present, path is always generated from controlling stream graph, and controlling stream graph can not reflect between predicate and its associated nodes Contact.So, associated simply by the presence of predicate, the path generated by controlling stream graph just certainly exists infeasible paths.
The trend of software development is made a general survey of, its complexity more and more higher, predicate relation also becomes increasingly complex, so necessarily causing A large amount of infeasible paths.But, infeasible paths are different from defect, and defect is recoverable.There is small portion in infeasible paths It is by unreachable point to divide(Dead code)Path, it should correct, be largely the inevitable outcome of programmed logic, it is impossible to correct.
To sum up, it is detection infeasible paths most straightforward approach to start with from predicate association angle.From the angle of problem space See, be broadly divided into two classes:1)The total space is detected:It is complete but less efficient for all predicates.2)Heuristic detection:For full The predicate of sufficient AD HOC, efficiency high but has omission.Because predicate is large number of, relation is complicated, " such as how simple logic, The less association predicate of selection, it is to put forward efficient key but to judge more infeasible paths ".Heuristic detection passes through pattern Identification, only selects less association predicate;Again because pattern is experience accumulation in itself, so as to can determine that more unreachable Path.In a word, heuristic detection cost performance is high.
The content of the invention
In view of this, it is a primary object of the present invention to provide a kind of path generating method based on contradiction fragment schema, To improve the judgement efficiency of infeasible paths.
To reach above-mentioned purpose, the technical proposal of the invention is realized in this way:
A kind of path generating method based on contradiction fragment schema, comprises the following steps:
Then A, the starting point for selecting from controlling stream graph this coordinates measurement perform step B as current point;
B, the follow-up point of selection, then perform step C;
If C, successfully choosing follow-up point, step G is performed;Otherwise step D is performed;
D, also previous point is checked whether, have and then perform step E;Otherwise step F is performed;
E, previous point is set to current point, then performs step B;
F, due to having return back to starting point, so generation path failure;
G, check follow-up point whether be path terminal, be to be successfully generated path;Otherwise step H is performed;
H, latter point be set to current point, then perform step B.
Wherein:In the step B, in addition it is also necessary to access the follow-up point of current point.
Also include:According to different coverage criterions, the follow-up point of current point is probably the follow-up point in controlling stream graph, also may be used It can be forerunner's contact;It is target point, it is necessary to controlling stream graph starting point with some point in the middle of controlling stream graph in sentence coverage criterion Half paths are found for terminal;Another half paths are found by terminal of controlling stream graph terminal again;Finally it is combined into a whole piece path;When When looking for first half paths, it is exactly to look for forerunner's point in controlling stream graph to select follow-up point;When looking for later half paths, it is exactly to look for select follow-up point Follow-up point in controlling stream graph.
In the step D, when there is the situation without previous point, show that the starting point of this coordinates measurement at all can not Reach home, i.e., the starting point of this coordinates measurement is a unreachable point.
It is a kind of that contradiction fragment is used for the method for coordinates measurement, mainly comprise the following steps:
Whether A, judgement present node also have the follow-up point of non-selected mistake;If so, then performing step B;Otherwise step is performed Rapid D;
B, one of them also non-selected mistake of selection present node follow-up point;
C, the path segments that path starting point is constituted to the follow-up point that currently selects are obtained, with contradiction fragment schema decision paths Whether fragment is unreachable;If it is determined that unreachable, then step A is performed;Put successfully otherwise, it is determined that selection is follow-up;
D, because all follow-up points of present node can not all constitute reachable path, show path starting point to present node constitute Path segments be infeasible paths fragment;Current path is necessary to back off a point, the previous point using current point as current point, Continue to select follow-up point.
Wherein, step A further comprises:When some follow-up point P has been selected, show what path starting point was constituted to P Path segments are determined as unreachable by contradiction fragment schema, now need to reselect a follow-up point.
Step B includes:Current descendant node need to be recorded to be selected;After being retracted when path, reselect current Point follow-up when, it is necessary to empty the follow-up access flag set before.
Step C includes:The path segments that path starting point is constituted to present node are first obtained, contradiction fragment schema is then used The path segments are carried out with unreachable judgement;If it is determined that unreachable, then need to select another follow-up point;Otherwise, show It successfully have selected the follow-up point of present node.
A kind of method that infeasible paths are judged using the path generating method based on contradiction fragment schema, including:
A, judge that path determines whether to include target predicate, if it is not, then performing step e;If it is, performing step b;
B, determine whether target predicate before whether concentrate all points by contradiction point, if it is not, then perform step e, If it is, performing step c;
C, determine whether path segments whether through releasing point concentrate an any point, if it is not, then perform step e, otherwise, Perform step d;
D, setting returning result are unreachable, and terminate this flow;
E, setting returning result are uncertain, and terminate this flow.
Path generating method provided by the present invention based on contradiction fragment schema, with advantages below:
Can quick detection current path fragment whether be infeasible paths in path using this method, So as to greatly improve the efficiency for judging infeasible paths.The concept for the contradiction fragment schema that the inventive method is proposed, in program The reason for infeasible paths occur carries out analysis classification, then carries out pattern-recognition and is accurately detected.The inventive method energy Contradiction fragment schema in enough first identification unit under tests, and it is applied to coordinates measurement.It is demonstrated experimentally that utilizing the base of the present invention The unreachable judgement in path is carried out in contradiction fragment schema, with the efficiency higher than the method that interval arithmetic mode is judged. Further, contradiction fragment schema is used to be analyzed in coordinates measurement and after coordinates measurement, in the case where there is target point, The former is more efficient.
Brief description of the drawings
Fig. 1 is applied to the flow total figure of coordinates measurement for the present invention;
Fig. 2 is applied to the flow subgraph of selection descendant node for the present invention;
Fig. 3 is the flow chart that infeasible paths are judged using path generating method of the present invention based on contradiction fragment schema;
Fig. 4 is to appear in point schematic diagram before target predicate in controlling stream graph;
Fig. 5 is contradiction fragment and the relation schematic diagram of contradiction predicate and releasing point set;
Fig. 6 is that contradiction fragment schema judges unreachable DFD;
Fig. 7 is to judge inaccessible step schematic diagram after contradiction predicate is used for coordinates measurement;
Fig. 8 be IF- predicates it is consistent/complement mode defines schematic diagram;
Fig. 9 be IF- predicates it is consistent/schematic flow sheet of complement mode;
Fig. 9 A be the obtained IF- predicates of the flow chart as described in Fig. 9 it is consistent/complement mode structure list flow chart;
Fig. 9 B are the releasing point set schematic flow sheet between the multiple contradiction predicates of processing;
Fig. 9 C are the releasing point set schematic flow sheet between the current contradiction predicate of processing
M points change Q predicate variable example when Figure 10 is P and Q predicate relation complementation;
Figure 11 is that contradiction fragment handles the example that current contradiction predicate is not used to the unreachable judgement in path;
Figure 12 is that IF- predicate constant patterns define schematic diagram;
Figure 13 is the schematic flow sheet of IF- predicate constant patterns;
Figure 13 A are the IF- predicate constant pattern structure list flow charts that flow chart is obtained as shown in Figure 13;
Figure 14 is that R predicate variable is entered as another constant by Q points when R predicate variable is entered as constant by P points Example;
Figure 15 is one of contradiction fragment schematic diagram shown in Figure 14;
Figure 16 is two schematic diagrames of contradiction fragment shown in Figure 14;
Figure 17 is that WHILE- predicate constant patterns define schematic diagram;
Figure 18 is the schematic flow sheet of WHILE- predicate constant patterns;
Figure 18 A are the flow chart of the WHILE- predicate constant pattern structure lists that flow chart is obtained as shown in Figure 18;
Figure 19 is the presence of the example that P predicate variable is entered as constant by Q points when P points are WHILE sentences in loop body;
Figure 20 is one of contradiction fragment schematic diagram shown in Figure 19;
Figure 21 is two schematic diagrames of contradiction fragment shown in Figure 19;
Figure 22 be WHILE_IF predicates it is consistent/the definition schematic diagram of complement mode;
Figure 23 be WHILE_IF predicates it is consistent/flow chart of complement mode;
Figure 23 A be the obtained WHILE_IF predicates of the flow chart as shown in Figure 23 it is consistent/complementary structure list flow chart;
Figure 24 is that P is P examples consistent with Q predicate when WHILE sentences Q is the IF statement in WHILE loop bodies;
Figure 25 is one of contradiction fragment shown in Figure 24;
Figure 26 is two of contradiction fragment shown in Figure 24.
Embodiment
Below in conjunction with the accompanying drawings and embodiments of the invention to the present invention the path generating method based on contradiction fragment schema It is described in further detail.
The implementation process of the inventive method includes:1st, the definition of contradiction predicate, contradiction fragment and contradiction fragment schema is proposed And structure;2nd, contradiction fragment is used for coordinates measurement.
Wherein, the contradiction predicate, contradiction fragment and the definition of contradiction fragment schema and its introduction about the construction are as follows.
1)Definition and structure.
(1)Target predicate, judges the entrance of predicate contradiction.
(2)Relating dot:
<1>At least one identical variable is quoted with target predicate.
The point before target predicate is appeared in controlling stream graph(There is path so that target predicate appears in relating dot Afterwards).As shown in Figure 4.
(3)Predicate is associated, relating dot is predicate node.
(4)Contradiction point:By the calculation to target predicate and its relating dot, those relating dots for drawing contradiction are all contradiction Point.For predicate, what is conflicted is branch, so contradiction point needs the corresponding branch of record contradiction.
(5)Contradiction point set, the set of contradiction point.
(6)Contradiction predicate:Target predicate+contradiction point set(They constitute contradiction).
(7)Release point:
<1>Belong to relating dot.
Belong to a certain group of contradiction predicate.
Appear in the middle of a certain group of contradiction predicate, lead to not judge whether former contradictory relation still has.
(8)Release point set:Release the set of point.
(9)Contradiction fragment:Contradiction predicate+releasing point set.
Here, because contradiction predicate and releasing point set are all a part for controlling stream graph, but need to be combined into an entirety It just can be used for judging infeasible paths, so we are expressed using this word of fragment, " several body synthesizes relatively independent whole This concept of body ".As shown in Figure 5.
(10)Contradiction fragment schema:Contradiction fragment is specific predicate, the set of sentence composition.By to abstract syntax tree Analyzed with controlling stream graph, we can take out some structures, these structures can produce contradiction fragment.It is this to come from The structure of abstract syntax tree and controlling stream graph is referred to as contradiction fragment schema.But not all structure can all be measured greatly in a program It is existing, so the structure largely existed really by checking just really has value.
A, contradiction fragment schema can effectively reduce the quantity and complexity of association predicate.
B, the contradiction fragment schema by checking, detect that the possibility of infeasible paths is bigger.
(11)Contradiction fragment schema judges unreachable step:It the following is contradiction fragment schema and judge inaccessible data flow Figure.As shown in Figure 6.
2)It is described that contradiction predicate is used for coordinates measurement.Under normal circumstances, we are always after coordinates measurement, then judge can not Reach.As shown in Figure 7.
By to controlling stream graph traversal, selecting node, path is generated, unreachable judgement is then carried out.
But, if we choose Q points, find from starting point to the path segments of Q_T branches(Starting point->...->P_ T->...->Q_T), be can be determined that by contradiction fragment schema to be unreachable, then the subgraph shown in the square frame of lower section will be no longer participate in Routing, routing is carried out so as to be directly entered Q_F branches.So, the point for participating in Path selection is reduced, coordinates measurement is improved Efficiency.
1st, the flow chart of the path generating method of the invention based on contradiction fragment schema, as shown in Figure 1.
1.1st, the purpose of coordinates measurement is exactly to generate reachable path according to coverage criterion, although coverage criterion is not quite similar, Coordinates measurement includes following several basic steps:
Then step A, the starting point for selecting from controlling stream graph this coordinates measurement perform step B as current point.
Step B, the follow-up point of selection, then perform step C.
If step C, follow-up point is successfully chosen, into step G;Otherwise step D is performed.
Step D, also previous point is checked whether, have and then perform step E;Otherwise, step F is performed.
Step E, previous point is set to current point, then performs step B.
Step F, due to having return back to starting point, so generation path failure.
Step G, check follow-up point whether be path terminal, be to be successfully generated path;Otherwise step H is performed.
Step H, latter point be set to current point, then perform step B.
1.2nd, it is necessary to access the follow-up point of current point in the step B.But according to different coverage criterions, currently The follow-up point of point is probably the follow-up point in controlling stream graph, it is also possible to forerunner's contact.In such as sentence coverage criterion, to control Some point is target point, it is necessary to find half paths by terminal of controlling stream graph starting point in the middle of flow graph, i.e., look for upwards;Again with control Flow graph terminal is that terminal finds another half paths, i.e., look for downwards.Finally it is combined into a whole piece path.When looking for first half paths, we Follow-up point is selected to be exactly to look for forerunner's point in controlling stream graph in method;When looking for later half paths, follow-up point is selected to be exactly to look in this method Follow-up point in controlling stream graph.
1.3rd, in the step D, it may appear that the situation without previous point.This shows the starting point root of this coordinates measurement Originally it can not reach home, i.e. the starting point of this this coordinates measurement is a unreachable point(unreachable code).
2nd, contradiction fragment is used for the flow chart for selecting descendant node, as shown in Figure 2.
2.1st, contradiction fragment schema is applied in coordinates measurement, exactly applies the follow-up point in selection present node, should Method comprises the following steps:
Whether step A, judgement present node have the follow-up point selected or not.If so, performing step B;Otherwise enter Row performs step D.
Here, some follow-up point P has been selected, and shows path segments that path starting point constituted to P by contradiction fragment Mode decision is unreachable, so needing to reselect a follow-up point.
Step B, one of them the follow-up point not selected also for selecting present node;
Step C, the path segments that path starting point is constituted to the follow-up point that currently selects are obtained, judged with contradiction fragment schema Whether path segments are unreachable.If it is determined that unreachable, then step A is performed;Otherwise follow-up put successfully is selected.
Step D, because all follow-up points of present node can not all constitute reachable path, show path starting point to present node The path segments of composition are infeasible paths fragments.Current path is necessary to back off a point(No longer include current point), to work as The previous point of preceding point is current point, continues to select follow-up point.
2.2nd, in the step B, current descendant node need to be recorded and be selected.It is especially noted that working as After path retracts, when reselecting follow-up of current point, because whole Segment has changed, need to empty it Follow-up access flag of preceding setting.
2.3rd, in the step C, the path segments that path starting point is constituted to present node are obtained first, lance is then used Scultellum stage mode carries out unreachable judgement to this path segments.If it is determined that unreachable, then needing selection, another is follow-up Point;Otherwise, the successful follow-up point that have selected present node is shown.
3)Optimisation strategy.
Consider extreme case:When program YouNGe branches, if contradiction fragment could not reduce the node for participating in routing, The number of times of contradiction piece segment call is up to the 2N orders of magnitude.
We have following 2 kinds of optimisation strategies:
(1)Overall call number is reduced, the target predicate of the contradictory fragment of institute is obtained first, target predicate ability is only encountered Call.
(2)Reduce the number of modes that is related to, pattern pressed into sentence classification of type, such as Select classes, While classes, Case classes, for classes and other;If Select nodes, only judged using Select class models.
4)Application scenarios.Application scenarios are divided into 2 classes:Have target point and without target point.Wherein:
(1)There is target point.
For some target coverage element, a paths are found.Such as, sentence covering, branch's covering.
For the program of a M sentence node and N branch node, sentence covering needs to find M paths, and divides Branch covering needs to find 2N paths.
Corresponding contradiction fragment judges that number of times is up to 2N* M and 2N*2N。
So, the situation for having target point is suitable in routing.
(2)There is no target point.
There is no specific target coverage element, such as path is covered, it is desirable to look for all paths.To a M sentence section For the program of point and N branch node, path covering needs to find 2NPaths.
Corresponding contradiction fragment judges that number of times is up to 2N*2N.And all path ability 2NAfter bar, i.e. coordinates measurement, then sentence It is fixed, only it need to call 2NIt is secondary.So, the situation without target point is unsuitable in routing.
Below, the process such as path and unreachable judgement is carried out specifically with reference to the specific embodiment of the present invention It is bright:
Carrying out coordinates measurement using the present invention mainly has two steps:
Step A, pattern-recognition.
Step B, infeasible paths decision method, refer to Fig. 3.
Wherein, step A need to be recognised that according to controlling stream graph in the presence of the contradiction fragment schema specified.It is given below several The description of pattern.
Following patterns all follows following principle:1)Abstract syntax tree determines structure(It is side by side or nested).2)Contradiction predicate Between there is no skip instruction(GOTO、LABEL).3)It is public to handle the algorithm of the releasing point set between contradiction predicate, so Only it is described in first pattern.
1)IF- predicates are consistent/complement mode, as shown in Figure 8.
A, definition, with reference to Fig. 8.
Two IF statements arranged side by side:P and Q are brotherhood on abstract syntax tree, and Q is P right brother.Moreover, P and Q Between there is no skip instruction.Here, Q is target predicate, for ensure Q performed after P, so between can not have skip instruction.
Two IF statement predicate relationship consistencies or complementation:P and Q predicates relationship consistency or complementation.
Without modification predicate variable between contradiction predicate:Point between the contradiction predicate that P and Q is produced does not change predicate change Amount.
B, its algorithm are as follows:
Input:AST.Output:Contradiction set of segments.Be illustrated in figure 9 IF- predicates it is consistent/flow chart of complement mode.Point Do not obtain IF- predicates it is consistent/complement mode structure list flow chart 9A, handle the releasing point set flow between multiple contradiction predicates Fig. 9 B, handle the releasing point set flow chart 9C between current contradiction predicate.
C, specific embodiment are as follows:
file = fopen(fileName);
P: if(file==null)
{
M: file = fopen(backupFileName);
}
Q: if(file!=null)
{
file.write("success!");
}
P and Q predicate relation complementation, M points have modified Q predicate variable.As shown in Figure 10.
D, contradiction fragment, as shown in figure 11.Although Q_True and P_true also constitute contradiction predicate, P_true's In the case of, release point M and necessarily occur, so contradiction fragment<Q_True,{P_true}>It is arranged to failure, that is, is not used to road Footpath is unreachable to be judged.
2)The IF- predicates constant pattern, it defines as shown in figure 12.
A, definition.
IF predicate variables are initialized to constant first:R predicate variable is initialized as constant by P points.
Between P and R, IF predicate variables are initialized to another constant again:R predicate variable is entered as another by Q points Constant.
Without modification predicate variable between contradiction predicate:Point between the contradiction predicate that P, Q and R are constituted does not change predicate Variable.
B, its algorithm are as follows.
Input:AST.
Output:Contradiction set of segments.
It is as shown in figure 13 IF- predicate constant pattern flow charts, obtains the IF predicate constant patterns structure row shown in Figure 13 A Table flow chart.
C, specific embodiment are as follows:
P: int copy_patch_value = 0;
if (to_use >= 0)
{
M: copy_patch_value = 1;
}
Q:if (copy_patch_value) {
printf("copy file ...\n");
return 1;
}
R predicate variable is entered as constant by P points, and R predicate variable is entered as another constant by Q points.Such as Figure 14 institutes Show.
D, contradiction segment:
Wherein, first contradiction fragment, as shown in figure 15.Second contradiction fragment is as shown in figure 16.
3)The WHILE- predicates constant pattern.
A, its definition, as shown in figure 17.
WHILE loop bodies are exited according to predicate variable control circulation:P is WHILE sentences.
In WHILE loop bodies, WHILE predicate variables are arranged to constant:P predicate variable is set to constant by Q.
Without modification predicate variable between contradiction predicate:The point that P and Q is constituted between contradiction predicate does not all change predicate Variable.
B, its algorithm are as follows.
Input:AST.Output:Contradiction set of segments.It is the flow chart of WHILE- predicate constant patterns as shown in figure 18, obtains To WHILE- predicate constant patterns structure list as shown in Figure 18 A.
Wherein, contradiction fragment 2=<P_False,{Q_False}>, Q here is assignment statement, and Q_False represents that Q does not go out It is existing.
C, specific embodiment, as shown in figure 19.
do {
enough_space = freeSpaceForFile();
if (!enough_space) {
Q: retry = 0;
}
P: } while (retry-- >0);
Wherein, P points are there is Q points in WHILE sentences, loop body P predicate variable is entered as into constant.
D, contradiction fragment:
Wherein, contradiction fragment one, as shown in figure 20.Contradiction fragment two, as shown in figure 21.
4)The WHILE_IF- predicates are consistent/complement mode.
A, its definition, as shown in figure 22.
IF predicate relationship consistency/complementation in WHILE condition and its loop body:P is WHILE sentences, and Q is that WHILE is followed IF statement in ring body, P and Q predicate logic are consistent or complementary.
Without modification predicate variable between contradiction predicate:Point between the contradiction predicate that Q and P is constituted all does not change meaning Word variable.
B, its algorithm are as follows.
Input:AST.
Output:Contradiction set of segments.As shown in figure 23 for WHILE-IF predicates it is consistent/complement mode flow chart, can obtain WHILE-IF predicates are consistent/complementary structure list flow chart 23A.
C, specific embodiment, as shown in figure 24.
P: while ( stream->avail_out > 0 ) {
M: use(stream);
Q:I f ( stream->avail_out > 0 ) {
printf("need %d more bytes\n", ...);
}
}
Wherein, P is WHILE sentences, and Q is the IF statement in WHILE loop bodies, moreover, P is consistent with Q predicate logic.
D, contradiction fragment.
Wherein, first contradiction fragment is as shown in figure 25.Second contradiction fragment is as shown in figure 26.
Although<Q_True,{P_False}>With<Q_ False,{P_ True }>Also contradiction predicate is constituted, but M points are changed Q predicate variable, so the two contradiction predicates fail.
Fig. 3 is the flow chart that infeasible paths are judged using path generating method of the present invention based on contradiction fragment schema. As shown in figure 3, this method includes:
Step a, judge that path determines whether to include target predicate, if it is not, then performing step e;If it is, performing step Rapid b.
Step b, determine whether target predicate before whether concentrate all points by contradiction point, if it is not, then performing step Rapid e, if it is, performing step c.
Step c, determine whether path segments whether through releasing point concentrate an any point, if it is not, then perform step e, Otherwise, step d is performed.
Step d, setting returning result are unreachable, and terminate this flow.
Step e, setting returning result are uncertain, and terminate this flow.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the scope of the present invention.

Claims (5)

1. a kind of be used for contradiction fragment the method for coordinates measurement, it is characterised in that mainly comprises the following steps:
Whether A, judgement present node also have the follow-up point of non-selected mistake;If so, then performing step B;Otherwise step D is performed;
B, one of them also non-selected mistake of selection present node follow-up point;
C, the path segments that path starting point is constituted to the follow-up point that currently selects are obtained, with contradiction fragment schema decision paths fragment It is whether unreachable;If it is determined that unreachable, then step A is performed;Put successfully otherwise, it is determined that selection is follow-up;Wherein, described lance Scultellum section refers to " contradiction predicate+releasing point set ", and the contradiction predicate refers to " target predicate+contradiction point set ", the target meaning Word is judges the entrance of predicate contradiction, and the contradiction point set is the set of contradiction point, and the contradiction point is by being called to target The calculation of word and its relating dot draws those relating dots of contradiction, wherein, the relating dot is and target predicate quotes at least one Individual identical variable;" the contradiction predicate ", " releasing point set " are a part for controlling stream graph, combine both into one it is whole Body is to judge infeasible paths;Contradiction fragment is specific predicate, the set of sentence composition;The contradiction fragment schema, be Refer to the general designation of the structure by some taken out to abstract syntax tree and controlling stream graph progress analysis to produce contradiction fragment; It is described to release point set to release the set of point;Described releasing point belongs to relating dot;Appear in the middle of a certain group of contradiction predicate, lead Cause can not judge the point whether former contradictory relation still has, and referred to as release a little;
D, because all follow-up points of present node can not all constitute reachable path, show the road that path starting point is constituted to present node Footpath fragment is infeasible paths fragment;Current path is necessary to back off a point, and the previous point using current point continues as current point Select follow-up point.
2. contradiction fragment is used for the method for coordinates measurement according to claim 1, it is characterised in that step A further to be wrapped Include:When some follow-up point P has been selected, show that path starting point is judged to the path segments that P is constituted by contradiction fragment schema To be unreachable, now need to reselect a follow-up point.
3. contradiction fragment is used for the method for coordinates measurement according to claim 1, it is characterised in that also include in step B: Current descendant node need to be recorded to be selected;After being retracted when path, it is necessary to clear when reselecting follow-up of current point The follow-up access flag set before sky.
4. contradiction fragment is used for the method for coordinates measurement according to claim 1, it is characterised in that step C also to include:First The path segments that path starting point is constituted to present node are obtained, then the path segments are carried out with contradiction fragment schema can not Up to judgement;If it is determined that unreachable, then need to select another follow-up point;Otherwise, show successfully to have selected present node Follow-up point.
5. a kind of method that infeasible paths are judged using the path generating method based on contradiction fragment schema, the contradiction fragment Pattern is the structure to produce contradiction fragment by some taken out to abstract syntax tree and controlling stream graph progress analysis Be referred to as, wherein, the contradiction fragment refers to " contradiction predicate+releasing point set ", the contradiction predicate refer to " target predicate+ Contradiction point set ", the target predicate is judges the entrance of predicate contradiction, and the contradiction point set is the set of contradiction point, described Contradiction point is those relating dots that contradiction is drawn by the calculation to target predicate and its relating dot, wherein, the relating dot is At least one identical variable is quoted with target predicate;Characterized in that, this method includes:
A, judge that path determines whether to include target predicate, if it is not, then performing step e;If it is, performing step b;
B, determine whether target predicate before whether concentrate all points by contradiction point, if it is not, then perform step e, if It is then to perform step c;Wherein, by the calculation to target predicate and its relating dot, those relating dots for drawing contradiction are contradiction Point;The contradiction point set, is the set of the contradiction point;
C, determine whether path segments whether through releasing point concentrate an any point, if it is not, then perform step e, otherwise, perform Step d;Wherein, release point and belong to relating dot;Appear in the middle of a certain group of contradiction predicate, lead to not judge that former contradictory relation is The no point still having, is referred to as released a little;The releasing point set, is the set for releasing point;
D, setting returning result are unreachable, and terminate this flow;
E, setting returning result are uncertain, and terminate this flow.
CN201310693444.3A 2013-12-17 2013-12-17 A kind of path generating method based on contradiction fragment schema Active CN104035864B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310693444.3A CN104035864B (en) 2013-12-17 2013-12-17 A kind of path generating method based on contradiction fragment schema

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310693444.3A CN104035864B (en) 2013-12-17 2013-12-17 A kind of path generating method based on contradiction fragment schema

Publications (2)

Publication Number Publication Date
CN104035864A CN104035864A (en) 2014-09-10
CN104035864B true CN104035864B (en) 2017-10-20

Family

ID=51466637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310693444.3A Active CN104035864B (en) 2013-12-17 2013-12-17 A kind of path generating method based on contradiction fragment schema

Country Status (1)

Country Link
CN (1) CN104035864B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106155898B (en) * 2015-04-16 2020-09-01 北京搜狗科技发展有限公司 Method and device for acquiring path of flow chart
CN109558964B (en) * 2017-09-27 2021-07-30 北京京东尚科信息技术有限公司 Method and device for establishing business map
CN109495541B (en) * 2018-10-15 2021-04-02 上海交通大学 Cross-data-center-based cloud service workflow scheduling method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6591404B1 (en) * 2001-07-27 2003-07-08 Hewlett-Packard Development Company, L.P. Method of automatically finding and fixing min-time violations
CN101216803A (en) * 2008-01-09 2008-07-09 四川大学 Test program control stream path set creation method based on base path
CN101286133A (en) * 2008-06-02 2008-10-15 北京邮电大学 Software test method applying interval operation
CN101436128A (en) * 2007-11-16 2009-05-20 北京邮电大学 Software test case automatic generating method and system
US8108826B2 (en) * 2004-09-29 2012-01-31 Avaya Inc. Code-coverage guided prioritized test generation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6591404B1 (en) * 2001-07-27 2003-07-08 Hewlett-Packard Development Company, L.P. Method of automatically finding and fixing min-time violations
US8108826B2 (en) * 2004-09-29 2012-01-31 Avaya Inc. Code-coverage guided prioritized test generation
CN101436128A (en) * 2007-11-16 2009-05-20 北京邮电大学 Software test case automatic generating method and system
CN101216803A (en) * 2008-01-09 2008-07-09 四川大学 Test program control stream path set creation method based on base path
CN101286133A (en) * 2008-06-02 2008-10-15 北京邮电大学 Software test method applying interval operation

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
单元测试中代码覆盖分析及路径选择技术的研究与应用;王思岚;《中国优秀硕士论文全文数据库 信息科技辑》;20120830;全文 *
基于回溯与引导的关键代码区域覆盖的二进制程序测试技术研究;崔宝江 等;《电子与信息学报》;20120131;第34卷(第1期);全文 *
基于回溯法的Dijkstra算法改进及仿真;王防修 等;《计算机仿真》;20131130;第30卷(第11期);全文 *

Also Published As

Publication number Publication date
CN104035864A (en) 2014-09-10

Similar Documents

Publication Publication Date Title
Xu Directed test suite augmentation
González et al. Atltest: A white-box test generation approach for ATL transformations
CN105138335B (en) A kind of function call path extraction method and device based on controlling stream graph
CN101339501B (en) WS-BPEL control loop detection method based on directed graph
Fawcett et al. Improved features for runtime prediction of domain-independent planners
CN106354630B (en) A kind of software defect detection method executed based on dynamic symbol
Xu et al. Factors affecting the use of genetic algorithms in test suite augmentation
JP2010218152A (en) Apparatus and method for generating test case
JP2007012003A (en) System for providing development environment of feature-oriented software product line
CN104035864B (en) A kind of path generating method based on contradiction fragment schema
Omar et al. HOMAJ: A tool for higher order mutation testing in AspectJ and Java
Löscher et al. Automating targeted property-based testing
Kim et al. Hybrid directed test suite augmentation: An interleaving framework
Kintis et al. Using data flow patterns for equivalent mutant detection
CN111897742B (en) Method and device for generating intelligent contract test case
Fragal et al. Extending HSI test generation method for software product lines
CN111858292A (en) Screening method, screening system, computer device and storage medium of test case
Wieber et al. On the usage of TGGs for automated model transformation testing
Gonzalez-Hernandez New bounds for mixed covering arrays in t-way testing with uniform strength
CN111045880A (en) Chip testing method, verification system and storage medium
US20100313187A1 (en) Method and system for detecting infeasible paths
Reynier et al. Minimal coverability set for Petri nets: Karp and Miller algorithm with pruning
CN108874662A (en) The non-transitory computer-readable medium of test method and storage program
Choi et al. Automatic feasible transition path generation from UML state chart diagrams using grouping genetic algorithms
Kumar et al. Notice of Retraction: Generation of efficient test data using path selection strategy with elitist GA in regression testing

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