CN104461861B - Path test data generation method based on EFSM models - Google Patents
Path test data generation method based on EFSM models Download PDFInfo
- Publication number
- CN104461861B CN104461861B CN201410561899.4A CN201410561899A CN104461861B CN 104461861 B CN104461861 B CN 104461861B CN 201410561899 A CN201410561899 A CN 201410561899A CN 104461861 B CN104461861 B CN 104461861B
- Authority
- CN
- China
- Prior art keywords
- test data
- individual
- path
- efsm
- adaptive value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention discloses the path test data generation methods based on EFSM models, include the following steps:Step 1: carrying out semiology analysis and data flow dependency analysis to EFSM models, the path constraint of every EFSM model is obtained;Step 2: generating the test data for meeting path constraint using genetic algorithm, initial individuals are given;Step 3: assessing the fitness value of initial individuals according to fitness function, if the adaptive value of individual is 0, then such initial individuals are exactly the test data for meeting path constraint, algorithm terminates;Step 4: if the adaptive value in step 3 is not above the maximum algebraically of setting, there can be the individuals of minimum adaptive value as father's individual progress crossover operation or mutation operation when choosing two in former generation, a new generation's individual is generated, and step 3 and step 4 are repeated to individual of new generation.For with Complex Constraints or being related to the path of multivariable, our method generates high more of success rate ratio S.Kalaji methods for the test data for meeting institute's Prescribed Properties.
Description
Technical field
The present invention relates to software test fields, and in particular to the path test data generation method based on EFSM models.
Background technology
The research for having had much Test data generations about program at present has also had Many researchers handle to be based on searching
The method of rope has been applied to the field.But the article of the test data generating method about EFSM models be not it is very much, at present
Main method is as follows:
J.Zhang etc. proposes a kind of test data generating method of path-oriented, first semiology analysis acquisition approach about
Then beam solves the path constraint using constraint solver, obtain the input value for meeting constraints.But semiology analysis peace treaty
The limitation that beam solves is cannot to solve nonlinear restriction.
R.Lefticaru etc. defines the list entries that a fitness evaluation method carrys out acquisition approach, this method handle
The adaptation value function of Tracey has been applied to each migration in path, and the adaptive value in path passes through each letter in path
Number regards a key event as to define.The limitation of this method is that it requires each function i.e. nested comprising inner track
IF statement, otherwise cannot use Tracy method.
The it is proposeds such as S.Kalaji test EFSM using genetic algorithm, he combines work branch's distance and close to level
For the fitness function of genetic algorithm, the fitness function for the EFSM coordinates measurement test datas with Complex Constraints at
Power is not high.For the paths EFSM comprising equality constraint, it cannot generate and meet the constrained test data of institute, the test of generation
The average constraint rate that data violate is higher, illustrates the of low quality of test data.
R.Lefticaru etc. improves the fitness function of S.Kalaji, they are path decomposing at the sub- road of a plurality of independence
Diameter, and the adaptive value per single sub path is calculated according to the method for S.Kalaji, the adaptive value in whole path is each single sub path
The sum of adaptive value.They give those satisfactions and well adapt to be worth compared with the individual of many condition, this is similar with our method.But
It is that their method can still encounter the same problem of S.Kalaji methods, and we are not the independent sons that can find path
Path.
Invention content
The technical problem to be solved in the present invention is to provide the path test data generation methods based on EFSM models, with extension
Finite-state machine (EFSM) model generates the test data towards the paths EFSM as research object using genetic algorithm,
Its branch's distance and unlapped condition ratio are considered when calculating the fitness of individual simultaneously.In an experiment, our side
The method of the S.Kalaji of method and the prior art compares, the results showed that our method has preferable effect and can obtain
Obtain the preferable test data of quality.
In order to achieve the above objectives, technical scheme is as follows:
Path test data generation method based on EFSM models, includes the following steps:
Step 1: carrying out semiology analysis and data flow dependency analysis to EFSM models, the path of every EFSM model is obtained
Constraint;
Step 2: generating the test data for meeting path constraint using genetic algorithm, initial individuals are given;
Step 3: the fitness value of initial individuals is assessed according to fitness function, if the adaptive value of individual is 0, then this
The initial individuals of sample are exactly the test data for meeting path constraint, and algorithm terminates;
, can be when choosing two in former generation Step 4: if the adaptive value in step 3 is not above the maximum algebraically of setting
A individual with minimum adaptive value carries out crossover operation or mutation operation as father's individual, generates a new generation's individual, and to new
Generation individual repeats step 3 and step 4.
In a preferred embodiment of the invention, the adaptive value in the step 4 has been more than the maximum algebraically of setting,
Algorithm terminates.
In a preferred embodiment of the invention, the path constraint in the step 1 uses parallel IF statement table
Show.
In a preferred embodiment of the invention, include only input variable in the path constraint.
In a preferred embodiment of the invention, the fitness function be initial individuals branch's distance with individual not
The sum of the ratio of condition in the path constraint of covering.
Through the above technical solutions, the beneficial effects of the invention are as follows:
For with Complex Constraints or being related to the path of multivariable, our method generates the survey for meeting institute's Prescribed Properties
Try high more of success rate ratio S.Kalaji methods of data;
Path for can be only generated the test data that cannot fully meet all conditions includes the path of equation, we
The average constraint rate violated with the test data of generation generates the quality of test data to weigh, the test that our method generates
Quality of data ratio S.Kalaji methods it is high.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
Obtain other attached drawings according to these attached drawings.
Fig. 1 is the work flow diagram of the present invention.
Fig. 2 a are the EFSM models of the embodiment of the present invention 1.
Fig. 2 b are the EFSM models of the embodiment of the present invention 2.
Fig. 2 c are the EFSM models of the embodiment of the present invention 3.
Fig. 3 a are that the extension state machine model of the simple Aircraft Security System of the present invention generates the average algebraically of test data.
Fig. 3 b are that the extension state machine model of the simple Aircraft Security System of the present invention generates the success rate of test data.
Fig. 3 c are that the extension state machine model of the transport protocol of the present invention generates the average algebraically of test data.
Fig. 3 d are the average algebraically for the test data that the extension state machine model of the elevator device of the present invention generates.
Fig. 3 e are the average constraint rate that the test data of the extension state machine model production of the elevator device of the present invention violates.
Specific implementation mode
In order to make the technical means, the creative features, the aims and the efficiencies achieved by the present invention be easy to understand, tie below
Conjunction is specifically illustrating, and the present invention is further explained.
Referring to Fig.1, the path test data generation method based on EFSM models, includes the following steps:
Step 1: carrying out semiology analysis and data flow dependency analysis for EFSM models, the road in every path EFSM is obtained
Diameter constrains.
Step 2: generating the test data for meeting path constraint using genetic algorithm, initial individuals are given.
Step 3: according to the fitness value of fitness function assessment individual, fitness function here is the branch of individual
Distance and the sum of the ratio of condition in the unlapped path constraint of individual.If the adaptive value of individual is 0, such
Body is exactly the test data for meeting path constraint, and algorithm terminates.
Step 4: otherwise, if being not above the maximum algebraically of setting, there can be minimum when choosing two in former generation
The individual of adaptive value carries out crossover operation as father's individual, generates the individual of a new generation;Or when one tool of selection in former generation
There is the individual of minimum adaptive value to carry out mutation operation as father's individual, generates the individual of a new generation.It sets if more than most
Advanced algebra, algorithm terminate.Repeat step 3-step 4.
Concept related to the present invention is as follows:
The finite-state machine (EFSM) of 1.1 extensions
Finite-state machine (FSM) is a kind of Mealy automatic machines, it contains finite state set, migration collection and input and output
Collection.Since it is unable to the data portion of modeling, so herein using the finite-state machine of extension as system model.Extension
Finite-state machine context variable, predicate and operation are extended on the basis of FSM.
EFSM is a hexa-atomic group of (S;s0;V;I;O;T), wherein S is finite state set;s0It is original state;On V is
The hereafter set of variable;I is finite input massage set;O is finite output massage set;T is finite migration set.
It is a five-tuple (s to migrate t ∈ Ts;i;g;op;se), wherein ssIt is the source state of t;I ∈ I are inputs, it may
It is related with input parameter;G is the logical expression of referred to as guard condition;The behaviour that op is made of assignment statement or output statement etc.
Make;seIt is the dbjective state of t.
When in state ssWhen, if that receive is input i and guard condition g satisfactions, triggering migration t=(ss;i;g;
op;se), the operation and state being performed simultaneously in op are converted to se.G and op can include input parameter and context variable.I
Only consider determining EFSMs here.If for multiple migration with identical input from same state, primary
There are one the guard conditions migrated to meet, i.e., a migration can only be once triggered, then what EFSM was to determine.
In EFSM, the guard condition of migration can be connected by logical operator AND with OR.By the monitoring item of AND connections
Part we be expressed as nested IF statement.By the guard condition of OR connections, it is divided into OR operators number+1 and moved by we
It moves, their adaptive value is calculated separately, finally using the minimum value between them as the adaptive value of entire guard condition.
1.2 semiology analysis
Semiology analysis is a kind of program analysis method of static state, it is using value of symbol rather than actual value executes program,
Execute the result is that an expression formula about symbol.This is very useful for analyzing the relationship between outputting and inputting.
When semiology analysis is applied in the Test data generation in path, it is just portrayed as Test data generation problem
The problem of character expression obtained after solution value of symbol execution route.For example, it is contemplated that migration path t1t2t3, each migration
In predicate be x > 0 respectively, y < 15, z >=10, we use value of symbol a respectively, and b, c substitute into variable x, y, z, held with value of symbol
Walking along the street diameter t1t2t3After obtain character expression (a > 0AND b < 15AND c < 10), generate path t1t2t3Test data is asked
Topic has been converted into the problem of searching character expression (c >=10 a > 0AND b < 15AND) solution.
1.3 data flows rely on
There are some input variables and context variables in EFSM.Usually we only indicate to need to ask with input variable
The character expression of solution.So for the context variable in path, we need to replace them using data stream analysis techniques
At corresponding value and input variable.
Given variable v claims v in t if v is assigned as input parameter in migrating t or in the operation of t
It is defined, is denoted as def (t).If v quotes (c-use) in the predicate of migration t in reference (p-use) or in operation, claim
V is used in t, is denoted as use (t).
It gives from migration tiTo tjMigration path, v ∈ def (ti) and v ∈ use (tj), if v is in tiAnd tjBetween migration
On all do not redefine, then we claim from tiTo tjPath be v the clear path of definition.(ti;tj) it is known as the definition-of v
Reference pair, tjData dependence is in ti。
After the data flow of context variable relies on obtaining each migration, to replacement technology on these after our uses
Hereafter variable replacement is at corresponding value and input variable.So-called backward replacement is exactly from the last one migration in path from rear past
Pre-treatment, the definition that the variable replacement quoted in migration is relied at it, the path expression finally obtained are to contain only
The character expression of input variable.
1.4 genetic algorithm
Based on the test method of search the generation problem representation of test data at optimization problem.Based on search
It has to select a kind of mode indicating candidate solution and a kind of method of assessment candidate solution in test method.The expression side of candidate solution
Formula usually has binary system, integer and full mold coding.And assess candidate solution method we be commonly referred to as fitness function.Fitness
Function is the method for weighing candidate solution quality, it assigns a positive number to each candidate solution, this positive number is used for assessing candidate
It is also how far to dissociate acceptable solution.Because optimization problem is typically minimization problem, the time with relatively low adaptive value
Choosing solution is preferable, and solution is then acceptable with the solution that adaptive value is 0.
After we choose coding mode and define fitness function, so that it may to use meta-heuristic search technique.
And genetic algorithm is then a kind of powerful meta-heuristic technology.Us are each solved in genetic algorithm is known as chromosome, it
Be made of gene.The main flow of genetic algorithm is assessed using fitness function the individual in population, choosing
The solution with preferable adaptive value is selected as father's individual, then generates follow-on new individual with mutation operation by intersecting.
Comparative illustration hereafter is carried out to S.Kalaji methods and the embodiment of the present invention:
We analyze in terms of three.
With reference to (the Simple in-flight safety system of embodiment 1 for the EFSM models that Fig. 2 a are the present invention
The extension state machine model of the simple Aircraft Security Systems of EFSM -), it is to generate the average generation of test data for the first aspect
Number.
With reference to (the Class II transport protocol of embodiment 2 for the EFSM models that Fig. 2 b are the present invention
The extension state machine model of EFSM-transport protocol), for the second aspect be cannot 100% generate test data the case where
Under, consider the success rate of two methods.
With reference to (the extension of Lift system EFSM-elevator device of embodiment 3 for the EFSM models that Fig. 2 c are the present invention
State machine model), it is to consider life in the case where completely the test data for meeting constraints cannot be generated for third aspect
At test data violate the average ratio that constrains in path.
Our method and the method for S.Kalaji all use Genetic Algorithm and Direct Search
Toolbox for Mathlab 7.0 are realized.We are using full mold coded representation individual, using random uniform design, selection
Scalar intersects, crossover probability 0.8, and using Gaussian mutation, selected population size is 20, and the initial value range of each variable is
[0 ... 100], the condition for searching for termination are that adaptive value is 0 or reaches maximum algebraically 1000.Search is executed for every migration path
10 times.
With reference to 3a, Fig. 3 b, Fig. 3 c and Fig. 3 d;According to migration coverage criterion, Simple in-flight safety
A total of 20 migration paths of system EFSM, the average algebraically that test data is generated for this 20 paths are shown in Fig. 3 a.
Two methods are in addition to path p2;p17;p18;p19;p20;When other coordinates measurement test datas outside p21,
Their average algebraically is roughly the same, all 52 or so.This is probably due in these paths, their constraint is all very simple
It is single, and pertain only to single variable.In the case of such, the performance of two methods is identical.To path p2;p17;p18;
p19;p20;P21 generate test data when, it is proposed that method average algebraically ratio S.Kalaji method it is high.
Both of which is successfully generated the test data for meeting path constraint every time in cannot being searched at 10 times, but I
Method generate test data probability of success ratio S.Kalaji high more of method, two methods are the life of this 6 paths
See Fig. 3 b at the success rate of test data.
This be possible this 6 paths constraint it is more complex, and be related to multiple variables, the method for S.Kalaji individual not
Higher adaptive value just is assigned to it when meeting compared with the constraint of outer layer, but although some individuals are unsatisfactory for individual outer layer constraints completely
The multiple internal layer constraints of foot, select such individual that may generate optimal solution.Such individual generates test number in S.Kalaji
It is but rejected during, leading to S.Kalaji methods, convergence obtains poor optimal solution faster faster, so
It cannot be the coordinates measurement test data with Complex Constraints to lead to him.
And it is proposed that method consider individual for constraint coverage condition, the higher individual fitness of coverage rate is more
It is low.Our method can select that the individual of optimal solution may be generated, that is, be unsatisfactory for outer layer constraint but meet multiple internal layer constraints
Individual.So average algebraically ratio S.Kalaji methods are high when leading to generate test data, but generate the success of test data
High more of rate ratio S.Kalaji methods.
Similarly, according to migration coverage criterion, a total of 12 paths of Transport Protocol EFSM, be this 12
The average algebraically that paths generate test data is shown in Fig. 3 c.Two methods can be that the coordinates measurement other than p8 tests number
According to, and average algebraically is almost the same.Cannot be the reason of p8 generates test data be p8 path constraint in include equation, and wait
Formula is very inappeasable.
There are 24 paths in Lift System EFSM, wherein only p1 and two paths of p2 can be obtained by genetic algorithm
Access evidence.For other paths, both of which cannot generate the test data for meeting constraints, but our side
The method that method generates the average algebraically ratio S.Kalaji of optimal solution is high, and the reason of causing this result is the same as In Flight Safety
Explanation in System EFSM.The path that these are failed with generation test data, in order to analyze the quality of two methods, I
The average bound rate that is violated from the test data of generation be compared.The average about beam ratio that the method for S.Kalaji violates
Rate is about 80%, and the average bound rate that our method violates is about 10%, that is to say, that our method generates
Test data other than violating equation it is other constraint all be meet.The average bound rate that we are violated with test data
Weigh the quality of test data, the average bound rate of violation is lower, then test data quality is higher.From the point of view of Fig. 3 e, I
Method generate test data quality ratio S.Kalaji methods it is much higher.
The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention.The technology of the industry
Personnel are it should be appreciated that the present invention is not limited to the above embodiments, and the above embodiments and description only describe this
The principle of invention, without departing from the spirit and scope of the present invention, various changes and improvements may be made to the invention, these changes
Change and improvement all fall within the protetion scope of the claimed invention.The claimed scope of the invention by appended claims and its
Equivalent thereof.
Claims (1)
1. the path test data generation method based on EFSM models, which is characterized in that include the following steps:Step 1: right
EFSM models carry out semiology analysis and data flow dependency analysis, obtain the path constraint of every EFSM model;Step 2: making
The test data for meeting path constraint is generated with genetic algorithm, gives initial individuals;Step 3: being assessed according to fitness function
The fitness value of initial individuals, if the adaptive value of individual is 0, then such initial individuals are exactly the survey for meeting path constraint
Data are tried, algorithm terminates;Step 4: if the adaptive value in step 3 is not above the maximum algebraically of setting, former generation can worked as
It is middle to choose two individuals with minimum adaptive value as father's individual progress crossover operation or mutation operation, it is a to generate a new generation
Body, and step 3 and step 4 are repeated to individual of new generation;Adaptive value in the step 4 has been more than the maximum generation of setting
Number, algorithm terminate;Path constraint in the step 1 is indicated using parallel IF sentences;Include only in the path constraint
Input variable;The fitness function is the ratio of the branch's distance and the condition in the unlapped path constraint of individual of initial individuals
The sum of rate.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410561899.4A CN104461861B (en) | 2014-10-21 | 2014-10-21 | Path test data generation method based on EFSM models |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410561899.4A CN104461861B (en) | 2014-10-21 | 2014-10-21 | Path test data generation method based on EFSM models |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104461861A CN104461861A (en) | 2015-03-25 |
CN104461861B true CN104461861B (en) | 2018-07-27 |
Family
ID=52907950
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410561899.4A Active CN104461861B (en) | 2014-10-21 | 2014-10-21 | Path test data generation method based on EFSM models |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104461861B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104765690B (en) * | 2015-04-22 | 2017-10-27 | 哈尔滨工业大学 | Embedded software test data generation method based on fuzzy genetic algorithm |
CN104881359B (en) * | 2015-06-10 | 2017-11-24 | 南京大学 | A kind of automatic generation of test data covered with linear fit realizing route |
CN107153605B (en) * | 2016-03-02 | 2021-07-06 | 阿里巴巴集团控股有限公司 | Test sample generation method and device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010123111A (en) * | 2008-11-21 | 2010-06-03 | Toyota Motor Engineering & Manufacturing North America Inc | Method and system for automatic test data generation for lookup table |
CN102368226A (en) * | 2011-10-10 | 2012-03-07 | 南京大学 | Method for automatically generating test cases based on analysis on feasible paths of EFSM (extended finite state machine) |
CN104077228A (en) * | 2014-07-08 | 2014-10-01 | 浙江理工大学 | EFSM performable test sequence generating method based on predicate dependency graph |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9323650B2 (en) * | 2012-07-23 | 2016-04-26 | Infosys Limited | Methods for generating software test input data and devices thereof |
-
2014
- 2014-10-21 CN CN201410561899.4A patent/CN104461861B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010123111A (en) * | 2008-11-21 | 2010-06-03 | Toyota Motor Engineering & Manufacturing North America Inc | Method and system for automatic test data generation for lookup table |
CN102368226A (en) * | 2011-10-10 | 2012-03-07 | 南京大学 | Method for automatically generating test cases based on analysis on feasible paths of EFSM (extended finite state machine) |
CN104077228A (en) * | 2014-07-08 | 2014-10-01 | 浙江理工大学 | EFSM performable test sequence generating method based on predicate dependency graph |
Non-Patent Citations (2)
Title |
---|
An improved test generation approach from extended finite state machines using genetic algorithms;Lefticaru R, Ipate F;《International Conference on Software Engineering and Formal Methods》;20121031;第294-296页 * |
An integrated search-based approach for automatic testing from extended finite state machine (EFSM) models;Kalaji A S, Hierons R M, Swift S;《Information and Software Technology》;20110616;第1299-1309页 * |
Also Published As
Publication number | Publication date |
---|---|
CN104461861A (en) | 2015-03-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105574098B (en) | The generation method and device of knowledge mapping, entity control methods and device | |
US11113433B2 (en) | Technique for generating a spectrum of feasible design solutions | |
Malhotra¹ et al. | Software maintainability prediction using machine learning algorithms | |
CN104536881B (en) | Many survey error reporting prioritization methods based on natural language analysis | |
CN110008259A (en) | The method and terminal device of visualized data analysis | |
CN104461861B (en) | Path test data generation method based on EFSM models | |
Assunção et al. | A multi-criteria strategy for redesigning legacy features as microservices: An industrial case study | |
CN104317886B (en) | The search choosing method at neighbour's conditional number strong point when tomography constrains lower Grid node interpolation | |
CN111446002A (en) | Novel coronavirus patient state of illness classification system based on artificial intelligence | |
CN112364352A (en) | Interpretable software vulnerability detection and recommendation method and system | |
CN105630797B (en) | Data processing method and system | |
CN107025169A (en) | A kind of software error layering diagnostic method based on Bayesian Network Inference | |
CN109086291A (en) | A kind of parallel method for detecting abnormality and system based on MapReduce | |
CN110334105A (en) | A kind of flow data Outlier Detection Algorithm based on Storm | |
CN105184403B (en) | The workflow allocation optimum optimization method examined based on machine learning and statistical model | |
CN112087316A (en) | Network anomaly root cause positioning method based on anomaly data analysis | |
JPWO2018025707A1 (en) | Table meaning estimation system, method and program | |
Reza et al. | Innovative approach in web application effort & cost estimation using functional measurement type | |
Paradis | The distribution of branch lengths in phylogenetic trees | |
Pan et al. | Refactoring packages of object–oriented software using genetic algorithm based community detection technique | |
CN110321458A (en) | A kind of dataflow analysis method and device based on controlling stream graph | |
CN109783361A (en) | The method and apparatus for determining code quality | |
Mueller et al. | Automated root cause analysis of non-conformities with machine learning algorithms | |
Tao et al. | Multi-objective grammar-guided genetic programming with code similarity measurement for program synthesis | |
Pan et al. | Recode: software package refactoring via community detection in bipartite software networks |
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 |