CN113918474A - Test case management method and device based on data mode - Google Patents

Test case management method and device based on data mode Download PDF

Info

Publication number
CN113918474A
CN113918474A CN202111528823.8A CN202111528823A CN113918474A CN 113918474 A CN113918474 A CN 113918474A CN 202111528823 A CN202111528823 A CN 202111528823A CN 113918474 A CN113918474 A CN 113918474A
Authority
CN
China
Prior art keywords
test
matrix
minimum
row
minimum test
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
CN202111528823.8A
Other languages
Chinese (zh)
Other versions
CN113918474B (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.)
Hangyin Consumer Finance Co ltd
Original Assignee
Hangyin Consumer Finance 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 Hangyin Consumer Finance Co ltd filed Critical Hangyin Consumer Finance Co ltd
Priority to CN202111528823.8A priority Critical patent/CN113918474B/en
Publication of CN113918474A publication Critical patent/CN113918474A/en
Application granted granted Critical
Publication of CN113918474B publication Critical patent/CN113918474B/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
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures

Abstract

The invention discloses a test case management method and equipment based on a data mode, relates to the technical field of automatic testing, and solves the problem that the existing minimum test case set generation method is poor in effect. The method comprises the following steps: creating a plurality of minimum test units and setting a unique unit identifier; combining a plurality of minimum test units to obtain all minimum test unit combinations; obtaining all minimum test unit combination rules in each minimum test unit combination; acquiring a minimum test case set of each minimum test unit combination rule; creating a plurality of types of test data and setting a unique data identifier; based on the unique unit identifier and the unique data identifier, performing field matching on the minimum test case set and the test data; and searching a corresponding minimum test case set in the test case library based on the received target test unit combination rule, and acquiring corresponding test data according to a field matching result.

Description

Test case management method and device based on data mode
Technical Field
The present application relates to the field of automated testing technologies, and in particular, to a test case management method and device based on a data pattern.
Background
Software testing is one of the necessary steps in developing high quality software. In the research and development process, software needs to go through the stages of unit test, integration test, system test, regression test and the like to ensure the quality of each basic component unit and each interface of the software, verify the correctness of the software function and the interface, and repair found errors. This requires the tester to write test cases to test the software. A test case is a set of test inputs, execution conditions, and expected results tailored for a particular purpose in order to test a certain program path or verify that the test results meet a certain requirement.
At present, more mature automatic test research and application exist, and some related tools (such as JUnit, XUnit, Robolect, etc.) are widely adopted by many enterprises, colleges and universities, etc. However, for the automatic generation of test cases, the difficulty lies in how to test the software sufficiently with the least test cases. At present, a popular minimum test case generation tool generally adopts a greedy algorithm with a high speed, but the greedy algorithm is difficult to ensure that a generated test case set is minimum. In addition, software testing requires inputting specific test data into a written test case, the test data often needs to be acquired from a plurality of different sources, and after the test data is acquired, a tester still needs to manually input the test data into the test case, so that real automatic testing cannot be achieved.
Disclosure of Invention
The embodiment of the application provides a test case management method based on a data mode, which is used for solving the following technical problems: the existing minimum test case set generation method has poor effect, and the acquisition and input of test data cannot be automated.
The embodiment of the application adopts the following technical scheme:
in one aspect, an embodiment of the present application provides a test case management method based on a data pattern, where the method includes: creating a plurality of minimum test units, and setting a unique unit identifier for each minimum test unit; wherein the minimum test unit is a software test requirement without a Boolean operator; combining the minimum test units to obtain all the minimum test unit combinations; in each minimum test unit combination, adding a preset Boolean operator between every two adjacent minimum test units to obtain all minimum test unit combination rules; based on matrix operation, acquiring a minimum test case set of each minimum test unit combination rule, and storing all the minimum test case sets in a database to obtain a test case library; creating a plurality of types of test data, and setting a unique data identifier for each type of test data; storing the test data of the types in a database to obtain a test database; the unique data identification is set according to the unique unit identification; based on the unique unit identifier and the unique data identifier, performing field matching on the minimum test case set in the test case library and the test data in the test database; and searching a corresponding minimum test case set in the test case library based on the received target test unit combination rule, and acquiring corresponding test data according to the field matching result.
In a possible embodiment, combining the minimum test units to obtain all combinations of the minimum test units includes: if a total number of M minimum test units, randomly selecting N minimum test units from the M minimum test units for combination to obtain all minimum test unit combinations; wherein N is more than or equal to 2 and less than or equal to M.
In a possible implementation manner, in each minimum test unit combination, a preset boolean operator is added between every two adjacent minimum test units to obtain all minimum test unit combination rules, which specifically include: determining that N-1 positions of each minimum test unit combination need to be added with the preset Boolean operator according to N minimum test units in each minimum test unit combination; the preset Boolean operator comprises an and an or; determining all quantity distribution schemes of the ANDs and the or according to the quantity of the Boolean operators and the quantity of the Boolean operators or; wherein the number allocation scheme is N-2 in total; allocating the quantity of the and the or according to the quantity allocation scheme to obtain N-1 Boolean operators; inserting the N-1 Boolean operators into the N-1 positions to obtain a minimum test unit combination rule corresponding to the quantity distribution scheme; and determining the minimum test unit combination rule corresponding to each quantity distribution scheme to obtain all the minimum test unit combination rules.
In a feasible implementation manner, the obtaining of the minimum test case set of each minimum test unit combination rule based on matrix operation specifically includes: representing the minimum test unit combination rule in a form of a binary tree; the minimum test unit in the minimum test unit combination rule is a leaf node of a binary tree, and the Boolean operator is a non-leaf node of the binary tree; according to a preset expression rule, expressing a first subtree and a second subtree of the binary tree by using a first matrix and a second matrix respectively; calculating the first matrix and the second matrix according to a preset operation rule to obtain the minimum test case set; wherein the minimum test case set is represented in a matrix form.
In a possible implementation manner, according to a preset representation rule, representing a first subtree and a second subtree of the binary tree by using a first matrix and a second matrix respectively includes: respectively enumerating all possible value conditions of each leaf node of each subtree; if the minimum test unit corresponding to the leaf node is true, taking a value of 1; if the minimum test unit corresponding to the leaf node is false, taking a value of 0; placing each value taking condition in each row of the matrix respectively; performing logic operation on each row in the matrix according to the Boolean operator corresponding to the parent node of the leaf node of each subtree; placing the result of the logical operation at the end of each row of the matrix; if the Boolean operator corresponding to the parent node is AND, deleting rows in the matrix, the number of which is greater than a preset value, of 0 to obtain the first matrix or the second matrix; wherein the preset value is half of the number of elements in each row of the matrix; and if the Boolean operator corresponding to the parent node is or, deleting the rows in the matrix, of which the number of 1 is greater than the preset value.
In a feasible implementation manner, the operating the first matrix and the second matrix according to a preset operation rule to obtain the minimum test case set specifically includes: if the Boolean operator connecting the first subtree and the second subtree is AND, performing a first preset operation on each row in the first matrix and the row with the operation result of 1 in the second matrix to obtain a first AND matrix; performing a first preset operation on each row in the second matrix and the row with the operation result of 1 in the first matrix to obtain a second and matrix; merging the first and second and matrixes, and removing repeated rows to obtain the minimum test case set; the specific method of the first preset operation includes: selecting a row with the last element of 1 in the second matrix, and determining the row as a target row; performing and operation on the last element of each row of the first matrix and the last element of the target row, and replacing the last element of each row of the first matrix with the operation result; inserting other elements except the last element in the target row before the last element of each row replaced by the first matrix; if the Boolean operator connecting the first subtree and the second subtree is an or, performing second preset operation on each row in the first matrix and the row with the operation result of 0 in the second matrix to obtain a first or matrix; performing second preset operation on each row in the second matrix and the row with the operation result of 0 in the first matrix to obtain a second or matrix; merging the first or matrix and the second or matrix, and removing repeated rows to obtain the minimum test case set; the specific method of the second preset operation includes: selecting a row with the last element of 0 in the second matrix, and determining the row as a target row; performing or operation on the last element of each row of the first matrix and the last element of the target row, and replacing the last element of each row of the first matrix with the operation result; and inserting other elements except the last element in the target row before the last element of each row replaced by the first matrix.
In a possible implementation manner, creating several types of test data, and setting a unique data identifier for each type of test data specifically includes: creating several types of test data according to specific software; wherein the test data includes at least any one of the following types: system test data, sql test data, performance test data, and XML test data; setting a unique data identifier for each type of test data according to the corresponding relation between each type of test data and the minimum test unit; and the preset field in the unique data identifier is the same as the preset field in the unique unit identifier of the corresponding minimum test unit.
In a possible implementation manner, after obtaining the corresponding test data according to the result of the field matching, the method further includes: determining all test cases corresponding to the target test unit combination rule and an expected result of each test case according to the minimum test case set corresponding to the target test unit combination rule; in a matrix corresponding to the minimum test case set, each row represents one test case; inputting the test data into each test case respectively, and automatically executing each test case to obtain a test result of each test case; and comparing the test result with the corresponding expected result, and if the comparison result is consistent, determining that the test result corresponding to the target test unit combination rule is a test pass.
In a possible implementation manner, after the test data is respectively input into each test case and each test case is automatically executed to obtain a test result of each test case, the method further includes: acquiring the real-time execution state of the minimum test case set, and displaying the real-time execution state in an automatic test tool; wherein the execution state includes at least any one of: executing progress, executing end and executing failure; the execution progress is used for indicating that the current time is executing the first test case of the minimum test case set; and storing the real-time execution state of each executing minimum test case set according to a preset template to generate a visual execution report.
On the other hand, an embodiment of the present application further provides a test case management device based on a data pattern, including: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor, so that the at least one processor can execute the test case management method based on the data pattern according to any one of the embodiments.
The embodiment of the application adopts at least one technical scheme which can achieve the following beneficial effects:
1. the method for solving the minimum test case set is characterized in that the combination rules of various minimum test units are represented by a binary tree, each subtree of the binary tree is represented by a matrix, then the minimum test case set of the current binary tree is obtained by operation among the matrices, and only simple matrix combinational logic operation is needed in the calculation process, so that the operation amount is small.
2. By constructing a series of minimum test units, then solving the minimum test case sets corresponding to all the combination rules of the lowest test unit, and storing the minimum test case sets in the test case library, when a tester needs to test a certain combination rule, the minimum test case set corresponding to the combination rule can be called out in the test case library only by inputting the combination rule. The method also creates various types of test data, stores the test data in the test database, and performs field matching on the data in the test database and each minimum test case set in the test case library. When the lowest test case set is called, the corresponding test data can be called out at the same time, and the corresponding test data does not need to be collected or searched manually. After the minimum test case set and the test data are called out, the test data can be automatically input into the minimum test case set, and each test case can be automatically executed. The acquisition and the input of the test data can be automated, and much time is saved for a tester.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts. In the drawings:
fig. 1 is a flowchart of a test case management method based on a data pattern according to an embodiment of the present application;
fig. 2 is a schematic diagram of a binary tree of minimum test unit combination rules according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a binary tree of another minimum test unit combination rule provided in the embodiment of the present application;
fig. 4 is a schematic structural diagram of a test case management device based on a data pattern according to an embodiment of the present application.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any inventive step based on the embodiments of the present disclosure, shall fall within the scope of protection of the present application.
The embodiment of the present application provides a test case management method based on a data pattern, as shown in fig. 1, the test case management method based on the data pattern specifically includes steps 101-:
step 101, creating a plurality of minimum test units, and setting a unique unit identifier for each minimum test unit.
Specifically, a plurality of corresponding minimum test units are created according to the software characteristics of the enterprise, and the created minimum test units can cover all the use requirements of the enterprise software as much as possible. Wherein the minimum test unit represents a software test requirement without a Boolean operator. For example, if a software test requirement is "the input character is a numeric character," then the software test requirement is a minimum unit of testing. If a software test requirement is that "the input character is a numeric character and the input character is 11 bits", the software test requirement is not a minimum test unit, wherein "the input character is a numeric character" and "the input character is 11 bits" are respectively a minimum test unit.
Further, a unique unit identification is set for each minimum test unit created, for example, identifying "the input character is a numeric character" as Q1, Q1 may be a string of characters or a string of numbers.
And 102, combining the minimum test units by the test case management equipment to obtain all the minimum test unit combinations.
Specifically, the test case management apparatus combines all the minimum test units created, and the combination here refers to "combination" in the mathematical term "permutation combination".
In one embodiment, if a total of M minimum test units are created, N (N) is arbitrarily chosen among the M minimum test units
Figure DEST_PATH_IMAGE001
[2,M]) And combining the minimum test units to obtain all the minimum test unit combinations. That is, 2, 3, … … M minimum test units are selected from the M minimum test units respectively for combination.
Wherein each time N takes a value, it will generate
Figure 860467DEST_PATH_IMAGE002
Combining the minimum test units to finally generate
Figure DEST_PATH_IMAGE003
A minimum test unit combination is used.
Step 103, the test case management device adds a preset boolean operator between every two adjacent minimum test units in each minimum test unit combination to obtain all minimum test unit combination rules.
And inserting the Boolean operator and or between every two minimum test units in the minimum test unit combination to obtain all possible minimum test unit combination rules. For example, an and or is inserted between every two minimum test units in the minimum test unit combination < Q1Q 2Q 3Q 4>, resulting in < Q1 and Q2 or Q3 and Q4>, which is a minimum test unit combination rule.
In one embodiment, several pairs of brackets may be further written algorithmically or manually added randomly in the minimum test unit combination rule, generating a combination rule with an operation order to meet various test requirements, such as < (Q1 and Q2) or (Q3 and Q4) >.
Specifically, since there is N (N) in each minimum test unit combination
Figure 300676DEST_PATH_IMAGE001
[2,M]) The minimum test unit indicates that N-1 positions in each minimum test unit combination need to be added with a preset Boolean operator, and therefore X is knownand+Xor= N-1, wherein XandNumber of Boolean operators and, XorThe number of boolean operators or. Therefore all quantity assignments for and or are N-2 in total. And then, carrying out quantity distribution on the and the or according to a quantity distribution scheme to obtain N-1 Boolean operators. For example, insert 1 and N-2 or.
Further, inserting N-1 Boolean operators into N-1 positions to obtain a minimum test unit combination rule corresponding to the quantity distribution scheme; wherein, the number of the insertion modes corresponding to each quantity distribution scheme is
Figure 167000DEST_PATH_IMAGE004
(ii) a The number of all minimum test unit combination rules is L = (N-2) ×
Figure 725283DEST_PATH_IMAGE004
And 104, the test case management equipment acquires the minimum test case set of each minimum test unit combination rule based on matrix operation, and stores all the minimum test case sets in a database to obtain a test case library.
Specifically, each minimum test unit combination is traversed from left to right, and each minimum test unit combination rule is represented in a binary tree form. And setting the traversed minimum test unit as a leaf node, and setting the traversed Boolean operator as a non-leaf node.
In one embodiment, if a certain minimum test unit combination rule is < (Q1 and Q2) and (Q3 or Q4) >, the rule is traversed from left to right, as shown in FIG. 2, setting Q1 as the first leaf node, Q2 as the second leaf node, the first and as the parents of Q1 and Q2, and the second and as the parents of the first and. Setting or as another child node of the second and, setting Q3 and Q4 as child nodes of or, respectively, and obtaining the complete binary tree shown in fig. 2 after the traversal is finished.
In another embodiment, if there are no parentheses in a certain minimum test unit combination rule, < Q1 and Q2) and Q3 or Q4>, then the rule is traversed from left to right, as shown in FIG. 3, setting Q1 as the first leaf node, Q2 as the second leaf node, the first and as the parent nodes of Q1 and Q2, the second and as the parent node of the first and, and Q3 as the child node of the second and. Setting or as the parent node of the second and, setting Q4 as the child node of or, and after the traversal is finished, obtaining the complete binary tree shown in fig. 3.
Further, according to a preset representation rule, the obtained first subtree and the second subtree of each binary tree are represented by a first matrix and a second matrix respectively. The preset representation rule specifically includes:
respectively enumerating all possible value conditions of each leaf node of each subtree; if the minimum test unit corresponding to the leaf node is true, taking a value of 1; if the minimum test unit corresponding to the leaf node is false, taking a value of 0; placing each value taking condition in each row of the matrix respectively; performing logic operation on each row in the matrix according to the Boolean operator corresponding to the parent node of the leaf node of each subtree; putting the result of the logic operation at the end of each row of the matrix; if the Boolean operator corresponding to the parent node is AND, deleting rows in the matrix, the number of which is greater than or equal to the preset value, of 0 to obtain a first matrix or a second matrix; wherein the preset value is half of the number of elements in each row of the matrix.
In one embodiment, as shown in fig. 2, the leaf nodes of the left subtree are Q1 and Q2, and the values of Q1 and Q2 are four cases, i.e., Q1=1 and Q2= 1; q1=1, Q2= 0; q1=0, Q2= 1; q1=0, Q2= 0; therefore, each value is placed in each row of the matrix, and the preliminary matrix is obtained as follows:
Figure DEST_PATH_IMAGE005
then, since the parent node between Q1 and Q2 is and, a logical operation is performed on each row in the matrix, and the logical operation result is placed at the end of each row, resulting in a matrix:
Figure 600835DEST_PATH_IMAGE006
. The final column of the matrix is the result of the first two columns and the first two columns are subjected to the and operation. Finally, since the parent node between Q1 and Q2 is AND, the number of 0 in the matrix is larger than that of 0 in the matrix
Figure DEST_PATH_IMAGE007
Deleting rows of 3, i.e. deleting the last row, to obtain the final first matrix
Figure 161129DEST_PATH_IMAGE008
. The right subtree is treated in the same way to obtain a second matrix
Figure DEST_PATH_IMAGE009
And further, the first matrix and the second matrix are operated according to a preset operation rule to obtain a minimum test case set. Wherein, the minimum test case set is represented in a matrix form. The preset operation rule specifically includes:
1. and if the Boolean operator connecting the first subtree and the second subtree is AND, performing a first preset operation on each row in the first matrix and the row with the operation result of 1 in the second matrix to obtain a first AND matrix. And then, performing a first preset operation on each row in the second matrix and the row with the operation result of 1 in the first matrix to obtain a second and matrix. And combining the first and second and matrixes, and removing repeated rows to obtain a matrix corresponding to the minimum test case set.
2. And if the Boolean operator connecting the first subtree and the second subtree is an or, performing second preset operation on each row in the first matrix and the row with the operation result of 0 in the second matrix to obtain a first or matrix. And then, performing second preset operation on each row in the second matrix and the row with the operation result of 0 in the first matrix to obtain a second or matrix. And merging the first or matrix and the second or matrix, and removing repeated rows to obtain a matrix corresponding to the minimum test case set.
The specific method of the first preset operation comprises the following steps:
selecting a row with the last element of 1 in the second matrix, and determining the row as a target row; performing and operation on the last element of each row of the first matrix and the last element of the target row, and replacing the last element of each row of the first matrix with the operation result; and inserting other elements except the last element in the target row before the last element of each row replaced by the first matrix.
For example, if the first matrix is
Figure 995093DEST_PATH_IMAGE010
The second matrix is
Figure DEST_PATH_IMAGE011
. As shown in FIG. 2, the Boolean operator connecting the first subtree and the second subtree is an AND. Then the row with the operation result of 1 in the second matrix is selected first
Figure 509513DEST_PATH_IMAGE012
And
Figure DEST_PATH_IMAGE013
the last element 1 in the two rows is respectively connected to the last column element in the first matrix
Figure 251073DEST_PATH_IMAGE014
And (5) performing an and operation. It can be known that the calculated results are all
Figure 869137DEST_PATH_IMAGE014
Calculated by calculation
Figure 139581DEST_PATH_IMAGE014
Replacing last column elements in the first matrix
Figure 610139DEST_PATH_IMAGE014
Obtaining a replaced matrix of
Figure DEST_PATH_IMAGE015
. Then will be
Figure 827493DEST_PATH_IMAGE012
The first two elements in (1) are respectively inserted into the replaced matrix
Figure 831222DEST_PATH_IMAGE015
Before the last column of elements of (1), get
Figure 475829DEST_PATH_IMAGE016
. Will be provided with
Figure 728956DEST_PATH_IMAGE013
The first two elements of (2) are inserted into the replaced matrix
Figure 484423DEST_PATH_IMAGE015
Before the last column of elements of (1), get
Figure DEST_PATH_IMAGE017
. At this time, the process of the present invention,
Figure 109701DEST_PATH_IMAGE016
and
Figure 925211DEST_PATH_IMAGE017
are all first and matrices.
The specific method of the second preset operation comprises the following steps: selecting a row with the last element of 0 in the second matrix, and determining the row as a target row; performing or operation on the last element of each row of the first matrix and the last element of the target row, and replacing the operation result with the last element of each row of the first matrix; and inserting other elements except the last element in the target row before the last element of each row replaced by the first matrix.
In one embodiment, if the first and matrix is
Figure 603317DEST_PATH_IMAGE016
And
Figure 162474DEST_PATH_IMAGE017
the second and matrix is
Figure 875215DEST_PATH_IMAGE018
Then the matrix corresponding to the minimum test case set after merging and after removing the repeated rows is
Figure DEST_PATH_IMAGE019
And
Figure 127205DEST_PATH_IMAGE020
the two matrices are<(Q1 and Q2) and (Q3 or Q4)>The minimum set of test cases.
Further, all the minimum test case sets obtained by the above method are stored in a database to obtain a test case library.
105, creating a plurality of types of test data, and setting a unique data identifier for each type of test data; and storing the test data of the plurality of types in a database to obtain a test database.
Specifically, various types of test data that can be used by the software are created according to the particular software. The test data comprises types such as system test data, sql test data, performance test data, XML test data and the like, and which test data can be created according to actual requirements.
Further, according to the corresponding relation between each type of test data and each minimum test unit, a unique data identifier is set for each type of test data. The preset field in the unique data identification is the same as the preset field in the corresponding unique unit identification of the minimum test unit.
For example, if the unique unit identifier of a certain minimum test unit is Q1, then the unique data identifier of the test data associated with this minimum test unit is also set to Q1. Alternatively, if Q1 is a 10-length string, then the first 5 characters in the unique data identifier of the test data associated with this minimum test unit are set to be the first 5 characters of Q1.
Further, all the created test data are stored in a database to obtain a test database. New test data can be added to the test database at any time.
And 106, the test case management equipment performs field matching on the minimum test case set in the test case library and the test data in the test database based on the unique unit identifier and the unique data identifier.
Specifically, the unique unit identifier of each minimum test unit is matched with the unique data identifier of each test data through a field matching technology, and if the same preset field exists, the matching is successful. The minimum test unit combination rule corresponding to one minimum test case set comprises a plurality of minimum test units, so that all test data corresponding to each minimum test case set are found through field matching.
And 107, the automatic test tool searches the corresponding minimum test case set in the test case library based on the received target test unit combination rule, and acquires corresponding test data according to the result of field matching.
Specifically, the tester may input the target test unit combination rule in the automated test tool, and the automated test tool may search the corresponding minimum test case set in the test case library according to the target test unit combination rule, and extract the test data corresponding to the minimum test case set in the test database.
For example, the minimum test unit combination rule < (Q1 and Q2) and (Q3 or Q4) > includes four minimum test units Q1, Q2, Q3 and Q4, and by field matching, which test data the Q1, Q2, Q3 and Q4 correspond to respectively is found, and all the test data are extracted in the test database.
Further, in the matrix corresponding to the minimum test case set, each row represents one test case, and the last element of each row represents an expected result of each test case.
In one embodiment, the minimum test unit combination rule<(Q1 and Q2) and (Q3 or Q4)>The corresponding minimum test case set is
Figure 375828DEST_PATH_IMAGE019
And
Figure 207518DEST_PATH_IMAGE020
each row of the two matrices is a test case, e.g., the first row of the first matrix
Figure 40345DEST_PATH_IMAGE021
Represents when Q1 is true and Q2 is true and Q3 is true and Q4 is false,<(Q1 and Q2) and (Q3 or Q4)>the expected result of (c) is true.
Furthermore, the test data is respectively input into each test case, and each test case is automatically executed to obtain the test result of each test case. And comparing the test result with the corresponding expected result, and if the comparison result is consistent, determining that the test result corresponding to the target test unit combination rule is a test pass.
For example, in the software to be tested, the test case is executed: < (Q1 and Q2) and (Q3 or Q4) >, wherein Q1 is true and Q2 is true and Q3 is true and Q4 is false. Then, the test data corresponding to Q1 is input into Q1, the test data corresponding to Q2 is input into Q2, the test data corresponding to Q3 is input into Q3, the test data corresponding to Q4 is input into Q4, and when Q1 is true, Q2 is true, Q3 is true, and Q4 is false, the test result of < (Q1 and Q2) and (Q3 or Q4) > is obtained, if the test result is true, the test case passes the test, and the next test case is executed continuously.
In one embodiment, the automated test tool obtains the real-time execution state of the minimum test case set and displays the real-time execution state in the visual interface. The execution state at least comprises execution progress, execution end and execution failure. The execution progress is used for indicating that the current time is executing the second test case of the minimum test case set.
And further, storing the real-time execution state of each executing minimum test case set according to a preset template to generate a visual execution report. The preset template is manually set and stored in the automatic testing tool in advance.
In addition, an embodiment of the present application further provides a test case management device 300 based on a data pattern, as shown in fig. 3, the device includes:
at least one processor 301; and a memory 302 communicatively coupled to the at least one processor; wherein the memory 302 stores instructions executable by the at least one processor 301 to enable the at least one processor 301 to:
creating a plurality of minimum test units, and setting a unique unit identifier for each minimum test unit; wherein the minimum test unit is a software test requirement without a Boolean operator;
combining a plurality of minimum test units to obtain all minimum test unit combinations;
in each minimum test unit combination, adding a preset Boolean operator between every two adjacent minimum test units to obtain all minimum test unit combination rules;
based on matrix operation, acquiring a minimum test case set of each minimum test unit combination rule, and storing all the minimum test case sets in a database to obtain a test case library;
creating a plurality of types of test data, and setting a unique data identifier for each type of test data; storing the test data of a plurality of types in a database to obtain a test database; the unique data identification is set according to the unique unit identification;
based on the unique unit identifier and the unique data identifier, performing field matching on the minimum test case set in the test case library and the test data in the test database;
and searching a corresponding minimum test case set in the test case library based on the received target test unit combination rule, and acquiring corresponding test data according to a field matching result.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the device, and the nonvolatile computer storage medium, since they are substantially similar to the embodiments of the method, the description is simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
The test case library and the test database are established and connected through field matching, so that the test case library, the test database and the automatic test tool form a complete automatic execution flow, a tester only needs to input a Boolean expression to be tested in the automatic test tool, a lowest test case set corresponding to the Boolean expression can be automatically executed, and test data do not need to be manually input. The execution progress and the execution result of each test case in the test case set can be seen in real time in the execution process, and the visual report can be automatically obtained after the execution is finished, so that the workload of testers is greatly reduced, and the automation degree of the test work is enhanced.
The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art to which the embodiments of the present application pertain. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A test case management method based on a data mode is characterized by comprising the following steps:
creating a plurality of minimum test units, and setting a unique unit identifier for each minimum test unit; wherein the minimum test unit is a software test requirement without a Boolean operator;
combining the minimum test units to obtain all the minimum test unit combinations;
in each minimum test unit combination, adding a preset Boolean operator between every two adjacent minimum test units to obtain all minimum test unit combination rules;
based on matrix operation, acquiring a minimum test case set of each minimum test unit combination rule, and storing all the minimum test case sets in a database to obtain a test case library;
creating a plurality of types of test data, and setting a unique data identifier for each type of test data; storing the test data of the types in a database to obtain a test database; the unique data identification is set according to the unique unit identification;
based on the unique unit identifier and the unique data identifier, performing field matching on the minimum test case set in the test case library and the test data in the test database;
and searching a corresponding minimum test case set in the test case library based on the received target test unit combination rule, and acquiring corresponding test data according to the field matching result.
2. The method for managing test cases based on data patterns according to claim 1, wherein the step of combining the minimum test units to obtain all combinations of the minimum test units comprises:
if a total number of M minimum test units, randomly selecting N minimum test units from the M minimum test units for combination to obtain all minimum test unit combinations; wherein N is more than or equal to 2 and less than or equal to M.
3. The method according to claim 2, wherein a preset boolean operator is added between every two adjacent minimum test units in each minimum test unit combination to obtain all minimum test unit combination rules, and specifically includes:
determining that N-1 positions of each minimum test unit combination need to be added with the preset Boolean operator according to N minimum test units in each minimum test unit combination; the preset Boolean operator comprises an and an or;
determining all quantity distribution schemes of the ANDs and the or according to the quantity of the Boolean operators and the quantity of the Boolean operators or; wherein the number allocation scheme is N-2 in total;
allocating the quantity of the and the or according to the quantity allocation scheme to obtain N-1 Boolean operators;
inserting the N-1 Boolean operators into the N-1 positions to obtain a minimum test unit combination rule corresponding to the quantity distribution scheme;
and determining the minimum test unit combination rule corresponding to each quantity distribution scheme to obtain all the minimum test unit combination rules.
4. The method according to claim 1, wherein the obtaining of the minimum test case set of each minimum test unit combination rule based on matrix operation specifically includes:
representing the minimum test unit combination rule in a form of a binary tree; the minimum test unit in the minimum test unit combination rule is a leaf node of a binary tree, and the Boolean operator is a non-leaf node of the binary tree;
according to a preset expression rule, expressing a first subtree and a second subtree of the binary tree by using a first matrix and a second matrix respectively;
calculating the first matrix and the second matrix according to a preset operation rule to obtain the minimum test case set; wherein the minimum test case set is represented in a matrix form.
5. The method for managing test cases based on data patterns according to claim 4, wherein the first subtree and the second subtree of the binary tree are represented by a first matrix and a second matrix respectively according to a preset representation rule, specifically comprising:
respectively enumerating all possible value conditions of each leaf node of each subtree; if the minimum test unit corresponding to the leaf node is true, taking a value of 1; if the minimum test unit corresponding to the leaf node is false, taking a value of 0;
placing each value taking condition in each row of the matrix respectively;
performing logic operation on each row in the matrix according to the Boolean operator corresponding to the parent node of the leaf node of each subtree;
placing the result of the logical operation at the end of each row of the matrix;
if the Boolean operator corresponding to the parent node is AND, deleting rows in the matrix, the number of which is greater than a preset value, of 0 to obtain the first matrix or the second matrix; wherein the preset value is half of the number of elements in each row of the matrix;
and if the Boolean operator corresponding to the parent node is or, deleting the rows in the matrix, of which the number of 1 is greater than the preset value.
6. The method according to claim 5, wherein the first matrix and the second matrix are operated according to a preset operation rule to obtain the minimum test case set, and the method specifically includes:
if the Boolean operator connecting the first subtree and the second subtree is AND, performing a first preset operation on each row in the first matrix and the row with the operation result of 1 in the second matrix to obtain a first AND matrix;
performing a first preset operation on each row in the second matrix and the row with the operation result of 1 in the first matrix to obtain a second and matrix;
merging the first and second and matrixes, and removing repeated rows to obtain the minimum test case set;
the specific method of the first preset operation includes:
selecting a row with the last element of 1 in the second matrix, and determining the row as a target row; performing and operation on the last element of each row of the first matrix and the last element of the target row, and replacing the last element of each row of the first matrix with the operation result; inserting other elements except the last element in the target row before the last element of each row replaced by the first matrix;
if the Boolean operator connecting the first subtree and the second subtree is an or, performing second preset operation on each row in the first matrix and the row with the operation result of 0 in the second matrix to obtain a first or matrix;
performing second preset operation on each row in the second matrix and the row with the operation result of 0 in the first matrix to obtain a second or matrix;
merging the first or matrix and the second or matrix, and removing repeated rows to obtain the minimum test case set;
the specific method of the second preset operation includes:
selecting a row with the last element of 0 in the second matrix, and determining the row as a target row; performing or operation on the last element of each row of the first matrix and the last element of the target row, and replacing the last element of each row of the first matrix with the operation result; and inserting other elements except the last element in the target row before the last element of each row replaced by the first matrix.
7. The method for managing the test cases based on the data patterns according to claim 1, wherein a plurality of types of test data are created, and a unique data identifier is set for each type of test data, and specifically comprises:
creating several types of test data according to specific software; wherein the test data includes at least any one of the following types: system test data, sql test data, performance test data, and XML test data;
setting a unique data identifier for each type of test data according to the corresponding relation between each type of test data and the minimum test unit; and the preset field in the unique data identifier is the same as the preset field in the unique unit identifier of the corresponding minimum test unit.
8. The method according to claim 1, wherein after obtaining the corresponding test data according to the result of the field matching, the method further comprises:
determining all test cases corresponding to the target test unit combination rule and an expected result of each test case according to the minimum test case set corresponding to the target test unit combination rule; in a matrix corresponding to the minimum test case set, each row represents one test case;
inputting the test data into each test case respectively, and automatically executing each test case to obtain a test result of each test case;
and comparing the test result with the corresponding expected result, and if the comparison result is consistent, determining that the test result corresponding to the target test unit combination rule is a test pass.
9. The method according to claim 8, wherein after the test data is respectively input into each test case and each test case is automatically executed to obtain the test result of each test case, the method further comprises:
acquiring the real-time execution state of the minimum test case set, and displaying the real-time execution state in an automatic test tool; wherein the execution state includes at least any one of: executing progress, executing end and executing failure; the execution progress is used for indicating that the current time is executing the first test case of the minimum test case set;
and storing the real-time execution state of each executing minimum test case set according to a preset template to generate a visual execution report.
10. A test case management device based on data patterns, the device comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a method for data pattern based test case management according to any of claims 1-9.
CN202111528823.8A 2021-12-15 2021-12-15 Test case management method and device based on data mode Active CN113918474B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111528823.8A CN113918474B (en) 2021-12-15 2021-12-15 Test case management method and device based on data mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111528823.8A CN113918474B (en) 2021-12-15 2021-12-15 Test case management method and device based on data mode

Publications (2)

Publication Number Publication Date
CN113918474A true CN113918474A (en) 2022-01-11
CN113918474B CN113918474B (en) 2022-03-11

Family

ID=79248803

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111528823.8A Active CN113918474B (en) 2021-12-15 2021-12-15 Test case management method and device based on data mode

Country Status (1)

Country Link
CN (1) CN113918474B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108415846A (en) * 2018-04-19 2018-08-17 挖财网络技术有限公司 A kind of method and apparatus generating minimal automation test use cases
CN108628748A (en) * 2018-05-09 2018-10-09 平安普惠企业管理有限公司 Automatic test management method and automatic test manage system
WO2019242868A1 (en) * 2018-12-12 2019-12-26 Mitsubishi Electric Corporation Software testing device, software testing method, and software testing program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108415846A (en) * 2018-04-19 2018-08-17 挖财网络技术有限公司 A kind of method and apparatus generating minimal automation test use cases
CN108628748A (en) * 2018-05-09 2018-10-09 平安普惠企业管理有限公司 Automatic test management method and automatic test manage system
WO2019242868A1 (en) * 2018-12-12 2019-12-26 Mitsubishi Electric Corporation Software testing device, software testing method, and software testing program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
姜淑娟: "基于模式组合的粒子群优化测试用例生成方法", 《软件学报》 *

Also Published As

Publication number Publication date
CN113918474B (en) 2022-03-11

Similar Documents

Publication Publication Date Title
US11163744B2 (en) Test data generation and scale up for database testing using unique common factor sequencing
Jones et al. The automatic generation of software test data sets using adaptive search techniques
CN110442847B (en) Code similarity detection method and device based on code warehouse process management
CA3004594C (en) Cause backtracing method
JP4554499B2 (en) A scoring mechanism for automatically generated test programs
CN108681505B (en) Test case ordering method and device based on decision tree
Shishmarev et al. Visual search tree profiling
CN113918474B (en) Test case management method and device based on data mode
CN111444635B (en) System dynamics simulation modeling method and system based on XML language
Glazer Using python and Eppy for a large national simulation study
CN109408114B (en) Program error automatic correction method and device, electronic equipment and storage medium
CN113505283B (en) Screening method and system for test data
Ghiduk et al. Reducing the cost of higher-order mutation testing
CN114741300A (en) Test case based test method and device
Arciszewski et al. Inductive learning: the user's perspective
CN109685453B (en) Method for intelligently identifying effective paths of workflow
US10810101B2 (en) Benchmark software system and method
US20240134780A1 (en) Method, device, and computer program product for generating test case
CN113157551A (en) ROS-oriented differential fuzzy test method
CN115460297B (en) Automatic form verification method for network security protocol
Shabaan et al. Effects of FSM minimization techniques on number of test paths in mobile applications MBT
de Souza et al. An experimental study to evaluate the impact of the programming paradigm in the testing activity
Haikola Optimization of a Search Function in a Large Software Product
CN115904946A (en) Test case automatic generation method and system based on MoMuTUML
CN114153715A (en) High-simulation database number making method and system

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