CN114579435B - Method for generating software test case - Google Patents
Method for generating software test case Download PDFInfo
- Publication number
- CN114579435B CN114579435B CN202210166764.2A CN202210166764A CN114579435B CN 114579435 B CN114579435 B CN 114579435B CN 202210166764 A CN202210166764 A CN 202210166764A CN 114579435 B CN114579435 B CN 114579435B
- Authority
- CN
- China
- Prior art keywords
- vector
- coverage
- software
- groups
- vector group
- 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
- 238000000034 method Methods 0.000 title claims abstract description 42
- 239000013598 vector Substances 0.000 claims abstract description 217
- 239000011159 matrix material Substances 0.000 claims abstract description 33
- 238000012360 testing method Methods 0.000 claims abstract description 27
- 125000004122 cyclic group Chemical group 0.000 claims abstract description 10
- 238000013461 design Methods 0.000 claims description 13
- 238000012937 correction Methods 0.000 claims description 12
- 238000010276 construction Methods 0.000 claims description 5
- 238000006243 chemical reaction Methods 0.000 abstract description 6
- 230000000694 effects Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 239000002245 particle Substances 0.000 description 2
- 238000000926 separation method Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 238000013101 initial test Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000035515 penetration Effects 0.000 description 1
- 238000012372 quality testing Methods 0.000 description 1
- 238000010845 search algorithm Methods 0.000 description 1
- 230000033772 system development Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/16—Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- General Engineering & Computer Science (AREA)
- Pure & Applied Mathematics (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Quality & Reliability (AREA)
- Computer Hardware Design (AREA)
- Data Mining & Analysis (AREA)
- Computing Systems (AREA)
- Algebra (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention relates to a method for generating software test cases, which comprises the steps of firstly obtaining a coverage vector group based on conversion of a coverage array problem, applying an evolutionary algorithm, then introducing a matrix cyclic modulo addition method, constructing a coverage array meeting parameter requirements, finally obtaining a software test case scheme which covers preset k+1 software types and respectively comprises v+1 selectable test software by conversion, and providing a test case generation scheme under the condition that the coverage intensity is equal to 2 on the basis of analyzing the mathematical structure of the coverage array. Compared with a direct heuristic method, the method can realize the generation of a software test case scheme by only searching an initial vector group, reduce the running time of a program and improve the searching efficiency.
Description
Technical Field
The invention relates to a method for generating a software test case, and belongs to the technical field of software test.
Background
With the continuous penetration of computer technology into various industries of society, the functions of software and hardware systems are increasingly powerful, the functions and the running environment of current software are becoming increasingly complex, and society is increasingly dependent on safe and high-quality software and hardware systems. Testing is a key means of ensuring the quality and efficiency of these systems and is an important and expensive link in system development. However, for a large software system, there are many factors that affect the operation of the system, and it is necessary to detect the effect of interactions between the factors on the system?
On the one hand, in order to comprehensively test a large-scale software or hardware system, various factors which may affect the system need a lot of time and resources, and it is generally considered that the test cost for developing a software system is at least 50% of the total cost of developing a hardware system, and the test cost for developing a hardware system is often higher.
On the other hand, the consequences of under-testing may be catastrophic. An extreme example is the initial test launch of the Ariane 5 launch vehicle of the asian class five in 1996, where the main processor and the standby processor are simultaneously overflowed to cause shutdown due to software failure controlling rocket flight, so that the whole rocket itself is destroyed 37 seconds after launch, which can be said to be the most serious software failure event in history.
In order to design a suitable test system, a scientific and effective test of the system is realized with fewer experiment times, and factors to be considered are generally classified into limited classes, each class comprises limited possible configurations, and the possible configurations are respectively selected from different classes for combined test. There is evidence that in most cases software conflicts occur with only a few classes of cross-configurations, so in general high quality testing only needs to check the relationship between any of several classes of factors in the system and the interactions on system performance, while minimizing the number of tests.
The combination test is an important method in the software test, and Cohen et al (Cohen MB,Gibbons PB,Mugridge WB,Colbourn CJ.Constructing test suites for interaction testing.In:Dillon L,Tichy W,eds.Proc.ofthe Int'l Conf.on Software Engineering(ICSE).Loa Alamitos:IEEE Press,2003.38-48.) in 2003 describes the test case set by adopting the mathematical structure of the coverage array (Covering Array), so that in order to reduce the cost of the test software, only the coverage array with fewer rows needs to be constructed.
Assuming that there are k classes of factors affecting the system, there are v possible configurations in each class, and the coverage array CA λ (N; t, k, v) is defined as an Nxk matrix, satisfying at least λ occurrences for any Nxt order submatrix, where t is the strength of the cross coverage. When λ=1, the coverage array can be abbreviated as CA (N; t, k, v).
Regarding the coverage array, various construction methods have been proposed by different students, such as greedy (Cohen,D.M.;Dalal,S.R.;Fredman,M.L.&Patton,G.C.The AETG system:An approach to testing based on combinatorial design.IEEE Transactions on Software Engineering,1997,23,437-444)、 particle swarm algorithm (Wu,H.;Nie,C.;Kuo,F.C.;Leung,H.&Colbourn,C.J.A Discrete Particle Swarm Optimization for Covering Array Generation.IEEE Transactions on Evolutionary Computation,2015,19,575-591) based on computer search by means of a mathematical tool's difference method (Li,Y.;Ji,L.&Yin,J.Covering arrays of strength 3and 4from holey difference matrices.Designs,Codes and Cryptography,2009,50,339-350),, and so on.
In the methods, the method based on the mathematical principle can obtain better calculation effect only under the specific parameter setting and cannot be popularized to the general parameters; while computer search algorithms consider less mathematical structures, which can give a viable solution under general parameters, they are time consuming and often difficult to guarantee in the case of limited computation time.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a method for generating the software test case, which adopts brand new logic design, has wide applicable parameters, can realize the generation of the software test case scheme by only searching the initial vector group, and has high construction efficiency.
The invention adopts the following technical scheme for solving the technical problems: the invention designs a method for generating a software test case, which is used for obtaining a software test case scheme covering preset k+1 software types and respectively comprising v+1 selectable test software, and the method is implemented according to the following steps:
Step A, aiming at the combination test scheme design problem of the selectable test software of different software types, obtaining the corresponding construction coverage array CA (2, k+1, v+1) problem, and then entering the step B;
step B, generating an initial coverage vector group by applying an evolution algorithm, and then entering the step C;
Step C, constructing a coverage array meeting parameter requirements CA (2, k+1, v+1) by applying a matrix cyclic modular addition method based on the initial coverage vector group, and then entering the step D;
And D, converting the coverage array into a corresponding software test case scheme.
As a preferred technical scheme of the invention: the step B comprises the following steps B1 to B5;
step B1, initializing the value of the vector group B as an empty set, initializing the iteration times n=1, and then entering step B2;
B2, updating the vector group B by using the correction operator so that the position difference coverage between every two data objects in each vector in the vector group B is satisfied The required set C is updated by adding 1 according to the iteration number n, wherein Z v = {0, 1, …, v-1}, and then the step B3 is carried out;
B3, judging whether the value of the iteration times N is equal to a preset first maximum iteration times N, if so, obtaining N vector groups B, and entering a step B4; otherwise, returning to the step B2; the method comprises the steps of presetting a first maximum iteration number N to be a positive even number;
Step B4., iteratively executing the following steps B4-1 to B4-2 until a preset iteration overflow condition is met, and then entering step B5;
B4-1, sorting the N vector groups B according to the number of vectors respectively contained in the N vector groups B in the order from small to large, selecting the first P vector groups B in the sorting according to a preset rule, defining the first vector group B in the first P vector groups B as the current iteration optimal solution, and then entering the step B4-2;
step B4-2, updating the vector group B according to a preset rule for each of the remaining vector groups B except the first P vector groups B in the N vector groups B, so that the position difference coverage between every two data objects in each vector in the vector group B is satisfied The required set C is used for updating the rest vector groups B except the former P vector groups B in the N vector groups B;
In step B5., according to the number of vectors contained in each of the N vector groups B, a vector group B corresponding to the minimum number of vectors contained therein is selected to form an initial coverage vector group.
As a preferred technical scheme of the invention: in the step B4-1, the following steps are performedThe first P vector groups B are selected from the ordering of the N vector groups B, wherein a represents a preset selection proportion,/>, andRepresenting an upward rounding; or by p= (N/2), the first P vector groups B are selected from the ordering of the N vector groups B.
As a preferred technical scheme of the invention: in the step B4-2, the following steps B4-2-1 to B4-2-3 are executed for each remaining vector group B except the first P vector groups B in the N vector groups B, and the update is performed for the vector group B so that the position difference coverage between every two data objects in each vector in the vector group B is satisfiedThe required set C is used for updating the rest vector groups B except the former P vector groups B in the N vector groups B;
step B4-2-1, applying the current optimal solution, replacing and updating the vector group B, and entering the step B4-2-2;
Step B4-2-2, randomly deleting a vector from the vector group B, updating the vector group B, and entering step B4-2-3;
step B4-2-3. Updating the vector group B by using a correction operator so that the position difference coverage between every two data objects in each vector in the vector group B is satisfied Set of requirements C.
As a preferred technical scheme of the invention: in the steps B2 and B4-2-3, the vector group B is updated by using a correction operator according to the following steps a) to d), so that the position difference coverage between every two data objects in each vector in the vector group B is satisfiedA set of requirements C;
step a), calculating a position difference set between every two data objects in each vector in the current vector group B, if the set covers the set C, finishing correction to obtain a group of vector groups B meeting the requirements, returning to the vector groups B, and exiting the process; otherwise, arbitrarily selecting one data object x which is not covered in the set C, and entering the step b);
Step b) randomly selecting k data objects from Z v to form a row vector u with the length of k, and entering the step c);
Step c) randomly selecting a position in the row vector u, modifying the value of the position, enabling the position difference of the row vector u to cover the data object x, and then entering step d);
Step d) adding the row vector u to the vector group B, updating the vector group B, and returning to step a).
As a preferred technical scheme of the invention: the preset iteration overflow condition in the step B4 includes a preset second maximum iteration number or a preset convergence condition satisfied by iteration of the population formed by the preset N vector groups B.
As a preferred technical scheme of the invention: the step C comprises the following steps C1 to C4, and a coverage array meeting parameter requirements CA (2, k+1, v+1) is constructed;
Step C1. Respectively aiming at each vector B i=(vi,0、vi,1、...、vi,k-1 in the initial coverage vector group, obtaining a cyclic matrix corresponding to the vector B i, adding an all-zero column on the left side of the matrix, and forming a matrix M i corresponding to the vector B i, wherein i=1, 2, & gt, M represents the number of vectors in the initial coverage vector group, and then entering step C2;
Step C2. is directed to the matrix M i corresponding to each vector B i, as follows:
V modulo matrixes corresponding to the matrix M i are obtained Thereby obtaining v modulo matrixes/>, which correspond to the vectors B i respectivelyThen enter step C3;
step C3. is as follows:
Constructing a special matrix M 0, and then entering a step C4;
Step C4. Matrix all the modules And special matrix M 0 are arranged vertically in blocks to form a coverage array meeting parameter requirements CA (2, k+1, v+1), and kmv +v+1 rows in total.
As a preferred technical scheme of the invention: in the step D, each element belonging to Z v { infinity } in the coverage array is replaced by each piece of optional test software respectively, namely, a software test case scheme is formed, wherein each row represents k+1 pieces of optional test software to carry out one test.
Compared with the prior art, the method for generating the software test case has the following technical effects:
(1) The invention designs a software test case generating method, firstly, based on the conversion of the problem of a coverage array, an evolutionary algorithm is applied to obtain a coverage vector group, then a matrix cyclic modulo addition method is introduced to construct a coverage array meeting parameter requirements, finally, a software test case scheme which is used for obtaining coverage preset k+1 software types and respectively comprises v+1 selectable test software is obtained through conversion, and the whole design is to propose a test case generating scheme under the condition that the coverage intensity is equal to 2 on the basis of analyzing the mathematical structure of the coverage array. Compared with a direct heuristic method, the method can realize the generation of a software test case scheme by only searching an initial vector group, reduce the running time of a program and improve the searching efficiency.
Drawings
FIG. 1 is a block diagram of a method of generating a software test case designed in the present invention.
Detailed Description
The following describes the embodiments of the present invention in further detail with reference to the drawings.
The invention designs a method for generating a software test case, which is used for obtaining a software test case scheme covering preset k+1 software types and respectively comprising v+1 selectable test software for each software type, and in practical application, as shown in fig. 1, the method is specifically executed as follows.
Step A, aiming at the combination test scheme design problem of the selectable test software of different software types, obtaining the corresponding construction coverage array CA (2, k+1, v+1) problem, and then entering the step B;
step B, generating an initial coverage vector group by applying an evolution algorithm, and then entering the step C;
In practical applications, the above step B is specifically performed as follows steps B1 to B5.
Step B1, initializing the value of the vector group B as an empty set, initializing the iteration number n=1, and then entering step B2.
B2, updating the vector group B by using the correction operator so that the position difference coverage between every two data objects in each vector in the vector group B is satisfiedThe set C is required and updated by 1 for the number of iterations n, where Z v = {0, 1, …, v-1}, then step B3 is entered.
Here "position difference", i.e. the s-separation difference setSet covered by k-1 for s=1, …/>The s-separation difference set is defined herein as
Dis={vi,p-vi,q(mod v):q-p≡s(modk),vi,p≠∞,vi,q≠∞},s=1,2,…,k-1,
Wherein, all operation modes v are kept constant.
B3, judging whether the value of the iteration times N is equal to a preset first maximum iteration times N, if so, obtaining N vector groups B, and entering a step B4; otherwise, returning to the step B2; the first maximum iteration number N is preset to be positive even number.
Step B4. is performed iteratively as follows steps B4-1 to B4-2 until a preset second maximum number of iterations is met, or a preset convergence condition is met by the iteration of the population constituted by the preset N vector groups B, and then step B5 is performed.
Step B4-1, according to the number of vectors contained in the N vector groups B, sorting the N vector groups B according to the order of the number of the vectors contained in the N vector groups B from small to large, and according to the order of the number of the vectors contained in the N vector groups BDefining the first P vector groups B in the sorting as the optimal solution of the current iteration by the first P vector groups B in the sorting, and then entering a step B4-2; wherein a represents a preset selection ratio, and a can select 50% in specific practical application, namely, the first half vector group B,/>, in the sequenceRepresenting an upward rounding; or by p= (N/2), the first P vector groups B are selected from the ordering of the N vector groups B.
Step B4-2, updating the vector group B according to a preset rule for each of the remaining vector groups B except the first P vector groups B in the N vector groups B, so that the position difference coverage between every two data objects in each vector in the vector group B is satisfiedThe required set C further updates each remaining vector group B of the N vector groups B except the first P vector groups B.
In the implementation, in the step B4-2, the following steps B4-2-1 to B4-2-3 are performed for each remaining vector group B except the first P vector groups B in the N vector groups B, and the update is performed for the vector group B so that the position difference coverage between every two data objects in each vector in the vector group B is satisfiedThe required set C further updates each remaining vector group B of the N vector groups B except the first P vector groups B.
And B4-2-1, applying the current optimal solution, carrying out replacement updating on the vector group B, and entering into the step B4-2-2.
And B4-2-2, randomly deleting a vector from the vector group B, updating the vector group B, and entering into a step B4-2-3.
Step B4-2-3. Updating the vector group B by using a correction operator so that the position difference coverage between every two data objects in each vector in the vector group B is satisfiedSet of requirements C.
In step B5., according to the number of vectors contained in each of the N vector groups B, a vector group B corresponding to the minimum number of vectors contained therein is selected to form an initial coverage vector group.
In the steps B1 to B5, the steps B2 and B4-2-3 are respectively performed according to the following steps a) to d), and the correction operator is used to update the vector group B so that the position difference coverage between every two data objects in each vector in the vector group B is satisfiedSet of requirements C.
Step a), calculating a position difference set between every two data objects in each vector in the current vector group B, if the set covers the set C, finishing correction to obtain a group of vector groups B meeting the requirements, returning to the vector groups B, and exiting the process; otherwise, arbitrarily selecting one data object x which is not covered in the set C, and proceeding to the step b).
Step b) randomly selecting k data objects from Z v to form a row vector u with the length of k, and entering step c).
Step c) randomly selecting a position in the row vector u, modifying the value of the position so that the position difference of the row vector u covers the data object x, and then entering step d).
Step d) adding the row vector u to the vector group B, updating the vector group B, and returning to step a).
And C, constructing a coverage array meeting the parameter requirement CA (2, k+1, v+1) by applying a matrix cyclic modulo addition method based on the initial coverage vector group, and then entering the step D.
In practical applications, the above step C is specifically performed as steps C1 to C4, and a coverage array satisfying the parameter requirement CA (2, k+1, v+1) is constructed.
Step C1. For each vector B i=(vi,0、vi,1、...、vi,k-1 in the initial coverage vector set, a cyclic matrix corresponding to the vector B i is obtained, and an all-zero column is added to the left side of the matrix to form a matrix M i corresponding to the vector B i, where i=1, 2,..m, M represents the number of vectors in the initial coverage vector set, and then step C2 is entered.
Step C2. is directed to the matrix M i corresponding to each vector B i, as follows:
V modulo matrixes corresponding to the matrix M i are obtained Thereby obtaining v modulo matrixes/>, which correspond to the vectors B i respectivelyThen step C3 is entered.
Step C3. is as follows:
A special matrix M 0 is constructed and then step C4 is entered.
Step C4. Matrix all the modulesAnd the special matrix M0 is vertically arranged in blocks to form a coverage array meeting parameter requirements CA (2, k+1, v+1), and the coverage array is totally kmv +v+1 rows.
And D, replacing each element belonging to the Z v U-shaped { infinity } in the coverage array with each piece of optional test software to form a software test case scheme, namely converting the coverage array into a corresponding software test case scheme, wherein each row represents k+1 pieces of optional test software to perform one test.
The method for generating the designed software test cases is applied to practice, such as presetting software test case schemes of 8 software types, wherein each software type comprises 10 pieces of optional test software, and the test schemes are designed so that the combined test schemes of the optional test software of every two different software types are tested at least once.
Firstly, converting the problem into a structure CA (2, k+1, v+1), wherein v= 9,k =7, and generating an initial coverage vector group (m=2):
B1=(∞,0,7,4,5,1,4),B2=(4,4,8,6,2,3,2),
Satisfy the following requirements And calculating position differences of each group:
D11={-,7,6,1,5,3,-},D12={-,4,7,6,8,-,5},D13={-,5,3,0,-,8,3},
D21={0,4,7,5,1,8,2},D22={4,2,3,6,0,1,2},D23={2,7,4,5,2,1,6};
It is easy to see that:
D11∪D21=D12∪D22=D13∪D23=Z9,
CA (2, k+1, v+1) is satisfied, a cyclic matrix and a modulo matrix are generated, and all modulo matrices and special matrices M 0 are arranged vertically, so that a covered array CA (kmv +v+1;2, k+1, v+1), that is, a covered array CA (136; 2,8, 10) is obtained.
According to the constructed array design test scheme, 8 types of different types of software can be realized, each type of software has 10 choices, and through 136 tests, each combination of two different types of software is ensured to be tested at least once, as shown in the following table 1.
TABLE 1
According to the method for generating the software test case designed by the technical scheme, firstly, the coverage vector group is obtained by applying an evolutionary algorithm based on the conversion of the coverage array problem, then, a matrix cyclic modulo addition method is introduced, the coverage array meeting the parameter requirement is constructed, finally, the software test case schemes which cover preset k+1 software types and respectively comprise v+1 selectable test software are obtained by conversion, and the whole design is that the test case generation scheme under the condition that the coverage intensity is equal to 2 is provided on the basis of analyzing the mathematical structure of the coverage array. Compared with a direct heuristic method, the method can realize the generation of a software test case scheme by only searching an initial vector group, reduce the running time of a program and improve the searching efficiency.
The embodiments of the present invention have been described in detail with reference to the drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the spirit of the present invention.
Claims (7)
1. The method for generating the software test case is used for obtaining a software test case scheme which covers preset k+1 software types and respectively comprises v+1 selectable test software, and is characterized by comprising the following steps of:
step A, aiming at the combination test scheme design problem of the selectable test software of different software types, obtaining the corresponding construction coverage array CA (2, k+1, v+1) problem, and then entering the step B;
step B, generating an initial coverage vector group by applying an evolution algorithm, and then entering the step C;
Step C, constructing a coverage array meeting parameter requirements CA (2, k+1, v+1) by applying a matrix cyclic modular addition method based on the initial coverage vector group, and then entering the step D;
Step D, converting the coverage array into a corresponding software test case scheme;
the step B comprises the following steps B1 to B5;
step B1, initializing the value of the vector group B as an empty set, initializing the iteration times n=1, and then entering step B2;
B2, updating the vector group B by using the correction operator so that the position difference coverage between every two data objects in each vector in the vector group B is satisfied The required set C is updated by adding 1 according to the iteration number n, wherein Z v = {0, 1, …, v-1}, and then the step B3 is carried out;
B3, judging whether the value of the iteration times N is equal to a preset first maximum iteration times N, if so, obtaining N vector groups B, and entering a step B4; otherwise, returning to the step B2; the method comprises the steps of presetting a first maximum iteration number N to be a positive even number;
Step B4., iteratively executing the following steps B4-1 to B4-2 until a preset iteration overflow condition is met, and then entering step B5;
B4-1, sorting the N vector groups B according to the number of vectors respectively contained in the N vector groups B in the order from small to large, selecting the first P vector groups B in the sorting according to a preset rule, defining the first vector group B in the first P vector groups B as the current iteration optimal solution, and then entering the step B4-2;
step B4-2, updating the vector group B according to a preset rule for each of the remaining vector groups B except the first P vector groups B in the N vector groups B, so that the position difference coverage between every two data objects in each vector in the vector group B is satisfied The required set C is used for updating the rest vector groups B except the former P vector groups B in the N vector groups B;
In step B5., according to the number of vectors contained in each of the N vector groups B, a vector group B corresponding to the minimum number of vectors contained therein is selected to form an initial coverage vector group.
2. The method for generating a software test case according to claim 1, wherein: in the step B4-1, the following steps are performedThe first P vector groups B are selected from the ordering of the N vector groups B, wherein a represents a preset selection proportion,/>, andRepresenting an upward rounding; or by p= (N/2), the first P vector groups B are selected from the ordering of the N vector groups B.
3. The method for generating a software test case according to claim 1, wherein: in the step B4-2, the following steps B4-2-1 to B4-2-3 are executed for each remaining vector group B except the first P vector groups B in the N vector groups B, and the update is performed for the vector group B so that the position difference coverage between every two data objects in each vector in the vector group B is satisfiedThe required set C is used for updating the rest vector groups B except the former P vector groups B in the N vector groups B;
step B4-2-1, applying the current optimal solution, replacing and updating the vector group B, and entering the step B4-2-2;
Step B4-2-2, randomly deleting a vector from the vector group B, updating the vector group B, and entering step B4-2-3;
step B4-2-3. Updating the vector group B by using a correction operator so that the position difference coverage between every two data objects in each vector in the vector group B is satisfied Set of requirements C.
4. A method for generating a software test case according to claim 3, wherein: in the steps B2 and B4-2-3, the vector group B is updated by using a correction operator according to the following steps a) to d), so that the position difference coverage between every two data objects in each vector in the vector group B is satisfiedA set of requirements C;
step a), calculating a position difference set between every two data objects in each vector in the current vector group B, if the set covers the set C, finishing correction to obtain a group of vector groups B meeting the requirements, returning to the vector groups B, and exiting the process; otherwise, arbitrarily selecting one data object x which is not covered in the set C, and entering the step b);
Step b) randomly selecting k data objects from Z v to form a row vector u with the length of k, and entering the step c);
Step c) randomly selecting a position in the row vector u, modifying the value of the position, enabling the position difference of the row vector u to cover the data object x, and then entering step d);
Step d) adding the row vector u to the vector group B, updating the vector group B, and returning to step a).
5. The method for generating a software test case according to claim 1, wherein: the preset iteration overflow condition in the step B4 includes a preset second maximum iteration number or a preset convergence condition satisfied by iteration of the population formed by the preset N vector groups B.
6. The method for generating a software test case according to claim 1, wherein: the step C comprises the following steps C1 to C4, and a coverage array meeting parameter requirements CA (2, k+1, v+1) is constructed;
Step C1. Respectively aiming at each vector B i=(vi,0、vi,1、…、vi,k-1 in the initial coverage vector group, obtaining a cyclic matrix corresponding to the vector B i, adding an all-zero column on the left side of the matrix to form a matrix M i corresponding to the vector B i, wherein i=1, 2, …, M represents the number of vectors in the initial coverage vector group, and then entering step C2;
Step C2. is directed to the matrix M i corresponding to each vector B i, as follows:
V modulo matrixes corresponding to the matrix M i are obtained Thereby obtaining v modulo matrixes/>, which correspond to the vectors B i respectivelyThen enter step C3;
step C3. is as follows:
Constructing a special matrix M 0, and then entering a step C4;
Step C4. Matrix all the modules And special matrix M 0 are arranged vertically in blocks to form a coverage array meeting parameter requirements CA (2, k+1, v+1), and kmv +v+1 rows in total.
7. The method for generating a software test case according to claim 1, wherein: in the step D, each element belonging to Z v { infinity } in the coverage array is replaced by each piece of optional test software respectively, namely, a software test case scheme is formed, wherein each row represents k+1 pieces of optional test software to carry out one test.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210166764.2A CN114579435B (en) | 2022-02-23 | 2022-02-23 | Method for generating software test case |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210166764.2A CN114579435B (en) | 2022-02-23 | 2022-02-23 | Method for generating software test case |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114579435A CN114579435A (en) | 2022-06-03 |
CN114579435B true CN114579435B (en) | 2024-05-28 |
Family
ID=81770371
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210166764.2A Active CN114579435B (en) | 2022-02-23 | 2022-02-23 | Method for generating software test case |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114579435B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102135937A (en) * | 2011-03-15 | 2011-07-27 | 西安邮电学院 | Pairwise overlay integrated software test case suite generating method |
CN107590073A (en) * | 2017-08-30 | 2018-01-16 | 华南理工大学 | Automatic example generation method based on path Coverage Software Testing |
CN109271320A (en) * | 2017-11-07 | 2019-01-25 | 西安邮电大学 | A kind of upper multiple target priorities of test cases sort method |
CN109947652A (en) * | 2019-03-26 | 2019-06-28 | 中山大学 | A kind of improvement sequence learning method of software defect prediction |
CN110334026A (en) * | 2019-07-03 | 2019-10-15 | 浙江理工大学 | Combined test case generation method based on CS-SPSO algorithm |
CN110515845A (en) * | 2019-08-20 | 2019-11-29 | 义乌工商职业技术学院 | Optimize generation method based on the combined test use-case for improving IPO strategy |
CN113238954A (en) * | 2021-05-26 | 2021-08-10 | 南京信息工程大学 | Recursion generation method of software test case |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7552361B2 (en) * | 2006-12-14 | 2009-06-23 | International Business Machines Corporation | Software testing optimization apparatus and method |
CN108763055B (en) * | 2018-04-19 | 2020-08-25 | 北京航空航天大学 | Construction method of test case constraint control technology based on epigenetic inheritance |
US11249887B2 (en) * | 2019-08-27 | 2022-02-15 | Nec Corporation | Deep Q-network reinforcement learning for testing case selection and prioritization |
-
2022
- 2022-02-23 CN CN202210166764.2A patent/CN114579435B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102135937A (en) * | 2011-03-15 | 2011-07-27 | 西安邮电学院 | Pairwise overlay integrated software test case suite generating method |
CN107590073A (en) * | 2017-08-30 | 2018-01-16 | 华南理工大学 | Automatic example generation method based on path Coverage Software Testing |
CN109271320A (en) * | 2017-11-07 | 2019-01-25 | 西安邮电大学 | A kind of upper multiple target priorities of test cases sort method |
CN109947652A (en) * | 2019-03-26 | 2019-06-28 | 中山大学 | A kind of improvement sequence learning method of software defect prediction |
CN110334026A (en) * | 2019-07-03 | 2019-10-15 | 浙江理工大学 | Combined test case generation method based on CS-SPSO algorithm |
CN110515845A (en) * | 2019-08-20 | 2019-11-29 | 义乌工商职业技术学院 | Optimize generation method based on the combined test use-case for improving IPO strategy |
CN113238954A (en) * | 2021-05-26 | 2021-08-10 | 南京信息工程大学 | Recursion generation method of software test case |
Non-Patent Citations (3)
Title |
---|
卓晓燕.基于改进差分进化算法的软件测试用例自动化生成问题求解.2016,全文. * |
基于变异分析和覆盖准则的回归测试用例集缩减;郑炜;杨喜兵;胡圣佑;付荣亮;李绍奇;张帆;西北工业大学学报;20171231;35(3);全文 * |
基于矩阵重复度的组合测试方法及其试验分析;陈锦富;苏晨飞;赵小磊;黄如兵;陈长川;江苏大学学报. 自然科学版;20161231;37(1);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN114579435A (en) | 2022-06-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Xu et al. | Prediction-guided multi-objective reinforcement learning for continuous robot control | |
US8185421B2 (en) | Multi-objective optimization within a constraint management system | |
White et al. | Local search is state of the art for NAS benchmarks | |
Semenkin et al. | Spacecrafts' control systems effective variants choice with self-configuring genetic algorithm | |
US11789698B2 (en) | Computer processing and outcome prediction systems and methods | |
JP7497653B2 (en) | Information processing device, integrated model generation method, and integrated model generation program | |
Shi et al. | Factor screening for simulation with multiple responses: Sequential bifurcation | |
Semenkin et al. | Stochastic models and optimization algorithms for decision support in spacecraft control systems preliminary design | |
Xiao et al. | Reliability modeling and optimization of a two-dimensional sliding window system | |
Suzuki et al. | Distributed randomized algorithms for PageRank based on a novel interpretation | |
CN114579435B (en) | Method for generating software test case | |
Wang et al. | Constructing cost-aware functional test-suites using nested differential evolution algorithm | |
O'Neil et al. | A hybrid column-generation and genetic algorithm approach for solving large-scale multimission selective maintenance problems in serial K-out-of-n: G systems | |
Tomesh et al. | Divide and conquer for combinatorial optimization and distributed quantum computation | |
Elyasi et al. | Genetic algorithms and heuristics hybridized for software architecture recovery | |
US7809657B2 (en) | System and method for implementing a multi objective evolutionary algorithm on a programmable logic hardware device | |
Tian et al. | Novel solution for sequential fault diagnosis based on a growing algorithm | |
US11003823B2 (en) | Re-design of analog circuits | |
Joshi et al. | Empirical and analytical study of many-objective optimization problems: analysing distribution of nondominated solutions and population size for scalability of randomized heuristics | |
Ghaffari et al. | A two-stage hybrid flowshop scheduling problem with serial batching | |
Lin et al. | Optimizing dynamic performance of phased-mission systems with a common bus and warm standby elements | |
Elyasi et al. | HYGAR: a hybrid genetic algorithm for software architecture recovery | |
Zhang et al. | A scalable evolution strategy with directional Gaussian smoothing for blackbox optimization | |
Wang et al. | Comparing expected improvement and kriging believer for expensive bilevel optimization | |
Smith et al. | An analysis of the alias method for discrete random-variate generation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |