Disclosure of Invention
In view of this, the embodiment of the invention provides a regression testing method and device, so as to achieve the purposes of improving the regression testing efficiency and ensuring the reliability of the regression testing.
In order to achieve the above object, the embodiment of the present invention provides the following technical solutions:
The embodiment of the invention discloses a regression testing method, which comprises the following steps:
acquiring a regression testing path to be subjected to regression testing;
Setting the test priority of the regression testing path based on the use information related to the regression testing path, and generating a test case priority configuration file;
carrying out regression testing on regression testing paths with different testing priorities according to the testing case priority configuration file, and carrying out data verification on the obtained regression testing data;
And recording regression test paths which do not pass the data verification, and path parameters of the regression test paths and corresponding regression test data.
Optionally, the setting the test priority of the regression testing path based on the usage information related to the regression testing path, and generating the test case priority configuration file includes:
And setting the test priority of the regression testing path according to the service requirements and the service functions of the regression testing path, and generating a test case priority configuration file.
Optionally, the setting the test priority of the regression testing path based on the usage information related to the regression testing path, and generating the test case priority configuration file includes:
Setting the test priority of the regression test path according to the access times of the regression test path recorded in the software system log, and generating a test case priority configuration file, wherein the access times of the regression test path are in direct proportion to the priority of the regression test path.
Optionally, the setting the test priority of the regression testing path based on the usage information related to the regression testing path, and generating the test case priority configuration file includes:
determining a weighted value by using the main stream Cheng Guanlian degrees of the service and software system;
And setting the test priority of the regression testing path according to the weighted value and the service function of the regression testing path, and generating a test case priority configuration file.
Optionally, the performing regression testing on the regression testing paths with different testing priorities according to the testing case priority configuration file, and performing data verification on the obtained testing return data includes:
determining the priority of a regression testing path which is currently subjected to regression testing according to the testing priority configuration file;
setting a regression test case corresponding to the regression test path according to the priority of the regression test path and the parameter requirement of the regression test path;
Executing the regression test case to carry out regression test on the regression test path to obtain regression test data;
matching and checking the regression test data based on a data check configuration file corresponding to the regression test path, wherein the data check configuration file comprises a preset field which is required to be returned in the regression test path;
If the fields of the regression testing data are matched with the fields in the data verification configuration data file, determining that the regression testing path passes the data verification;
And if any field of the regression testing data is not matched with the field in the data verification configuration data file, determining that the regression testing path fails the data verification.
Optionally, the performing the matching verification on the regression testing data based on the data verification configuration file corresponding to the regression testing path includes:
Layering all fields of the regression testing data according to the data types to obtain a multi-layer data structure, wherein the data type corresponding to each field in the last layer data structure is the data type of the minimum unit;
and sequentially matching the fields in the data verification configuration file corresponding to the regression test path with the fields contained in the data structure of each layer.
Optionally, layering each field of the regression testing data according to the data type to obtain a multi-layer data structure, including:
Dividing the regression test data according to fields to generate a layer of data structure;
Determining whether the data type of the layering to be refined exists in the data types corresponding to the fields in the current layer data structure;
if so, layering the fields corresponding to the data types of the layering to be thinned again to obtain a two-layer data structure, and returning to the step of determining whether the data types of the layering to be thinned exist in the data types corresponding to the fields in the current layer data structure;
if the regression test data does not exist, the layering of the regression test data is determined to be completed, and a multi-layer data structure is obtained;
wherein each layer of data structure comprises: field name, field data type, and related parameters.
The second aspect of the embodiment of the invention discloses a regression testing device, which comprises:
the path acquisition module is used for acquiring a regression testing path to be subjected to regression testing;
the priority determining module is used for setting the test priority of the regression testing path based on the use information related to the regression testing path and generating a test case priority configuration file;
The regression testing module is used for carrying out regression testing on regression testing paths with different testing priorities according to the testing case priority configuration file and carrying out data verification on the obtained regression testing data;
the recording module is used for recording the regression testing path which does not pass the data verification, and the path parameters of the regression testing path and the corresponding regression testing data.
Optionally, the regression testing module includes:
the determining unit is used for determining the priority of the regression testing path which is currently subjected to regression testing according to the testing priority configuration file;
The setting unit is used for setting regression test cases corresponding to the regression test paths according to the priorities of the regression test paths and the parameter requirements of the regression test paths;
The test unit is used for executing the regression test case to carry out regression test on the regression test path to obtain regression test data;
The verification unit is used for carrying out matching verification on the regression test data based on a data verification configuration file corresponding to the regression test path, wherein the data verification configuration file comprises a preset field which is required to be returned in the regression test path;
And the processing unit is used for determining that the regression test path passes the data verification if the fields of the regression test data are matched with the fields in the data verification configuration data file, and determining that the regression test path does not pass the data verification if any field of the regression test data is not matched with the fields in the data verification configuration data file.
Optionally, the verification unit includes:
a layering subunit, configured to layer each field of the regression testing data according to a data type, to obtain a multi-layer data structure, where a data type corresponding to each field in the last layer data structure is a data type of a minimum unit;
And the matching subunit is used for sequentially matching the fields in the data verification configuration file corresponding to the regression test path with the fields contained in the data structure of each layer.
Based on the regression testing method provided by the embodiment of the invention, the method comprises the following steps: acquiring a regression testing path to be subjected to regression testing; setting the test priority of the regression test path based on the use information related to the regression test path, and generating a test case priority configuration file; carrying out regression testing on regression testing paths with different testing priorities according to the test case priority configuration file, and carrying out data verification on the obtained regression testing data; and recording the regression testing path which does not pass the data verification, and recording the path parameters of the regression testing path and the corresponding regression testing data. In the scheme, the regression test paths to be subjected to the regression test in the system are set with the test priorities, the regression test is performed on the regression test paths with different test priorities according to the test cases, and the obtained regression test data are subjected to data verification, so that the reliability of the regression test is ensured, the regression test efficiency is improved, and meanwhile, the regression test cost is reduced. In addition, the regression testing paths which do not pass through verification are integrated and recorded, so that the positioning of the problem regression testing paths is further improved, and the problem regression testing paths can be analyzed more quickly and defects can be overcome.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the present disclosure, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As known from the background art, when the full-function test is adopted to perform the regression test, a great amount of time and labor are required to be consumed, so that the regression test efficiency is greatly reduced, and the artificial error detection result is easy to generate; in the same way, when the automatic test case is adopted to run and the simple data is checked to carry out the regression test, individual functions are missed, and each time the regression test is executed, the test result is required to be manually maintained, and the considered error detection result is easy to generate.
Therefore, in the scheme, the regression testing method and device set the testing priority for the regression testing paths to be subjected to the regression testing in the system, carry out the regression testing on the regression testing paths with different testing priorities according to the testing cases, and carry out data verification on the obtained regression testing data, so that the reliability of the regression testing is ensured, the regression testing efficiency is improved, and meanwhile, the regression testing cost is reduced. In addition, the regression testing paths which do not pass through verification are integrated and recorded, so that the positioning of the problem regression testing paths is further improved, and the problem regression testing paths can be analyzed more quickly and defects can be overcome.
Referring to fig. 1, a flowchart of a regression testing method according to an embodiment of the present invention is provided, where the regression testing method includes the following steps:
step S101: and acquiring a regression testing path to be subjected to regression testing.
In step S101, the regression testing path is specifically described by taking an http interface as an example, for example, http:// www.baidu.com/search is an http interface, where/search is the regression testing path.
In the specific implementation process of step S101, a plurality of regression testing paths to be subjected to regression testing are generally obtained, and each regression testing path can be subjected to regression testing by applying the method provided by the invention.
Step S102: and setting the test priority of the regression testing path based on the use information related to the regression testing path, and generating a test case priority configuration file.
In step S102, the usage information related to the regression-test path includes: service requirements, service functions of the regression testing path, access times of the regression testing path recorded in a software system log, and the main flow Cheng Guanlian degrees of the service and the software system.
In step S102, the test case is a set of test parameters, wherein the test parameters are a set of input parameters.
In the specific implementation step S102, according to the acquired related usage information carried in the regression testing path, the regression testing path is set with a test priority, that is, the sequence of the regression testing path for performing the regression test is set, and a test case priority configuration file is generated.
The test case priority configuration file is configured according to the priority of the regression test path combined with the interface of the regression test path in the log, and sets weight proportion for the regression test path which is important.
Step S103: and carrying out regression testing on regression testing paths with different testing priorities according to the testing case priority configuration file, and carrying out data verification on the obtained regression testing data.
In the specific implementation step S103, after determining the test case priority configuration file, firstly, performing regression testing on the regression test paths corresponding to each test case in sequence from the highest priority according to the priority of the test case, to obtain regression test data corresponding to each regression test path, and then performing data verification according to the obtained regression test data.
Step S104: judging whether the regression testing path passes the data verification, if not, executing step S105; if so, step S106 is performed.
In the specific implementation step S104, judging whether the regression testing path passes the data verification, if the regression testing path does not pass the data verification, indicating that the regression testing for the regression testing path with different testing priorities fails, and executing step S105; if the regression testing path passes the data verification, it is indicated that the regression testing is successful for the regression testing paths with different testing priorities, and step S106 is executed.
Step S105: and recording regression test paths which do not pass the data verification, and path parameters of the regression test paths and corresponding regression test data.
In the specific implementation step S105, if the regression testing path fails the data verification, it is indicated that the regression testing path fails the regression testing, and the regression testing path that fails the regression testing is recorded, and the path parameters of the regression testing path and the corresponding regression testing data are recorded.
Step S106: and (5) ending the regression test.
Based on the regression testing method disclosed by the embodiment of the invention, a regression testing path to be subjected to regression testing is obtained; setting the test priority of the regression test path based on the use information related to the regression test path, and generating a test case priority configuration file; carrying out regression testing on regression testing paths with different testing priorities according to the test case priority configuration file, and carrying out data verification on the obtained regression testing data; and recording the regression testing path which does not pass the data verification, and recording the path parameters of the regression testing path and the corresponding regression testing data. In the scheme, the regression test paths to be subjected to the regression test in the system are set with the test priorities, the regression test is performed on the regression test paths with different test priorities according to the test cases, and the obtained regression test data are subjected to data verification, so that the reliability of the regression test is ensured, the regression test efficiency is improved, and meanwhile, the regression test cost is reduced. In addition, the regression testing paths which do not pass through verification are integrated and recorded, so that the positioning of the problem regression testing paths is further improved, and the problem regression testing paths can be analyzed more quickly and defects can be overcome.
Referring to fig. 2, a flowchart of another regression testing method according to an embodiment of the present invention is provided, where the regression testing method includes the following steps:
Step S201: and acquiring a regression testing path to be subjected to regression testing.
The execution principle and process of the above step S201 are the same as those of the step S101 disclosed in fig. 1, and will not be described here again.
Step S202: and setting the test priority of the regression testing path according to the service requirements and the service functions of the regression testing path, and generating a test case priority configuration file.
In step S202, the service requirement refers to expanding a new service line.
In step S202, the service function refers to a function of returning the service line related to the test path.
In the specific implementation process of step S202, on the basis of the service requirement and the service function in the acquired regression testing path, the regression testing path is set with a test priority, that is, the sequence of the regression testing performed by the regression testing path is set, and a test case priority configuration file is generated.
Step S203: and carrying out regression testing on regression testing paths with different testing priorities according to the testing case priority configuration file, and carrying out data verification on the obtained regression testing data.
Step S204: judging whether the regression testing path passes the data verification, and if the regression testing path does not pass the data verification, executing step S205; if the regression testing path passes the data verification, step S206 is performed.
Step S205: and recording regression test paths which do not pass the data verification, and path parameters of the regression test paths and corresponding regression test data.
Step S206: and (5) ending the regression test.
The execution principle and process of the above steps S203 to S206 are the same as those of the steps S103 to S106 disclosed in fig. 1, and will be referred to herein without further description.
Based on the regression testing method disclosed by the embodiment of the invention, a regression testing path to be subjected to regression testing is obtained; setting the test priority of the regression testing path according to the service requirements and the service functions of the regression testing path, and generating a test case priority configuration file; carrying out regression testing on regression testing paths with different testing priorities according to the test case priority configuration file, and carrying out data verification on the obtained regression testing data; and recording the regression testing path which does not pass the data verification, and recording the path parameters of the regression testing path and the corresponding regression testing data. In the scheme, the regression test paths to be subjected to the regression test in the system are set with the test priorities, the regression test is performed on the regression test paths with different test priorities according to the test cases, and the obtained regression test data are subjected to data verification, so that the reliability of the regression test is ensured, the regression test efficiency is improved, and meanwhile, the regression test cost is reduced. In addition, the regression testing paths which do not pass through verification are integrated and recorded, so that the positioning of the problem regression testing paths is further improved, and the problem regression testing paths can be analyzed more quickly and defects can be overcome.
Referring to fig. 3, a flowchart of another regression testing method according to an embodiment of the present invention is provided, where the regression testing method includes the following steps:
Step S301: and acquiring a regression testing path to be subjected to regression testing.
The execution principle and process of the above step S301 are the same as those of the step S101 disclosed in fig. 1, and will not be described here again.
Step S302: and setting the test priority of the regression test path according to the access times of the regression test path recorded in the software system log, and generating a test case priority configuration file.
In step S302, the number of accesses to the regression-test path is proportional to the priority of the regression-test path.
In the specific implementation process of step S302, the test priority of the regression test path is set based on the access times of the regression test path recorded in the software system log, that is, the sequence of the regression test performed by the regression test path is set, and a test case priority configuration file is generated.
Step S303: and carrying out regression testing on regression testing paths with different testing priorities according to the testing case priority configuration file, and carrying out data verification on the obtained regression testing data.
Step S304: judging whether the regression testing path passes the data verification, and if the regression testing path does not pass the data verification, executing step S305; if the regression testing path passes the data verification, step S306 is executed.
Step S305: and recording regression test paths which do not pass the data verification, and path parameters of the regression test paths and corresponding regression test data.
Step S306: and (5) ending the regression test.
The execution principle and process of the above steps S303 to S306 are the same as those of the steps S103 to S106 disclosed in fig. 1, and will not be repeated here.
Based on the regression testing method disclosed by the embodiment of the invention, a regression testing path to be subjected to regression testing is obtained; setting the test priority of the regression test path according to the access times of the regression test path recorded in the software system log, and generating a test case priority configuration file; carrying out regression testing on regression testing paths with different testing priorities according to the testing case priority configuration file, and carrying out data verification on the obtained regression testing data; and recording regression test paths which do not pass the data verification, and path parameters of the regression test paths and corresponding regression test data. In the scheme, the regression test paths to be subjected to the regression test in the system are set with the test priorities, the regression test is performed on the regression test paths with different test priorities according to the test cases, and the obtained regression test data are subjected to data verification, so that the reliability of the regression test is ensured, the regression test efficiency is improved, and meanwhile, the regression test cost is reduced. In addition, the regression testing paths which do not pass through verification are integrated and recorded, so that the positioning of the problem regression testing paths is further improved, and the problem regression testing paths can be analyzed more quickly and defects can be overcome.
Referring to fig. 4, a flowchart of another regression testing method according to an embodiment of the present invention is provided, the regression testing method includes the following steps:
Step S401: and acquiring a regression testing path to be subjected to regression testing.
The execution principle and process of the above step S401 are the same as those of the step S101 disclosed in fig. 1, and will not be described here again.
Step S402: the weighting values are determined using the degree of the main stream Cheng Guanlian of the business and software system.
In the specific implementation process of step S402, weighting adjustment with different degrees is performed according to the degree of association between the service and the main flow of the software system, so as to obtain a weighted value.
The main flow of the software system refers to the main business flow of the software system, namely the main flow of the software system.
Wherein the weight adjustment may be adjusted by a technician based on experience.
Step S403: and setting the test priority of the regression testing path according to the weighted value and the service function of the regression testing path, and generating a test case priority configuration file.
In the specific implementation process of step S403, according to the obtained weighted value and the service function of the regression testing path, the regression testing path is set with a test priority, that is, the sequence of the regression testing path for performing the regression test is set, and a test case priority configuration file is generated.
Step S404: and carrying out regression testing on regression testing paths with different testing priorities according to the testing case priority configuration file, and carrying out data verification on the obtained regression testing data.
Step S405: judging whether the regression testing path passes the data verification, if not, executing step S406; if the regression testing path passes the data verification, step S407 is performed.
Step S406: and recording regression test paths which do not pass the data verification, and path parameters of the regression test paths and corresponding regression test data.
Step S407: and (5) ending the regression test.
The execution principle and process of the above steps S404 to S407 are the same as those of the steps S103 to S106 disclosed in fig. 1, and will be referred to herein without further description.
Based on the regression testing method disclosed by the embodiment of the invention, a regression testing path to be subjected to regression testing is obtained; determining a weighted value by using the main stream Cheng Guanlian degrees of the service and software system; setting the test priority of the regression testing path according to the weighted value and the service function of the regression testing path, and generating a test case priority configuration file; carrying out regression testing on regression testing paths with different testing priorities according to the testing case priority configuration file, and carrying out data verification on the obtained regression testing data; and recording regression test paths which do not pass the data verification, and path parameters of the regression test paths and corresponding regression test data. In the scheme, the regression test paths to be subjected to the regression test in the system are set with the test priorities, the regression test is performed on the regression test paths with different test priorities according to the test cases, and the obtained regression test data are subjected to data verification, so that the reliability of the regression test is ensured, the regression test efficiency is improved, and meanwhile, the regression test cost is reduced. In addition, the regression testing paths which do not pass through verification are integrated and recorded, so that the positioning of the problem regression testing paths is further improved, and the problem regression testing paths can be analyzed more quickly and defects can be overcome.
The process of performing regression testing on the regression testing paths with different testing priorities according to the test case priority configuration file and performing data verification on the obtained test return data, which are referred to in step S103, step S203, step S303 and step S404 in the foregoing embodiment of the present invention disclosed in fig. 1, refer to fig. 5, and is a flowchart of regression testing and data verification provided in the embodiment of the present invention, which includes the following steps:
Step S501: and determining the priority of the regression testing path which is currently subjected to the regression testing according to the testing priority configuration file.
In the specific implementation process of step S501, according to the priorities of the test cases in the generated test case priority configuration file, a regression test path corresponding to each test case is determined, that is, the priority of the regression test path that is being subjected to the regression test is obtained by using the priorities of the test cases. And in the follow-up execution test, the regression test path corresponding to the test case is tested from high to low according to the priority of the test case.
Step S502: and setting regression test cases corresponding to the regression test paths according to the priorities of the regression test paths and the parameter requirements of the regression test paths.
In the specific implementation process of step S502, according to the determined priority of the regression testing path, in combination with the parameter requirement of the regression testing path, the regression testing parameters of the regression testing path are configured, and the regression testing case of the corresponding regression testing path is generated.
For example: test path for a > b, a=b, a < b has three different test results, for a and b settings, i.e. regression test parameters are set:
(1)5,3
(2)5,5
(3)3,5
this is three sets of regression testing parameters, which may also be referred to as three sets of test cases.
Step S503: executing the regression test case to carry out regression test on the regression test path to obtain regression test data.
In step S503, when executing the regression test case, the python coding mode is adopted, and the unnittest test frames are combined, so that the generated regression test case is integrated, and an automatic execution test case is obtained.
In the specific implementation process of step S503, after determining the regression test case, the regression test path is subjected to a regression test according to the priority of the regression test path, so as to obtain corresponding regression test data.
Step S504: and carrying out matching verification on the regression test data based on the data verification configuration file corresponding to the regression test path.
In step S504, the data verification configuration file includes a field that should be returned in a preset regression test path.
In the specific implementation process of step S504, the regression test data obtained through the regression test is matched and checked according to different data verification configuration files corresponding to the regression test paths with different priorities.
In the embodiment of the invention, one regression testing path corresponds to one data check configuration file.
Step S505: judging whether fields of the regression test data are matched with fields in the data verification configuration data file, and if so, executing step S506; if not, step S507 is executed.
In the specific implementation step S505, it is determined whether fields of the regression test data are all matched with fields in the data verification configuration data file, if so, it is indicated that the regression test path passes the data verification, and step S506 is executed; if not, it is indicated that any field of the regression testing data is not matched with the field in the data verification configuration data file, and step S507 is performed.
Step S506: and determining that the regression testing path passes the data verification.
Step S507: and determining that the regression test path fails the data verification.
Based on the regression testing method disclosed by the embodiment of the invention, the priority of the regression testing path for carrying out the regression testing currently is determined according to the testing priority configuration file; setting regression test cases corresponding to the regression test paths according to the priorities of the regression test paths and the parameter requirements of the regression test paths; executing the regression test case to carry out regression test on the regression test path to obtain regression test data; matching and checking regression test data based on a data checking configuration file corresponding to a regression test path, wherein the data checking configuration file comprises a preset field which is required to be returned in the regression test path; judging whether the fields of the regression test data are matched with the fields in the data verification configuration data file, if so, determining that the regression test path passes the data verification, and if not, determining that the regression test path does not pass the data verification. Different regression test parameters are set, corresponding regression test cases are generated, the regression test reliability is guaranteed, the number of the regression test cases is reduced, and therefore the test efficiency is improved, and the test cost is reduced.
The process of matching and checking the regression testing data based on the data checking configuration file corresponding to the regression testing path, which is referred to in step S504 in fig. 5 in the embodiment of the present invention, is referred to fig. 6, which is a flowchart for layering and matching and checking each field of the regression testing data, provided in the embodiment of the present invention, and includes the following steps:
Step S601: the regression testing data is divided according to the fields to generate a layer of data structure.
In step S601, the regression-test data is divided into fields according to the data types in the regression-test path.
In the specific implementation process of step S601, according to the data verification configuration file including the field to be returned in the preset regression test path, the regression test data is divided according to the field, so as to obtain a layer of data structure.
The data of the field to be returned in the regression test path may be json format data.
Step S602: judging whether the data type of the layering to be refined exists in the data types corresponding to the fields in the current layer data structure, and if so, executing step S603; if not, step S604 is performed.
In the specific implementation process of step S602, determining whether a data type to be refined and layered exists in the data types corresponding to each field in the current layer data structure, if so, executing step S603 if the data type to be refined and layered exists, which indicates that the layering of the regression test data is not completed yet; if not, indicating that the layering of the regression-test data has been completed, step S604 is performed.
Step S603: and layering the fields corresponding to the data types to be thinned and layered again to obtain a two-layer data structure, and returning to the step S602 to continue execution.
In the specific implementation step S603, on the basis of the one-layer data structure, the fields corresponding to the data types to be thinned and layered, which need to be layered, of the current layer are divided again to obtain a two-layer data structure, and the step S602 is continuously executed, if the fields corresponding to the data types to be thinned and layered, which need to be layered, exist, the layering is continuously performed on the fields corresponding to the data types to be thinned and layered; and if the field corresponding to the data type to be thinned and layered which is required to be layered does not exist, layering the regression test data is completed, and a multi-layer data structure is obtained. The basic format of the data verification configuration file corresponding to the regression test path is described in conjunction with table 1. Table 1:
Field name |
Type or determined value |
Minimum number of |
Maximum number of |
|
object |
1 |
10 |
|
string |
1 |
1 |
|
number |
1 |
1 |
|
boolean |
1 |
1 |
|
array |
1 |
1 |
|
null |
1 |
1 |
As shown in table 1, the basic format of the data verification profile includes:
the field name is used for indicating that the data checking configuration file contains the name of a field which is required to be returned in a preset regression test path.
The type or the determined value comprises the data type of the field to be returned or the determined value of the field to be returned in the preset regression test path in the data check configuration file.
The minimum number is the minimum field size contained in the field to be returned in the preset regression test path contained in the data verification configuration file.
The maximum number is the maximum field size contained in the field which should be returned in the preset regression test path and contained in the data verification configuration file. For the object type data, the refinement configuration can be performed, the next layer verification can be continued until the smallest layer is obtained, and layering is completed, so that the multi-layer data structure is obtained.
In order to better understand the process of layering and matching verification of the respective fields of the regression-test data in step S601, step S602, and step S603, explanation will be made below with specific application examples.
If the field of the object data type exists in the current layer data structure, layering can be continued until the field of the object data type does not exist in the current layer data structure, layering of the regression test data is completed, and a multi-layer data structure is obtained.
The data types in the multi-layer data structure may be the data types shown in table 1.
For example: as shown in fig. 7, the regression-test data is divided according to fields, and a layer of data structure is obtained, where the fields included in the layer of data structure are: code, requestId, msg, data specific field formats are shown in table 2.
As can be seen from table 2, if the data type of the data field in the one-layer data structure is object, the layering can be further deepened to obtain a two-layer data structure, where the fields included in the two-layer data structure are as follows: projectId, content, order specific field formats are shown in table 3.
As can be seen from table 3, if the data type of the content field in the two-layer data structure is object, the layering can be further deepened to obtain a three-layer data structure, and the fields included in the three-layer data structure include: name, icon, link specific field formats are shown in table 4.
As can be seen from table 4, if the data type of the delamination to be refined does not exist in the three-layer data structure, delamination of the regression test data is completed, and the three-layer data structure is obtained.
According to the data types in the regression test path, matching the fields in the data verification configuration file corresponding to the regression test path with the fields contained in the obtained one-layer data structure, the fields contained in the two-layer data structure and the fields contained in the three-layer data structure respectively to obtain that the fields of the regression test data are matched with the fields in the data verification configuration data file, and determining that the regression test path passes the data verification.
Table 2:
Field name |
Type(s) |
Determining a value |
Minimum number of |
Maximum number of |
code |
number |
200 |
1 |
1 |
requestId |
null |
|
1 |
1 |
msg |
string |
success |
1 |
1 |
data |
object |
|
1 |
10 |
Table 3:
Field name |
Type(s) |
Determining a value |
Minimum number of |
Maximum number of |
projectId |
number |
|
1 |
1 |
content |
object |
|
1 |
1 |
order |
number |
|
1 |
1 |
Table 4:
Field name |
Type(s) |
Determining a value |
Minimum number of |
Maximum number of |
name |
string |
|
1 |
1 |
icon |
string |
|
1 |
1 |
link |
string |
|
1 |
1 |
Step S604: and determining that layering of the regression testing data is completed, and obtaining a multi-layer data structure.
In the specific implementation process of step S604, the data types of the layers to be refined do not exist in the data types corresponding to the fields in the current layer data structure, the layering of the regression test data is completed, the number of layers of the layering of the regression test data is determined, and the multi-layer data structure is obtained.
In step S604, the data type corresponding to each field in the last layer data structure in the multi-layer data structure is the data type of the minimum unit.
In an embodiment of the present invention, each layer of data structure comprises: field name, field data type, and related parameters.
Step S605: and sequentially matching the fields in the data verification configuration file corresponding to the regression test path with the fields contained in each layer of data structure.
In the specific implementation process of step S605, each field in the data verification configuration file corresponding to the regression testing path is sequentially matched with the fields included in each layer of data structure.
Based on the regression testing method disclosed by the embodiment of the invention, each field of regression testing data is layered according to the data type to obtain a multi-layer data structure, and the fields in the data verification configuration file corresponding to the regression testing path are sequentially matched with the fields contained in each layer of data structure. Because the formats of the returned data are unified, the fields contained in each layer of data structure of the multi-layer data structure can be matched uniformly according to the data verification configuration file, so that the testing efficiency is improved, and the testing cost is reduced.
Based on the regression testing method disclosed by the embodiment of the invention, the embodiment of the invention correspondingly discloses a regression testing device, and referring to fig. 8, the regression testing device comprises: a path acquisition module 81, a priority determination module 82, a regression testing module 83, and a recording module 84.
The path obtaining module 81 is configured to obtain a regression testing path to be subjected to a regression test.
The priority determining module 82 is configured to set a test priority of the regression testing path based on the usage information related to the regression testing path, and generate a test case priority configuration file.
In a specific implementation, the priority determining module 82 that sets the test priority of the regression testing path based on the usage information related to the regression testing path and generates the test case priority configuration file is specifically configured to set the test priority of the regression testing path according to the service requirement and the service function of the regression testing path and generate the test case priority configuration file.
The priority determining module 82, configured to set the test priority of the regression test path based on the usage information related to the regression test path, and generate a test case priority configuration file, is specifically configured to set the test priority of the regression test path according to the number of accesses to the regression test path recorded in the software system log, and generate a test case priority configuration file, where the number of accesses to the regression test path is proportional to the priority of the regression test path.
The priority determining module 82 for generating a test case priority configuration file is specifically configured to determine a weighted value by using a main flow Cheng Guanlian degrees of a service and a software system, and set the test priority of the regression test path according to the weighted value and a service function of the regression test path, so as to generate the test case priority configuration file.
The regression testing module 83 is configured to perform regression testing on the regression testing paths with different testing priorities according to the test case priority configuration file, and perform data verification on the obtained regression testing data.
The recording module 84 is configured to record the regression testing path that fails the data verification, and the path parameters and the corresponding regression testing data of the regression testing path.
Based on the regression testing device disclosed by the embodiment of the invention, a regression testing path to be subjected to regression testing is obtained; setting the test priority of the regression test path based on the use information related to the regression test path, and generating a test case priority configuration file; carrying out regression testing on regression testing paths with different testing priorities according to the test case priority configuration file, and carrying out data verification on the obtained regression testing data; and recording the regression testing path which does not pass the data verification, and recording the path parameters of the regression testing path and the corresponding regression testing data. In the scheme, the regression test paths to be subjected to the regression test in the system are set with the test priorities, the regression test is performed on the regression test paths with different test priorities according to the test cases, and the obtained regression test data are subjected to data verification, so that the reliability of the regression test is ensured, the regression test efficiency is improved, and meanwhile, the regression test cost is reduced. In addition, the regression testing paths which do not pass through verification are integrated and recorded, so that the positioning of the problem regression testing paths is further improved, and the problem regression testing paths can be analyzed more quickly and defects can be overcome.
Referring to fig. 8, fig. 9 is a schematic structural diagram of another regression testing apparatus according to an embodiment of the present invention, where the regression testing module 83 includes: a determining unit 831, a setting unit 832, a testing unit 833, a checking unit 834 and a processing unit 835.
And the determining unit 831 is configured to determine the priority of the regression testing path currently performing the regression testing according to the testing priority configuration file.
The setting unit 832 is configured to set a regression testing case corresponding to the regression testing path according to the priority of the regression testing path and the parameter requirement of the regression testing path.
And the test unit 833 is used for executing the regression test case to carry out regression test on the regression test path to obtain regression test data.
And a verification unit 834, configured to perform a matching verification on the regression test data based on a data verification configuration file corresponding to the regression test path, where the data verification configuration file includes a preset field that should be returned in the regression test path.
And a processing unit 835, configured to determine that the regression test path passes the data verification if the fields of the regression test data are all matched with the fields in the data verification configuration data file, and determine that the regression test path does not pass the data verification if any field of the regression test data is not matched with the fields in the data verification configuration data file.
Based on the regression testing device disclosed by the embodiment of the invention, a regression testing path to be subjected to regression testing is obtained; setting the test priority of the regression test path based on the use information related to the regression test path, and generating a test case priority configuration file; carrying out regression testing on regression testing paths with different testing priorities according to the test case priority configuration file, and carrying out data verification on the obtained regression testing data; and recording the regression testing path which does not pass the data verification, and recording the path parameters of the regression testing path and the corresponding regression testing data. In the scheme, the regression test paths to be subjected to the regression test in the system are set with the test priorities, the regression test is performed on the regression test paths with different test priorities according to the test cases, and the obtained regression test data are subjected to data verification, so that the reliability of the regression test is ensured, the regression test efficiency is improved, and meanwhile, the regression test cost is reduced. In addition, the regression testing paths which do not pass through verification are integrated and recorded, so that the positioning of the problem regression testing paths is further improved, and the problem regression testing paths can be analyzed more quickly and defects can be overcome.
Referring to fig. 8, fig. 10 is a schematic structural diagram of a regression testing apparatus according to another embodiment of the present invention, where the verification unit 834 includes: a hierarchical subunit 8341 and a matching subunit 8342.
And the layering subunit 8341 is configured to layer each field of the regression testing data according to the data type, so as to obtain a multi-layer data structure, where the data type corresponding to each field in the last layer data structure is the data type of the minimum unit.
And a matching subunit 8342, configured to match the fields in the data check configuration file corresponding to the regression testing path with the fields included in the data structure of each layer in sequence.
Based on the regression testing device disclosed by the embodiment of the invention, a regression testing path to be subjected to regression testing is obtained; setting the test priority of the regression test path based on the use information related to the regression test path, and generating a test case priority configuration file; carrying out regression testing on regression testing paths with different testing priorities according to the test case priority configuration file, and carrying out data verification on the obtained regression testing data; and recording the regression testing path which does not pass the data verification, and recording the path parameters of the regression testing path and the corresponding regression testing data. In the scheme, the regression test paths to be subjected to the regression test in the system are set with the test priorities, the regression test is performed on the regression test paths with different test priorities according to the test cases, and the obtained regression test data are subjected to data verification, so that the reliability of the regression test is ensured, the regression test efficiency is improved, and meanwhile, the regression test cost is reduced. In addition, the regression testing paths which do not pass through verification are integrated and recorded, so that the positioning of the problem regression testing paths is further improved, and the problem regression testing paths can be analyzed more quickly and defects can be overcome.
The specific working process of each module and unit in the regression testing device disclosed in the above embodiment of the present invention can be referred to the corresponding content in the regression testing method disclosed in the above embodiment of the present invention, and will not be described herein.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for a system or system embodiment, since it is substantially similar to a method embodiment, the description is relatively simple, with reference to the description of the method embodiment being made in part. The systems and system embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
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.