CN112631917A - Test case generation method and device and electronic equipment - Google Patents

Test case generation method and device and electronic equipment Download PDF

Info

Publication number
CN112631917A
CN112631917A CN202011558098.4A CN202011558098A CN112631917A CN 112631917 A CN112631917 A CN 112631917A CN 202011558098 A CN202011558098 A CN 202011558098A CN 112631917 A CN112631917 A CN 112631917A
Authority
CN
China
Prior art keywords
value
reverse
dereferencing
target
combination
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.)
Pending
Application number
CN202011558098.4A
Other languages
Chinese (zh)
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.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
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 Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202011558098.4A priority Critical patent/CN112631917A/en
Publication of CN112631917A publication Critical patent/CN112631917A/en
Pending legal-status Critical Current

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

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)
  • Tests Of Electronic Circuits (AREA)

Abstract

The invention provides a test case generation method, a test case generation device and electronic equipment, on the basis of generating a test case, when the value combination operation is carried out, a plurality of forward value combination results with the same number as the maximum number can be obtained only by carrying out the maximum number of forward values screening, the forward value filling operation of a target input item and the forward value combination operation of the input item, and then the reverse value combination results are determined based on the forward value combination results and the reverse values of the input items.

Description

Test case generation method and device and electronic equipment
Technical Field
The invention relates to the field of testing, in particular to a method and a device for generating a test case and electronic equipment.
Background
The test case refers to a test document written by a tester in the software test, and comprises information such as methods, steps, expected results and the like.
In the process of writing the test case, the operation of combining the values of the input items on the same function page is often involved. The function page may include a plurality of entries, each entry having a number of forward values and a number of reverse values. When the number of the input items is large or the values of the input items are large, the time required by the process of generating the value combination is long, and the efficiency is low.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for generating a test case, and an electronic device, so as to solve the problems of long time and low efficiency in the process of generating a value combination when the number of input items is large or the values of the input items are large.
In order to solve the technical problems, the invention adopts the following technical scheme:
a method for generating a test case comprises the following steps:
acquiring each input item; the input item at least comprises a forward value;
acquiring the maximum number of the forward dereferencing numbers of the input items, screening out the input items of which the forward dereferencing numbers are smaller than the maximum number, and determining the input items as target input items;
carrying out forward value filling operation on the target input items until the number of forward values of the target input items is the maximum number;
performing a combination operation on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combination results with the same number as the maximum number;
determining a reverse dereferencing combined result based on the forward dereferencing combined results and the reverse dereferencing of each input item;
and generating a test case according to the forward value combination results and the reverse value combination results.
Optionally, performing forward value filling operation on the target input item until the number of forward values of the target input item is the maximum number, including:
filling at least one target forward value into the target input item until the number of the forward values of the target input item is the maximum number; the target forward value comprises a last forward value in the forward values included in the target entry.
Optionally, performing a combining operation on the forward values of the input items to obtain a plurality of forward value combining results with the same number as the maximum number, including:
and combining forward dereferencing values corresponding to the same serial number in each input item to obtain a plurality of forward dereferencing combined results.
Optionally, determining a reverse-valued combination result based on the forward-valued combination results and the reverse values of the respective input items, including:
selecting a forward dereferencing combined result from the plurality of forward dereferencing combined results, and determining the forward dereferencing combined result as a target forward dereferencing combined result;
obtaining the reverse value of each input item;
and for each reverse value, replacing target data in the target forward value combination result with the reverse value to obtain a reverse value combination result, wherein the target data is the forward value which is in the same input item with the reverse value.
Optionally, after determining a reverse-valued combination result based on the forward-valued combination results and the reverse values of the respective input items, the method further includes:
and determining test expected results of the forward-value combination results and the reverse-value combination results based on the judgment result of whether the reverse-value is included in the forward-value combination results and the reverse-value combination results.
A test case generation device comprises:
the input item acquisition module is used for acquiring each input item; the input item at least comprises a forward value;
the input item determining module is used for acquiring the maximum number of the forward dereferencing numbers of the input items, screening out the input items of which the forward dereferencing numbers are smaller than the maximum number, and determining the input items as target input items;
the data filling module is used for carrying out forward value filling operation on the target input items until the number of forward values of the target input items is the maximum number;
the data combination module is used for carrying out combination operation on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combination results with the number being the same as that of the maximum number;
a combination determination module, configured to determine a reverse-valued combination result based on the forward-valued combination results and the reverse values of the input items;
and the case generating module is used for generating a test case according to the forward value combination results and the reverse value combination results.
Optionally, the data padding module is specifically configured to:
filling at least one target forward value into the target input item until the number of the forward values of the target input item is the maximum number; the target forward value comprises a last forward value in the forward values included in the target entry.
Optionally, the data combining module is specifically configured to:
and combining forward dereferencing values corresponding to the same serial number in each input item to obtain a plurality of forward dereferencing combined results.
Optionally, the combination determination module includes:
the selecting submodule is used for selecting a forward value combination result from the plurality of forward value combination results and determining the forward value combination result as a target forward value combination result;
the value obtaining submodule is used for obtaining the reverse value of each input item;
and the data replacement submodule is used for replacing target data in the target forward value combination result with the reverse value for each reverse value to obtain a reverse value combination result, wherein the target data is the forward value which is in the same input item with the reverse value.
An electronic device, comprising: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is used to:
acquiring each input item; the input item at least comprises a forward value;
acquiring the maximum number of the forward dereferencing numbers of the input items, screening out the input items of which the forward dereferencing numbers are smaller than the maximum number, and determining the input items as target input items;
carrying out forward value filling operation on the target input items until the number of forward values of the target input items is the maximum number;
performing a combination operation on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combination results with the same number as the maximum number;
determining a reverse dereferencing combined result based on the forward dereferencing combined results and the reverse dereferencing of each input item;
and generating a test case according to the forward value combination results and the reverse value combination results.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides a test case generation method, a test case generation device and electronic equipment, wherein after each input item is obtained, the maximum number of forward-direction values of each input item is obtained, the input items of which the number is smaller than the maximum number are screened out and determined as target input items, then forward-direction value filling operation is carried out on the target input items until the number of the forward-direction values of the target input items is the maximum number, the forward-direction values of each input item are combined to obtain a plurality of forward-direction value combination results which are the same as the maximum number, then reverse-direction value combination results are determined based on the plurality of forward-direction value combination results and the reverse-direction values of each input item, and according to the plurality of forward-direction value combination results and the reverse-direction value combination results, and generating a test case. That is, the test case can be generated by this embodiment, and on this basis, when performing value combination operation, only the operations of screening the maximum number of forward values, performing forward value filling operation on a target input item, and performing forward value combination operation on the input item are performed, so as to obtain a plurality of forward value combination results having the same number as the maximum number, and then determining a reverse value combination result based on the plurality of forward value combination results and the reverse values of the input items, and each step is simple in operation, so that time required for generating value combination can be shortened, and efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings 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 embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for generating a test case according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for generating another test case according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a test case generation apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the process of compiling the cases, values of various input items are often involved, and different values have different case expectations. During testing, values of all input items of a certain function page are combined together to form a testing case containing a certain 'value combination'.
In practical applications, the inventors have found that the value combination can be achieved by the following steps. In particular, the method comprises the following steps of,
assuming that a certain function page has n input items, each input item has a plurality of forward values and a plurality of backward values, for all the input items, the following operations are performed:
first, four pools, namely a demand pool, a forward combination pool, a case step pool and a case pool, need to be defined.
1. And listing all forward values of the input items as a requirement and bringing the requirement into a requirement pool.
2. And acquiring forward values of all the input items, and taking the values of all the input items as Cartesian products to acquire all possible combination conditions to form a forward combination pool.
3. And traversing the cases in the case pool, and recording the quantity of the requirements in the existing requirement pool covered by each case.
4. Selecting the combination case with the largest covering requirement quantity, taking out the combination case from the combination pool, putting the combination case into the case step pool, and taking out the requirement covered by the case from the requirement pool.
5. And repeating the steps 3 and 4 until the number of the values in the demand pool is 0, and assuming that m forward combination cases are generated in the step.
6. And generating a negative combined case according to the positive combined case.
In order that those skilled in the art will be able to clearly understand this implementation, an example will now be described.
Assuming that a page has 5 entries I1, I2, I3, I4, I5, the following table:
TABLE 1
Input item Forward value of Reverse dereferencing
I1 T11、T12、T13 F11、F12、F13
I2 T21
I3 T31、T32 F31
I4 T41、T42、T43
I5 T51 F51
1. And listing all forward values of the input items as a requirement and bringing the requirement into a requirement pool.
TABLE 2
Figure BDA0002859381750000061
2. And acquiring forward values of all the input items, and taking the values of all the input items as Cartesian products to acquire all possible combination conditions to form a forward combination pool.
TABLE 3
Figure BDA0002859381750000062
Figure BDA0002859381750000071
3. And traversing the cases in the case pool, and recording the quantity of the requirements in the existing requirement pool covered by each case.
TABLE 4
Figure BDA0002859381750000072
Figure BDA0002859381750000081
4. Selecting the combination case with the largest covering requirement quantity, taking out the combination case from the combination pool, putting the combination case into the case step pool, and taking out the requirement covered by the case from the requirement pool.
We select [ serial number 1 ] in the forward combination pool, and then there are 2-12 cases remaining in the forward combination pool, one case is added in the case step pool, and 5 requirements are reduced in the requirement pool, as shown in the following table.
TABLE 5
Figure BDA0002859381750000082
TABLE 6
Figure BDA0002859381750000083
Figure BDA0002859381750000091
TABLE 7
Figure BDA0002859381750000092
5. And repeating the steps 3 and 4 until the number of the values in the demand pool is 0, and assuming that m forward combination cases are generated in the step.
Our 1 st round of selection has been tabulated previously, followed by a few subsequent rounds of selection.
[ 2 nd round of screening ]
First, a demand pool is provided, and after taking out 4 demands of the 1 st round, the remaining demands of the demand pool are as follows, and the number of the demands is 5.
TABLE 8
Figure BDA0002859381750000093
And repeating step 3, and updating the required quantity of the coverage requirement pool.
TABLE 9
Figure BDA0002859381750000094
Figure BDA0002859381750000101
And repeating step 4, at this time, selecting the [ serial number 11 ] in the forward combination pool (the coverage quantity is the maximum, and is 3), at this time, remaining cases of numbers 2-10 and 12-18 in the forward combination pool, adding one case in the case step pool, and reducing the requirements in the requirement pool by 3, as shown in the following table.
Watch 10
Figure BDA0002859381750000102
TABLE 11
Figure BDA0002859381750000103
Figure BDA0002859381750000111
TABLE 12
Figure BDA0002859381750000112
[ 3 rd round of screening ]
The first is the demand pool, and after taking out 3 demands of the 2 nd round, the remaining demands of the demand pool are as follows, and the number is 2.
Watch 13
Figure BDA0002859381750000113
And repeating step 3, and updating the required quantity of the coverage requirement pool.
TABLE 14
Figure BDA0002859381750000121
And repeating step 4, at this time, selecting [ serial number 15 ] in the forward combination pool (the coverage quantity is the maximum, and is 2), at this time, adding one case in the case step pool and reducing 3 requirements in the requirement pool by the number 2-10,12-15 and 16-18 cases in the forward combination pool, as shown in the following table.
Watch 15
Figure BDA0002859381750000122
Figure BDA0002859381750000131
TABLE 16
Figure BDA0002859381750000132
TABLE 17
Figure BDA0002859381750000133
At this time, the number of results in the requirement pool is 0, we have selected the descriptions of 3 forward combination cases at this time, step 5 ends, and step 6 begins to be executed, so as to obtain all combination results.
Although the above findings can achieve the result of value combination, the inventors found that the following technical problems still exist:
1. step 2, all the input items need to be fully combined, and the generated case combination number is the product of forward values of all the input items according to a multiplication principle; when the number of page entries is large, the product value rises exponentially, and a lot of time is consumed for both writing and generating by using a computer program.
2. Step 3 needs to count the number of coverage requirements based on step 2, and also needs to consume a lot of time when there are many cases generated in step 2.
3. Step 5 needs to repeat steps 3 and 4, and under the condition of more input items and values, step 3 needs to be executed to count the number of coverage requirements again every time of repetition, which still causes a great deal of time consumption.
4. The method has higher complexity, needs a certain algorithm and permutation and combination basis for operators, has higher difficulty in the hands, is not beneficial to case generation of a large-scale system with more input item and value combination, and if the method is realized in a computer program, the time and space complexity is exponential O (m ^ n).
In order to solve the technical problems of complex operation, long time consumption and difficulty in starting by technicians, the inventor finds that if the forward combinations can be expanded from zero forward combinations to a plurality of final forward combinations, the time and operation for obtaining the plurality of final forward combinations from all the forward combinations in a multi-screening mode due to determination of all the forward combinations can be reduced, thereby simplifying the operation process and saving the operation time.
Specifically, after each input item is obtained, the maximum number of the forward value numbers of each input item is obtained, the input items with the forward value numbers smaller than the maximum number are screened out and determined as target input items, then forward value filling operation is performed on the target input items until the forward value number of the target input items is the maximum number, combination operation is performed on the forward value numbers of the input items to obtain a plurality of forward value combination results the number of which is the same as that of the maximum number, then reverse value combination results are determined based on the plurality of forward value combination results and the reverse value of each input item, and test cases are generated according to the plurality of forward value combination results and the reverse value combination results. That is, the test case can be generated by this embodiment, and on this basis, when performing value combination operation, only the operations of screening the maximum number of forward values, performing forward value filling operation on a target input item, and performing forward value combination operation on the input item are performed, so as to obtain a plurality of forward value combination results having the same number as the maximum number, and then determining a reverse value combination result based on the plurality of forward value combination results and the reverse values of the input items, and each step is simple in operation, so that time required for generating value combination can be shortened, and efficiency is improved.
On the basis of the above content, an embodiment of the present invention provides a method for generating a test case, and with reference to fig. 1, the method may include:
and S11, acquiring each input item.
In practical application, referring to table 18, the input item includes at least one forward value, for example, input item I1 has three forward values of T11, T12, and T13, and input item I2 has T21 a forward value, and in addition, the input item may include at least one backward value, or may not include a backward value, for example, input item I1 has three values of F11, F12, and F13, but I2 does not have a backward value.
Watch 18
Input item Forward value of Reverse dereferencing
I1 T11、T12、T13 F11、F12、F13
I2 T21
I3 T31、T32 F31
I4 T41、T42、T43
I5 T51 F51
And S12, acquiring the maximum number of the forward-direction dereferencing numbers of the input items, screening the input items of which the forward-direction dereferencing numbers are smaller than the maximum number, and determining the input items as target input items.
Specifically, the number of forward values of each input item is determined, and then the maximum number is selected, referring to table 18, in table 18, the maximum number of forward values is 3, that is, max is 3.
And after the maximum number is determined, screening out the input items of which the number of forward values is less than the maximum number, such as 3, and determining the input items as target input items. In the present embodiment, the target entries are I2, I3, and I5.
And S13, performing forward value filling operation on the target input items until the number of forward values of the target input items is the maximum number.
In practical application, forward value filling operation is performed on the target input items, so as to ensure that the number of forward values included in each input item is the same.
More specifically, in this embodiment, in specific implementation, the following may be implemented:
filling at least one target forward value into the target input item until the number of the forward values of the target input item is the maximum number; the target forward value comprises a last forward value in the forward values included in the target entry.
Referring to table 19, the entries with forward values less than 3 are filled, the filling entry is the last value until 3 entries are filled, and the following table is shown after filling (bold font is filled):
watch 19
Input item Forward value of Reverse dereferencing
I1 T11、T12、T13 F11、F12、F13
I2 T21、T21、T21
I3 T31、T32、T32 F31
I4 T41、T42、T43
I5 T51、T51、T51 F51
And S14, performing combination operation on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combination results with the same number as the maximum number.
In practical application, forward values corresponding to the same serial number in each input item can be combined to obtain a plurality of forward value combination results.
Specifically, referring to table 19, the input item I1 has three forward values T11, T12, and T13, which correspond to sequence numbers of 1, 2, and 3, respectively, the input item I2 has three forward values T21, T21, and T21, which correspond to sequence numbers of 1, 2, and 3 … …, the input item I5 has three forward values T51, T51, and T51, which correspond to sequence numbers of 1, 2, and 3, respectively.
In this embodiment, forward values corresponding to the same serial number in each of the input entries are combined, that is, a first forward value in the input entries I1, I2, I3, I4, and I5 is combined, a second forward value in the input entries I1, I2, I3, I4, and I5 is combined, and a third forward value in the input entries I1, I2, I3, I4, and I5 is combined, so that a plurality of forward value combination results can be obtained. In this embodiment, a first forward value of the input items I1, I2, I3, I4, and I5 is combined, a second forward value of the input items I1, I2, I3, I4, and I5 is combined, and a third forward value of the input items I1, I2, I3, I4, and I5 is also referred to as a vertical alignment value, and referring to table 20, finally, 3 forward value combination results are generated, and the combination results are shown in the following table:
watch 20
Case number Value combination
1 T11 T21 T31 T41 T51
2 T12 T21 T32 T42 T51
3 T13 T21 T32 T43 T51
And S15, determining a reverse-value combination result based on the forward-value combination results and the reverse values of the input items.
In practical application, the reverse-valued combination result is obtained according to the forward-valued combination result, and specifically, referring to fig. 2, the determining process of the reverse-valued combination result may include:
and S21, selecting one forward-direction value combination result from the multiple forward-direction value combination results, and determining the forward-direction value combination result as a target forward-direction value combination result.
In practical application, one forward-direction value combination result can be randomly selected from the plurality of forward-direction value combination results, and the forward-direction value combination result is determined as a target forward-direction value combination result.
For example, in the generated forward value combination results, a combination x is selected optionally, and the value of each input item is recorded, where case T11T 21T 31T 41T 51 with sequence number 1 is selected.
And S22, acquiring the reverse value of each input item.
In this embodiment, the total reverse-value-taking number of all the entries of the function page is 5(F11, F12, F13, F31, and F51).
And S23, for each reverse value, replacing the target data in the target forward value combination result with the reverse value to obtain a reverse value combination result, wherein the target data is the forward value in the same input item with the reverse value.
Specifically, for each reverse value V of each input item, V is used to replace the forward value of the corresponding input item in x, and then 5 reverse case combinations can be generated, as shown in the following table. In addition, the bold part in table 21 is a value after replacement.
TABLE 21
Case number Value combination
1 F11 T21 T31 T41 T51
2 F12 T21 T31 T41 T51
3 F13 T21 T31 T41 T51
4 T11 T21 F31 T41 T51
5 T11 T21 T31 T41 F51
In summary, 8 combined results are generated, and each combined result is used as a combined case, which can cover all the value-taking situations, as shown in the following table:
TABLE 22
Case number Value combination
1 T11 T21 T31 T41 T51
2 T12 T21 T32 T42 T51
3 T13 T21 T32 T43 T51
4 F11 T21 T31 T41 T51
5 F12 T21 T31 T41 T51
6 F13 T21 T31 T41 T51
7 T11 T21 F31 T41 T51
8 T11 T21 T31 T41 F51
In practical application, after obtaining the reverse value-taking combination result, the method may further include:
and determining test expected results of the forward-value combination results and the reverse-value combination results based on the judgment result of whether the reverse-value is included in the forward-value combination results and the reverse-value combination results.
Specifically, a column [ expected results ] is added to the above table of combined results to form a new table, as shown in the following table:
TABLE 23
Case number Value combination Expected result
1 T11 T21 T31 T41 T51
2 T12 T21 T32 T42 T51
3 T13 T21 T32 T43 T51
4 F11 T21 T31 T41 T51
5 F12 T21 T31 T41 T51
6 F13 T21 T31 T41 T51
7 T11 T21 F31 T41 T51
8 T11 T21 T31 T41 F51
Judging whether the expected result is reverse expectation or forward expectation according to whether the value combination of each row has reverse value, and filling the expected result of each row; in this example, the combination of values in three cases, 1, 2, and 3, does not contain the [ reverse value ], so the expected result is the [ forward expected ], and five cases, 4, 5, 6, 7, and 8 contain the [ reverse value ], so the expected result is the [ reverse expected ], as shown in the following table:
watch 24
Case number Value combination Expected result
1 T11 T21 T31 T41 T51 [ PROXIMITY ] A composition comprising a compound of formula (I)
2 T12 T21 T32 T42 T51 [ PROXIMITY ] A composition comprising a compound of formula (I)
3 T13 T21 T32 T43 T51 [ PROXIMITY ] A composition comprising a compound of formula (I)
4 F11 T21 T31 T41 T51 [ inverse expectation ]
5 F12 T21 T31 T41 T51 [ inverse expectation ]
6 F13 T21 T31 T41 T51 [ inverse expectation ]
7 T11 T21 F31 T41 T51 [ inverse expectation ]
8 T11 T21 T31 T41 F51 [ inverse expectation ]
At this point, the generation of the combined result in the test case is finished.
And S16, generating a test case according to the forward-direction value combination results and the reverse-direction value combination results.
In practical application, the forward value combination results and the reverse value combination results can be directly added to corresponding parts in corresponding test cases to obtain the test cases. In addition, a test case can be generated by referring to a plurality of forward value combination results and the reverse value combination results in a manual mode.
In this embodiment, after obtaining each input item, the maximum number of the forward value numbers of each input item is obtained, and an input item whose forward value number is smaller than the maximum number is screened out and determined as a target input item, then a forward value filling operation is performed on the target input item until the forward value number of the target input item is the maximum number, and a combining operation is performed on the forward value numbers of each input item to obtain a plurality of forward value combination results which are the same as the maximum number, then a reverse value combination result is determined based on the plurality of forward value combination results and the reverse value of each input item, and a test case is generated according to the plurality of forward value combination results and the reverse value combination result. That is, by the present embodiment, a test case can be generated, and on this basis, when performing a value combination operation, only a combination operation of screening the maximum number of forward values, performing a forward value filling operation on a target input item, and performing a forward value combination operation of the input item is performed, so as to obtain a plurality of forward value combination results having the same number as the maximum number, and then determining a reverse value combination result based on the plurality of forward value combination results and the reverse values of the input items, each step is simple in operation, so that time required for generating a value combination can be shortened, and efficiency can be improved.
In addition, the method only needs three steps from obtaining the input items to generating the forward case combination, namely [ statistical value maximum ], [ filling ], [ contraposition grouping ], and does not need any algorithm foundation, so that most testing practitioners and even some non-testing practitioners can quickly start to operate.
Optionally, on the basis of the embodiment of the method for generating a test case, another embodiment of the present invention provides an apparatus for generating a test case, and with reference to fig. 3, the method may include:
an input item obtaining module 11, configured to obtain each input item; the input item at least comprises a forward value;
an input item determining module 12, configured to obtain the maximum number of the forward-direction-value numbers of the input items, screen out input items whose forward-direction-value numbers are smaller than the maximum number, and determine the input items as target input items;
a data filling module 13, configured to perform forward value filling operation on the target input item until the number of forward values of the target input item is the maximum number;
the data combination module 14 is configured to perform a combination operation on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combination results, the number of which is the same as the maximum number;
a combination determination module 15, configured to determine a reverse-valued combination result based on the forward-valued combination results and the reverse values of the input items;
and a use case generating module 16, configured to generate a test use case according to the forward value combination results and the reverse value combination results.
Further, the data filling module is specifically configured to:
filling at least one target forward value into the target input item until the number of the forward values of the target input item is the maximum number; the target forward value comprises a last forward value in the forward values included in the target entry.
Further, the data combination module is specifically configured to:
and combining forward dereferencing values corresponding to the same serial number in each input item to obtain a plurality of forward dereferencing combined results.
Further, the combination determination module includes:
the selecting submodule is used for selecting a forward value combination result from the plurality of forward value combination results and determining the forward value combination result as a target forward value combination result;
the value obtaining submodule is used for obtaining the reverse value of each input item;
and the data replacement submodule is used for replacing target data in the target forward value combination result with the reverse value for each reverse value to obtain a reverse value combination result, wherein the target data is the forward value which is in the same input item with the reverse value.
Further, still include:
and the test result determining module is used for determining test expected results of the forward dereferencing combined results and the reverse dereferencing combined results based on whether the judgment results of the reverse dereferencing are included in the forward dereferencing combined results and the reverse dereferencing combined results.
In this embodiment, after obtaining each input item, the maximum number of the forward value numbers of each input item is obtained, and an input item whose forward value number is smaller than the maximum number is screened out and determined as a target input item, then a forward value filling operation is performed on the target input item until the forward value number of the target input item is the maximum number, and a combining operation is performed on the forward value numbers of each input item to obtain a plurality of forward value combination results which are the same as the maximum number, then a reverse value combination result is determined based on the plurality of forward value combination results and the reverse value of each input item, and a test case is generated according to the plurality of forward value combination results and the reverse value combination result. That is, by the present embodiment, a test case can be generated, and on this basis, when performing a value combination operation, only a combination operation of screening the maximum number of forward values, performing a forward value filling operation on a target input item, and performing a forward value combination operation of the input item is performed, so as to obtain a plurality of forward value combination results having the same number as the maximum number, and then determining a reverse value combination result based on the plurality of forward value combination results and the reverse values of the input items, each step is simple in operation, so that time required for generating a value combination can be shortened, and efficiency can be improved.
It should be noted that, for the working process of each module in this embodiment, please refer to the corresponding description in the above embodiments, which is not described herein again.
Optionally, on the basis of the embodiments of the method and the apparatus for generating a test case, another embodiment of the present invention provides an electronic device, including: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is used to:
acquiring each input item; the input item at least comprises a forward value;
acquiring the maximum number of the forward dereferencing numbers of the input items, screening out the input items of which the forward dereferencing numbers are smaller than the maximum number, and determining the input items as target input items;
carrying out forward value filling operation on the target input items until the number of forward values of the target input items is the maximum number;
performing a combination operation on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combination results with the same number as the maximum number;
determining a reverse dereferencing combined result based on the forward dereferencing combined results and the reverse dereferencing of each input item;
and generating a test case according to the forward value combination results and the reverse value combination results.
Further, performing forward value filling operation on the target input item until the number of forward values of the target input item is the maximum number, including:
filling at least one target forward value into the target input item until the number of the forward values of the target input item is the maximum number; the target forward value comprises a last forward value in the forward values included in the target entry.
Further, the combining operation is performed on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combined results with the same number as the maximum number, and the method comprises the following steps:
and combining forward dereferencing values corresponding to the same serial number in each input item to obtain a plurality of forward dereferencing combined results.
Further, determining a reverse-valued combination result based on the forward-valued combination results and the reverse values of the respective input items, including:
selecting a forward dereferencing combined result from the plurality of forward dereferencing combined results, and determining the forward dereferencing combined result as a target forward dereferencing combined result;
obtaining the reverse value of each input item;
and for each reverse value, replacing target data in the target forward value combination result with the reverse value to obtain a reverse value combination result, wherein the target data is the forward value which is in the same input item with the reverse value.
Further, after determining a reverse-valued combination result based on the forward-valued combination results and the reverse values of the respective entries, the method further includes:
and determining test expected results of the forward-value combination results and the reverse-value combination results based on the judgment result of whether the reverse-value is included in the forward-value combination results and the reverse-value combination results.
In this embodiment, after obtaining each input item, the maximum number of the forward value numbers of each input item is obtained, and an input item whose forward value number is smaller than the maximum number is screened out and determined as a target input item, then a forward value filling operation is performed on the target input item until the forward value number of the target input item is the maximum number, and a combining operation is performed on the forward value numbers of each input item to obtain a plurality of forward value combination results which are the same as the maximum number, then a reverse value combination result is determined based on the plurality of forward value combination results and the reverse value of each input item, and a test case is generated according to the plurality of forward value combination results and the reverse value combination result. That is, by the present embodiment, a test case can be generated, and on this basis, when performing a value combination operation, only a combination operation of screening the maximum number of forward values, performing a forward value filling operation on a target input item, and performing a forward value combination operation of the input item is performed, so as to obtain a plurality of forward value combination results having the same number as the maximum number, and then determining a reverse value combination result based on the plurality of forward value combination results and the reverse values of the input items, each step is simple in operation, so that time required for generating a value combination can be shortened, and efficiency can be improved.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for generating a test case is characterized by comprising the following steps:
acquiring each input item; the input item at least comprises a forward value;
acquiring the maximum number of the forward dereferencing numbers of the input items, screening out the input items of which the forward dereferencing numbers are smaller than the maximum number, and determining the input items as target input items;
carrying out forward value filling operation on the target input items until the number of forward values of the target input items is the maximum number;
performing a combination operation on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combination results with the same number as the maximum number;
determining a reverse dereferencing combined result based on the forward dereferencing combined results and the reverse dereferencing of each input item;
and generating a test case according to the forward value combination results and the reverse value combination results.
2. The generation method of claim 1, wherein performing a forward-valued padding operation on the target entry until the number of forward-valued values of the target entry is the maximum number comprises:
filling at least one target forward value into the target input item until the number of the forward values of the target input item is the maximum number; the target forward value comprises a last forward value in the forward values included in the target entry.
3. The generation method according to claim 1, wherein the combining operation is performed on the forward values of the respective input items to obtain a plurality of forward value combination results having the same number as the maximum number, and includes:
and combining forward dereferencing values corresponding to the same serial number in each input item to obtain a plurality of forward dereferencing combined results.
4. The method of claim 1, wherein determining a backward-valued combination result based on the forward-valued combination results and the backward values of the respective entries comprises:
selecting a forward dereferencing combined result from the plurality of forward dereferencing combined results, and determining the forward dereferencing combined result as a target forward dereferencing combined result;
obtaining the reverse value of each input item;
and for each reverse value, replacing target data in the target forward value combination result with the reverse value to obtain a reverse value combination result, wherein the target data is the forward value which is in the same input item with the reverse value.
5. The generation method according to claim 1, wherein after determining the backward-valued combination result based on the forward-valued combination results and the backward values of the respective input items, the generation method further comprises:
and determining test expected results of the forward-value combination results and the reverse-value combination results based on the judgment result of whether the reverse-value is included in the forward-value combination results and the reverse-value combination results.
6. An apparatus for generating a test case, comprising:
the input item acquisition module is used for acquiring each input item; the input item at least comprises a forward value;
the input item determining module is used for acquiring the maximum number of the forward dereferencing numbers of the input items, screening out the input items of which the forward dereferencing numbers are smaller than the maximum number, and determining the input items as target input items;
the data filling module is used for carrying out forward value filling operation on the target input items until the number of forward values of the target input items is the maximum number;
the data combination module is used for carrying out combination operation on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combination results with the number being the same as that of the maximum number;
a combination determination module, configured to determine a reverse-valued combination result based on the forward-valued combination results and the reverse values of the input items;
and the case generating module is used for generating a test case according to the forward value combination results and the reverse value combination results.
7. The generation apparatus of claim 6, wherein the data population module is specifically configured to:
filling at least one target forward value into the target input item until the number of the forward values of the target input item is the maximum number; the target forward value comprises a last forward value in the forward values included in the target entry.
8. The generation apparatus according to claim 6, wherein the data combination module is specifically configured to:
and combining forward dereferencing values corresponding to the same serial number in each input item to obtain a plurality of forward dereferencing combined results.
9. The generation apparatus of claim 6, wherein the combination determination module comprises:
the selecting submodule is used for selecting a forward value combination result from the plurality of forward value combination results and determining the forward value combination result as a target forward value combination result;
the value obtaining submodule is used for obtaining the reverse value of each input item;
and the data replacement submodule is used for replacing target data in the target forward value combination result with the reverse value for each reverse value to obtain a reverse value combination result, wherein the target data is the forward value which is in the same input item with the reverse value.
10. An electronic device, comprising: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is used to:
acquiring each input item; the input item at least comprises a forward value;
acquiring the maximum number of the forward dereferencing numbers of the input items, screening out the input items of which the forward dereferencing numbers are smaller than the maximum number, and determining the input items as target input items;
carrying out forward value filling operation on the target input items until the number of forward values of the target input items is the maximum number;
performing a combination operation on the forward dereferencing of each input item to obtain a plurality of forward dereferencing combination results with the same number as the maximum number;
determining a reverse dereferencing combined result based on the forward dereferencing combined results and the reverse dereferencing of each input item;
and generating a test case according to the forward value combination results and the reverse value combination results.
CN202011558098.4A 2020-12-25 2020-12-25 Test case generation method and device and electronic equipment Pending CN112631917A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011558098.4A CN112631917A (en) 2020-12-25 2020-12-25 Test case generation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011558098.4A CN112631917A (en) 2020-12-25 2020-12-25 Test case generation method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN112631917A true CN112631917A (en) 2021-04-09

Family

ID=75325326

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011558098.4A Pending CN112631917A (en) 2020-12-25 2020-12-25 Test case generation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112631917A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468514A (en) * 2015-01-29 2016-04-06 深圳Tcl数字技术有限公司 Test method and device based on data combination
US10338993B1 (en) * 2018-04-22 2019-07-02 Sas Institute Inc. Analysis of failures in combinatorial test suite
CN111752834A (en) * 2020-06-24 2020-10-09 京东数字科技控股有限公司 Automatic testing method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468514A (en) * 2015-01-29 2016-04-06 深圳Tcl数字技术有限公司 Test method and device based on data combination
US10338993B1 (en) * 2018-04-22 2019-07-02 Sas Institute Inc. Analysis of failures in combinatorial test suite
CN111752834A (en) * 2020-06-24 2020-10-09 京东数字科技控股有限公司 Automatic testing method and device

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
HXYSHFY: "常用测试设计方法--数据组合覆盖测试设计", Retrieved from the Internet <URL:https://blog.51cto.com/ravihxy/686285> *
佚名: "利用分类树方法设计测试用例", Retrieved from the Internet <URL:http://www.uml.org.cn/Test/200903266.asp> *
国家市场监督管理总局、中国国家标准化管理委员会: "GB/T38639-2020:系统与软件工程 软件组合测试方法", pages 3, Retrieved from the Internet <URL:https://openstd.samr.gov.cn/bzgk/gb/newGbInfo?hcno=0DB8D7390A5266BB1F2D8AFBFF8984A1> *
是李黏黏鸭: "15.4 - 分类树法", Retrieved from the Internet <URL:https://blog.csdn.net/qq_46071165/article/details/127143745> *
是李黏黏鸭: "15.7- 组合测试", Retrieved from the Internet <URL:https://blog.csdn.net/qq_46071165/article/details/127165128> *

Similar Documents

Publication Publication Date Title
US10346380B2 (en) Test data generation and scale up for database testing using unique common factor sequencing
CN106599317A (en) Test data processing method and device for question-answering system and terminal
CN107330014B (en) Data table creating method and device
US20220391471A1 (en) Method, circuit, and soc for performing matrix multiplication operation
CN110597851A (en) Big data based data processing and report display method
CN110874358A (en) Multi-attribute column storage and retrieval method and device and electronic equipment
US8954838B2 (en) Presenting data in a tabular format
CN112631917A (en) Test case generation method and device and electronic equipment
CN110928665B (en) Data processing method, device, storage medium and terminal
CN106202374A (en) A kind of data processing method and device
CN116186473A (en) Data conversion method, device and storage medium
CN111079390B (en) Method and device for determining selection state of check box list
CN110032564B (en) Method and device for determining association relation of data table
CN113641661A (en) Database batch import method and device, electronic equipment and storage medium
CN107515867A (en) The generation method and device that data storage, querying method and the device and a kind of rowKey of a kind of NoSQL databases combine entirely
CN112506944B (en) Data standard conversion access method, device, equipment and medium between service systems
CN106446261B (en) Content searching method and device based on multi-platform interface
EP2657887A1 (en) Improvements in and relating to data comparison
WO2016131242A1 (en) Method and device for file parsing
CN117215455B (en) Report calculation formula generation method and device, computer equipment and storage medium
CN114528338B (en) Method, device, equipment and medium for dynamically exporting field
KR102696254B1 (en) Method of controling integer multiplier and apparatus thereof
CN111930313B (en) Method and device for data association access in host
CN117609210B (en) Data table processing method, device, computer equipment and storage medium
US10693494B2 (en) Reducing a size of multiple data sets

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