CN110990257B - Automatic generation method for code-level test case set - Google Patents

Automatic generation method for code-level test case set Download PDF

Info

Publication number
CN110990257B
CN110990257B CN201911036129.7A CN201911036129A CN110990257B CN 110990257 B CN110990257 B CN 110990257B CN 201911036129 A CN201911036129 A CN 201911036129A CN 110990257 B CN110990257 B CN 110990257B
Authority
CN
China
Prior art keywords
parameter
list
group
values
numbers
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
Application number
CN201911036129.7A
Other languages
Chinese (zh)
Other versions
CN110990257A (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.)
Northwestern Polytechnical University
Xian Aisheng Technology Group Co Ltd
Original Assignee
Northwestern Polytechnical University
Xian Aisheng Technology Group Co Ltd
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 Northwestern Polytechnical University, Xian Aisheng Technology Group Co Ltd filed Critical Northwestern Polytechnical University
Priority to CN201911036129.7A priority Critical patent/CN110990257B/en
Publication of CN110990257A publication Critical patent/CN110990257A/en
Application granted granted Critical
Publication of CN110990257B publication Critical patent/CN110990257B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Complex Calculations (AREA)

Abstract

The invention discloses a method for automatically generating a code-level test case set, which is used for solving the technical problem of low test efficiency of the conventional method for automatically generating test cases. Firstly, traversing a source program, searching keywords of a conditional statement or a logic operational character to extract a parameter name, a parameter value and a comparison operational character between the parameter name and the parameter value; and expanding the parameter values by adopting a mode of combining equivalence class division and boundary value analysis, and replacing subjective selection by utilizing automatically extracted parameters. And carrying out Cartesian product calculation on the expanded parameter value list to form a full-coverage test case list, combining every two values in the list, comparing every two combined values with other groups in a mode from bottom to top, deleting one group if the same data are found in other groups by the two combined values, and otherwise, keeping the same. And after all the pairwise combination values of each group are traversed, the combination values are arranged to form a test case set, so that the test efficiency is improved.

Description

Automatic generation method for code-level test case set
Technical Field
The invention relates to a method for automatically generating a test case, in particular to a method for automatically generating a code-level test case set.
Background
The document "an automatic black box test case generation method based on combined coverage, aircraft control science, 2008, vol27 (5), p54-56" discloses an automatic black box test case generation method based on combined coverage. The method includes the steps of taking values of parameters on the basis of combined coverage, filling parameter values into each column of a matrix, expanding the matrix into a minimum matrix by adopting a matrix decomposition method, and finally extracting a group of test cases which are few in quantity and can meet the requirements of the combined coverage of the parameters. Meanwhile, after the parameter values are filled in the matrix, if the column where the parameter is located has a vacancy, any value of the parameter is used for filling, and the matrix is guaranteed to be decomposable.
The method disclosed by the literature has the advantages that the number of test cases generated is large, and the test efficiency is reduced; in addition, the method disclosed by the literature extracts parameters and parameter values in a subjective judgment mode, the randomness is high, and the test implementation effect is influenced when the parameters and the value selection thereof are inappropriate.
Disclosure of Invention
In order to overcome the defect of low test efficiency of the existing automatic test case generation method, the invention provides an automatic generation method for a code-level test case set. Firstly, traversing a source program and a mode of searching keywords or logic operational characters of a condition statement, and extracting parameter names, parameter values and comparison operational characters between the parameter names and the parameter values; according to the comparison operational character, a mode of combining equivalence class division and boundary value analysis is adopted, the parameter value is expanded, the subjective selection is replaced by the automatic extraction parameter, and the randomness of parameter selection is reduced. And carrying out Cartesian product calculation on the expanded parameter value list to form a full-coverage test case list, combining every two values in the list, comparing every two combined values with other groups in a mode from bottom to top, deleting one group if the same data are found in other groups by the two combined values, and otherwise, keeping the same. And after all the pairwise combination values of each group are traversed, the combination values are arranged to form a test case set, so that the number of test cases is reduced, and the test efficiency is improved.
The technical scheme adopted by the invention for solving the technical problems is as follows: a method for automatically generating a code-level test case suite is characterized by comprising the following steps of:
step one, traversing a source program, searching keywords of a conditional statement, extracting judgment conditions, and summarizing to form a condition list. If the condition comprises the logic operator, the logic operator is taken as a partition point to carry out interception, and the logic operator is gathered again to form a condition list.
And step two, traversing the condition list, and extracting the parameter names, the parameter values and comparison operational characters between the parameter names and the parameter values.
And step three, expanding the parameter values by adopting a mode of combining equivalence class division and boundary value analysis according to the comparison operational characters between the parameter names and the parameter values. Summarizing parameter values corresponding to the ith parameter to form a one-dimensional list P i Comprises the following steps:
P i =[a i ,a i +r,a i -r] (1)
in the formula 1<=i<= n, n denotes the total number of extracted parameters, a i Representing the value of the ith parameter in the decision condition, r representing a non-zero random positive number, a i +r,a i And r is a parameter value formed by expanding in an equivalent class division and boundary value analysis mode. If the comparison operational character is greater than the number and less than the number, deleting the P i The first element a in i I.e. P i =[a i +r,a i -r]If the comparison operational character is equal sign or unequal sign, deleting P i Middle third element a i R is P i =[a i ,a i +r]。
Forming an extended parameter value list P = { P = { (P) 1 ,...,P i ,...,P n }。
Fourthly, performing Cartesian product operation on the parameter numerical value list P to form a full-coverage test case list D = { D = 1 ,...,d j ,...,d m H, m represents the number of elements in the list, 1<=j<= m, i.e. D = P 1 *...*P i *...*P n
P 1 *...*P i *...*P n ={(p 1 ,...,p i ,...,p n )|p i ∈P i ,i=1,2,...,n} (2)
Step five, splitting the full coverage test case list D according to elements to form a parameter value sublist D j I.e. d j =(a j1 ,a j2 ,...,a jn ),a j1 Is d j The value of the first parameter, and so on, a jn Is d j The last parameter value.
Step six, pair d j The numerical values in (1) are combined in pairs to form d j Corresponding combined list R j I.e. R j ={(a j1 ,a j2 ),(a j1 ,a j3 ),...,(a j1 ,a jn ),...,(a j(n-1) ,a jn )}。
Step seven, the step six shows that R m ={(a m1 ,a m2 ),(a m1 ,a m3 ),...,(a m1 ,a mn ),...,(a m(n-1) ,a mn ) R is substituted by m The first group of (a) m1 ,a m2 ) And R 1 To R m-1 Each group number in (1) is compared, and if the same data is found, R is compared m Middle second number (a) m1 ,a m3 ) And R 1 To R m-1 Comparing the numbers in each group, and repeating the steps until R m All of them being in R 1 To R m-1 If the same data is found, then R is added m Indicated by asterisks, the above procedure was repeated until R was substituted 1 And R 2 To R m After comparing each set of numbers in (1), this step is ended.
Step eight, finishing R 1 To R m And deleting the list represented by the asterisk, and acquiring a combined list in which the redundant cases are removed, namely the test case set which is automatically generated.
The invention has the beneficial effects that: firstly, traversing a source program and a mode of searching keywords or logic operational characters of a condition statement, and extracting parameter names, parameter values and comparison operational characters between the parameter names and the parameter values; according to the comparison operational characters, a mode of combining equivalence class division and boundary value analysis is adopted, parameter values are expanded, subjective selection is replaced by automatic extraction parameters, and randomness of parameter selection is reduced. And carrying out Cartesian product calculation on the expanded parameter value list to form a full-coverage test case list, combining every two values in the list, comparing every two combined values with other groups in a mode from bottom to top, deleting one group if the same data are found in other groups by the two combined values, and otherwise, keeping the same. And after all the pairwise combination values of each group are traversed, the combination values are arranged to form a test case set, so that the number of test cases is reduced, and the test efficiency is improved.
Specifically, the method adopts a mode of traversing a source program, searching keywords or logic operational characters of conditional statements, extracts parameter names, parameter values and comparison operational characters between the parameter names and the parameter values, and expands the parameter values according to a mode of combining equivalence class division and boundary value analysis, so that subjective selection is replaced by automatic parameter extraction, the randomness of parameter selection is reduced, and the test implementation effect is ensured; in the selection stage of the test cases, the parameter values are subjected to Cartesian product operation, the values in the operation result are combined pairwise, redundant test cases are eliminated in a pairwise comparison mode from bottom to top, and the number of the test cases is further reduced. For example, 5 parameters, one of which takes 3 values, the others take 2 values, the method introduced in the literature in the background art needs 11 test cases, and the invention needs 8 test cases; 4 parameters, each parameter takes 4 values, the number of cases to be tested is 28 in the method introduced by the literature in the background technology, and the number of cases to be tested is 19 in the invention; 5 parameters, each parameter takes 5 values, the method introduced by the literature in the background art needs 125 test cases, and the invention needs 36 test cases.
The present invention will be described in detail with reference to the following embodiments.
Detailed Description
The method for automatically generating the code-level test case set comprises the following specific steps of:
step one, traversing a source program, searching keywords of a conditional statement, extracting judgment conditions, and summarizing to form a condition list. If the condition comprises the logic operator, the logic operator is taken as a partition point to carry out interception, and the condition list is formed in a reintegration mode. Assume that the condition list extracted by traversing the source program is that the value of parameter 1 is less than or equal to 6, the value of parameter 2 is less than or equal to 3, and the value of parameter 3 is less than or equal to 9.
And step two, traversing the condition list, and extracting the parameter names, the parameter values and comparison operational characters between the parameter names and the parameter values. Assuming that the extracted result is the parameter 1 name, 6, less than or equal to; parameter 2, name, 3, less than or equal to; the parameter 3 is the name, 9 is less than or equal to.
And step three, expanding the parameter values by adopting a mode of combining equivalence class division and boundary value analysis according to the comparison operational characters between the parameter names and the parameter values. The parameter values corresponding to the ith parameter are summarized to form a one-dimensional list P i Comprises the following steps:
P i =[a i ,a i +r,a i -r] (1)
in the formula 1<=i<= n, n denotes the total number of extracted parameters, a i Representing the value of the ith parameter in the judgment condition, r representing a non-zero random positive number, a i +r,a i And r is a parameter value formed by expanding in an equivalent class division and boundary value analysis mode. If the comparison operational character is greater than the number and less than the number, deleting the P i First element a of i I.e. P i =[a i +r,a i -r]If the comparison operational character is equal sign or unequal sign, deleting P i Third element a of i R is P i =[a i ,a i +r]. Forming expanded parameters numerical value list P = { P = { P = 1 ,...,P i ,...,P n }. Assuming r =1,n =3, P is acquired 1 =[6,7,5]、P 2 =[3,4,2]、P 3 =[9,10,8]。
Fourthly, performing Cartesian product operation on the parameter numerical value list P to form a full-coverage test case list D = { D = 1 ,...,d j ,...,d m H, m represents the number of elements in the list, 1<=j<= m, i.e. D = P 1 *...*P i *...*P n
P 1 *...*P i *...*P n ={(p 1 ,...,p i ,...,p n )|p i ∈P i ,i=1,2,...,n} (2)
According to the assumed data of step three, m =27,D = P 1 *P 2 *P 3 ={(6,3,9),(6,3,10),(6,3,8),(6,4,9),(6,4,10),(6,4,8),(6,2,9),(6,2,10),(6,2,8),(7,3,9),(7,3,10),(7,3,8),(7,4,9),(7,4,10),(7,4,8),(7,2,9),(7,2,10),(7,2,8),(5,3,9),(5,3,10),(5,3,8),(5,4,9),(5,4,10),(5,4,8),(5,2,9),(5,2,10),(5,2,8)}。
Step five, splitting the full coverage test case list D according to elements to form a parameter value sublist D j I.e. d j =(a j1 ,a j2 ,...,a jn ),a j1 Is d j The value of the first parameter, and so on, a jn Is d j The last parameter value in (1).
According to the assumed data D in step four, a parameter value sub-list D is generated 1 =(6,3,9)、d 2 =(6,3,10)、d 3 =(6,3,8)、d 4 =(6,4,9)、d 5 =(6,4,10)、d 6 =(6,4,8)、d 7 =(6,2,9)、d 8 =(6,2,10)、d 9 =(6,2,8)、d 10 =(7,3,9)、d 11 =(7,3,10)、d 12 =(7,3,8)、d 13 =(7,4,9)、d 14 =(7,4,10)、d 15 =(7,4,8)、d 16 =(7,2,9)、d 17 =(7,2,10)、d 18 =(7,2,8)、d 19 =(5,3,9)、d 20 =(5,3,10)、d 21 =(5,3,8)、d 22 =(5,4,9)、d 23 =(5,4,10)、d 24 =(5,4,8)、d 25 =(5,2,9)、d 26 =(5,2,10)、d 27 =(5,2,8)。
Step six, pair d j The numerical values in (1) are combined in pairs to form a jth combination list R j I.e. R j ={(a j1 ,a j2 ),(a j1 ,a j3 ),...,(a j1 ,a jn ),...,(a j(n-1) ,a jn )}。
Let the parameter value sub-list be d in step five 1 To d 27 Then the combined list is R 1 ={(6,3),(6,9),(3,9)}、R 2 ={(6,3),(6,10),(3,10)}、R 3 ={(6,3),(6,8),(3,8)}、R 4 ={(6,4),(6,9),(4,9)}、R 5 ={(6,4),(6,10),(4,10)}、R 6 ={(6,4),(6,8),(4,8)}、R 7 ={(6,2),(6,9),(2,9)}、R 8 ={(6,2),(6,10),(2,10)}、R 9 ={(6,2),(6,8),(2,8)}、R 10 ={(7,3),(7,9),(3,9)}、R 11 ={(7,3),(7,10),(3,10)}、R 12 ={(7,3),(7,8),(3,8)}、R 13 ={(7,4),(7,9),(4,9)}、R 14 ={(7,4),(7,10),(4,10)}、R 15 ={(7,4),(7,8),(4,8)}、R 16 ={(7,2),(7,9),(2,9)}、R 17 ={(7,2),(7,10),(2,10)}、R 18 ={(7,2),(7,8),(2,8)}、R 19 ={(5,3),(5,9),(3,9)}、R 20 ={(5,3),(5,10),(3,10)}、R 21 ={(5,3),(5,8),(3,8)}、R 22 ={(5,4),(5,9),(4,9)}、R 23 ={(5,4),(5,10),(4,10)}、R 24 ={(5,4),(5,8),(4,8)}、R 25 ={(5,2),(5,9),(2,9)}、R 26 ={(5,2),(5,10),(2,10)}、R 27 ={(5,2),(5,8),(2,8)}。
Step seven, the step six shows that R m ={(a m1 ,a m2 ),(a m1 ,a m3 ),...,(a m1 ,a mn ),...,(a m(n-1) ,a mn ) H, converting R into m The first group number (a) m1 ,a m2 ) And R 1 To R m-1 Each group of numbers in (1) is compared, and if the same data is found, R is compared m Middle second number (a) m1 ,a m3 ) And R 1 To R m-1 Comparing the numbers in each group, and repeating the steps until R m All of them being in R 1 To R m-1 If the same data is found, then R is added m Indicated by asterisks, the above procedure was repeated until R was substituted 1 And R 2 To R m After comparing each group number in (1), this step is ended.
Suppose R 1 To R 27 The data of (2) is assumed data of step six, and the steps are as follows:
1、R 27 the first number of groups (5, 2) and R in (1) 1 To R 26 The numbers of each group in (1) are compared in turn to find R 25 First number of and R 27 The first group number of (2) is the same; r is to be 27 In (2)Number of groups (5, 8) and R 1 To R 26 The numbers of each group in (1) are compared in turn to find R 21 A second number of and R 27 The second numbers of groups of (a) are the same; r is 27 The third group of numbers (2, 8) and R in (1) 1 To R 26 The numbers of each group in (1) are compared in turn to find R 27 Number of the third group R 9 Is the same, so that R is 27 Indicated by an asterisk.
2、R 26 Each group of R and 1 to R 27 Removing R 26 The other sets of numbers are compared in turn. The method is the same as the step 1. Exist with R 26 The same three groups of numbers, thus combining R 26 Indicated by an asterisk.
3、R 25 The first number of groups (5, 2) and R in (1) 1 To R 27 Removing R 25 All the other groups of numbers are compared in turn, and the same value, R, is not found 25 No changes are made.
4、R 24 Each group of R and 1 to R 27 Removing R 24 The other sets of numbers are compared in turn. The method is the same as the step 1. Exist with R 24 The same three groups of numbers, thus combining R 24 Indicated by an asterisk.
5、R 23 Each group of (1) and R 1 To R 27 Removing R 23 The other sets of numbers are compared in turn. The method is the same as the step 1. Exist with R 23 The same three groups of numbers, thus R 23 Indicated by an asterisk.
6、R 22 The first number of groups (5, 4) and R in (1) 1 To R 27 Removing R 22 The other sets of numbers are compared in turn. No identity value, R, was found 22 No changes are made.
7、R 21 The first number of groups (5, 3) and R in (1) 1 To R 27 Removing R 21 The numbers of each group are compared in sequence to find R 21 First number of and R 20 The first group number of (2) is the same; r is to be 21 A second number of groups (5, 8) and R 1 To R 27 Remove R 21 All the other groups of numbers are compared in turn, and the same value, R, is not found 21 Is not changed。
8、R 20 The first number of groups (5, 3) and R in (1) 1 To R 27 Removing R 20 The numbers of each group are compared in turn to find R 20 First number of and R 21 The first group number of (2) is the same; r is to be 20 A second number of groups (5, 10) and R 1 To R 27 Removing R 20 All the other groups of numbers are compared in turn, and the same value, R, is not found 20 No changes are made.
9、R 19 Each group of R and 1 to R 27 Removing R 19 The other numbers of each group are compared in turn. The method is the same as the step 1. Exist with R 19 The same three groups of numbers, thus combining R 19 Indicated by an asterisk.
10、R 18 Each group of R and 1 to R 27 Removing R 18 The other sets of numbers are compared in turn. The method is the same as step 1. Exist with R 18 The same three groups of numbers, thus combining R 18 Indicated by an asterisk.
11、R 17 Each group of R and 1 to R 27 Removing R 17 The other numbers of each group are compared in turn. The method is the same as the step 1. Exist with R 17 The same three groups of numbers, thus R 17 Indicated by an asterisk.
12、R 16 The first number of groups (7, 2) and R in (1) 1 To R 27 Removing R 16 The other groups of numbers are compared in sequence, and the same value, R, is not found 16 No changes are made.
13、R 15 Each group of R and 1 to R 27 Removing R 15 The other sets of numbers are compared in turn. The method is the same as step 1. Exist with R 15 The same three groups of numbers, thus combining R 15 Indicated by an asterisk.
14、R 14 Each group of (1) and R 1 To R 27 Removing R 14 The other numbers of each group are compared in turn. The method is the same as step 1. Exist with R 14 The same three groups of numbers, thus combining R 14 Indicated by an asterisk.
15、R 13 The first number of groups (7, 4) and R in (1) 1 To R 27 Removing R 13 All the other groups of numbers are compared in turn, and the same value, R, is not found 13 No changes are made.
16、R 12 The first number of groups (7, 3) and R in (1) 1 To R 27 Removing R 12 The numbers of each group are compared in turn to find R 12 First number of and R 10 The first group number of (2) is the same; r is to be 12 A second number of groups (7, 8) and R 1 To R 27 Removing R 12 All the other groups of numbers are compared in turn, and the same value, R, is not found 12 No changes are made.
17、R 11 The first number of groups (7, 3) and R in (1) 1 To R 27 Removing R 12 The numbers of each group are compared in turn to find R 11 First number of and R 10 The first group number of (2) is the same; r is to be 11 A second number of (7, 10) and R in (1) 1 To R 27 Removing R 11 The other groups of numbers are compared in sequence, and the same value, R, is not found 11 No changes are made.
18、R 10 Each group of R and 1 to R 27 Removing R 10 The other sets of numbers are compared in turn. The method is the same as the step 1. Exist with R 10 The same three groups of numbers, thus combining R 10 Indicated by an asterisk.
19、R 9 The first number of groups (6, 2) and R in (1) 1 To R 27 Removing R 9 The numbers of each group are compared in turn to find R 9 First number of and R 7 The first group number of (2) is the same; r is to be 9 The second group of numbers (6, 8) of (1) and R 1 To R 27 Removing R 9 The numbers of each group are compared in turn to find R 9 Second number of and R 3 The second number of groups of (2) is the same; r is 9 The third group of numbers (2, 8) and R in (1) 1 To R 27 Removing R 9 The other groups of numbers are compared in sequence, and the same value, R, is not found 9 No changes are made.
20、R 8 The first number of (6, 2) and R in (1) 1 To R 27 Removing fromR 8 The numbers of each group are compared in turn to find R 8 First number of and R 7 The first group number of (2) is the same; r is to be 8 A second number of groups (6, 10) and R 1 To R 27 Removing R 8 The numbers of each group are compared in turn to find R 8 A second number of and R 2 The second number of groups of (2) is the same; r 8 Third group of numbers (2, 10) of (1) and R 1 To R 27 Removing R 8 The other groups of numbers are compared in sequence, and the same value, R, is not found 8 No changes are made.
21、R 7 Each group of R and 1 to R 27 Removing R 7 The other sets of numbers are compared in turn. The method is the same as step 1. Exist with R 7 The same three groups of numbers, thus combining R 7 Indicated by an asterisk.
22、R 6 The first number of (6, 4) and R in (1) 1 To R 27 Removing R 6 The numbers of each group are compared in sequence to find R 6 First number of and R 4 The first group number of (2) is the same; r is to be 6 A second number of groups (6, 8) and R 1 To R 27 Removing R 6 The numbers of each group are compared in turn to find R 6 A second number of and R 3 The second number of groups of (2) is the same; r 6 Third group of numbers (4, 8) of (1) and R 1 To R 27 Removing R 6 All the other groups of numbers are compared in turn, and the same value, R, is not found 6 No changes are made.
23、R 5 The first number of groups (6, 4) and R in (1) 1 To R 27 Removing R 5 The numbers of each group are compared in turn to find R 5 First number of and R 4 The first group number of (2) is the same; r is to be 5 A second number of (6, 10) and R in (1) 1 To R 27 Removing R 5 The numbers of each group are compared in turn to find R 5 Second number of and R 2 The second numbers of groups of (a) are the same; r 5 The third group of numbers (4, 10) and R in (1) 1 To R 27 Removing R 5 All the other groups of numbers are compared in turn, and the same value, R, is not found 5 No changes are made.
24、R 4 Each group of R and 1 to R 27 Removing R 4 The other sets of numbers are compared in turn. The method is the same as the step 1. Exist with R 4 The same three groups of numbers, thus R 4 Indicated by an asterisk.
25、R 3 Each group of (1) and R 1 To R 27 Removing R 3 The other numbers of each group are compared in turn. The method is the same as the step 1. Exist with R 3 The same three groups of numbers, thus combining R 3 Indicated by an asterisk.
26、R 2 Each group of R and 1 to R 27 Removing R 2 The other sets of numbers are compared in turn. The method is the same as the step 1. Exist with R 2 The same three groups of numbers, thus combining R 2 Indicated by an asterisk.
27、R 1 The first number of (6, 3) and R in (1) 2 To R 27 Are compared in sequence, and no identical value is found, R 1 No changes are made.
Step eight, finishing R 1 To R m And deleting the list represented by the asterisk, and acquiring a combined list in which the redundant cases are removed, namely the test case set which is automatically generated. From the hypothesis data of step seven, the automatically generated test cases are (6, 3, 9), (6, 4, 10), (6, 4, 8), (6, 2, 10), (6, 2, 8), (7, 3, 10), (7, 3, 8), (7, 4, 9), (7, 2, 9), (5, 3, 10), (5, 3, 8), (5, 4, 9), (5, 2, 9).

Claims (1)

1. A method for automatically generating a code-level test case set is characterized by comprising the following steps:
step one, traversing a source program, searching keywords of a conditional statement, extracting judgment conditions, and summarizing to form a condition list; if the condition comprises a logic operational character, intercepting the logic operational character serving as a partition point, and summarizing to form a condition list;
step two, traversing the condition list, and extracting parameter names, parameter values and comparison operational characters between the parameter names and the parameter values;
step three, based on the parameter name and the parameter valueThe inter-comparison operational characters expand parameter values in a mode of combining equivalence class division and boundary value analysis; summarizing parameter values corresponding to the ith parameter to form a one-dimensional list P i Comprises the following steps:
P i =[a i ,a i +r,a i -r] (1)
in the formula 1<=i<= n, n denotes the total number of extracted parameters, a i Representing the value of the ith parameter in the decision condition, r representing a non-zero random positive number, a i +r,a i -r is a parameter value formed by expanding in an equivalence class division and boundary value analysis mode; if the comparison operational character is greater than the number and less than the number, deleting the P i First element a of i I.e. P i =[a i +r,a i -r]If the comparison operator is equal or unequal, deleting P i Middle third element a i R, i.e. P i =[a i ,a i +r];
Forming expanded parameters numerical value list P = { P = { P = 1, ...,P i, ...,P n };
Fourthly, performing Cartesian product operation on the parameter numerical value list P to form a full-coverage test case list D = { D = 1,..., d j,..., d m H, m represents the number of elements in the list, 1<=j<= m, i.e. D = P 1 *...*P i *...*P n
P 1 *...*P i *...*P n ={(p 1 ,...,p i ,...,p n )|p i ∈P i ,i=1,2,...,n} (2)
Step five, splitting the full coverage test case list D according to elements to form a parameter value sublist D j I.e. d j =(a j1 ,a j2 ,...,a jn ),a j1 Is d j The value of the first parameter, and so on, a jn Is d j The last parameter value;
step six, pair d j The numerical values in (1) are combined in pairs to form d j Corresponding combined list R j I.e. R j ={(a j1 ,a j2 ),(a j1 ,a j3 ),...,(a j1 ,a jn ),...,(a j(n-1) ,a jn )};
Step seven, the step six shows that R m ={(a m1 ,a m2 ),(a m1 ,a m3 ),...,(a m1 ,a mn ),...,(a m(n-1) ,a mn ) R is substituted by m The first group number (a) m1 ,a m2 ) And R 1 To R m-1 Each group of numbers in (1) is compared, and if the same data is found, R is compared m Middle second number (a) m1 ,a m3 ) And R 1 To R m-1 Comparing each group number in (1), and repeating the same until R m In which all the numbers are in R 1 To R m-1 If the same data is found, then R is added m Indicated by asterisks, the above procedure was repeated until R was substituted 1 And R 2 To R m After comparing each group number in the step (a), finishing the step;
step eight, finishing R 1 To R m And deleting the list represented by the asterisk, and acquiring a combined list with the redundant cases removed, namely the automatically generated test case set.
CN201911036129.7A 2019-10-29 2019-10-29 Automatic generation method for code-level test case set Active CN110990257B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911036129.7A CN110990257B (en) 2019-10-29 2019-10-29 Automatic generation method for code-level test case set

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911036129.7A CN110990257B (en) 2019-10-29 2019-10-29 Automatic generation method for code-level test case set

Publications (2)

Publication Number Publication Date
CN110990257A CN110990257A (en) 2020-04-10
CN110990257B true CN110990257B (en) 2022-11-18

Family

ID=70082551

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911036129.7A Active CN110990257B (en) 2019-10-29 2019-10-29 Automatic generation method for code-level test case set

Country Status (1)

Country Link
CN (1) CN110990257B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102831056A (en) * 2012-07-31 2012-12-19 东南大学 Regression testing sample generating method based on modification impact analysis
EP2605141A1 (en) * 2011-12-15 2013-06-19 The Boeing Company Automated framework for dynamically creating test scripts for software testing
CN106776260A (en) * 2015-11-19 2017-05-31 北京计算机技术及应用研究所 The traversal search method of combination of two Test cases technology
CN107291620A (en) * 2017-06-30 2017-10-24 郑州云海信息技术有限公司 A kind of method for generating test case and device
CN109656802A (en) * 2017-10-10 2019-04-19 大连飞创信息技术有限公司 Test case design system based on high coupling automatic matching technology

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7024589B2 (en) * 2002-06-14 2006-04-04 International Business Machines Corporation Reducing the complexity of finite state machine test generation using combinatorial designs
DE102014105109A1 (en) * 2014-04-10 2015-10-15 Phoenix Contact Gmbh & Co. Kg Method and device for generating and processing test cases
CN109710532A (en) * 2018-12-28 2019-05-03 北京金山安全软件有限公司 Test case management method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2605141A1 (en) * 2011-12-15 2013-06-19 The Boeing Company Automated framework for dynamically creating test scripts for software testing
CN102831056A (en) * 2012-07-31 2012-12-19 东南大学 Regression testing sample generating method based on modification impact analysis
CN106776260A (en) * 2015-11-19 2017-05-31 北京计算机技术及应用研究所 The traversal search method of combination of two Test cases technology
CN107291620A (en) * 2017-06-30 2017-10-24 郑州云海信息技术有限公司 A kind of method for generating test case and device
CN109656802A (en) * 2017-10-10 2019-04-19 大连飞创信息技术有限公司 Test case design system based on high coupling automatic matching technology

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Multidimensional upwind scheme of diagonal Cartesian method for an advection–diffusion problem;He G et al.;《Computers & Fluids》;20090531;第38卷(第05期);全文 *
一种基于组合覆盖的黑盒测试用例自动生成方法;张卫祥 等;《飞行器测控学报》;20081031;第27卷(第5期);全文 *
组合的测试用例设计与评价方法;浦云明;《计算机技术与发展》;20140331;第24卷(第03期);全文 *

Also Published As

Publication number Publication date
CN110990257A (en) 2020-04-10

Similar Documents

Publication Publication Date Title
Cheng et al. Biclustering of expression data.
CN107807982B (en) Consistency checking method and device for heterogeneous database
JP7168772B2 (en) Neural network search method, device, processor, electronic device, storage medium and computer program
JP5427640B2 (en) Decision tree generation apparatus, decision tree generation method, and program
DE112011104633B4 (en) Unit for determining the starting point for a search
Czumaj et al. Relating two property testing models for bounded degree directed graphs
EP3826000B1 (en) Automatic preparation of a new midi file
CN110990257B (en) Automatic generation method for code-level test case set
Barenboim et al. Fully-dynamic graph algorithms with sublinear time inspired by distributed computing
Chen et al. Multi-stage design for quasipolynomial-time isomorphism testing of Steiner 2-systems
US5189629A (en) Method of logic gate reduction in a logic gate array
JP6136567B2 (en) Program, information processing apparatus, and information processing method
JP7087931B2 (en) Search program, search method and search device
Henzinger et al. Certificates and fast algorithms for biconnectivity in fully-dynamic graphs
Xie et al. HGC: Hierarchical group convolution for highly efficient neural network
Shi et al. Generating and validating cluster sampling matrices for model-free factor screening
CN106777262B (en) High-throughput sequencing data quality filtering method and filtering device
CN115857944A (en) Method for analyzing json array field and displaying json array field in rows based on sql
Krawczyk Classes of states of discrete systems
CN111061456B (en) Intelligent pseudo-random number generation method based on distributed architecture
Hypki et al. BEANS–distributed data analysis for numerical simulations
JPH08221254A (en) Method and device for merging sort
WO2022093206A1 (en) Dimensionality reduction
CN116933027A (en) SVD algorithm-based data anomaly detection method
CN116010281A (en) Integrated fuzzy test method and system for automatically selecting fuzzifier combination

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