CN103810104B - A kind of software test case optimization method and system - Google Patents
A kind of software test case optimization method and system Download PDFInfo
- Publication number
- CN103810104B CN103810104B CN201410077655.9A CN201410077655A CN103810104B CN 103810104 B CN103810104 B CN 103810104B CN 201410077655 A CN201410077655 A CN 201410077655A CN 103810104 B CN103810104 B CN 103810104B
- Authority
- CN
- China
- Prior art keywords
- test case
- mrow
- test
- ant
- subset
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Abstract
The invention discloses a kind of new software test case optimization method and system, analytic hierarchy process (AHP) is combined it is determined that advantage and ant group algorithm, genetic algorithm on weighted value determine the technical advance in most simple, override sequence use-case subset.The weighted value of each functional requirement of system under test (SUT) is determined using the Mode of Level Simple Sequence of analytic hierarchy process (AHP), total sequence and consistency check quantification;Recycle the weighted value that ant group algorithm combination has been obtained to be determined by essential strategy, redundancy strategy and Greedy strategy and the minimum test case subset of each functional requirement, run cost is completely covered;On the basis of most simple set of uses case is obtained, the weighted value obtained is combined using genetic algorithm new assessment formula is determined, and error detection speed highest test case sequence is determined by selection opertor, crossover operator, mutation operator.
Description
Technical field
The present invention relates to a kind of method and system optimized to software test case.
Background technology
In software test procedure, Test Sample Design is particularly important link, and the quality of case designing is directly affected
Quality to software test and the assessment to test product quality, and with the expansion of system under test (SUT) software size, software
Demand it is more and more, the quantity of corresponding test case is also just more and more, wherein being no lack of substantial amounts of redundancy testing use-case.Cause
This limit test is impossible.Perform in addition each test case be required for taking some time, manpower etc., these costs
Cost be can not be ignored, it is therefore desirable to which test use cases are optimized.It is finally reached, it is most effective with minimum test case
Priority ranking software is tested so that realize reduction testing cost, improve testing efficiency purpose.
The content of the invention
The invention discloses a kind of software test case optimization method, comprise the steps of:
Step 1):The weighted value of each functional requirement of system under test (SUT) is determined using analytic hierarchy process (AHP);
Step 2):The minimum test case of each functional requirement, run cost is completely covered using ant group algorithm acquisition is improved
Subset;
Step 3):For step 2) obtained by most simple test case subset, using improved adaptive GA-IAGA carry out priority row
Sequence, obtains error detection speed highest test case sequence.
Further, above-mentioned steps 1) include following step mule:
a1):Structural model is set up based on the correlation and membership between each element in system;
b1):Judgment matrix is set up using 1~9 scale and Paired Comparisons;
c1):Carry out Mode of Level Simple Sequence;
d1):Carry out the final weight value that total hierarchial sorting obtains each functional requirement;
e1):Test case run cost is assessed.
Further, above-mentioned step mule 2) comprise the following steps:
a2):For the relation of test use cases in system and functional requirement collection, two-dimensional matrix is generated, is represented with T-R, square
The row of battle array represents test case, and matrix column represents functional requirement;
b2):For two-dimentional relation matrix T-R, carry out test use cases using essential strategy, redundancy strategy and simplify
Use-case subset T ';
c2):With reference to step 1) e1) obtained by each test case run cost value, to use-case subset T ' using greed calculate
Method, one path of generation is determined, the less priori test use-case subset of cost;
d2):Strengthen rule using initial path pheromones, strengthen c2) in all tests in the priori subset tried to achieve
The initial information element value of case node;
e2):Ant number, the disaggregation of each ant, taboo list are set;
f2):All test case nodes in test use cases T ' are randomly dispersed on these ants, at the same by this
The solution of ant is concentrated where start node is placed on;
g2):Every ant calculates and selected the test case node that next step will be selected, when all ants are selected
During the test case subset that one satisfaction is required, ant stops epicycle search;
h2):Compare the test case subset that all ants are searched out, find out and each function need are completely covered in epicycle circulation
Ask, the test case subset that run cost is minimum;
i2):On the basis of all nodal information elements got over through ant are strengthened, additionally dynamically strengthen current iteration most
The pheromones value on test case node that excellent test case subset is included;Current iteration terminates;
j2):Repeat e2)~i2), until obtaining most simple test case subset.
Further, above-mentioned steps 3) comprise the following steps:
a3):Determine test case coverage rate;
b3):Determine the coding strategy of test case;
c3):With reference to step 1) d1) obtained by weighted value determine fitness function;
d3):Determine selection opertor, crossover operator and mutation operator generation population of new generation;
e3):Repeat c3)~d3), until obtaining error detection speed highest test case sequence.
Optimize system the invention also discloses a kind of software test case, by being constituted with lower module:
First module, it determines the weighted value of each functional requirement of system under test (SUT) using analytic hierarchy process (AHP);
Second module, the minimum test of each functional requirement, run cost is completely covered using ant group algorithm acquisition is improved in it
Use-case subset;
3rd module, for the most simple test case subset obtained by the calculating of the second module, is carried out using improved adaptive GA-IAGA
Priority ranking, obtains error detection speed highest test case sequence.
Further, above-mentioned first module performs following operate:
a1):Structural model is set up based on the correlation and membership between each element in system;
b1):Judgment matrix is set up using 1~9 scale and Paired Comparisons;
c1):Carry out Mode of Level Simple Sequence;
d1):Carry out the final weight value that total hierarchial sorting obtains each functional requirement;
e1):Test case run cost is assessed.
Further, above-mentioned second module performs following operate:
a2):For the relation of test use cases in system and functional requirement collection, two-dimensional matrix is generated, is represented with T-R, square
The row of battle array represents test case, and matrix column represents functional requirement;
b2):For two-dimentional relation matrix T-R, carry out test use cases using essential strategy, redundancy strategy and simplify
Use-case subset T ';
c2):The calculation step e1 performed with reference to the first module) obtained by each test case run cost value, to example
Collection T ' uses greedy algorithm, and one path of generation is determined, the less priori test use-case subset of cost;
d2):Strengthen rule using initial path pheromones, strengthen c2) in all tests in the priori subset tried to achieve
The initial information element value of case node;
e2):Ant number, the disaggregation of each ant, taboo list are set;
f2):All test case nodes in test use cases T ' are randomly dispersed on these ants, at the same by this
The solution of ant is concentrated where start node is placed on;
g2):Every ant calculates and selected the test case node that next step will be selected, when all ants are selected
During the test case subset that one satisfaction is required, ant stops epicycle search;
h2):Compare the test case subset that all ants are searched out, find out and each function need are completely covered in epicycle circulation
Ask, the test case subset that run cost is minimum;
i2):On the basis of all nodal information elements got over through ant are strengthened, additionally dynamically strengthen current iteration most
The pheromones value on test case node that excellent test case subset is included;Current iteration terminates;
j2):Repeat e2)~i2), until obtaining most simple test case subset.
Further, above-mentioned 3rd module performs following operate:
a3):Determine test case coverage rate;
b3):Determine the coding strategy of test case;
c3):With reference to the first module perform calculation step d1) obtained by weighted value determine fitness function;
d3):Determine selection opertor, crossover operator and mutation operator generation population of new generation;
e3):Repeat c3)~d3), until obtaining error detection speed highest test case sequence.
The participation of people in software test procedure can be reduced according to the optimization method and system of the present invention, it is to avoid due to personnel
The impacted situation of test effect occurs caused by the deficiency of experience and ability, improves the order of accuarcy and efficiency of test.
Brief description of the drawings
Fig. 1 is analytic hierarchy process (AHP) flow chart;
Fig. 2 is hierarchy Model figure;
Fig. 3 is to improve ant group algorithm flow chart;
Fig. 4 is cross match flow chart;
Fig. 5 is variation flow chart;
Fig. 6 is software test case optimization method flow chart;
Fig. 7 is that functional requirement is subordinate to figure;
Fig. 8 is comprehensive weight distribution diagram;
Embodiment
Test case optimization method is a kind of Test Strategy based on risk, and its purpose is the test using full blast
Use-case combination finds most latent defects in tested software, on the one hand can save resource and time, on the other hand can be with
Embody the adequacy of test.The research both at home and abroad on test case optimization method is broadly divided into the test use cases side of simplifying at present
Method and test case prioritization method.
First, test case compressing method
So-called test case compressing method refers to using traditional method for test examples design according to functional requirement, for example
The initial set of uses case that equivalence class partition, boundary values, cause effect graph etc. are designed, after being simplified according to certain regular targets
The minimum use-case subset of gained.If initial test case collection is combined into T, finding minimum use-case subset for T can be used for fully covering
Lid function demand collection R, that is, meetAnd Req (T ')=R.If all meeting T ' radix for other any use-case subsets
(use-case number) is minimum, then claims T ' to be minimum test case subset.
1st, the basic principle that test use cases are simplified is:
1. validity:Validity refers to the coverage rate of the test case subset T ' after yojan with original test use cases T's
Coverage rate is identical.It is to therefrom select test as few as possible to use to the original test use cases T main purposes optimized
Example, can be completely covered all functional requirements, so as to reduce the cost prices such as human and material resources, time;
2. efficiency:In yojan test use cases, it is necessary to consider the operation expense of Algorithm for Reduction taken, algorithm generation
The run cost paid during optimal test case subset must be smaller than the cost that use-case is possessed deleted;
3. applicability:Applicable Algorithm for Reduction is selected according to software type and test object.
In above-mentioned several reduction rules, rule 1. be validity be it has to be ensured that, ensure validity under conditions of,
Selection suitably from about contracted calculation, improves efficiency as far as possible.No matter which kind of is described, it is necessary to is met a premise, that is, is selected most
Small test case subset will not reduce the reliability of test effect and program.
A focus of research in terms of the research about test use cases compressing method is test at present.Related scholar enters
Substantial amounts of research and experiment is gone.
2nd, the similarities and differences of each algorithm are as follows:
1) applicable elements
Greedy algorithm, partitioning algorithm, dynamic programming algorithm theory are simple, easy to operate, time efficiency is higher, but gained knot
Fruit is easily trapped into locally optimal solution, therefore above-mentioned three kinds of algorithms are limited suitable for the less demanding, test resource of overall importance to solution
Under conditions of carry out.Ant group algorithm acquired results accuracy is high, of overall importance strong, but the Algorithms T-cbmplexity is higher, takes and surveys
Try resource more, it is adaptable to which the Global Optimality of solution is required to carry out under conditions of higher, test resource is more sufficient;
2) minimum set of uses case scale
The minimum set of uses case scale of each algorithm is relevant with the scale of initial set of uses case, and feelings are remained according to redundancy testing use-case
Redundancy use-case in condition, minimum set of uses case obtained by greedy algorithm is more, next to that partitioning and dynamic programming algorithm, both gained
As a result the redundancy use-case in is close, and it is minimum that ant group algorithm acquired results contain redundancy use-case;
3) coverage rate
Minimum use-case subset is identical with the functional requirement coverage rate of initial test case collection obtained by each algorithm.
3rd, ant group algorithm is improved:
For actual test case, it is determined that carry out test case using ant group algorithm and simplify, but the algorithm there is also
Many problems:
(1) for complete system, demand is very big, often hundreds of so that thousands of, related to functional requirement
The test case enormous amount of connection, if directly carrying out yojan to original test use cases using Basic Ant Group of Algorithm, can cause
Ant Search is slower, expends for a long time, cost is higher;
(2) initial path select permeability, in Basic Ant Group of Algorithm, due in initial time, the pheromones of all nodes
Value is identical, and ant is entirely random search, and algorithmic theory of randomness is excessive;
(3) setting of iterations.If iterations sets excessive, devote a tremendous amount of time and be intended merely to obtain very small
Improvement, lose more than gain;If iterations sets too small, easily cause and stop iteration too early, do not find optimal solution.Base
These problems that this ant group algorithm is present all limit its application in practice to a certain extent;
(4) assessment of test case run cost is mainly empirically method judgement, it is impossible to pass through more objective assessment
Method distinguishes the test case run cost for different importance functional requirements.
1) ant group algorithm introduction is improved
Importance sequenencing is carried out to the functional requirement of system under test (SUT) first with analytic hierarchy process (AHP), the weight of each demand is obtained
Value, and determine using weighted value to cover the corresponding test case run cost of each demand, then original test use cases are entered
Row about degeneracy operation is based on the enhanced ant group algorithm of initial path pheromones.This method has taken into full account the feature of test case,
For the functional requirement relational matrix of initial test case one, essential test case therein and redundancy testing use-case are selected
Out, so as to reduce the scale of original test use cases, the execution time of ant group algorithm is greatly reduced, then to yojan after
Test use cases seek obtaining a priori subset, and strengthen institute in the subset using greedy algorithm and using the weighted value of each demand
Have the plain value of initial information of node so that ant group algorithm one preferably on the basis of be to enter on the basis of relatively low total cost
Row convergence;The randomness of ant group algorithm is reduced simultaneously, accelerates convergence rate, solution, this method are faster optimal with less time
The run cost of test case can be greatly lowered, the quantity of test use cases is reduced, so that cost-effective.
2) analytic hierarchy process (AHP) introduction
Analytic hierarchy process AHP (Analytic Hierarchy Process) be the U.S. plan strategies for scholar T.L.Saaty proposition
A kind of systematic analytic method, be the method often having in system engineering in terms of being widely used in decision-making, prediction, assessing.
This method is typically the property and the general objective to be reached according to problem, and each element of challenge is dominated according to respective
And correlation is distinguished in groups, forms the hierarchy Model for passing rank in order, people by comparing each hierarchical elements in pairs
To determine the relative importance of each element, then by comprehensive analysis finally determine that each element is relatively important relative to general objective
The sequence of degree.Therefore preferably system each element relative importance can be estimated using analytic hierarchy process (AHP), level point
Analysis method basic procedure is as shown in Figure 1.
Analytic hierarchy process (AHP) main contents include:
(1) hierarchy Model is set up
Structural model is set up based on the correlation and membership between each element in system, the model mainly divides
For:Destination layer, rule layer, solution layer and follow-up scheme sublayer etc..As shown in Figure 2.
(2) judgment matrix is set up using 1~9 scale and Paired Comparisons
Judgment matrix is set up using the ratio between relative importance between each hierarchical elements in system, to make phase between element
The ratio between significance level is easy to quantify, 1~9 scaling law proposed according to psychology using T.L. Saaty et al., such as the institute of table 1
Show:
The scale value of table 11~9
(3) Mode of Level Simple Sequence is carried out
The weight vector of each judgment matrix is calculated according to root method, specific calculating process is as follows:
1. it will determine that in matrix that each row element is multiplied and opens m th Roots;
2. weight vector is normalized to obtain in the column vector of gained:
3. the coincident indicator value corresponding to judgment matrix is obtained:
4. consistency check:
The CI values tried to achieve in formula (3) and the Aver-age Random Consistency Index value RI of 1~9 rank shown in following table are compared,
Obtain consistency ration value CR:
The rank RI values of table 21~9
Judgment matrix approach, which is met, if CR < 0.1 requires, on the contrary then readjust judgment matrix.
(4) total hierarchial sorting is carried out
After Mode of Level Simple Sequence is completed, divide the relatively heavy of index included in rule layer, solution layer and scheme sublayer
Degree is wanted to be determined, equivalent to the emphasis determined corresponding to each individual event functional requirement.But finally bottom is also obtained respectively to test
Sub- demand need to carry out total hierarchial sorting relative to the weighted value that general objective is system effectiveness.
Total hierarchial sorting be in hierarchical structure since the second layer untill the bottom each layer all elements relative to mesh
It is integrated ordered that general objective in mark layer is carried out.Its specific calculating process is as follows:
1. the synthesis weight vector of K layers of element is calculated
If WkWeight vector, w are integrated for K layers of total hierarchial sortingskTo be associated in K layers relative to last layer each element
The weight matrix that Mode of Level Simple Sequence weight vector corresponding to each element is constituted.Remaining each level is by that analogy.Then K layers of element are comprehensive
Close weight vector calculating process as follows:
Wk=wk*wk-1*wk-2.............*W2 (5)
2. K layers of total consistency check is carried out
Carry out after total hierarchial sorting, the inconsistency error that carry out total consistency check to detect each level accumulation is
It is no in effective range.Specific calculating process is as follows:
Wherein:CRkIt is K layers of total consistency ration value, CRk-1It is K-1 layers of total consistency ration value, CIj k
It is the RI using K-1 layers of j-th of element as the coincident indicator value of the judgment matrix obtained by criterion in K layersj kIt is in K layers
Using K-1 layers of j-th of element as the Aver-age Random Consistency Index value of the judgment matrix obtained by criterion, ajIt is K-1 layers
The synthetic weights weight values of j-th of element.
Set up by a series of hierarchical structure, single sequence and total sequence are finally given relative to system under test (SUT) efficiency
The weighted value of each functional requirement has a more objective, quantization for which demand is important, which demand is typically important
Evaluation.
(5) test case run cost is assessed
After the relative weight value that each atomic function demand is determined by analytic hierarchy process (AHP), always needed according to last layer time correlation
Testing time for asking simultaneously carries out testing time division using weighted value to each atomic function demand.Specifically divide such as formula (7), (8)
It is shown:
Ti=t1+t2+t3+… (7)
t1=Ti*W1;t2=Ti*W2;t3=Ti*W3........... (8)
Wherein, TiFor the testing time of last layer time aggregate demand, WiFor the weighted value of the aggregate demand correlator demand, tiFor
The estimated testing time of the aggregate demand correlator demand.And a test case will typically cover several functional requirements, therefore
The run cost of test case is expected testing time sum for the functional requirement that the use-case is covered.
3) ant group algorithm implementation steps are improved
(1) using improvement ant group algorithm, it is necessary to meet two constraintss:
1. in each iteration, every ant can only be at most accessed once each test case node;
2. the solution that all row in matrix can finally be tried to achieve is completely covered, that is, the test case subset finally obtained must
Must all demands of energy Complete test.The constraints is to weigh the standard whether ant stops construction solution.
(2) algorithm implementation process is described
Step one:
For the relation of test use cases in system and functional requirement collection, two-dimensional matrix is generated, is represented with T-R, matrix
Row represents test case, and matrix column represents functional requirement, while the pheromones value τ of all test case nodes of assignmentiIf, τ
(0)=C (C is constant), this problem sets τi(0)=1:
Step 2:
For two-dimentional relation matrix T-R, simplifying for test case set is carried out, the process of implementing is:
1. first by essential strategy, the essential test case t in matrix is found outi, by tiIt is added to initial value
In empty set, while carrying out phase and computing with all rows of the row where the test case and remaining in matrix, to eliminate other
T in rowiThe functional requirement met, after the step is finished, the dimension of T-R row and column is although constant, it is likely that depositing
Be all that the number of zero row or column, i.e. test case and functional requirement can be reduced, at the same might have it is new essential
Or redundancy testing use-case is produced;
2. redundancy strategy is then taken, redundancy testing use-case is found out, and add it to set TrongIn, this step may
New essential test case is had to produce;
1., 2. step is alternately performed, untill it no longer there is essential test case and redundancy testing use-case in matrix,
Now set TbiWith redundancy testing use-case TrongContain all essential test cases that original test case concentrates and superfluous
Remaining test case, while will be all that zero row or column is removed in original matrix, original test case set T scale significantly drops
It is low, simplify as test case set T ', so as to reduce the scale of original two dimensional relational matrix.
Step 3:
Then greedy algorithm is used to test case set T ', ultimately generates path determination, the less priori of cost
Test case subset;
Step 4:
Strengthened using initial path pheromones and used in rule, enhancing step 3 in the priori subset that greedy algorithm is tried to achieve
All test case nodes initial information element value;
Step 5:
The number of ant is set, and the quantity of ant is set to that primitive relation matrix is carried out to simplify rear remaining by the algorithm
The number of test case.Every ant has an initial value to be empty disaggregation simultaneously, for depositing the path that ant creeps;Together
Sample, every ant has a taboo list of oneself, the test case node that main storage ant had creeped, so as to prevent
The ant selects this test case node again in same an iteration;
Step 6:
After being initialized according to above-mentioned rule to relational matrix, by all test cases in the test use cases T ' after yojan
Node is randomly dispersed on these ants, while the solution of ant where this start node is placed on is concentrated;
Step 7:
The test case node that every ant calculates by certain rule and selects next step to select, while will choosing
Fixed nodes records are concentrated in the solution of oneself, when all ants select a test case subset, and test case
Collection can meet above-mentioned two constraints, when all functional requirements in matrix are completely covered, and ant stops epicycle search;
Step 8:
In epicycle circulation, after all ants complete search, the test case that relatively more all ants are searched out
Subset:First compare the high functional requirement number of the weighted value that is covered of each ant homographic solution integrated test use-case number, covered
The more disaggregation of the high functional requirement number of the weighted value of lid should be paid the utmost attention to;Concentrated when different solutions and cover the high work(of weighted value
Can demand number it is identical when, run cost it is few should preferentially examine rate.Find out the minimum test case of run cost in epicycle circulation
Subset;
Step 9:
On the basis of all nodal information elements got over through ant are strengthened, additionally dynamically enhancing current iteration is optimal surveys
The pheromones value on test case node that example collection on probation is included, to strengthen in next iterative process, the test case section
The selected probability of point, the process of current iteration construction solution terminates;
Step 5 is repeated to nine, when iterations meets condition requirement, stops algorithm performs.By what is finally given
Minimum test case subset, adds essential test case set, is to be solved.
For any one ant k in test case node electing process, its selection next node i probability is:
In formula, allowedk={ T '-tabu } represents that ant k next step runs selectable all test case sets of node
Close, i.e.,:The set of the current all case nodes not accessed by this ant.τiRepresent this time to circulate, test case node i
Pheromones value, ηiFor heuristic function, reflection ant k selects the expected degree of test case node i, and general value is 1/ci, table
Show that the run cost of the test case is smaller, it expects that selected probability is bigger;α (α >=0) is information heuristic greedy method, instead
The pheromones for having reflected node accumulation select ant the importance of its direction of motion, and its value is bigger, then ant more tends to selection
The node;β (β >=0) is expected heuristic value, reflects the influence degree that heuristic information is selected node, and value is bigger, should
It is higher that node is selected probability.Above-mentioned steps are represented in the form of flow chart, as shown in Figure 3.
(4) Rulemaking of algorithm
1. the enhancing of initial path pheromones is regular
If the number for simplifying rear test use cases is m ', if the number for the test case that greedy algorithm is chosen is t, then it is left
Not selected test case number be m '-t, the enhanced multiple of test case pheromones chosen is represented with M, is not chosen
Test case pheromones still be initial setting 1.Pheromones total amount on whole test use cases is divided into partI.e.:In selected set of uses case, every 10 test cases occupy portion therein, not selected all test cases
Have a foot in the dish altogether, then have formula:
Above-mentioned equation is solved to obtain:
I.e.:Pheromones value in the priori subset selected using greedy algorithm on all nodes is strengthenedTimes.
2. pheromone updating rule
In each iterative process of algorithm, it is required for updating the pheromones on test case node.It is main to include two
The renewal of aspect:Pheromone concentration on test case node each first can be over time disappearance and vapor away a part;Its
Secondary, ant also can leave pheromones in search procedure on the test case node of process.The method that this algorithm is taken
It is:The node that all ants pass through is carried out on the basis of Pheromone update, the ant for constructing optimal path is carried out additionally
Pheromone update.When algorithm is initial, if the pheromones on each test case node are a normal number τiIf, τi(0)=C
(C is a constant, and C is set in the method 1), then to find out a determination subset using greedy algorithm, and by the subset
The pheromones of all test case nodes strengthened according to formula (16), then using ant group algorithm.Whole test use cases
The solution procedure of reduction problem completed jointly by many ants.Whenever certain ant selection node tiWhen, by tiIt is put into it
Solution is concentrated, while removing t from demand collection RiThe functional requirement covered, until R is sky, ant current iteration solution procedure knot
Beam, remaining ant also searches for the disaggregation of oneself using identical method, until all ants all stop search, current iteration process
Terminate.Then all test case nodes passed through to the ant in each iteration carry out Pheromone update, and its pheromones is more
Newly rule is:
Wherein, ρ is volatility coefficient, and 1- ρ reflect the residual degree of pheromones, and nc represents iterations, then nciRepresent the
I iteration, nci+1Represent i+1 time iteration, τjFor the pheromones value of j-th of test case node.Δτj(nci、nci+1) represent
J-th of test case node Pheromone update value in ith iteration,Represent if j-th of test is used
Example node is the case node in ith iteration in optimal test case subset, then is the Pheromone update value to the node.Tool
Body calculation formula is as follows:
If ant k passes through test case node j, node j Pheromone updates value is has value part in formula (13), such as
Fruit passes through node j without any ant, then its Pheromone update value is 0.
If case node j is located in ith iteration in optimal test case subset, node j Pheromone update values are
There is value part in formula (14), if it is not, its Pheromone update value is 0.
C in formula (13), (14)k(nci) represent in ith iteration, total fortune of the test case subset obtained by ant k
Row cost, Cbest(nci) represent total run cost of optimal test case subset for being tried to achieve in ith iteration.Ith is changed
The increased multiple of pheromones on all test case nodes that ant is passed through in generation strengthens according to formula (11).If some is tested
Case node is in the minimum test case subset that ith iteration is tried to achieve, in addition it is also necessary to additionally increase pheromones according to formula (14),
I.e. when i+1 time iteration starts, the pheromones on all test case nodes calculate the value tried to achieve for formula (12).
3. ant quantity is set
It can be seen from the characteristics of ant group algorithm, the execution of the quantity of ant to program also has an impact, and ant quantity is very few, entirely
Office's search capability weakens;Ant quantity is too many, and the ability of searching optimum of algorithm is stronger, but quantity is excessive, causes each iteration
The overlong time of execution, algorithm the convergence speed slows down.And under identical ant number, with the increase of problem scale, calculate
The ability of searching optimum reduction of method.Modern system is mostly more complicated, and the functional requirement that is related to, test case number are all very
It is many, if ant quantity is set to identical with initial test case number, the time can be caused to postpone significantly, not meet actual use
Situation.Ant group algorithm is improved before ant group algorithm is performed, enters test use cases-functional requirement collection relational matrix scale
The significantly reduction gone, therefore the quantity of ant is set to after being pre-processed to relational matrix, included in matrix
The number of test case node.
4. iterated conditional is stopped
Relevant ant group algorithm iterations offering question, is found, in the middle and later periods of algorithm, largely by consulting lot of documents
Iterations produce solution be identical, that is, exist successive ignition still without it is more excellent solution generation phenomenon.It is substantial amounts of so as to show
Iterations is not necessarily to.So total iterations can be reduced, so as to reach drop in the case where not influenceing solution
The complexity of low algorithm is simultaneously in order to reduce the cost of testing time and test, if continuous many in view of the purpose of optimization
Secondary iteration, devotes a tremendous amount of time and is intended merely to obtain very small improvement, lose more than gain, and is considered based on such,
Association area expert shows by substantial amounts of result of the test:When the optimal solution difference that continuous several times iteration is produced is less than 0.01,
Stop iteration, so as to accelerate the solving speed of algorithm.I.e. and it is not provided with the total iterations of algorithm, but a boolean is set
Variable, is initialized as false, when algorithm number of run is more than 5, the optimal solution and inverse the 5th produced with last time iteration
The optimal solution of secondary generation is compared, and when difference is less than 0.01, the Boolean variable is set into true, you can stop iteration.
5. parameter factors are analyzed
By formula (9), (12), (13) and (14), the quality of ant group algorithm operation result is largely dependent upon
Parameter alpha, β, ρ in the selection of parameter value, algorithm have a great impact to algorithm performance.The reasonable value scope of these parameters
It is as follows:
Parameter (α >=0) is also known as heuristic factor, shows to remain in the valued degree of pheromones on node, reflects
The relative importance of pheromones, from formula (14), when α values are too small, convergence rate is slow.α values are bigger, and ant selects the survey
The probability for trying node is also bigger, and the randomness of search diminishes, but if α is excessive, also easily causes search to be absorbed in local optimum
Solution;
Parameter (β >=0) is also known as expecting factor, reacted heuristic information (priori subset) ant select node in by
Attention degree, from formula (14) as can be seen that β value is bigger, then the selected probability of the node is higher.Therefore, β size, which is reflected, searches
The factors such as apriority, certainty during rope.For to a certain extent, the speed of algorithmic statement is accelerated, but if taking
It is not be worthwhile, also it is easily caused and is absorbed in locally optimal solution;
Parameter (0≤ρ≤1) is also known as pheromones volatilization factor, then 1- ρ are pheromones retention factors, and ant group algorithm is global
The quality of search capability is directly determined by the parameter.It is known that during Food Recruiment In Ants, ant energy release pheromone, together
When, over time, the pheromones left in the past also can be vapored away gradually.From formula (12), ρ values are smaller, path
The pheromones of upper residual can be bigger, improves the path being selected selected possibility again, may fall into algorithm
Enter local optimum, ρ values are excessive, and the ability of searching optimum of algorithm gets a promotion, but convergence rate can be slack-off.Therefore, ρ value meeting
Directly influence arithmetic result.
Analyzed more than, parameter alpha, the quality of β and ρ values largely have impact on ant group algorithm and exist
Application in practical problem.Show that α is optimal near 1 by association area expert's abundant experimental results, β is optimal near 5, ρ
It is optimal near 0.5.
2nd, test case prioritization method
Original test use cases are simplified by above-mentioned test use cases compressing method, but in actual tests
In due to test resource it is limited, it is desirable to test use cases have error detection capability faster, especially to test item
Key component, therefore be accomplished by carrying out priority ranking to Optimizing Test Case subset according to rule, arrange high priority use-case
It is preferential before being listed in perform.So as to improve the error detection speed of test use cases, position excessive risk mistake as early as possible or with faster
Speed cover main functional requirement.
By the abstract optimal set problem to find in test case fully intermeshing of priorities of test cases problem.Given test
Set of uses case T, T fully intermeshing collection are combined into PT, are f by the function that each element in PT is mapped to real number, seek PT ' ∈ PT, then(PT ' ' ∈ PT) (PT ' ' ≠ PT ') [f (PT ') > f (PT ")], in other words, if one group of test case according to
Specific order is performed, then this group of test case causes object function f to have higher " suitability degree " value.It is generally believed that higher
Suitable angle value represent the sequence of more preferable priorities of test cases.Ideally, test case should be according to as early as possible
Error detection capability (speed for improving error detection) is maximized to sort.Maximizing error detection capability as soon as possible can be more
Feedback information earlyly is provided to programmer, so that they position and repaired earlier mistake.But before error message is unknown,
Sequence is unpractical like this.Therefore, priorities of test cases method is using acting on behalf of ordering attribute, by as far as possible it is early most
Some attributes that bigization is acted on behalf of, maximize error detection capability as early as possible.
Priorities of test cases method needs to pay close attention to two specific scenes:General priorities of test cases method and spy
Determine the priorities of test cases method of version.General priorities of test cases method is applied in the initial release of program,
It is unaware of being ranked up test case in the case that later release makes an amendment program, tries hard to make the sequence to follow-up version
This program is effective;Program of the priorities of test cases method of particular version only to a certain particular version is effective, this method
The modification information done using particular version to prototype version is ranked up.Therefore based on actual tests work, it should pay close attention to general
Priorities of test cases method.This method is effective to down-stream version so that carry out priority row to test case
The cost of sequence is shared in each later release, greatly reduces the expense of method.
1st, the comparison of test case prioritization method
Research about test case prioritization at present has been improved based on test use cases detection error rate, largely
Scholar has carried out the research and experiment of correlation.The similarities and differences of each algorithm are as follows:
1) applicable elements
Basic greedy algorithm, extra greedy algorithm and hill-climbing algorithm, algorithm idea is simple, time complexity is low, but institute
Solving result is easily trapped into local optimum.Therefore above-mentioned three kinds of algorithms are applied to, test less demanding to the detection rates of disaggregation
Under conditions of resource is less.Genetic algorithm is proceeded from the situation as a whole to be traveled through, and the solution space to problem is scanned for, to a certain degree
On can search out globally optimal solution, but the Algorithms T-cbmplexity is higher, algorithm cost is applied to greatly detection speed to disaggregation
Rate requires high, under conditions of test resource more abundance.
2) algorithm stability
Basic greedy algorithm, extra greedy algorithm and hill-climbing algorithm, algorithm structure are simple, the less gained knot of influence factor
It is really relatively stable.Genetic algorithm, algorithm structure is complicated, parameter influences larger to result, and acquired results have certain floating.But with
The popularity of algorithm application, deep-going to improve constantly, algorithm parameter is set and has also carried out continuous correction, heredity at present is calculated
The parameter of method is improved well, and acquired results quality is greatly improved.
2nd, improved adaptive GA-IAGA
, i.e., can not possibly be really before test case execution, as a consequence it is hardly possible to know the corresponding relation of test case and mistake
Know the average error verification and measurement ratio of test case with cutting.So, test case prioritization algorithm is all to improve test case sequence
Row find the possibility and speed of mistake.For genetic algorithm, the assessment formula for selecting suitable institute Solve problems is most
For crucial method points, suitable formula of assessing more can really reflect the different importance of different test case sequence pairs
The quick detection of tested software part, therefore the most key to the improvement of genetic algorithm is exactly the improvement to assessment formula,
It is exactly the improvement to test case prioritization goal-based assessment method for test case.
1) traditional genetic algorithm assesses formula
It is generally believed that the coverage rate of test case is bigger, this use-case finds that the possibility of mistake is bigger, then can be with
With the coverage rate information of test case come quantified goal.It is that functional requirement coverage rate, sentence cover according to the coverage rate information used
Lid rate judges coverage rate etc., corresponding evaluation method have respectively APRC, APSC, APDC,.Test case can lead to before performing
Cross coverage rate analysis and obtain its coverage rate information, thus APRC, APSC, APDC, can apply test case execution before
Use, for instructing the priority ordering of test case.Its specific formula is:
Wherein, n is the number of test case in test case sequence, and m is functional requirement (sentence, judgement) number.TRiTable
Show the test case Position Number of first covering function demand (sentence, judgement) i in test case sequence.
But above-mentioned formula has two:
(1) importance of the functional requirement, sentence or the judgement that are covered in formula assumes identical, but each in practice
Functional requirement, statement sentence, the importance of predicate node each other are all different, therefore each several part importance are all provided with
To be identical improper;
(2) in actual test, the tested software part that quite a few test case is covered all overlaps each other, and this
Kind overlap with beneficial to being examined from different perspectives to tested software, and described in formula (15) be to being initially coated with demand
Or the statistics of the test case of mistake is found, without the statistics in view of the test case for lap.
In summary, traditional assessment formula need to be improved can just meet actual demand.
2) improved adaptive GA-IAGA assesses formula
The weighted value of each functional requirement is obtained using analytic hierarchy process (AHP), while using the assessment formula based on overlap test,
Construct improved adaptive GA-IAGA and assess formula (including repeat demand):
Wherein, n is the number of test case in test case sequence, and k is the functional requirement corresponding to test case sequence
The sequence number of individual manifold, wiThe weighted value of i-th of the functional requirement covered by k-th of test case, num is that k-th of test is used
The functional requirement number that example is covered.
In above-mentioned formula, the functional requirement number that test case is covered is counted according to following example:Assuming that use-case A
Cover 4 functional requirements, wherein 2 to be new functional requirement (do not covered) weighted value by other use-cases is respectively
0.1st, 0.2, another 2 are that repetition covering demand respective weights value is 0.3,0.4, and repeat covering 5 times by other test cases,
Then 2 corresponding weighted values of repeat demand are 0.3/5,0.4/5, then the functional requirement value that the final test case is covered is
0.44。
Test case sequence can be carried out using formula (16) to more conform to actual good and bad assessment.
3) improved adaptive GA-IAGA implementation steps
(1) coverage rate of test case
Test case coverage rate should be based on functional requirement coverage rate.
(2) coding strategy
Due to being that priority ordering is carried out to test case, therefore the input of genetic algorithm is several test cases composition
Test use cases, output is test case sequence.Whole flow process is the arrangement position for converting these test cases, it is not intended that
The concrete composition of test case.So in genetic algorithm, real number can be used to number to represent test case.For test case
The each test case concentrated assigns the numbering of a real number, and test case sequence just can be with the array of these numbering compositions come table
Show.
(3) fitness function
Choose improved adaptive GA-IAGA and assess formula.
(4) genetic operator is selected
1. selection opertor
In practical implementation, roulette selection strategy is commonly used, its concrete meaning is:According to fitness function to initial
Each individual can obtain a fitness function value F in populationi∈ F=< F1, F2, F3………Fs>, then passes through formula
Fi÷(F1+F2+F3+………+Fs) calculate the ratio value that i-th of individual accounts for all individual adaptation degree functional value summations.Understand,
All individual ratio values are added and equal to 1.Then the individual in population is arranged from low to high according to its fitness function value,
And added up with the ratio value of above individual.Then, randomly generate first in a number r ∈ [0,1], the individual sequence after arrangement
The individual that individual ratio accumulated value is more than or equal to r is to be selected, until population number of future generation reaches initial population
Number, selection stops.As can be seen that the big individual of fitness value, it is selected remain into follow-on probability will more greatly, this is also complied with
The principle of the survival of the fittest.
2. crossover operator
The effect of crossover operator respectively produces the random number between one 0 to 1 aiming at the individual passed through obtained by selection, such as
Really this random number is less than crossover probability Pc, then choose the individual and carry out cross match, can only there are two individual intersections to match somebody with somebody every time
Right, when the number of individuals for participating in cross match is multiplied by colony's number equal to crossover probability, then crossover operation is finished, and remaining individual is lost
Pass to the next generation.Specifically cross match process is:If two parent individualities are respectively:δk、δl, the offspring individual after cross match
For:δq、δr;A crosspoint k is randomly generated, k value is more than 1, less than n (n is the number of use-case in test case sequence);Will
δkIn preceding k test case turn into δqPreceding k test case;δlReject δkIn the preceding remaining n-k of k test case
Test case constitutes δqIn rear n-k test case;For δrAnabolic process and δqSimilar, it is by δlIn it is preceding n-k survey
Example on probation and δkReject δlIn preceding n-k test case remained by k test case composition.Idiographic flow is as shown in Figure 4.
In theory, crossover probability PcIt is advisable between 0.2~0.8, typically takes steady state value.Crossover probability is bigger, individual quilt
The possibility of destruction will increase, and the individual configurations with high fitness value are more more easily damaged;And crossover probability is too small will
Search procedure is become slow, stagnate.Therefore, reasonable selection crossover probability PcIt is the successful key point of genetic algorithm, according to
The result emulated according to the research and engineering practice of associated specialist understands crossover probability PcGenerally it is chosen for 0.8.
3. mutation operator
In genetic algorithm, variation is to maintain the important channel of species diversity.The effect of mutation operator is with certain
The a certain gene of the selection of probability at random, and change its value, so that new individual is formed, while reaching variation purpose.For test
Use-case priority ordering, is exactly, to one random number of each Test cases technology in each individual, to be compared with mutation probability
Compared with (every time two and be all an individual), if less than the probable value, two use-cases intercourse position.When the test of variation
Use-case number reaches that then mutation operation is finished mutation probability when being multiplied by total use-case number.Idiographic flow is as shown in Figure 5.
Mutation probability PmSize will influence the efficiency of genetic algorithm:PmIt is bigger, make a variation more, be easily destroyed existing
Defect individual;Conversely, being then not likely to produce new individual, the requirement of population diversity is not reached.In theory, the usual value of mutation probability
Between 0.005~0.1, according to correlation engineering practical experience, the usual value of mutation probability is 0.03.
4. algorithm end condition is set
At present, the end condition of most of genetic algorithms is to be based on certain criterion, i.e., restrained simultaneously in judgement population
There is no terminate to calculate after trend of evolution.But, due to complexity and genetic algorithm the randomness in itself of practical problem, in reality
Often according to engineering practice and emulation experience using end condition of the fixed evolution iterations as genetic algorithm in the application of border,
Generally take 200~500 times.This method uses 500 iteration.Due in the iterative process of genetic algorithm by it is many it is random because
The influence of element, so last time iterative process not necessarily contains optimal solution.Looked into therefore, being compared for convenience to result
Ask, often to record the optimum individual in per generation.Relative optimal solution is obtained at the end of so as to algorithm.
3rd, software test case optimization method
For utilizing the initial set of uses case designed by traditional test case designing method, it is first determined between each functional requirement
Membership, recycle analytic hierarchy process (AHP) to assign each functional requirement weighted value that initial set of uses case is covered, then using changing
Enter ant group algorithm to simplify initial set of uses case, finally effectively sorted using improved adaptive GA-IAGA to simplifying set of uses case,
Finally give one and meet actual demand, with higher error detection speed and save the test use cases of testing cost.In fact
Existing flow is as shown in Figure 6.
4th, instance analysis
The displaying of test case optimization process is carried out by taking the basic operation module of certain system as an example.
1st, functional requirement weighted value is determined
Effectively to carry out Validity Test to the module using new software test case optimization method it may first have to utilize layer
Fractional analysis assigns each functional requirement weighted value of the module.Specific calculation process is as follows:
(1) determine that functional requirement is subordinate to level
It is as shown in Figure 7 that functional requirement is subordinate to level.
(2) Mode of Level Simple Sequence
Set up rule layer judgment matrix.According to 1-9 scaling laws, according to basic control, Communication Control and systematic parameter phase
Significance level for master control function is compared, and gained judgment matrix is:
λmax=3, CI=0, CR=0 < 0.1, the judgment matrix reaches coherence request.Weight vector is:
1. basic control judgment matrix is set up
The matrix is set up using rule layer judgment matrix method for building up to obtain:
λmax=8.9824, CI=0.1403, CR=0.0995 < 0.1, the judgment matrix reaches coherence request.Quan Xiang
Measure and be:
2. Communication Control judgment matrix is set up
λmax=4.2412, CI=0.0804, CR=0.0903 < 0.1, the judgment matrix reaches coherence request.Quan Xiang
Measure and be:
3. systematic parameter judgment matrix is set up
λmax=6.2980, CI=0.0596, CR=0.0473 < 0.1, the judgment matrix reaches coherence request.Quan Xiang
Measure and be:
(3) total hierarchial sorting
Obtaining final weight value using formula (5) is:
The integrated ordered weighted value distribution of each bottom functional requirement is as shown in Figure 8.As seen from Figure 8, No. 5 bottom functional requirements
Shared weighted value highest is:Controll plant is most important.The rest may be inferred for other bottom functional requirements.
(4) total consistency check
Carry out after total hierarchial sorting, the inconsistency error that carry out total consistency check to detect each level accumulation is
It is no in effective range.
CR=0.0887 < 0.1 (26)
Coincident indicator value is met, then the final weight vector of gained can use.
2nd, test use cases are simplified
(1) two-dimentional relation matrix is built
The two-dimentional relation matrix of table 4
Note:F in table represents functional requirement, and C represents test case
(2) initial set of uses case is simplified
The initial set of uses case shown in table 4 is simplified using ant group algorithm is improved, method parameter setting:Initial set of uses case
Use-case number:23;Stop iterated conditional:When algorithm iteration number of times is more than 5, with last time iteration produce optimal solution with
The optimal solution of 5th generation reciprocal is compared, and absolute difference can stop iteration output optimal solution when being less than 0.01;α is 1;
β is 5;ρ is 0.5.Obtain and simplify set of uses case as follows:
[C1、C2、C5、C9、C10、C11、C12、C13、C14、C15、C16、C17、C18、C19]。
Two-dimentional relation matrix after gained is simplified is as shown in the table:
Table 5 simplifies two-dimentional relation matrix
Simplify set of uses case and initial set of uses case contrast table:
Table 6 simplifies contrast table
(3) priority ordering is carried out to simplifying set of uses case
Using improved adaptive GA-IAGA to simplifying after test use cases carry out priority ordering.Method parameter is set:It is initial to plant
Group's scale:292150;Coding strategy:Encoded using each test case position number;Commented using improved adaptive GA-IAGA
Estimate formula and carry out the good and bad assessment of individual;Selected using roulette method;Intersected using two point, crossover probability PcFor 0.8;Variation
Probability PmFor 0.03;Stop iteration output optimal solution after algorithm iteration 500 times.Obtaining test use cases priority ordering is:[C15、
C16、C5、C14、C12、C18、C11、C1、C2、C9、C10、C13、C17、C19]。
Optimal use-case sequence and initial use-case alignment table:
The priority ordering contrast table of table 7
By the further investigation to traditional test use-case optimization method, for its presence shortcoming using analytic hierarchy process (AHP),
A kind of new software test case optimization method of ant group algorithm, genetic Algorithm Design, and this method is applied to actual soft
In part test so that test case quantity and testing time are significantly simplified, testing efficiency is significantly improved, and test result is more accorded with
Close the virtual condition of system under test (SUT).Effective development of this method to each software test rank (especially system-Level software test) has
There are realistic meaning and reference value.
Claims (2)
1. a kind of software test case optimization method, it is characterized in that:Comprise the steps of:
Step 1):The weighted value of each functional requirement of system under test (SUT) is determined using analytic hierarchy process (AHP);
Step 2):The minimum test case subset of each functional requirement, run cost is completely covered using ant group algorithm acquisition is improved;
Step 3):For step 2) obtained by most simple test case subset, using improved adaptive GA-IAGA carry out priority ranking, obtain
Obtain error detection speed highest test case sequence;
Above-mentioned steps 1) comprise the following steps:
a1):Structural model is set up based on the correlation and membership between each element in system;
b1):Judgment matrix is set up using 1~9 scale and Paired Comparisons;
c1):Carry out Mode of Level Simple Sequence;
d1):Carry out the final weight value that total hierarchial sorting obtains each functional requirement;
e1):Test case run cost is assessed;
Above-mentioned steps 2) comprise the following steps:
a2):For the relation of test use cases in system and functional requirement collection, two-dimensional matrix is generated, is represented with T-R, matrix
Row represents test case, and matrix column represents functional requirement;
b2):For two-dimentional relation matrix T-R, carry out test use cases using essential strategy and redundancy strategy and simplify handy
Example collection T ';
c2):With reference to step 1) e1) obtained by each test case run cost value, greedy algorithm is used to use-case subset T ', it is raw
Into path determination, the less priori test use-case subset of cost;
d2):Strengthen rule using initial path pheromones, strengthen c2) in all test cases in the priori subset tried to achieve
The initial information element value of node;
e2):Ant number is set, the quantity of ant is set to primitive relation matrix is carried out to simplify rear remaining test case
Number;Every ant has an initial value to be empty disaggregation, for depositing the path that ant creeps;Every ant has one
The individual taboo list of oneself, the test case node that main storage ant had creeped, so as to prevent the ant from once being changed same
This test case node is selected again in generation;
f2):All test case nodes in test use cases T ' are randomly dispersed on these ants, while this is initial
The solution of ant is concentrated where node is placed on;
g2):Every ant calculates and selected the test case node that next step will be selected, when all ants select one
When meeting desired test case subset, ant stops epicycle search;
h2):Compare the test case subset that all ants are searched out, find out epicycle circulation in be completely covered each functional requirement,
The minimum test case subset of run cost;
i2):On the basis of all nodal information elements got over through ant are strengthened, additionally dynamically enhancing current iteration is optimal surveys
The pheromones value on test case node that example collection on probation is included;Current iteration terminates;
j2):Repeat e2)~i2), until obtaining most simple test case subset;
Above-mentioned steps 3) comprise the following steps:
a3):Determine test case coverage rate;
b3):Determine the coding strategy of test case;
c3):With reference to step 1) d1) obtained by weighted value determine fitness function:Obtaining each function using analytic hierarchy process (AHP) needs
The weighted value asked, while using the assessment formula based on overlap test, constructing the improved adaptive GA-IAGA comprising repeat demand and commenting
Estimate formula:
<mrow>
<mi>A</mi>
<mi>P</mi>
<mi>O</mi>
<mi>R</mi>
<mi>C</mi>
<mrow>
<mo>(</mo>
<mi>A</mi>
<mi>P</mi>
<mi>O</mi>
<mi>S</mi>
<mi>C</mi>
<mo>,</mo>
<mi>A</mi>
<mi>P</mi>
<mi>O</mi>
<mi>D</mi>
<mi>C</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mn>1</mn>
<mo>-</mo>
<mfrac>
<mn>1</mn>
<mi>n</mi>
</mfrac>
<mfrac>
<mrow>
<munderover>
<mi>&Sigma;</mi>
<mrow>
<mi>k</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<mo>&lsqb;</mo>
<mi>k</mi>
<mo>*</mo>
<mrow>
<mo>(</mo>
<munderover>
<mi>&Sigma;</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>n</mi>
<mi>u</mi>
<mi>m</mi>
</mrow>
</munderover>
<msub>
<mi>w</mi>
<mi>i</mi>
</msub>
<mo>)</mo>
</mrow>
<mo>&rsqb;</mo>
</mrow>
<mrow>
<munderover>
<mi>&Sigma;</mi>
<mrow>
<mi>k</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<munderover>
<mi>&Sigma;</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>n</mi>
<mi>u</mi>
<mi>m</mi>
</mrow>
</munderover>
<msub>
<mi>w</mi>
<mi>i</mi>
</msub>
</mrow>
</mfrac>
<mo>+</mo>
<mfrac>
<mn>1</mn>
<mrow>
<mn>2</mn>
<mi>n</mi>
</mrow>
</mfrac>
</mrow>
Wherein, n is the number of test case in test case sequence, and k is the functional requirement number corresponding to test case sequence
The sequence number of collection, wiThe weighted value of i-th of the functional requirement covered by k-th of test case, num is k-th of test case institute
The functional requirement number of covering;
d3):Determine selection opertor, crossover operator and mutation operator generation population of new generation;
e3):Repeat c3)~d3), until obtaining error detection speed highest test case sequence.
2. a kind of software test case optimizes system, it is characterized in that:By being constituted with lower module:
First module, it determines the weighted value of each functional requirement of system under test (SUT) using analytic hierarchy process (AHP);
Second module, the minimum test case of each functional requirement, run cost is completely covered using ant group algorithm acquisition is improved in it
Subset;
3rd module, for the most simple test case subset obtained by the calculating of the second module, row major is entered using improved adaptive GA-IAGA
Level sequence, obtains error detection speed highest test case sequence;
Above-mentioned first module performs following operate:
a1):Structural model is set up based on the correlation and membership between each element in system;
b1):Judgment matrix is set up using 1~9 scale and Paired Comparisons;
c1):Carry out Mode of Level Simple Sequence;
d1):Carry out the final weight value that total hierarchial sorting obtains each functional requirement;
e1):Test case run cost is assessed;
Above-mentioned second module performs following operate:
a2):For the relation of test use cases in system and functional requirement collection, two-dimensional matrix is generated, is represented with T-R, matrix
Row represents test case, and matrix column represents functional requirement;
b2):For two-dimentional relation matrix T-R, carry out test use cases using essential strategy and redundancy strategy and simplify handy
Example collection T ';
c2):With reference to the first module perform calculation step e1) obtained by each test case run cost value, to use-case subset T '
Using greedy algorithm, one path of generation is determined, the less priori test use-case subset of cost;
d2):Strengthen rule using initial path pheromones, strengthen c2) in all test cases in the priori subset tried to achieve
The initial information element value of node;
e2):Ant number is set, the quantity of ant is set to primitive relation matrix is carried out to simplify rear remaining test case
Number;Every ant has an initial value to be empty disaggregation, for depositing the path that ant creeps;Every ant has one
The individual taboo list of oneself, the test case node that main storage ant had creeped, so as to prevent the ant from once being changed same
This test case node is selected again in generation;
f2):All test case nodes in test use cases T ' are randomly dispersed on these ants, while this is initial
The solution of ant is concentrated where node is placed on;
g2):Every ant calculates and selected the test case node that next step will be selected, when all ants select one
When meeting desired test case subset, ant stops epicycle search;
h2):Compare the test case subset that all ants are searched out, find out epicycle circulation in be completely covered each functional requirement,
The minimum test case subset of run cost;
i2):On the basis of all nodal information elements got over through ant are strengthened, additionally dynamically enhancing current iteration is optimal surveys
The pheromones value on test case node that example collection on probation is included;Current iteration terminates;
j2):Repeat e2)~i2), until obtaining most simple test case subset;
Above-mentioned 3rd module performs following operate:
a3):Determine test case coverage rate;
b3):Determine the coding strategy of test case;
c3):With reference to step 1) d1) obtained by weighted value determine fitness function:Obtaining each function using analytic hierarchy process (AHP) needs
The weighted value asked, while using the assessment formula based on overlap test, constructing the improved adaptive GA-IAGA comprising repeat demand and commenting
Estimate formula:
<mrow>
<mi>A</mi>
<mi>P</mi>
<mi>O</mi>
<mi>R</mi>
<mi>C</mi>
<mrow>
<mo>(</mo>
<mi>A</mi>
<mi>P</mi>
<mi>O</mi>
<mi>S</mi>
<mi>C</mi>
<mo>,</mo>
<mi>A</mi>
<mi>P</mi>
<mi>O</mi>
<mi>D</mi>
<mi>C</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mn>1</mn>
<mo>-</mo>
<mfrac>
<mn>1</mn>
<mi>n</mi>
</mfrac>
<mfrac>
<mrow>
<munderover>
<mi>&Sigma;</mi>
<mrow>
<mi>k</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<mo>&lsqb;</mo>
<mi>k</mi>
<mo>*</mo>
<mrow>
<mo>(</mo>
<munderover>
<mi>&Sigma;</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>n</mi>
<mi>u</mi>
<mi>m</mi>
</mrow>
</munderover>
<msub>
<mi>w</mi>
<mi>i</mi>
</msub>
<mo>)</mo>
</mrow>
<mo>&rsqb;</mo>
</mrow>
<mrow>
<munderover>
<mi>&Sigma;</mi>
<mrow>
<mi>k</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<munderover>
<mi>&Sigma;</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>n</mi>
<mi>u</mi>
<mi>m</mi>
</mrow>
</munderover>
<msub>
<mi>w</mi>
<mi>i</mi>
</msub>
</mrow>
</mfrac>
<mo>+</mo>
<mfrac>
<mn>1</mn>
<mrow>
<mn>2</mn>
<mi>n</mi>
</mrow>
</mfrac>
</mrow>
Wherein, n is the number of test case in test case sequence, and k is the functional requirement number corresponding to test case sequence
The sequence number of collection, wiThe weighted value of i-th of the functional requirement covered by k-th of test case, num is k-th of test case institute
The functional requirement number of covering;
d3):Determine selection opertor, crossover operator and mutation operator generation population of new generation;
e3):Repeat c3)~d3), until obtaining error detection speed highest test case sequence.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410077655.9A CN103810104B (en) | 2014-03-04 | 2014-03-04 | A kind of software test case optimization method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410077655.9A CN103810104B (en) | 2014-03-04 | 2014-03-04 | A kind of software test case optimization method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103810104A CN103810104A (en) | 2014-05-21 |
CN103810104B true CN103810104B (en) | 2017-08-25 |
Family
ID=50706900
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410077655.9A Expired - Fee Related CN103810104B (en) | 2014-03-04 | 2014-03-04 | A kind of software test case optimization method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103810104B (en) |
Families Citing this family (27)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104391790A (en) * | 2014-11-21 | 2015-03-04 | 浪潮电子信息产业股份有限公司 | Automatic test case selection method based on greedy algorithm |
CN106033386A (en) * | 2015-03-10 | 2016-10-19 | 联想(北京)有限公司 | A software testing method and an electronic apparatus |
CN106933728B (en) * | 2015-12-29 | 2020-12-01 | 中移信息技术有限公司 | Method and device for measuring association between requirement and use case |
CN106095684B (en) * | 2016-06-17 | 2019-01-29 | 北京大学 | A kind of predictability mutation testing method |
CN106776311A (en) * | 2016-12-09 | 2017-05-31 | 华北计算技术研究所 | A kind of software interface test data auto generation method |
CN106874199B (en) * | 2017-02-10 | 2022-10-18 | 腾讯科技(深圳)有限公司 | Test case processing method and device |
CN106919504B (en) * | 2017-02-14 | 2020-09-22 | 浙江理工大学 | Test data evolution generation method based on GA algorithm |
CN109271320B (en) * | 2017-11-07 | 2021-09-24 | 西安邮电大学 | Higher-level multi-target test case priority ordering method |
CN107992414B (en) * | 2017-11-28 | 2020-11-17 | 曲明成 | Method for acquiring dependency relationship between process modules based on test cases |
CN107832228A (en) * | 2017-11-29 | 2018-03-23 | 北京锐安科技有限公司 | A kind of test case reduction method, device, equipment and storage medium |
CN108508745B (en) * | 2018-01-22 | 2021-02-19 | 中国铁道科学研究院通信信号研究所 | Multi-target test sequence set optimization generation method |
CN108920353A (en) * | 2018-04-03 | 2018-11-30 | 郑州云海信息技术有限公司 | A kind of test method, device and electronic equipment |
CN108537449B (en) * | 2018-04-12 | 2021-11-12 | 长江勘测规划设计研究有限责任公司 | Reservoir coordination scheduling strategy obtaining method considering river flood demand |
CN108958890A (en) * | 2018-07-25 | 2018-12-07 | 北京奇艺世纪科技有限公司 | Container microscope testing method, apparatus and electronic equipment |
CN109165159B (en) * | 2018-08-10 | 2021-10-01 | 北京理工大学 | Multi-defect positioning method based on program frequency spectrum |
CN109189673B (en) * | 2018-08-14 | 2021-08-27 | 联动优势电子商务有限公司 | Software test scheme, and method and device for determining test cases |
CN109783349B (en) * | 2018-12-10 | 2022-02-15 | 江苏大学 | Test case priority ranking method and system based on dynamic feedback weight |
CN109800169A (en) * | 2019-01-24 | 2019-05-24 | 拉扎斯网络科技(上海)有限公司 | Acquisition methods, device, readable storage medium storing program for executing and the electronic equipment of test case |
CN111240995B (en) * | 2020-01-21 | 2023-07-25 | 江西财经大学 | Multi-path coverage method and system combining key point probability and path similarity |
CN111324541A (en) * | 2020-03-05 | 2020-06-23 | 中国工程物理研究院计算机应用研究所 | Test case set reduction method based on error detection capability |
CN111949552A (en) * | 2020-09-03 | 2020-11-17 | Oppo广东移动通信有限公司 | Test case set generation method and device, computer equipment and storage medium |
CN112631907B (en) * | 2020-12-19 | 2024-04-02 | 北京化工大学 | Super heuristic frame upper layer scheduling method based on utilization and exploration |
CN112597718B (en) * | 2020-12-21 | 2023-10-03 | 海光信息技术股份有限公司 | Verification method, verification device and storage medium for integrated circuit design |
CN113128556B (en) * | 2021-03-10 | 2022-10-28 | 天津大学 | Deep learning test case sequencing method based on mutation analysis |
CN113900942B (en) * | 2021-10-09 | 2023-04-07 | 电子科技大学 | Method for generating simplified test case set of flight control machine-mounted model |
CN114091710B (en) * | 2022-01-20 | 2022-04-12 | 广东立升数字技术有限公司 | National maintenance technology supporting method and system |
CN116882212B (en) * | 2023-09-07 | 2023-12-01 | 中汽数据(天津)有限公司 | Error reporting and tracing method, device and equipment of non-causal equation of whole vehicle part simulation |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102063376A (en) * | 2011-02-16 | 2011-05-18 | 哈尔滨工程大学 | Test case selection method |
CN102323906A (en) * | 2011-09-08 | 2012-01-18 | 哈尔滨工程大学 | MC/DC test data automatic generation method based on genetic algorithm |
CN102880545A (en) * | 2012-08-30 | 2013-01-16 | 中国人民解放军63928部队 | Method for dynamically adjusting priority sequence of test cases |
CN103218299A (en) * | 2013-05-17 | 2013-07-24 | 网宿科技股份有限公司 | Automatic generating method and system of optimized ant colony algorithm test case |
CN103605611A (en) * | 2013-12-10 | 2014-02-26 | 浪潮电子信息产业股份有限公司 | Test case optimization method based on genetic algorithm |
-
2014
- 2014-03-04 CN CN201410077655.9A patent/CN103810104B/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102063376A (en) * | 2011-02-16 | 2011-05-18 | 哈尔滨工程大学 | Test case selection method |
CN102323906A (en) * | 2011-09-08 | 2012-01-18 | 哈尔滨工程大学 | MC/DC test data automatic generation method based on genetic algorithm |
CN102880545A (en) * | 2012-08-30 | 2013-01-16 | 中国人民解放军63928部队 | Method for dynamically adjusting priority sequence of test cases |
CN103218299A (en) * | 2013-05-17 | 2013-07-24 | 网宿科技股份有限公司 | Automatic generating method and system of optimized ant colony algorithm test case |
CN103605611A (en) * | 2013-12-10 | 2014-02-26 | 浪潮电子信息产业股份有限公司 | Test case optimization method based on genetic algorithm |
Non-Patent Citations (5)
Title |
---|
信息科技辑》.2010,(第7期),I138-399. * |
信息科技辑》.2012,(第12期),I138-119. * |
基于层次分析法的战术通信网络效能评估;卢紫毅等;《现代电子技术》;20110101;第34卷(第1期);第57页到第60页 * |
张瑞.基于改进蚁群算法的测试用例集约简技术研究.《中国优秀硕士学位论文全文数据库• * |
陈文萍."基于遗传算法的软件测试用例优化技术研究.《中国优秀硕士学位论文全文数据库• * |
Also Published As
Publication number | Publication date |
---|---|
CN103810104A (en) | 2014-05-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103810104B (en) | A kind of software test case optimization method and system | |
Marcus et al. | Plan-structured deep neural network models for query performance prediction | |
Petković et al. | Feature ranking for multi-target regression | |
Park et al. | Tools for interactive multiattribute decisionmaking with incompletely identified information | |
CN103971161B (en) | Hybrid recommendation method based on Cauchy distribution quantum-behaved particle swarm optimization | |
Von Buelow | ParaGen: Performative Exploration of generative systems | |
CN104484548B (en) | A kind of improved sequential Fault Diagnosis Strategy optimization method | |
CN105389505A (en) | Shilling attack detection method based on stack type sparse self-encoder | |
Crawford et al. | Dynamic selection of enumeration strategies for solving constraint satisfaction problems | |
Sun et al. | Boosting ant colony optimization via solution prediction and machine learning | |
Aggarwal et al. | On sensor selection in linked information networks | |
Chaudhuri et al. | DSLEUTH: A distributed version of SLEUTH urban growth model | |
Videau et al. | Multi-objective genetic programming for explainable reinforcement learning | |
CN114139940A (en) | Generalized demand side resource network load interaction level assessment method based on combined empowerment-cloud model | |
CN109491709B (en) | Software code controllability comprehensive evaluation method based on AHP and neural network | |
CN105930272A (en) | Important statement-based branch coverage testing data generation method | |
KR101462349B1 (en) | Method for multi-objective optimizing based on Pareto-optimality | |
de Moraes et al. | Parallelization of the next Closure algorithm for generating the minimum set of implication rules. | |
Mısır | Benchmark set reduction for cheap empirical algorithmic studies | |
CN101894063A (en) | Method and device for generating test program for verifying function of microprocessor | |
CN113792984B (en) | Cloud model-based anti-air defense anti-pilot command control model capability assessment method | |
CN112306665A (en) | Service integration method driven by sequence QoS | |
Konen et al. | Parameter-tuned data mining: A general framework | |
Marzouk et al. | Selecting building materials using system dynamics and ant colony optimization | |
CN110942149B (en) | Feature variable selection method based on information change rate and condition mutual information |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170825 Termination date: 20210304 |
|
CF01 | Termination of patent right due to non-payment of annual fee |