CN114579435A - Method for generating software test case - Google Patents

Method for generating software test case Download PDF

Info

Publication number
CN114579435A
CN114579435A CN202210166764.2A CN202210166764A CN114579435A CN 114579435 A CN114579435 A CN 114579435A CN 202210166764 A CN202210166764 A CN 202210166764A CN 114579435 A CN114579435 A CN 114579435A
Authority
CN
China
Prior art keywords
vector
software
coverage
test case
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.)
Granted
Application number
CN202210166764.2A
Other languages
Chinese (zh)
Other versions
CN114579435B (en
Inventor
张媛
彭茂
卢长娜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University of Information Science and Technology
Original Assignee
Nanjing University of Information Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University of Information Science and Technology filed Critical Nanjing University of Information Science and Technology
Priority to CN202210166764.2A priority Critical patent/CN114579435B/en
Publication of CN114579435A publication Critical patent/CN114579435A/en
Application granted granted Critical
Publication of CN114579435B publication Critical patent/CN114579435B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix 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 a software test case, which comprises the steps of firstly obtaining a coverage vector group by applying an evolutionary algorithm based on the conversion of a coverage array problem, then introducing a matrix cyclic modular addition method to construct a coverage array meeting parameter requirements, and finally obtaining a software test case scheme covering preset k +1 software types and each software type respectively comprising v +1 optional test software through conversion, wherein the whole design is to provide a test case generation scheme under the condition that the coverage strength is equal to 2 on the basis of analyzing the mathematical structure of the coverage array. Compared with a pure mathematic construction method, the method is wider in applicability, and compared with a direct heuristic method, the method can realize the generation of the software test case scheme only by searching the initial vector group, reduce the program running time and improve the searching efficiency.

Description

Method for generating software test case
Technical Field
The invention relates to a method for generating a software test case, and belongs to the technical field of software testing.
Background
Along with the continuous penetration of computer technology to various industries in society, the functions of software and hardware systems are increasingly powerful, the functions and operating environments of current software are becoming increasingly complex, and the society increasingly depends on safe and high-quality software and hardware systems. Testing becomes a critical means of ensuring the quality and efficiency of these systems and is also an important and expensive step 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 influence of the interaction between the factors on the system?
On the one hand, in order to comprehensively test a large software or hardware system, a great deal of time and resources are required to try various factors which may affect the system, and it is generally considered that the test cost for developing a software system is at least more than 50% of the total development cost, and the test cost for developing a hardware system is often higher.
On the other hand, the consequences of inadequate testing can be catastrophic. An extreme example is the first test launch of the Ariane 5 carrier rocket in 1996, the main processor and the standby processor are simultaneously overflowed to cause shutdown due to software failure for controlling the rocket to fly, so that the whole rocket is destroyed within 37 seconds after being launched, and the event can be said to be the most disastrous software failure event in history.
In order to design a suitable test system and achieve scientific and effective tests on the system with a small number of experiments, people generally divide factors to be considered into limited classes, each class comprises limited possible configurations, and the possible configurations are selected from different classes to perform combined tests. There is evidence that in most cases, software conflicts occur with only a few types of cross-configurations, so in general, high quality testing requires only checking the relationship between any of several types of factors in the system and the interplay on system performance, while minimizing the number of tests.
The combination test is an important method in Software testing, and Cohen et al (Cohen MB, Gibbons PB, Mugridge WB, Colbourn CJ. structural test requirements for interaction testing. in: Dillon L, TiChy W, eds. Proc. soft. Int' L Conf. on Software Engineering (ICSE). Loa algorithms: IEEE Press,2003.38-48.) in 2003 adopts the mathematical structure of the coverage Array (Covering Array) to describe the test case set, so that the construction of the coverage Array with fewer line numbers is only needed to reduce the cost of the test Software.
Given the k classes of factors that affect the system, there are v possible configurations in each classDefine overlay array CAλ(N; t, k, v) is an Nxk matrix, satisfying that for any Nxt-order submatrix, each t permutation occurs at least λ times, where t is referred to as the strength of the cross-over coverage. When λ ═ 1, the overlay array can be abbreviated CA (N; t, k, v).
With respect to the overlay arrays, various researchers have proposed various construction methods, such as the difference method by mathematical tools (Li, Y.; Ji, L. & Yin, J.converting Array of string H3 and 4from hole difference information, designs, Codes and Cryptography,2009,50,339-350), computer search-based greedy method (Cohen, D.M.; Dalal, S.R.; Freman, M.L. & Patton, G.C. the AEsystem: An adaptive to biological base on combining analysis. IEEE Transactions on Software Engineering,1997,23, 437-algorithm), 444, Particle Swarm algorithm (Wu, H.; Nie, C.; F.C. C., transform. C.; Particle Swarm, III., calculation, III. calculation, J.P.P.A. 19, calculation, TG, calculation, III, calculation, etc.).
Among the methods, the method based on the mathematical principle can obtain better calculation effect only under the setting of specific parameters and cannot be popularized to general parameters; the computer search algorithm considers mathematical structures less, can provide feasible solutions under general parameters, but consumes a lot of time, and the quality of the feasible solutions is often difficult to guarantee under the condition of limited calculation time.
Disclosure of Invention
The invention aims to solve the technical problem of providing a method for generating a software test case, which adopts brand-new logic design, has wide applicable parameters, can realize the generation of a software test case scheme only by searching an 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 each software type respectively comprises v +1 selectable test software and is executed according to the following method:
step A, aiming at the design problem of a combined test scheme of optional test software of two different software types, obtaining the problem of correspondingly constructing a coverage array CA (2, k +1, v +1), and then entering the step B;
b, generating an initial coverage vector group by applying an evolutionary algorithm, and then entering the step C;
c, based on the initial coverage vector group, constructing a coverage array meeting parameter requirements CA (2, k +1, v +1) by applying a matrix cyclic modulo addition method, 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 a value of a vector group B to be an empty set, initializing iteration times n to be 1, and then entering step B2;
b2, updating the vector group B by using a correction operator to ensure that the coverage of the position difference between every two data objects in each vector in the vector group B meets the requirement
Figure BDA0003516516490000021
A required set C, and updating by adding 1 for the iteration number n, wherein Z v1, …, v-1, and then go to step B3;
b3, judging whether the value of the iteration times N is equal to a preset first maximum iteration time N, if so, obtaining N vector groups B, and entering the step B4; otherwise, returning to the step B2; the method comprises the following steps of presetting a first maximum iteration number N as a positive even number;
step B4. iteratively executes the following steps B4-1 to B4-2 until a preset iteration overflow condition is met, and then enters step B5;
b4-1, sorting the N vector groups B according to the number of vectors respectively contained in the N vector groups B and the sequence of the number of the vectors respectively contained 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, for each of the remainder of the N vector sets B except the first P vector sets BEach vector group B is updated according to a preset rule so that the coverage of the position difference between every two data objects in each vector in the vector group B meets the requirement
Figure BDA0003516516490000032
The required set C is further updated to each remaining vector group B except the former P vector groups B in the N vector groups B;
step B5. selects the vector group B corresponding to the minimum number of vectors contained therein according to the number of vectors contained in each of the N vector groups B, to form an initial coverage vector group.
As a preferred technical scheme of the invention: in the step B4-1, according to
Figure BDA0003516516490000033
Selecting the first P vector groups B from the sequence of the N vector groups B, wherein a represents a preset selection proportion,
Figure BDA0003516516490000031
represents rounding up; or selecting the first P vector groups B from the sequence of the N vector groups B according to the ratio of P to (N/2).
As a preferred technical scheme of the invention: in the step B4-2, the following steps B4-2-1 to B4-2-3 are performed for the remaining vector groups B except the first P vector groups B in the N vector groups B, respectively, and the vector group B is updated so that the coverage of the position difference between every two data objects in each vector in the vector group B satisfies the requirement
Figure BDA0003516516490000034
The required set C is further updated to each remaining vector group B except the former P vector groups B in the N vector groups B;
b4-2-1, applying the current optimal solution, carrying out replacement updating aiming at 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 proceeding to step B4-2-3;
step B4-2-3, use the correction operatorUpdating the vector group B so that the coverage of the position difference between every two data objects in each vector in the vector group B satisfies
Figure BDA0003516516490000035
A set of requirements C.
As a preferred technical scheme of the invention: in the step B2 and the step B4-2-3, the vector group B is updated by using a correction operator according to the following steps a) to d), respectively, so that the coverage of the position difference between every two data objects in each vector in the vector group B satisfies the requirement
Figure BDA0003516516490000036
A set of requirements C;
step a) calculating a position difference set between every two data objects in each vector in the current vector set B, finishing correction if the set covers the set C to obtain a set of vector sets B meeting requirements, returning to the vector sets B, and exiting the process; otherwise, randomly selecting one data object x which is not covered in the set C, and entering the step b);
step b) from ZvRandomly selecting k data objects 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 to enable 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 into the vector group B, updating the vector group B, and returning to the step a).
As a preferred technical scheme of the invention: the preset iteration overflow condition in step B4 includes a preset second maximum iteration number, or a preset convergence condition that is satisfied by the iteration of the group consisting of N vector groups B.
As a preferred technical scheme of the invention: the step C comprises the following steps C1 to C4, constructing a covering array which meets the parameter requirement CA (2, k +1, v + 1);
step C1. respectively aiming at each vector B in the initial covering vector groupi=(vi,0、vi,1、...、vi,k-1) Obtaining a vector BiCorresponding cyclic matrix, and adding an all-zero column to the left side of the matrix to form the vector BiCorresponding matrix MiStep C2 is then performed, where i ═ 1, 2,. and m, where m denotes the number of vectors in the initial set of coverage vectors;
Figure BDA0003516516490000041
step C2. is directed to each vector BiCorresponding matrix MiThe method comprises the following steps:
Figure BDA0003516516490000042
obtaining a matrix MiCorresponding v modulo addition matrices
Figure BDA0003516516490000043
Thereby obtaining each vector BiV modulo addition matrixes respectively corresponding to
Figure BDA0003516516490000044
Then proceed to step C3;
step C3. is as follows:
Figure BDA0003516516490000045
constructing special matrices M0Then proceed to step C4;
c4, adding all the modulus to the matrix
Figure BDA0003516516490000046
And a special matrix M0The coverage array which meets the parameter requirement CA (2, k +1, v +1) is formed by vertically arranging blocks, and kmv + v +1 rows are total.
As a preferred technical scheme of the invention: in the step D, the coverage array belongs to ZvAnd respectively replacing each element in the U { ∞ } with each optional test software, namely forming a software test case scheme, wherein each row represents k +1 optional test software to perform primary test.
Compared with the prior art, the method for generating the software test case has the following technical effects:
(1) the invention relates to a method for generating a designed software test case, which comprises the steps of firstly obtaining a coverage vector group by applying an evolutionary algorithm based on the conversion of a coverage array problem, then introducing a matrix cyclic modular addition method to construct a coverage array meeting parameter requirements, and finally obtaining a software test case scheme covering preset k +1 software types and enabling each software type to respectively comprise v +1 optional test software through conversion, wherein the whole design is to provide a test case generation scheme under the condition that the coverage strength is equal to 2 on the basis of analyzing the mathematical structure of the coverage array. Compared with a pure mathematic construction method, the method is wider in applicability, and compared with a direct heuristic method, the method can realize the generation of the software test case scheme only by searching the initial vector group, reduce the program running time and improve the searching efficiency.
Drawings
FIG. 1 is a block diagram of a method for generating a test case of software designed by the present invention.
Detailed Description
The following description will explain embodiments of the present invention in further detail with reference to the accompanying 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 each software type respectively comprises v +1 optional test software, and in practical application, as shown in figure 1, the following method is specifically executed.
Step A, aiming at the design problem of a combined test scheme of optional test software of two different software types, obtaining the problem of correspondingly constructing a coverage array CA (2, k +1, v +1), and then entering the step B;
b, generating an initial coverage vector group by applying an evolutionary algorithm, and then entering the step C;
in practical applications, the step B specifically executes the following steps B1 to B5.
And B1, initializing the value of the vector group B to be an empty set, and initializing the number n of iterations to be 1, and then entering the step B2.
B2, 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 meets the requirement
Figure BDA0003516516490000053
A required set C, and updating by adding 1 for the iteration number n, wherein Z v0, 1, …, v-1, and then proceeds to step B3.
Here "position difference", i.e. set of s-separation differences
Figure BDA0003516516490000051
For s-1, …, k-1 covered set
Figure BDA0003516516490000052
Where the s-separation difference set is defined as
Dis={vi,p-vi,q(mod v):q-p≡s(modk),vi,p≠∞,vi,q≠∞},s=1,2,…,k-1,
Where all operations are modulo v and are held constant.
B3, judging whether the value of the iteration times N is equal to a preset first maximum iteration time N, if so, obtaining N vector groups B, and entering the step B4; otherwise, returning to the step B2; the first maximum iteration number N is preset to be a positive even number.
Step B4. iterates the following steps B4-1 to B4-2 until a preset second maximum number of iterations is satisfied, or a preset convergence condition is satisfied by iterating the group formed by the N vector groups B, and then step B5 is performed.
Step B4-1, according to the number of vectors contained in each of the N vector groups B, sorting the N vector groups B in the order of decreasing the number of vectors contained in each vector group B to increasing the number of vectors contained in each vector group B,and press
Figure BDA0003516516490000061
Defining the first P vector groups B in the sequence as the optimal solution of the current iteration, and then entering the step B4-2; wherein a represents a preset selection proportion, and in the specific practical application, a can be selected to be 50 percent, namely, the vector group B in the first half of the sequence,
Figure BDA0003516516490000063
represents rounding up; or selecting the first P vector groups B from the sequence of the N vector groups B according to the ratio of P to (N/2).
B4-2, updating the vector group B according to a preset rule aiming at the rest vector groups B except the former P vector groups B in the N vector groups B respectively, so that the position difference coverage between every two data objects in each vector in the vector group B meets the requirement
Figure BDA0003516516490000062
The required set C further updates each of the remaining vector groups B of the N vector groups B except the previous P vector groups B.
In a specific implementation, in the step B4-2, the following steps B4-2-1 to B4-2-3 are performed on the remaining vector groups B of the N vector groups B except the previous P vector groups B, respectively, and the vector group B is updated so that the coverage of the position difference between every two data objects in each vector of the vector group B satisfies the requirement of satisfying the requirement of the coverage of the position difference between every two data objects in each vector of the vector group B
Figure BDA0003516516490000064
The required set C further updates each of the remaining vector groups B of the N vector groups B except the previous P vector groups B.
And step B4-2-1, applying the current optimal solution, carrying out replacement updating on the vector group B, and entering step B4-2-2.
And step B4-2-2, randomly deleting one vector from the vector group B, updating the vector group B, and performing step B4-2-3.
Step B4-2-3. update the vector set B using a correction operator so thatObtaining the coverage of the position difference between every two data objects in each vector in the vector group B
Figure BDA0003516516490000065
A set of requirements C.
Step B5. selects the vector group B corresponding to the minimum number of vectors included therein to form an initial coverage vector group according to the number of vectors included in each of the N vector groups B.
In the above steps B1 to B5, the steps B2 and B4-2-3 are respectively as follows, step a) to step d), and the vector set B is updated by using the correction operator, so that the coverage of the position difference between every two data objects in each vector in the vector set B satisfies the requirement
Figure BDA0003516516490000066
A set of requirements C.
Step a) calculating a position difference set between every two data objects in each vector in the current vector set B, if the set covers the set C, finishing correction to obtain a set of vector sets B meeting the requirements, returning to the vector sets B, and exiting the process; otherwise, randomly selecting one data object x which is not covered in the set C, and entering the step b).
Step b) from ZvThen k data objects are randomly selected to form a row vector u with the length of k, and the step c) is carried out.
Step c) randomly selecting a position in the row vector u, modifying the value of the position to make the position difference of the row vector u cover the data object x, and then entering step d).
Step d) adding the row vector u into the vector group B, updating the vector group B, and returning to the step a).
And C, constructing a covering array meeting the parameter requirement CA (2, k +1, v +1) by applying a matrix cyclic modulo addition method based on the initial covering vector group, and then entering the step D.
In practical applications, the step C specifically executes the following steps C1 to C4 to construct a coverage array satisfying the parameter requirement CA (2, k +1, v + 1).
Step C1. respectively forEach vector B in the initial set of coverage vectorsi=(vi,0、vi,1、...、vi,k-1) Obtaining a vector BiCorresponding cyclic matrix, and adding an all-zero column to the left side of the matrix to form the vector BiCorresponding matrix MiAs follows, where i ═ 1, 2,. and m, which represent the number of vectors in the initial set of coverage vectors, then step C2 is entered.
Figure BDA0003516516490000071
Step C2. is directed to each vector BiCorresponding matrix MiThe method comprises the following steps:
Figure BDA0003516516490000072
obtaining a matrix MiCorresponding v modulo addition matrices
Figure BDA0003516516490000073
Thereby obtaining each vector BiV modulo addition matrixes respectively corresponding to
Figure BDA0003516516490000074
Then proceed to step C3.
Step C3. is as follows:
Figure BDA0003516516490000075
constructing special matrices M0Then, the process proceeds to step C4.
C4, adding all the modulus to the matrix
Figure BDA0003516516490000076
And the special matrix M0 is vertically arranged according to blocks to form a covering array meeting the parameter requirement CA (2, k +1, v +1) and has kmv + v +1 rows.
Step D. covering the arrayBelong to ZvAnd respectively replacing each element in the U { ∞ } with each optional test software to form a software test case scheme, namely converting the coverage array into the corresponding software test case scheme, wherein each row represents k +1 optional test software to perform one test.
The method for generating the designed software test case is applied to practice, for example, a software test case scheme is preset with 8 software types, each software type comprises 10 optional test software, and the test scheme is designed to ensure that the combined test scheme of every two optional test software with different software types is tested at least once.
First, the problem is translated to the structure CA (2, k +1, v +1), v 9, k 7, generating an initial set of coverage vectors (m 2):
B1=(∞,0,7,4,5,1,4),B2=(4,4,8,6,2,3,2),
satisfy the requirement of
Figure BDA0003516516490000082
And calculating the position difference 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 can be seen that:
D11∪D21=D12∪D22=D13∪D23=Z9
satisfying CA (2, k +1, v +1), generating cyclic matrix and modulo addition matrix, and adding all the modulo addition matrix and special matrix M0Arranged vertically, a covering array CA (kmv + v + 1; 2, k +1, v +1), i.e., a covering 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 the combination of every two different types of software is ensured to be tested at least once through 136 tests, as shown in the following table 1.
TABLE 1
Figure BDA0003516516490000081
Figure BDA0003516516490000091
The generation method of the software test case designed by the technical scheme includes the steps of firstly obtaining a coverage vector group by applying an evolutionary algorithm based on conversion of a coverage array problem, then introducing a matrix cyclic modular addition method to construct a coverage array meeting parameter requirements, and finally obtaining a software test case scheme covering preset k +1 software types and including v +1 optional test software in each software type through conversion, wherein the whole design is that a test case generation scheme under the condition that the coverage strength is equal to 2 is provided on the basis of analyzing the mathematical structure of the coverage array. Compared with a pure mathematic construction method, the method is wider in applicability, and compared with a direct heuristic method, the method can realize the generation of the software test case scheme only by searching the initial vector group, reduce the program running time 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 gist of the present invention.

Claims (8)

1. A method for generating a software test case is used for obtaining a software test case scheme which covers preset k +1 software types and each software type comprises v +1 selectable test software respectively, and is characterized by being executed according to the following method:
step A, aiming at the design problem of a combined test scheme of optional test software of two different software types, obtaining the problem of correspondingly constructing a coverage array CA (2, k +1, v +1), and then entering the step B;
b, generating an initial coverage vector group by applying an evolutionary algorithm, and then entering the step C;
c, based on the initial coverage vector group, constructing a coverage array meeting parameter requirements CA (2, k +1, v +1) by applying a matrix cyclic modulo addition method, and then entering the step D;
and D, converting the coverage array into a corresponding software test case scheme.
2. The method for generating the software test case according to claim 1, wherein: the step B comprises the following steps B1 to B5;
step B1, initializing a value of a vector group B to be an empty set, initializing iteration times n to be 1, and then entering step B2;
b2, updating the vector group B by using a correction operator to ensure that the coverage of the position difference between every two data objects in each vector in the vector group B meets the requirement
Figure FDA0003516516480000011
A required set C, and updating by adding 1 for the iteration number n, wherein Zv1, …, v-1, and then go to step B3;
b3, judging whether the value of the iteration times N is equal to a preset first maximum iteration time N, if so, obtaining N vector groups B, and entering the step B4; otherwise, returning to the step B2; the method comprises the steps that a first maximum iteration number N is preset to be a positive even number;
step B4. iteratively executes the following steps B4-1 to B4-2 until a preset iteration overflow condition is met, and then enters step B5;
b4-1, sorting the N vector groups B according to the number of vectors respectively contained in the N vector groups B and the sequence of the number of the vectors respectively contained 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 (ii) ofB4-2, respectively aiming at each residual vector group B except the former P vector groups B in the N vector groups B, updating the vector groups B according to a preset rule so that the coverage of the position difference between every two data objects in each vector in the vector group B meets the requirement of the coverage of the position difference between every two data objects in each vector
Figure FDA0003516516480000012
Figure FDA0003516516480000013
The required set C is further updated to each remaining vector group B except the former P vector groups B in the N vector groups B;
step B5. selects the vector group B corresponding to the minimum number of vectors included therein to form an initial coverage vector group according to the number of vectors included in each of the N vector groups B.
3. The method for generating the software test case according to claim 2, wherein: in the step B4-1, according to
Figure FDA0003516516480000014
Selecting the first P vector groups B from the sequence of the N vector groups B, wherein a represents a preset selection proportion,
Figure FDA0003516516480000015
represents rounding up; or selecting the first P vector groups B from the sequence of the N vector groups B according to the ratio of P to (N/2).
4. The method for generating the software test case according to claim 2, wherein: in the step B4-2, the following steps B4-2-1 to B4-2-3 are performed for the remaining vector groups B except the first P vector groups B in the N vector groups B, respectively, and the vector group B is updated so that the coverage of the position difference between every two data objects in each vector in the vector group B satisfies the requirement
Figure FDA0003516516480000021
Require thatTo further update each remaining vector group B of the N vector groups B except the first P vector groups B;
b4-2-1, applying the current optimal solution, carrying out replacement updating aiming at 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 proceeding to step B4-2-3;
step B4-2-3, updating the vector group B by using a correction operator so that the coverage of the position difference between every two data objects in each vector in the vector group B satisfies the requirement
Figure FDA0003516516480000022
A set of requirements C.
5. The method for generating the software test case according to claim 4, wherein: in the step B2 and the step B4-2-3, the vector group B is updated by using a correction operator according to the following steps a) to d), respectively, so that the coverage of the position difference between every two data objects in each vector in the vector group B satisfies the requirement
Figure FDA0003516516480000023
A set of requirements C;
step a) calculating a position difference set between every two data objects in each vector in the current vector set B, if the set covers the set C, finishing correction to obtain a set of vector sets B meeting the requirements, returning to the vector sets B, and exiting the process; otherwise, randomly selecting one data object x which is not covered in the set C, and entering the step b);
step b) from ZvRandomly selecting k data objects 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 to enable 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 into the vector group B, updating the vector group B, and returning to the step a).
6. The method for generating the software test case according to claim 2, wherein: the preset iteration overflow condition in step B4 includes a preset second maximum iteration number, or a preset convergence condition that is satisfied by the iteration of the group consisting of N vector groups B.
7. The method for generating the software test case according to claim 1, wherein: the step C comprises the following steps C1 to C4, constructing a covering array which meets the parameter requirement CA (2, k +1, v + 1);
step C1. respectively aiming at each vector B in the initial covering vector groupi=(vi,0、vi,1、...、vi,k-1) Obtaining a vector BiCorresponding cyclic matrix, and adding an all-zero column to the left side of the matrix to form the vector BiCorresponding matrix MiAfter i is 1, 2, …, and m represents the number of vectors in the initial coverage vector group, the process proceeds to step C2;
Figure FDA0003516516480000031
step C2. is directed to each vector BiCorresponding matrix MiThe method comprises the following steps:
Figure FDA0003516516480000032
obtaining a matrix MiCorresponding v modulo addition matrices
Figure FDA0003516516480000033
Thereby obtaining each vector BiV modulo addition matrixes respectively corresponding to
Figure FDA0003516516480000034
Then proceed to step C3;
step C3. is as follows:
Figure FDA0003516516480000035
constructing special matrices M0Then proceed to step C4;
c4, adding all the modulus to the matrix
Figure FDA0003516516480000036
And a special matrix M0And the coverage arrays are vertically arranged according to blocks to form kmv + v +1 rows which meet parameter requirements CA (2, k +1, v + 1).
8. The method for generating the software test case according to claim 1, wherein: in the step D, the coverage array belongs to ZvAnd respectively replacing each element in the U { ∞ } with each optional test software, namely forming a software test case scheme, wherein each row represents k +1 optional test software to perform primary test.
CN202210166764.2A 2022-02-23 2022-02-23 Method for generating software test case Active CN114579435B (en)

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 true CN114579435A (en) 2022-06-03
CN114579435B 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 (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080148247A1 (en) * 2006-12-14 2008-06-19 Glenn Norman Galler Software testing optimization apparatus and method
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
US20190087313A1 (en) * 2018-04-19 2019-03-21 Beihang University Construction method of test case constraint control technology based on epigenetics
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
US20210064515A1 (en) * 2019-08-27 2021-03-04 Nec Laboratories America, Inc. Deep q-network reinforcement learning for testing case selection and prioritization
CN113238954A (en) * 2021-05-26 2021-08-10 南京信息工程大学 Recursion generation method of software test case

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080148247A1 (en) * 2006-12-14 2008-06-19 Glenn Norman Galler Software testing optimization apparatus and method
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
US20190087313A1 (en) * 2018-04-19 2019-03-21 Beihang University Construction method of test case constraint control technology based on epigenetics
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
US20210064515A1 (en) * 2019-08-27 2021-03-04 Nec Laboratories America, Inc. Deep q-network reinforcement learning for testing case selection and prioritization
CN113238954A (en) * 2021-05-26 2021-08-10 南京信息工程大学 Recursion generation method of software test case

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
卓晓燕: "基于改进差分进化算法的软件测试用例自动化生成问题求解", 31 December 2016 (2016-12-31) *
郑炜;杨喜兵;胡圣佑;付荣亮;李绍奇;张帆: "基于变异分析和覆盖准则的回归测试用例集缩减", 西北工业大学学报, vol. 35, no. 3, 31 December 2017 (2017-12-31) *
陈锦富;苏晨飞;赵小磊;黄如兵;陈长川: "基于矩阵重复度的组合测试方法及其试验分析", 江苏大学学报. 自然科学版, vol. 37, no. 1, 31 December 2016 (2016-12-31) *

Also Published As

Publication number Publication date
CN114579435B (en) 2024-05-28

Similar Documents

Publication Publication Date Title
Doerr et al. Fast genetic algorithms
Ho et al. Simple explanation of the no free lunch theorem of optimization
US8185421B2 (en) Multi-objective optimization within a constraint management system
Zhan et al. An adaptive parallel learning dependent Kriging model for small failure probability problems
Semenkin et al. Stochastic models and optimization algorithms for decision support in spacecraft control systems preliminary design
JP3152279B2 (en) Sub-optimal assignment determination method
Suzuki et al. Distributed randomized algorithms for PageRank based on a novel interpretation
Czumaj et al. A new algorithm approach to the general Lovász local lemma with applications to scheduling and satisfiability problems
Wang et al. Constructing cost-aware functional test-suites using nested differential evolution algorithm
Le et al. Dynamic matching algorithms under vertex updates
Friedrich et al. Near-perfect load balancing by randomized rounding
Lee et al. A heuristic genetic algorithm for solving resource allocation problems
Mancino-Ball et al. A decentralized primal-dual framework for non-convex smooth consensus optimization
CN114579435A (en) Method for generating software test case
Mo et al. Mission reliability analysis of fault-tolerant multiple-phased systems
Ding et al. A low-dimensional semidefinite relaxation for the quadratic assignment problem
Bang-Jensen et al. Edge-connectivity augmentation preserving simplicity
Shin et al. Method for expanding search space with hybrid operations in DynamicNAS
Ajimakin et al. The competing genes evolutionary algorithm: Avoiding genetic drift through competition, local search, and majority voting
Smith et al. An analysis of the alias method for discrete random-variate generation
De Stefani On the I/O complexity of hybrid algorithms for Integer Multiplication
Xing et al. A concentration phenomenon in a gossip interaction model with two communities
Wang et al. Communication-efficient federated optimization over semi-decentralized networks
Li et al. Expensive inequality constraints handling methods suitable for dynamic surrogate-based optimization
Zhang et al. Decentralized non-convex learning with linearly coupled constraints

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