CN106502908A - Executable basic path evolution generation method based on statistical analysis - Google Patents

Executable basic path evolution generation method based on statistical analysis Download PDF

Info

Publication number
CN106502908A
CN106502908A CN201610971672.6A CN201610971672A CN106502908A CN 106502908 A CN106502908 A CN 106502908A CN 201610971672 A CN201610971672 A CN 201610971672A CN 106502908 A CN106502908 A CN 106502908A
Authority
CN
China
Prior art keywords
path
chromosome
basic
statistical analysis
executable
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.)
Pending
Application number
CN201610971672.6A
Other languages
Chinese (zh)
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.)
Mudanjiang Normal University
Original Assignee
Mudanjiang Normal University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mudanjiang Normal University filed Critical Mudanjiang Normal University
Priority to CN201610971672.6A priority Critical patent/CN106502908A/en
Publication of CN106502908A publication Critical patent/CN106502908A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/12Computing arrangements based on biological models using genetic models
    • G06N3/126Evolutionary algorithms, e.g. genetic algorithms or genetic programming

Abstract

The invention discloses a kind of executable basic path evolution generation method based on statistical analysis, it is therefore an objective to the test path of generation is can be applicable in any path testing technology, so as to improve the efficiency of software test.First, analysis model is designed using statistical analysis technique, determines controlling stream graph, DD figures and the mutual exclusion side of tested program;Then, the variable-length genetic algorithm based on statistical analysis is proposed, using the executable coordinates measurement model of this method design and basic path detection model, is evolved and is generated executable basic path.Previous methods are all will to generate test path and detect that executable path is separately studied, two parts content is realized by present invention design with a kind of method, the basic path that evolution is generated inherently can perform path, and the circulatory problems in controlling stream graph are overcome, the efficiency of test path generation can be significantly improved.

Description

Executable basic path evolution generation method based on statistical analysis
Technical field
The present invention relates to computer software testing field, devise and a kind of can be held based on automatically generating for statistical analysis technique The new evolvement method in row basis path.The method is different from former methodical characteristic and is, the test path of generation is can be held The capable independent pathway for meeting linear independence, you can the basic path of execution.
Background technology
Software test is important part in software life-cycle, and structured testing is the main method of software test, Path testing is maximally effective coverage criterion in structured testing again, and which needs the test path for executing tested program.Therefore, automatically The mission critical that test path is software test is generated, is the effective ways for simplifying software test procedure, software survey can be reduced Examination cost, improves testing efficiency.
Basic path testing is one of maximally effective testing standard in structured testing, and which can be detected 65% in tested program Mistake, and various structured testing data generation problems are both for basic path testing.In addition, not wrapping in basic path set The test path for containing, can be represented by the linear relationship in basic path.Therefore, automatically generate basic path to grind software test Study carefully significant.
Based on search optimisation technique, such as simulated annealing, hill-climbing algorithm, particle cluster algorithm, tabu search algorithm and Genetic algorithm etc. has been successfully applied in software test.Trace N. etc. propose simulated annealing and generate path coverage test Data method.Deepak Garg etc. propose hill-climbing algorithm and generate basic path testing data method.YaHui Jia etc. and Shujuan Jiang etc. propose particle swarm optimization algorithm and generate test data method.Diaz E. etc. propose to calculate based on TABU search The software configuration method of testing of method.Genetic algorithm the problems such as regression test, mutation testing, concurrent testing in have and preferably should With.Wuchuan etc. and the research application of the genetic algorithm in regression test such as Yang Bo, Chang-ai Sun etc., Pedro Reales Mateo etc., party Xiang Ying etc., Zhang Gongjie etc. and the research application of the genetic algorithm in mutation testing such as Gong Dunwei, G.H. Hwang Deng and the research application of the genetic algorithm in parallel program testing such as Tian Tian, achieve preferable achievement.In test data Automatically generate in problem, genetic algorithm is most widely used, M.A. Ahmed etc. and D. Gonga etc. propose application heredity and calculate The method that method generates multipath test data, P.M.S. Bueno etc., Moheb R. Girgis etc., Ahmed S. Ghiduk Test data method is effectively generated Deng application genetic algorithm is proposed.
As can be seen here, what genetic algorithm was ripe is applied to software test field.Up to the present, to genetic algorithm Concern is also concentrated mainly on the evolution of test data and generates problem, and the main method of software test is structured testing.Therefore, certainly The dynamic test path that generates is for software test is most important.J. Poole have studied the depth-first search side for relying on controlling stream graph Method generates basic path, and the method does not account for loop structure, and have ignored how to concentrate selection structure base in both candidate nodes The optimum node in plinth path, major defect are that the method uses insecure destructuring code, basic path set Number is no longer equal to the complexity measure of controlling stream graph.Z. Guangmei proposes a kind of side for automatically generating basic path set Method, the method equally adopt the depth first search technique of controlling stream graph, in order to avoid Infinite Cyclic and the minimizing search of algorithm Process, sub- road warp of many in-degree nodes of the method consideration tested program as endpoint node, during structure foundation path set, Sub- road of the record comprising circulation warp, but the method do not account for can not execution route.J. Yan etc. proposes the executable road of generation The finite aggregate F methods in footpath, F meet basic path coverage criterion, but the method needs to execute institute at the executable path of detection There is path, take very much.Z. Zhonglin etc. and D. Qingfeng etc. generates Line independent path set using cyclomatic complexity, by The variable included in decision node has data dependency, thus the basic path set for generating most be can not execution route, be This with reference to dependence Baseline Methods avoid selection can not execution route, but the method do not have in processing routine circulation knot Structure.Ahmed S. Ghiduk propose a kind of genetic algorithm of variable-length and generate test path collection, and the length of chromosome is with repeatedly The change of generation number gradually increases, and to represent the path of different length, the path set that the method is generated includes all of test road Footpath, its contain much can not execution route, be deletion can not execution route, the method using can not execution route detection model inspection The whole test paths for generating are surveyed, this process takes very much.
In order to solve the defect of said method, the present invention devises a kind of executable basic path based on statistical analysis and enters Change generation method, using statistical analysis technique, judge the mutual exclusion side in DD- figures, propose the variable-length based on statistical analysis and lose Whether propagation algorithm, judge chromosome containing mutual exclusion side, generates executable test path, and whether inspection path is independent pathway, And satisfaction and the linear independence in basic path, evolve and generate executable basic path set, can apply to any path survey In method for testing, so as to improve the validity of software test.
Content of the invention
The present invention proposes a kind of executable basic path evolution generation method based on statistical analysis.First, using statistics Analysis method, detects the correlation of tested program conditional statement, according to the correlation of conditional statement, determines the mutual exclusion in DD- figures Side, as in follow-up evolutionary process judge can not execution route foundation.Secondly, research is evolved automatically and generates executable basis Path set technology, proposes the variable-length genetic algorithm based on statistical analysis, and the length of chromosome is with the change of iterations Gradually increase, represent the test path for generating of evolving, during evolution, whether chromosome is judged containing mutual exclusion side, if dyeing Body contains mutual exclusion side, then the path which represents for can not execution route, such chromosome is no longer participate in evolving, thus generates Test path is executable test path.Finally, whether the test path that inspection is generated is independent pathway, if the survey for generating Examination path is independent pathway, and with basic path linear independence, i.e., which can not be by the basic path linear expression for having generated, general Which adds executable basic path set, can apply in any path testing method.
The technical problem to be solved:Overcome the shortcomings of existing test path generation method, based on genetic algorithm A kind of effective evolution optimization method is proposed, is made the path of generation be executable test path, and is met basic path The constraints of collection.
The technical solution of the present invention:A kind of executable basic path evolution generation method based on statistical analysis, its It is characterised by comprising the steps of.
The design of step 1. Statistic analysis models.
Using statistical analysis technique, one group of test data operation tested program, statistics different condition sentence meaning is randomly generated The value condition of the corresponding stochastic variable of word, obtains sample data, using maximum Likelihood, obtains conditional statement correlation Corresponding estimate, the relevancy type of Rule of judgment sentence determine the mutual exclusion side in DD- figures, as follow-up evolutionary process in Judge the foundation in executable path.
The main task that the present invention sets up analysis module is as follows:
Task 1:Tested program is read, sort program sentence is simultaneously formatted, constructor controlling stream graph;
Task 2:Using the carried simplified algorithms of Ahmed S. Ghiduk et al., according to controlling stream graph construction DD- figures;
Task 3:According to statistic analysis result, the mutual exclusion side in DD- figures is judged;
Task 4:By controlling stream graph, DD- figures, mutual exclusion while and while between the executable coordinates measurement mould of dependence test Block.
It follows that the present invention is applied to mathematical statistics analysis method in the analysis model of software test so that analysis As a result there is higher accuracy and science, this is being clearly distinguished from existing achievement in research of the invention.
Step 2. can perform the design of coordinates measurement model.
The present invention can perform road using the variable-length genetic algorithm evolutionary optimization Solve problems based on statistical analysis, design Footpath generation model, the main expression for including chromosome, the design of adaptation value function and the generation of executable test path.
Based on the variable-length genetic algorithm of statistical analysis, chromosome is represented with integer variable, represent tested program DD- figure In side, the length of chromosome depends on the length in basic path, as the change of iterations gradually increases, represents into metaplasia Into test path, method for expressing is as follows:
Based on the variable-length genetic algorithm of statistical analysis, design fitness function and evaluate each individual evolution generation test path Good and bad degree, so as to determine the size of its hereditary chance, its value depends on the probability of adjacent edge in DD- paths, calculates public Formula is as follows:
f(xi):Represent chromosome xiThe fitness function value of (i=1 ..., PM);
d(xi):Represent chromosome xiThe quantity of adjacent edge;
w(eij):Represent chromosome xiMiddle side ejWeight;
L(xi):Represent chromosome xiLength(Chromosome x is representediIn the quantity containing side).
Based on the variable-length genetic algorithm of statistical analysis, whether chromosome is judged containing mutual exclusion side, if chromosome contains Mutual exclusion side, then the test path which represents for can not execution route, such chromosome is no longer participate in evolving.Therefore, generation Test path is executable test path.
It follows that the present invention is in executable coordinates measurement model, devises the variable-length based on statistical analysis and lose Propagation algorithm, the effect on consideration mutual exclusion side in evolutionary process.Therefore, the path of generation is executable test path, and this is this Invention is distinguished with the maximum of existing achievement in research.
The design of step 3. basis path detection model.
The test path that the present invention is generated using basic path detection model testing whether based on path.First, detect Whether the test path of generation is independent pathway, and independent pathway at least a line did not occur in other paths.Secondly, Verification test path whether can by basic path set in basic path linear expression, it is impossible to by basic path linear expression Independent pathway adds basic path set;Otherwise, the test path of generation can not add basic path set.
Basic path set is the set being made up of one group of basic path, and which need to meet following three constraints:
Each basic path must be an independent pathway;
All basic path in basic path set must cover all sides of controlling stream graph;
Be not included in any path in basic path set can by basic path set in basic path linear expression.
It follows that the present invention judges whether executable test path meets basis in basic path detection model Three constraintss of path set, it is ensured that the most simple property of basic path set and comprehensive, this is the present invention and study into Fruit is clearly distinguished from.
In summary, the survey generated based on the executable basic path evolution generation method of statistical analysis of present invention design Examination path is can be applicable in any path testing method, so as to improve the efficiency of software test.
Description of the drawings
Fig. 1 is the executable basic path evolution Core Generator system assumption diagram based on statistical analysis.
Fig. 2 is the source code of triangle classification program.
Fig. 3 is the controlling stream graph of triangle classification program.
Fig. 4 is the DD- figures of triangle classification program.
Specific embodiment
With reference to the executable basic path evolution generation side of concrete accompanying drawing and example to the present invention based on statistical analysis The embodiment of method is described in detail.
A kind of executable basic path evolution Core Generator based on statistical analysis of present invention design, its system assumption diagram is such as Shown in Fig. 1, comprising 3 modules:Statistical analysis module, executable path-generating module and basic path detection module.
The design of step 1. Statistic analysis models.
The design of Statistic analysis models is broadly divided into sentencing for two steps, the judgement of conditional statement correlation and mutual exclusion side Fixed.
The judgement of 1.1 conditional statement correlations.
Using statistical analysis technique, one group of test data operation tested program, statistics different condition sentence meaning is randomly generated The value condition of the corresponding stochastic variable of word, obtains sample data, using maximum Likelihood, calculates estimating for stochastic variable Evaluation, the relevancy type of decision condition sentence, main method is:If niAnd njIt is 2 conditional statements, then
If niN during Qu Zhen branchesjInevitable Qu Zhen branches, then claim sentence group (ni,nj) there is T-T correlations;
If niN during Qu Zhen branchesjFalse ramification is necessarily taken, then claims sentence group (ni,nj) there is T-F correlations;
If niN when taking false ramificationjInevitable Qu Zhen branches, then claim sentence group (ni,nj) there is F-T correlations;
If niN when taking false ramificationjFalse ramification is necessarily taken, then claims sentence group (ni,nj) there is F-F correlations.
The judgement on 1.2 mutual exclusion sides.
According to the relevancy type of conditional statement, judge that the mutual exclusion side in DD- figures, main method are:If conditional statement ni True branch corresponding to side be eiT, the side corresponding to false ramification is eiF, then
If sentence is to (ni,nj) there is T-T correlations, then claim (eiT→ejF) it is its corresponding mutual exclusion side;
If sentence is to (ni,nj) there is T-F correlations, then claim (eiT→ejT) it is its corresponding mutual exclusion side;
If sentence is to (ni,nj) there is F-T correlations, then claim (eiF→ejF) it is its corresponding mutual exclusion side;
If sentence is to (ni,nj) there is F-F correlations, then claim (eiF→ejT) it is its corresponding mutual exclusion side.
Step 2. can perform the design of coordinates measurement model.
The design of executable coordinates measurement model generates one group of executable test using genetic algorithm proposed by the present invention Path.Entrance in initialization tested program DD- figure judges mutual exclusion side according to statistic analysis result while with outlet, and which is corresponding Path for can not execution route, given up during evolution.By the breeding computing of genetic algorithm to each paths Increase new side, till obtaining a fullpath.During generating path, it is contemplated that the corresponding path in mutual exclusion side is not for Executable path, therefore, the path of generation is executable path.Main method is as follows.
2.1 search space.
Search space is the set of required solve problem, and in search space, each point represents a possible solution party Case.In the methods of the invention, if its search space is D, then
(1)
It follows that the input domain of the inventive method is the set on all sides in tested program DD- figure.
2.2 individual UVR exposure.
The operand of genetic algorithm is to represent individual symbol string, can be binary system, numerical value, array, list, tree or Person other objects, coding depend on the problem of solution.In the methods of the invention, chromosome is represented with integer variable, represent Side in tested program DD- figure, the length of chromosome depend on the length in basic path, then chromosome is
(2).
2.3 initial population.
Genetic algorithm is the evolutional operation carried out by colony, needs the initial population data for preparing to represent initiating searches point. In the methods of the invention, in initial population, each is individual(That is chromosome)Comprising the entrance in two sides, i.e. tested program DD- figure While with outlet, Population Size is set to PM.Therefore, the minimum length of chromosome is 2, and the maximum length of chromosome is equal to DD- Contain most quantity on side in path.
2.4 individual evaluation.
Genetic algorithm evaluates the good and bad degree of each individuality using individual adaptation degree, so as to determine the big of its hereditary chance Little.In the methods of the invention, the evaluation of application fitness function is evolved and generates the quality in path, and its value is depended in DD- paths The probability of adjacent edge, computing formula are as follows:
(3)
(4)
f(xi):Represent chromosome xiThe fitness function value of (i=1 ..., PM);
d(xi):Represent chromosome xiThe quantity of adjacent edge;
w(eij):Represent chromosome xiMiddle side ejWeight;
L(xi):Represent chromosome xiLength(Chromosome x is representediIn the quantity containing side).
2.5 Selecting operation.
The individual inheritance for selecting current population's fitness higher is to population of future generation.Ordinary circumstance, fitness higher Body there is a greater chance that and be genetic to population of future generation.In the methods of the invention, using the method for roulette, i.e., with fitness into just The quantity of the determine the probability of ratio each individual inheritance to population of future generation.
2.6 crossing operation.
Crossing operation is the major calculations process for generating new individual in genetic algorithm, and which exchanges two individualities with certain probability Portion gene seat.In the methods of the invention, the method that is intersected using single-point, i.e., determine crossover location, then in chromosome With the portion gene seat that a certain probability exchanges two pairing chromosomes in the point.
2.7 mutation operator.
Mutation operator is that the gene on a certain locus of chromosome is changed with a less probability, and produces new A kind of individual major calculations.In the methods of the invention, using the method for basic bit mutation, i.e., determine that gene becomes in chromosome Dystopy is put, and then enters row variation with a certain probability to the gene of the point.
2.8 breeding computings.
Breeding computing is primarily to realize that extension chromosome makes which represent complete path.In the methods of the invention, adopt The a certain gene locus for being used in chromosome postpones the new gene of insertion, realizes the extension of chromosome.
The design of step 3. basis path detection model.
The executable path that the detection of basic path detection module is generated whether based on path.If the executable road for generating Footpath is independent pathway, and meets the linear independence with existing basic path, then this generation path is added basic path Collection.Genetic algorithm of operation can generate a plurality of test path, and iteration is until generating one group of basic test path or full Sufficient end condition.
3.1 checked operation.
Checked operation, mainly judges whether the test path (i.e. fitness function value is 1 chromosome) for generating is base Plinth path.First, whether the test path that detection is generated is independent pathway, and independent pathway at least a line is in other paths Do not occurred.Secondly, verification test path its whether can by basic path set in basic path linear expression, it is impossible to by The independent pathway of basic path linear expression adds basic path set;Otherwise, the test path of generation can not add basic path Collection.
3.2 algorithms terminate.
In traditional genetic algorithm, Evolution of Population represents solution to certain individuality or reaches maximum iteration time When, algorithm terminates.In the methods of the invention, one group of test path of generation meets the constraints of basic path set or reaches During maximum iteration time, algorithm terminates.It should be noted that the inventive method satisfaction is that multiple target generates problem, once enter Metaplasia into be one group of test path, i.e., basic path set.
3.3 test case.
In the present invention, by taking triangle classification program as an example, how automatic using the evolution generation method of statistical analysis introduce Generate the detailed process of basic path set.The source code of triangle classification program is as shown in Fig. 2 corresponding controlling stream graph such as Fig. 3 Shown, corresponding DD- figures are as shown in Figure 4.
(1)Relevancy type and the judgement on mutual exclusion side.
Using the correlation of Statistic analysis models decision condition sentence, the mutual exclusion side in DD- figures is determined.Concrete grammar is such as Under:
Randomly generate one group of test data operation tested program;
The value condition of the corresponding stochastic variable of statistics different condition sentence predicate, obtains sample data;
Using maximum Likelihood, the corresponding estimate of conditional statement correlation, the correlation of decision condition sentence is obtained Property type;
According to the relevancy type of conditional statement, the mutual exclusion side in DD- figures is determined.
In triangle classification program, decision condition sentence correlation with reference to the beautiful thesis for the doctorate of Yao Xiang " complex software test number According to evolution generative theory and application " in method, but which is modified according to actual conditions.Correlation according to conditional statement Property type, determines the mutual exclusion side in DD- figures, as shown in table 1.
1 triangle classification program conditional sentence correlation of table and mutual exclusion side
Conditional statement Relevancy type Mutual exclusion side Conditional statement Relevancy type Mutual exclusion side
(11,13) T→F e9→e11 (4,8,11) TF→F e3,e8→e9
(2,4,6) TT→F e1,e3→e5 (6,8,11) TF→F e5,e8→e9
(2,8,11) TF→F e1,e8→e9 (2,4,8,13) TTF→F e1,e3,e8→e11
(4,6,8) TF→T e3,e6→e8 (4,6,8,13) TTF→F e3,e5,e8→e11
(2)The setting of initial population.
In initial population every chromosome comprising the entrance in two sides, i.e. tested program DD- figure while and during outlet, population It is dimensioned to PM.In triangle classification program, it is assumed that initial population contains 8 chromosomes, as shown in table 2.
(3)Individual evaluation function.
In triangle classification program, it is assumed that current population contains a group chromosome of different length, x1=(0,1,13), x2= (0,2,3,13), x3=(0, Isosorbide-5-Nitrae, 5,13), x4=(0,2,4,5,7,13);According to the quantity containing side in chromosome, L is calculated (xi) (i=1,2,3,4), L (x1)=3, L (x2)=4, L (x3)=5, L (x4)=6;According to the length of chromosome, side in chromosome is calculated Probability(That is weight), w (e1j)=1/3 (j=0,1,13), w (e2j)=1/4 (j=0,2,3,13), w (e3j)=1/5(j=0,1,4, 5,13), w (e4j)=1/6(j=0,2,4,5,7,13).According to the quantity of adjacent edge in chromosome, d (x are calculatedi)(i=1,2,3, 4), d (x1)=2, d (x2)=3, d (x3)=4, d (x4)=6.Further according to formula (3) and (4), fitness function value is calculated:f(x1)=2/ 3, f (x2)=3/4, f (x3)=4/5, f (x4)=1.
From this group of data, chromosome x4The path p of representative4={e0,e2,e4,e5,e7,e13It is optimal path, if This path is independent pathway, and meets linear independence with basic path, then which is added basic path set.
(4)Selecting operation.
In triangle classification program, using roulette method choice next generation population, concrete grammar is as follows:
Calculate the sum of all individual fitness function values in population:
(5)
Calculate each individual relative adaptability degrees functional value:
(6)
The size of relative adaptability degrees functional value determines the probability is genetic in population of future generation by each individuality, each probable value group Into a region, all relative adaptability degrees functional values and be 1.
As can be seen here, the higher individual selected probability of fitness function value is bigger;Conversely, fitness function value is lower Individual selected chance less.
Random generation number r,.The probability region fallen into according to r, determines each individual selected number of times m.
In triangle classification program, it is assumed that current population has following 8 chromosome, according to corresponding mutual exclusion edge contract not The corresponding chromosome in executable path.Length L=5 of every chromosome, adjacent edge quantity d=4 calculate the fitness letter of chromosome Numerical value and relative adaptability degrees functional value.Random number r is generated, the selected number of times m of chromosome is determined.Selection course such as 3 institute of table Show.
(5)Crossing operation.
In triangle classification program, the portion gene seat of method two pairing chromosomes of exchange intersected using single-point.Behaviour Make process as follows:
To all individual random pairs in current population;
Cross-point locations pos in random generation chromosomec
Crossover probability p is setc=0.8, random generation number r,
If r is < pc, crosspoint in two chromosomes of exchange pairing(Comprising crosspoint)Locus afterwards.
In triangle classification program, to selection after population carry out crossover operation, it is assumed that cross-point locations posc=4.Intersect Process is as shown in table 4.
(6)Mutation operator.
In triangle classification program, row variation is entered to gene using the method for basic bit mutation.Operating process is as follows:
The change point position pos of in current population chromosome is generated at randomm
Mutation probability p is setm=0.15, random generation number r,
If r is < pm, by the genic value at change point place(That is the true and false branch on side)Negate.
In triangle classification program, to intersection after population carry out mutation operation, it is assumed that change point position posm=4.Variation Process is as shown in table 5.
(7)Breeding computing.
In triangle classification program, the new gene of insertion is postponed in a certain gene locus of chromosome, realize chromosome Extension.Operating process is as follows:
The breeding point position pos of in current population chromosome is generated at randomb
Determine the gene adjacent with breeding point(That is side), and a line is randomly choosed as breeding gene;
After gene insertion breeding point position will be bred, as locus posb+ 1 corresponding gene, increases the length of chromosome.
In triangle classification program, to variation after population carry out breeding operation, it is assumed that breeding point a position posb=4.Breeding Process is as shown in table 6.
(8)Checked operation.
In triangle classification program, chromosome x is calculated1,x4,x5,x7Fitness function value be 1.Wherein, contaminate Colour solid x1,x4,x7Containing the side for differing, its 3 test path for representing is independent pathway;Chromosome x5The side contained with x1,x4,x7The side that contains is identical, i.e., do not contain new side, and its test path for representing is not independent pathway.In addition, 3 generated Independent pathway does not have linear relationship.Therefore, the test path x that will be generated1,x4,x7Add basic path set.
(9)Algorithm terminates.
In triangle classification program, the continuous iteration of variable-length genetic algorithm based on statistical analysis, being obtained 17 can Execution route.Wherein, the constraints of only 6 executable path satisfaction basis path sets, i.e., which is independent pathway and does not have Wired sexual intercourse, as shown in table 7.In the DD- figures of this example, cyclomatic complexity C (G)=E-N+P=14-9+1=6.Therefore, this 6 surveys Path based on examination path, formation base path set, algorithm terminate.
In sum, the present invention devises a kind of variable-length genetic algorithm based on statistical analysis and is used for entering automatically metaplasia Into executable basic test path, which can be applied to any path testing technology as test path.The inventive method is adopted Statistical analysis technique, judges the mutual exclusion side in DD- figures, and judging on this basis can not execution route.Propose to be based on statistical analysis Variable-length genetic method, the length of chromosome gradually increases with the change of iterations, represents the test for generating of evolving Path.In the Selecting operation of genetic algorithm, whether chromosome is judged containing mutual exclusion side, if chromosome contains mutual exclusion side, its The path of representative for can not execution route, given up, the path for thus generating is executable test path.Inspection is generated Test path whether based on path, if the test path for generating is independent pathway, and meet linear nothing with basic path Guan Xing, is added into executable basic path set, can apply in any path testing method.Meanwhile, the method can take Circulatory problems in controlling stream graph.The feasibility and effectively that institute extracting method is assessed by case study.

Claims (5)

1. the executable basic path evolution generation method based on statistical analysis, it is characterised in that following steps:
Step 1.1:Using statistical analysis technique, applied statistics analysis model detects tested program conditional statement correlation, according to The relevancy type of conditional statement, determines the mutual exclusion side in DD- figures, as judge in follow-up evolutionary process executable path according to According to;
Step 1.2:For the mutual exclusion side that the employing statistical analysis technique of step 1.1 determines, it is proposed that a kind of based on statistical analysis Variable-length genetic algorithm, the executable coordinates measurement model of application generates executable test path, and the genetic algorithm is more Extensively can apply in the method for solving of target evolutionary optimization;
Step 1.3:Executable test path is generated using the genetic algorithm of step 1.2, application foundation path detection model is examined Whether the test path for testing generation is independent pathway, if the test path for generating is independent pathway, and with the base for generating Plinth path linear independence, then be added into executable basic path set, can be applicable in any path testing method.
2. the statistical analysis technique in claim 1 described in step 1.1, it is characterised in that comprise the steps of:
Step 2.1:Randomly generate one group of test data operation tested program, the corresponding stochastic variable of statistics different condition sentence predicate Value condition, obtain sample data, using maximum Likelihood, obtain the corresponding estimate of conditional statement correlation, The relevancy type of decision condition sentence, if niAnd njIt is 2 conditional statements, then
If niN during Qu Zhen branchesjInevitable Qu Zhen branches, then claim sentence group (ni,nj) there is T-T correlations;
If niN during Qu Zhen branchesjFalse ramification is necessarily taken, then claims sentence group (ni,nj) there is T-F correlations;
If niN when taking false ramificationjInevitable Qu Zhen branches, then claim sentence group (ni,nj) there is F-T correlations;
If niN when taking false ramificationjFalse ramification is necessarily taken, then claims sentence group (ni,nj) there is F-F correlations;
Step 2.2:The mutual exclusion side in DD- figures is judged with the relevancy type of conditional statement, if conditional statement niInstitute of true branch right The side that answers is eiT, the side corresponding to false ramification is eiF, then
If sentence is to (ni,nj) there is T-T correlations, then claim (eiT→ejF) it is its corresponding mutual exclusion side;
If sentence is to (ni,nj) there is T-F correlations, then claim (eiT→ejT) it is its corresponding mutual exclusion side;
If sentence is to (ni,nj) there is F-T correlations, then claim (eiF→ejF) it is its corresponding mutual exclusion side;
If sentence is to (ni,nj) there is F-F correlations, then claim (eiF→ejT) it is its corresponding mutual exclusion side.
3. the variable-length genetic algorithm based on statistical analysis in claim 1 described in step 1.2, it is characterised in that comprising such as Lower step:
Step 3.1:Variable-length genetic algorithm based on statistical analysis compared with traditional genetic algorithm, the method for expressing of chromosome Different with individual evaluation function, and breeding operation is increased, arthmetic statement is as follows:
Initialization,
Individual evaluation,
Selection operation,
Crossover operation,
Mutation operation,
Breeding operation,
Algorithm terminates, if being unsatisfactory for end condition,, go toStep;If meeting end condition, output is worked as Front optimum individual, algorithm terminate;
Step 3.2:Based on the variable-length genetic algorithm of statistical analysis, chromosome is represented with integer variable, represent tested program Side in DD- figures, the length of chromosome depend on the length in basic path, as the change of iterations gradually increases, represent The test path that evolution is generated, the method for expressing of chromosome are as follows:
Step 3.3:Based on the variable-length genetic algorithm of statistical analysis, design fitness function and evaluate each individual evolution generation The good and bad degree of test path, so as to determine the size of its hereditary chance, its value depends on the general of adjacent edge in DD- paths Rate, computing formula are as follows:
f(xi):Represent chromosome xiThe fitness function value of (i=1 ..., PM);
d(xi):Represent chromosome xiThe quantity of adjacent edge;
w(eij):Represent chromosome xiMiddle side ejWeight;
L(xi):Represent chromosome xiLength(Chromosome x is representediIn the quantity containing side);
Step 3.4:Based on the variable-length genetic algorithm of statistical analysis, whether chromosome is judged containing mutual exclusion side, if chromosome Containing mutual exclusion side, then which represents test path for can not execution route, such chromosome is no longer participate in evolving, therefore, raw Into test path be executable test path.
4. the executable test path of the application foundation path detection model inspection generation in claim 1 described in step 1.3 is No for independent pathway, and whether meet the linear independence with existing basic path, it is characterised in that comprise the steps of:
Step 4.1:Whether the executable test path that inspection is generated is independent pathway, and independent pathway requires that at least a line exists Do not occurred in other paths of controlling stream graph;Meet the linear independence with existing basic path, refer to independent road Footpath can not carry out linear expression by the basic path for having generated, then be added into basic path set;
Step 4.2:Basic path set is the set being made up of one group of basic path, and which need to meet following three constraints:
Each basic path must be an independent pathway;
All basic path in basic path set must cover all sides of controlling stream graph;
Be not included in any path in basic path set can by basic path set in basic path linear expression.
5. the variable-length genetic algorithm based on statistical analysis described in claim 1, it is characterised in that provide the realization of algorithm Process is as follows:
(1)Search space
Search space is the set of required solve problem, and in search space, each point represents one and possible solution, this Method sets its search space as D, then
It follows that the input domain of algorithm is the set on all sides in tested program DD- figure;
(2)Individual UVR exposure
The operand of genetic algorithm is to represent individual symbol string, can be binary system, numerical value, array, list, tree or its His object, coding depend on the problem of solution, and this method represents chromosome using integer variable, represents tested program DD- Side in figure, the length of chromosome depend on the length in basic path;
(3)Initial population
Genetic algorithm is the evolutional operation carried out by colony, needs the initial population data for preparing to represent initiating searches point, we In method initial population, each is individual(That is chromosome)Comprising the entrance in two sides, i.e. tested program DD- figure while with outlet, plant Group is dimensioned to PM, and the minimum length of chromosome is 2, and the maximum length of chromosome contains the most most of side equal to DD- paths Amount;
(4)Individual evaluation
Genetic algorithm evaluates the good and bad degree of each individuality using individual adaptation degree, so as to determine the size of its hereditary chance, this Method design fitness function evaluation is evolved and generates the quality in path, and its value depends on the probability of adjacent edge in DD- paths;
(5)Selecting operation
To population of future generation, the higher individuality of fitness there is a greater chance that for the individual inheritance for selecting current population's fitness higher It is genetic to population of future generation, method of this method using roulette, i.e., the determine the probability being directly proportional to fitness each individuality are lost Pass to the quantity of population of future generation;
(6)Crossing operation
Crossing operation is the major calculations process for generating new individual in genetic algorithm, and which exchanges two individual portions with certain probability Locus, the method that this method is intersected using single-point is divided to determine crossover location that is, in chromosome, then with a certain probability at this Point exchanges the portion gene seat of two pairing chromosomes;
(7)Mutation operator
Mutation operator is that the gene on a certain locus of chromosome is changed with a less probability, and produces new individual A kind of major calculations, method of this method using basic bit mutation determine genetic mutation position that is, in chromosome, then with A certain probability enters row variation to the gene of the point;
(8)Breeding computing
Breeding computing is primarily to realize that extension chromosome makes which represent complete path, this method adopts certain in chromosome One gene locus postpones the new gene of insertion, realizes the extension of chromosome;
(9)Checked operation
Checked operation mainly judge the test path (i.e. fitness function value is 1 chromosome) of generation whether based on road Footpath, if the test path for generating is independent pathway, and meets and basic path linear independence, is then added into basic path Collection;
(10)Algorithm terminates
In genetic algorithm, Evolution of Population to the one group of test path for generating meets the constraints of basic path set or reaches During maximum iteration time, algorithm terminates.
CN201610971672.6A 2016-11-07 2016-11-07 Executable basic path evolution generation method based on statistical analysis Pending CN106502908A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610971672.6A CN106502908A (en) 2016-11-07 2016-11-07 Executable basic path evolution generation method based on statistical analysis

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610971672.6A CN106502908A (en) 2016-11-07 2016-11-07 Executable basic path evolution generation method based on statistical analysis

Publications (1)

Publication Number Publication Date
CN106502908A true CN106502908A (en) 2017-03-15

Family

ID=58323133

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610971672.6A Pending CN106502908A (en) 2016-11-07 2016-11-07 Executable basic path evolution generation method based on statistical analysis

Country Status (1)

Country Link
CN (1) CN106502908A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763055A (en) * 2018-04-19 2018-11-06 北京航空航天大学 A kind of construction method of the test case constraint control technology based on epigenetic
CN109741362A (en) * 2018-12-29 2019-05-10 牡丹江师范学院 Modeling method based on Voronoi and in big data security application
CN111338957A (en) * 2020-02-28 2020-06-26 牡丹江师范学院 Software testing basic path evolution generation method based on probability statistics
CN113742251A (en) * 2021-11-08 2021-12-03 山东建筑大学 Software test path generation method and system based on set evolution
CN114401211A (en) * 2022-01-17 2022-04-26 重庆邮电大学 Test system and test method for accessing industrial wireless network equipment to IPv6 network

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050177351A1 (en) * 2004-02-09 2005-08-11 The Board Of Trustees Of The University Of Illinois Methods and program products for optimizing problem clustering
CN102331966A (en) * 2011-01-10 2012-01-25 中国矿业大学 Software test data evolution generation system facing path
CN102868572A (en) * 2012-09-07 2013-01-09 北京歌华有线电视网络股份有限公司 Path delay measuring method based on end-to-end detection
CN103559129A (en) * 2013-10-31 2014-02-05 中国矿业大学 Statistical regression test data generation method based on genetic algorithm
CN104811491A (en) * 2015-04-17 2015-07-29 华南理工大学 Cloud computing resource scheduling method based on genetic algorithm
CN105808426A (en) * 2016-02-28 2016-07-27 徐州工程学院 Path coverage test data generation method used for weak mutation test

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050177351A1 (en) * 2004-02-09 2005-08-11 The Board Of Trustees Of The University Of Illinois Methods and program products for optimizing problem clustering
CN102331966A (en) * 2011-01-10 2012-01-25 中国矿业大学 Software test data evolution generation system facing path
CN102868572A (en) * 2012-09-07 2013-01-09 北京歌华有线电视网络股份有限公司 Path delay measuring method based on end-to-end detection
CN103559129A (en) * 2013-10-31 2014-02-05 中国矿业大学 Statistical regression test data generation method based on genetic algorithm
CN104811491A (en) * 2015-04-17 2015-07-29 华南理工大学 Cloud computing resource scheduling method based on genetic algorithm
CN105808426A (en) * 2016-02-28 2016-07-27 徐州工程学院 Path coverage test data generation method used for weak mutation test

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
AHMED S. GHIDULC: "Automatic generation of basis test paths using variable length genetic algorithm", 《INFORMATION PROCESSING LETTERS》 *
夏春艳: "基于节点概率的路径覆盖测试数据进化生成", 《软件学报》 *
姚香娟: "复杂软件测试数据进化生成理论及应用", 《中国博士学位论文全文数据库信息科技辑》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763055A (en) * 2018-04-19 2018-11-06 北京航空航天大学 A kind of construction method of the test case constraint control technology based on epigenetic
CN108763055B (en) * 2018-04-19 2020-08-25 北京航空航天大学 Construction method of test case constraint control technology based on epigenetic inheritance
CN109741362A (en) * 2018-12-29 2019-05-10 牡丹江师范学院 Modeling method based on Voronoi and in big data security application
CN109741362B (en) * 2018-12-29 2019-09-03 牡丹江师范学院 Modeling method based on Voronoi and in big data security application
CN111338957A (en) * 2020-02-28 2020-06-26 牡丹江师范学院 Software testing basic path evolution generation method based on probability statistics
CN111338957B (en) * 2020-02-28 2023-03-31 牡丹江师范学院 Software testing basic path evolution generation method based on probability statistics
CN113742251A (en) * 2021-11-08 2021-12-03 山东建筑大学 Software test path generation method and system based on set evolution
CN113742251B (en) * 2021-11-08 2022-01-28 山东建筑大学 Software test path generation method and system based on set evolution
CN114401211A (en) * 2022-01-17 2022-04-26 重庆邮电大学 Test system and test method for accessing industrial wireless network equipment to IPv6 network
CN114401211B (en) * 2022-01-17 2023-05-12 重庆邮电大学 Test system and test method for accessing industrial wireless network equipment to IPv6 network

Similar Documents

Publication Publication Date Title
CN106502908A (en) Executable basic path evolution generation method based on statistical analysis
Oliveira et al. Invited review: Advances and applications of random regression models: From quantitative genetics to genomics
JP6630846B2 (en) Prediction method of abundance of pelagic squid resources based on gray system
Dung et al. Multi-objective automatic calibration of hydrodynamic models utilizing inundation maps and gauge data
Carstens et al. How to fail at species delimitation
Kamali et al. Automatic calibration of HEC‐HMS using single‐objective and multi‐objective PSO algorithms
Wan et al. Pareto optimal prediction intervals of electricity price
EP3326093B1 (en) Improved computer implemented method for predicting true agronomical value of a plant
Yang et al. Test-cost sensitive classification on data with missing values
Peng et al. Hybrid learning clonal selection algorithm
CN107729241B (en) Software variation test data evolution generation method based on variant grouping
Zhang et al. Constraint handling in NSGA-II for solving optimal testing resource allocation problems
Yao et al. Genetic algorithm-based test data generation for multiple paths via individual sharing
CN109947652A (en) A kind of improvement sequence learning method of software defect prediction
CN108563555A (en) Failure based on four objective optimizations changes code prediction method
Baldan et al. Introducing ‘riverconn’: an R package to assess river connectivity indices
Oliveira et al. Footprints of fitness functions in search-based software testing
CN105930272A (en) Important statement-based branch coverage testing data generation method
Sophocleous et al. A graph-based analytical technique for the improvement of water network model calibration
Chis et al. Multi-objective DSE algorithms' evaluations on processor optimization
Rosli et al. Intelligent prediction system for gas metering system using particle swarm optimization in training neural network
Larsen et al. Evaluation of scenario reduction methods for stochastic inflow in hydro scheduling models
Koljonen Comparison of nearest point algorithms by genetic algorithms
Waibel et al. Clustering and ranking based methods for selecting tuned search heuristic parameters
Boussaa et al. A novelty search-based test data generator for object-oriented programs

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170315

WD01 Invention patent application deemed withdrawn after publication