Test data setting method, test data application method, device and related equipment
By building and using target test data, the problems of high data redundancy and frequent data conflicts in test cases are solved, and more efficient use of test data and smoother test task execution are achieved.
Patent Information
- Application Number
- CN202010112595.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-24
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2040-02-24
AI Technical Summary
In the prior art test cases, there are problems such as high data redundancy and frequent data conflicts, which affects the smooth progress of the test tasks.
By determining the metadata of the original test data, associating the metadata with the original test data, building the target test data, and using the use case design centered on the target test data, realizing the reuse of different use cases, reducing data redundancy, and passing the target test Data is detected by data conflict to reduce data conflicts.
It effectively reduces data redundancy, reduces data conflicts, improves the efficiency of test data utilization and the smoothness of test tasks.
Smart Images

Figure CN113297056B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of testing technology, and in particular to a test data setting method, a test data application method, a device and related equipment. Background Art
[0002] A test case is a description of a test task, which is mainly composed of one or more test data, test requests and expected results that the test case depends on. It is widely used in fields such as business testing.
[0003] Currently, a test case can be obtained by combining one or more test data, test requests and expected results. This method uses the test data as part of the test case, and the test case and test data are closely organized, resulting in the possibility of multiple identical test data in different test cases, and a high data redundancy problem. At the same time, when adding or modifying test cases based on this method, the test data in the added or modified test case may conflict with the test data in other test cases, affecting the smooth progress of subsequent test tasks.
[0004] Therefore, how to provide a test data setting solution to reduce data redundancy and provide a possibility for reducing data conflicts has become a problem that technical personnel in this field urgently need to solve. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a test data setting method, a test data application method, an apparatus and related equipment to reduce data redundancy and provide a possibility for reducing data conflicts.
[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0007] A test data setting method, comprising:
[0008] Determine one or more use case identifiers corresponding to use cases that need to be constructed based on the original test data, and determine metadata of the original test data at least based on the use case identifiers;
[0009] Associating the metadata with the original test data to obtain target test data;
[0010] The target test data is stored, wherein the target test data is associated with a test request and an expected result required to construct a corresponding use case based on the use case identifier in the metadata.
[0011] The embodiment of the present invention further provides a test data application method, which constructs a test case based on the target test data set by the test data setting method described above, including:
[0012] Get the test case construction request;
[0013] Determine first test data based on the test case construction request;
[0014] Determine metadata of the first test data, where the metadata at least includes one or more use case identifiers corresponding to use cases that need to be constructed based on the first test data;
[0015] Associating the metadata with the first test data to obtain first target test data;
[0016] Performing data conflict detection on the first target test data and the stored target test data;
[0017] According to the data conflict detection results, the test case construction results are determined.
[0018] The embodiment of the present invention further provides a test data application method, which executes a test task based on the target test data set by the test data setting method described above, including:
[0019] Identify multiple target use cases for executing test tasks;
[0020] Determining target test data associated with the multiple target use cases from the stored target test data;
[0021] If the data attributes of the original test data in the determined target test data are all data full preparation attributes, the multiple target test cases are executed in parallel.
[0022] The embodiment of the present invention further provides a test data application method, which performs data recommendation based on the target test data set by the test data setting method described above, including:
[0023] Obtaining a data recommendation request, wherein the data recommendation request includes a recommendation condition;
[0024] The stored target test data is scanned to determine recommended test data that meets the recommendation condition from the stored target test data.
[0025] The embodiment of the present invention also provides a test data setting device, comprising:
[0026] A metadata determination module is used to determine one or more use case identifiers corresponding to the use case that needs to be constructed based on the original test data, and to determine the metadata of the original test data at least based on the use case identifiers.
[0027] An association module, used for associating the metadata with the original test data to obtain target test data;
[0028] The data storage module is used to store the target test data, wherein the target test data is associated with the test request and expected result required to construct the corresponding use case based on the use case identifier in the metadata.
[0029] The embodiment of the present invention also provides a test data application device, including:
[0030] Request acquisition module, used to obtain test case construction requests;
[0031] A first test data determination module, configured to determine first test data based on the test case construction request;
[0032] A metadata determination module, used to determine metadata of the first test data, wherein the metadata at least includes one or more use case identifiers corresponding to use cases that need to be constructed based on the first test data;
[0033] an associating module, configured to associate the metadata with the first test data to obtain first target test data;
[0034] a conflict detection module, used for performing data conflict detection between the first target test data and the stored target test data;
[0035] The construction result determination module is used to determine the construction result of the test case according to the data conflict detection result.
[0036] The embodiment of the present invention also provides a test data application device, including:
[0037] A target use case determination module is used to determine multiple target use cases for executing a test task;
[0038] A test data determination module, used to determine target test data associated with the multiple target use cases from the stored target test data;
[0039] The execution module is used to execute the multiple target test cases in parallel if the data attributes of the original test data in the determined target test data are all data full preparation attributes.
[0040] The embodiment of the present invention also provides a test data application device, including:
[0041] A recommendation request acquisition module, used to acquire a data recommendation request, wherein the data recommendation request includes a recommendation condition;
[0042] The scanning module is used to scan the stored target test data to determine the recommended test data that meets the recommendation condition from the stored target test data.
[0043] An embodiment of the present invention further provides a server, including:
[0044] at least one memory for storing one or more computer executable instructions;
[0045] At least one processor is used to call the one or more computer executable instructions to execute the test data setting method as described above, or the test data application method as described in any one of the above.
[0046] An embodiment of the present invention further provides a storage medium storing one or more computer executable instructions, wherein the one or more computer executable instructions are used to execute the test data setting method as described above, or the test data application method as described in any one of the above.
[0047] The test data setting method provided by the embodiment of the present invention can determine one or more use case identifiers corresponding to the use case that needs to be constructed based on the original test data, so as to determine the metadata of the original test data at least according to the use case identifier; and then associate the original test data and the metadata of the original test data as target test data. When storing the target test data, the target test data can be associated with the test request and expected result required to construct the corresponding use case through the use case identifier in the metadata, so that one target test data can be associated with multiple use cases, that is, different use cases can reuse the same target test data, which greatly reduces data redundancy. At the same time, when performing data conflict detection, the embodiment of the present invention can avoid performing data conflict detection based on the use case, but can perform data conflict detection on the original test data of each target test data based on the target test data, so that data conflict detection is easier to implement, which provides the possibility of reducing data conflicts. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0049] Figure 1 A schematic diagram of the existing use case;
[0050] Figure 2 A schematic diagram of setting test data provided by an embodiment of the present invention;
[0051] Figure 3 A flow chart of a test data setting method provided by an embodiment of the present invention;
[0052] Figure 4 A schematic diagram of metadata provided by an embodiment of the present invention;
[0053] Figure 5 A schematic diagram of data attributes provided by an embodiment of the present invention;
[0054] Figure 6 A schematic diagram of calling a plug-in provided in an embodiment of the present invention;
[0055] Figure 7 A flow chart of a test data application method provided by an embodiment of the present invention;
[0056] Figure 8 An example diagram of test case construction provided by an embodiment of the present invention;
[0057] Fig. 9 Another flow chart of the test data application method provided by an embodiment of the present invention;
[0058] Fig.10 Another flow chart of the test data application method provided by the embodiment of the present invention;
[0059] Fig.11 A block diagram of a test data setting device provided by an embodiment of the present invention;
[0060] Fig.12 A block diagram of a server provided in an embodiment of the present invention;
[0061] Fig.13 A block diagram of a test data application device provided by an embodiment of the present invention;
[0062] Fig.14 Another block diagram of a test data application device provided by an embodiment of the present invention;
[0063] Fig.15 Another block diagram of the test data application device provided by the embodiment of the present invention. DETAILED DESCRIPTION
[0064] like Figure 1 The schematic diagram of the test case (hereinafter referred to as the use case) shown is a diagram of a test case, which can be composed of one or more test data, test requests and expected results. Based on the use case, test tasks can be performed in scenarios such as functional testing of the business system and defect testing of the software, so as to achieve the purpose of verifying whether the function of the business system is abnormal and whether the software has defects. Taking the test of the function of the business system as an example, based on the use case, a test request is first input into the business system, and the functional testing process of the business system is executed based on the test steps and test scripts indicated by the test data, so as to obtain the test results fed back by the business system, and then compare whether the test results match the expected results to verify whether the function of the business system is normal.
[0065] The existing test data setting method is use case-centric and organizes test data as part of the use case. This will result in multiple identical test data in different use cases, such as Figure 1 As shown in Figure 1, there are the same test data 1 and 3 in use cases 1, 2 and 3, which undoubtedly leads to high data redundancy. Figure 1 As shown in the figure, use case 1 can be composed of test data 1, 2 and 3 that use case 1 depends on, as well as test request 1 and expected result 1 of use case 1. The composition of use case 2 and use case 3 is similar.
[0066] At the same time, test data is set with use cases as the center. If operations such as adding or modifying use cases are performed on them, the test data in the added or modified use cases is likely to conflict with the test data in other use cases, and the data conflict is not easy to detect. If there is a data conflict in the test data of different use cases, different use cases will affect each other during execution, making it impossible to perform the test tasks sequentially. It should be noted that test data can include multiple data records in the form of key / value. Data conflict refers to data records with the same key but different values. Due to data mutual exclusion, data conflict will affect the efficiency and accuracy of use case execution in the test field.
[0067] To solve the above problems, the embodiments of the present invention provide an improved test data setting scheme to reduce data redundancy and provide a possibility for reducing data conflicts. The technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0068] In an optional implementation, the test data setting diagram provided in the embodiment of the present invention can be as follows: Figure 2 As shown, refer to Figure 2 , the test data is stored in the form of target test data, and the target test data may include original test data and metadata of the original test data; different from the existing method of setting test data centered on use cases, the embodiment of the present invention decouples the organizational form of test data and use cases, so as to design use cases centered on target test data, and by associating target test data with one or more use cases to be constructed, different use cases can reuse the same target test data, thereby achieving the purpose of reducing data redundancy;
[0069] The original test data may be test data generated by the prior art, and may record information such as test steps and test scripts. The embodiment of the present invention may obtain the original test data generated by the prior art from heterogeneous data sources, such as tair (a data storage service) and mysql (a relational database management system). These heterogeneous data sources may store the original test data generated by the prior art.
[0070] The metadata of the original test data is data that describes the original test data. Considering the decoupling of the organizational form of the test data and the use case, in the embodiment of the present invention, the metadata should at least include one or more use case identifiers corresponding to the use case that needs to be constructed based on the original test data. Generally speaking, one use case corresponds to one use case identifier; furthermore, the original test data and the metadata of the original test data are combined into target test data. The target test data can be associated with the test request and expected result required to construct the corresponding use case through the use case identifier in the metadata, so that one target test data can be associated with multiple use cases, so that different use cases can reuse the same target test data, thereby reducing data redundancy;
[0071] It should be noted that the embodiment of the present invention decouples the test data from the organizational form of the use case, and sets the target test data so that the target test data is associated with the test request and expected result of the use case through the use case identifier in the metadata; for example, Figure 2 The target test data 1 includes the original test data 1 and metadata 1. If the use case identifier indicated by metadata 1 is the identifier of use cases 1, 2 and 3, then the target test data 1 can be associated with the test requests and expected results of use cases 1, 2 and 3 through the use case identifier indicated by metadata 1, so as to realize the association between the target test data 1 and use cases 1, 2 and 3; Figure 2 The association method between any target test data and use case in the diagram can be referred to in a similar way.
[0072] It should be noted that the target test data can be stored in a unified manner. For example, an embodiment of the present invention can set up a data lake to uniformly store the target test data in the data lake. The data lake can be understood as a large warehouse for storing data, in which the data can be accessed, processed, analyzed and transmitted.
[0073] It can be seen that the embodiment of the present invention combines the original test data and the metadata of the original test data into target test data, and associates the target test data with the test request and expected result of the use case through the use case identifier in the metadata, so that one target test data can be associated with multiple use cases, greatly reducing data redundancy. At the same time, when performing data conflict detection, the embodiment of the present invention can perform data conflict detection on the original test data of each target test data based on the target test data, making data conflict detection easier to implement and providing the possibility of reducing data conflicts.
[0074] Based on the above description, in an optional implementation, Figure 3 An optional process of the test data setting method provided by an embodiment of the present invention is shown. Based on this method, the embodiment of the present invention can reconstruct the original test data into target test data and perform unified storage of the target test data; optionally, the method process can be executed by the server, such as Figure 3 As shown, the method flow may include:
[0075] Step S100: determining one or more use case identifiers corresponding to use cases that need to be constructed based on original test data, and determining metadata of the original test data at least according to the use case identifiers.
[0076] Optionally, the original test data may be test data formed by the prior art, and the embodiment of the present invention may obtain the original test data from heterogeneous data sources such as Tair and MySQL. Optionally, the original test data may have multiple data records, and the data records may record information such as test steps and test scripts. Optionally, the data records may be a key / value information structure.
[0077] An embodiment of the present invention can determine one or more use case identifiers corresponding to the use case that needs to be constructed based on the original test data. One use case can correspond to one use case identifier, thereby determining the metadata of the original test data at least based on the use case identifier; that is, the metadata of the original test data should at least include: one or more use case identifiers corresponding to the use case that needs to be constructed based on the original test data.
[0078] In an optional implementation, the embodiment of the present invention can automatically determine the metadata of the original test data through a metadata processing plug-in. The determined metadata should at least include: one or more use case identifiers (use case identifiers such as use case ids) corresponding to the use cases that need to be constructed based on the original test data. For example, if the original test data is d1 and is used by use cases 1, 2, and 3, the use case identifiers recorded in the metadata of the original test data d1 can be the use case ids of use cases 1, 2, and 3.
[0079] It can be understood that the prior art organizes the original test data as part of the use case, while the embodiments of the present invention determine the use case identifier corresponding to the use case that needs to be constructed based on the original test data, and record the use case identifier in the metadata of the original test data. When constructing the target test data later, the use case association can be performed through the use case identifier in the metadata, thereby providing a basis for decoupling the original test data and the use case.
[0080] Of course, in addition to the use case identifier, the metadata may also include other descriptive information describing the original test data. The specific content of the metadata may be defined according to actual conditions, and the embodiment of the present invention does not limit this.
[0081] Step S110 : Associating the metadata with the original test data to obtain target test data.
[0082] After the metadata of the original test data is determined, the metadata may be associated with the original test data to obtain target test data.
[0083] Step S120: Storing the target test data, wherein the target test data is associated with a test request and an expected result required to construct a corresponding use case based on the use case identifier in the metadata.
[0084] For any original test data, the embodiment of the present invention can construct the corresponding target test data in the above manner, and the obtained target test data can be stored uniformly; in an optional implementation, the embodiment of the present invention can store the target test data in a data lake.
[0085] The embodiment of the present invention decouples the test data from the organizational content of the use case, so as to design the use case with the target test data as the center. Therefore, for the target test data stored in a unified manner, the embodiment of the present invention uses the use case identifier of the metadata in the target test data to associate the target test data with the test requests and expected results required to build the corresponding use case, thereby realizing the association between the target test data and the use case.
[0086] The test data setting method provided by the embodiment of the present invention can determine one or more use case identifiers corresponding to the use case that needs to be constructed based on the original test data, so as to determine the metadata of the original test data at least according to the use case identifier; and then associate the original test data and the metadata of the original test data as target test data. When storing the target test data, the target test data can be associated with the test request and expected result required to construct the corresponding use case through the use case identifier in the metadata, so that one target test data can be associated with multiple use cases, that is, different use cases can reuse the same target test data, which greatly reduces data redundancy. At the same time, when performing data conflict detection, the embodiment of the present invention can avoid performing data conflict detection based on the use case, but can perform data conflict detection on the original test data of each target test data based on the target test data, so that data conflict detection is easier to implement, which provides the possibility of reducing data conflicts.
[0087] In an optional implementation, combining Figure 4 As shown, the metadata of the original test data may include: business description information of the original test data, data preparation information and use case identification; accordingly, in the optional implementation of step S100, the embodiment of the present invention can also determine the business description information and data preparation information of the original test data on the basis of determining the use case identification corresponding to the use case that needs to be constructed based on the original test data, thereby associating the business description information, the data preparation information and the use case identification to obtain the metadata of the original test data.
[0088] Among them, the business description information is information that describes the business of the original test data. Optionally, the original test data may include multiple data records. The business description information may indicate the data format type of the data record and the purpose of the information in the data record. For example, in a product recommendation scenario, the business description information of the original test data may describe the data record of the original test data as a tair format type, which is used to store product information preferred by users, etc.
[0089] The data preparation information is the execution information of the data preparation process of the original test data. The data preparation process of the original test data can be understood as the process of updating the original test data. In further optional implementations, continue to refer to Figure 4 , the data preparation information may include: data attributes of the original test data, calling plug-ins, and storage location information of the data after data preparation; accordingly, the embodiment of the present invention can determine the data attributes of the original test data, calling plug-ins, and storage location information of the data after data preparation to determine the data preparation information of the original test data.
[0090] In an optional implementation, the data attribute may indicate the type of data preparation for the original test data, and different types of data preparation for the original test data may correspond to different data attributes; optionally, such as Figure 5 As shown, data attributes can be divided into the following categories: hot data attributes, restart load data attributes, data full preparation attributes, and data serial preparation attributes;
[0091] Among them, the hot data attribute means: when preparing the original test data, if the original test data changes, the system can be hot loaded, that is, the changed original test data takes effect in real time;
[0092] The restart loading data attribute means: when preparing the original test data, if the original test data changes, the system needs to restart the process to make the changed original test data take effect;
[0093] The full data preparation attribute means that multiple data records in the original test data can be prepared at one time, that is, multiple data records can be prepared in batches, which helps improve data preparation efficiency;
[0094] The data serial preparation attribute means that the data records in the original test data can only be prepared serially, not in batches;
[0095] An original test data may have one or more of the above-mentioned non-contradictory data attributes. An embodiment of the present invention may indicate the data attributes of the original test data through a data tag, and a data tag indicates a data attribute, so that one or more data tags indicating the data attributes of the original test data may be combined as: a data tag combination of the original test data; accordingly, an embodiment of the present invention may determine the data attributes of the original test data by determining the data tag combination of the original test data; in a more specific implementation, an embodiment of the present invention may determine the data tag combination of the original test data, and the data tag combination includes one or more data tags, and the data tags are used to indicate at least one of the following data attributes of the original test data: a hot data attribute, a restart loading data attribute, a data full preparation attribute, and a data serial preparation attribute.
[0096] In an optional implementation, the calling plugin can represent the plugin that performs data preparation on the raw test data, optionally, such as Figure 6 As shown, the calling plug-in may include: a single preparation plug-in, a full preparation plug-in, a data aggregation plug-in, and a data standardization plug-in; wherein, an original test data may have at least one of the calling plug-ins above;
[0097] It should be noted that the single preparation plug-in is used to update a data record of the original test data; for example, taking the original test data as Tair data, which includes multiple data records in key / value format, the embodiment of the present invention can insert a key / value data record into Tair data based on the single preparation plug-in, thereby updating the key / value data records one by one;
[0098] A full preparation plug-in is used to batch update multiple data records of the original test data; for example, to batch insert multiple key / value data records into the Tair data at the same time;
[0099] The data aggregation plug-in is used to aggregate similar data records in the original test data; for example, if two data records differ in value by only one space, then the two data records are essentially the same and can be aggregated into one data record;
[0100] The data standardization plug-in is used to determine the data element of the data record in the original test data, and the data element is the basic unit of data.
[0101] The storage location information of the data after data preparation indicates the location where the original test data is stored after data preparation, such as the server or data index pointed to by the Tair data after data preparation.
[0102] In a further implementation, the target test data determined by the embodiment of the present invention can be uniformly stored in the data lake, that is, multiple target test data are stored in the data lake, and each target test data is associated with the test request and expected result of the use case through the use case identifier in the metadata; in the prior art, test data is used as the organizational content of the use case, and the test data is strongly bound to the use case, and the same test data may exist in different use cases; while the embodiment of the present invention is centered on the data lake, and the target test data in the data lake is associated with the test request and expected result of the use case through the use case identifier, so different use cases can reuse the same target test data in the data lake, reducing data redundancy. At the same time, the embodiment of the present invention can perform data conflict detection based on the target test data in the data lake, and data conflict detection is easier to implement and more efficient, which provides a possibility for reducing data conflicts.
[0103] The target test data provided by the embodiment of the present invention can be applicable in a variety of application scenarios and has corresponding applicable effects; for example, based on the target test data provided by the embodiment of the present invention, test cases can be constructed, test tasks can be executed, data recommendations can be made, etc. The application solutions in these application scenarios are introduced below.
[0104] In an alternative implementation, Figure 7The optional process of the test data application method provided by the embodiment of the present invention is shown. Figure 7 The method shown can construct a test case based on the target test data provided by the embodiment of the present invention; refer to Figure 7 The method flow may include:
[0105] Step S200: Obtain a test case construction request.
[0106] Constructing test cases, such as modifying and adding test cases, etc.; a user (such as a tester) can send a test case construction request to the server through his terminal device, so that the server can obtain the test case construction request.
[0107] Step S210: Determine first test data based on the test case construction request.
[0108] After the server obtains the test case construction request, it can determine the first test data based on the user's operations of modifying and adding test cases, that is, the first test data can be considered as test data constructed by the user; the first test data can include multiple data records to record the test steps, test scripts and other information corresponding to the first test data.
[0109] Step S220: Determine metadata of the first test data, where the metadata at least includes one or more use case identifiers corresponding to use cases that need to be constructed based on the first test data.
[0110] After determining the first test data, according to the format of the target test data provided by the embodiment of the present invention, the embodiment of the present invention needs to determine the metadata of the first test data, so as to associate the metadata of the first test data with the first test data as corresponding target test data.
[0111] For the specific content and determination method of the metadata, please refer to the description of the corresponding part above, which will not be repeated here.
[0112] Step S230: Associating the metadata with the first test data to obtain first target test data.
[0113] The target test data obtained by associating the first test data with the metadata of the first test data is referred to as first target test data in this embodiment of the present invention.
[0114] Step S240: Perform data conflict detection on the first target test data and the stored target test data.
[0115] The first target test data should not have data conflicts with the stored target test data (such as the target test data stored in the data lake) in order to construct a test case based on the first target test data. Therefore, the embodiment of the present invention needs to perform data conflict detection on the first target test data and the stored target test data.
[0116] It can be understood that the first target test data includes the first test data and the metadata of the first test data, and any stored target test data includes the original test data and the metadata of the original test data. The first test data and the original test data may include multiple data records, and each data record may be an information structure in a key-value format;
[0117] The embodiment of the present invention can compare the key-value information of the first test data with the key-value information of the original test data in the stored target test data; if the first test data and the original test data have data records with repeated key information but different value information, the data conflict detection result is determined to be a data conflict; if the first test data and the original test data do not have repeated key information, or there are data records with repeated key information and the same value information, the data conflict detection result is determined to be no data conflict; that is, if there are data records with the same key information but different value information, there is a data conflict problem, which will cause data records with the same key but different values to overlap each other, affecting the efficiency and accuracy of the use case execution.
[0118] Step S250: Determine the test case construction result according to the data conflict detection result.
[0119] It can be understood that if the data conflict detection result is that the data does not conflict, the embodiment of the present invention can determine that the test case construction is successful, so as to store the first target test data, for example, storing the first target test data in the data lake storing the target test data; if the data conflict detection result is a data conflict, it can prompt that a test case conflict occurs, and prompt the user whether to continue constructing the test case. Optionally, the embodiment of the present invention can prompt the construction of the use case affected by the first target test data based on the use case identifier in the metadata of the first target test data, so that the user can confirm whether to perform a secondary use case construction.
[0120] In an optional implementation, an embodiment of the present invention may also add a data format detection for the first target test data. Only when the data format detection of the first target test data passes and there is no data conflict, the test case is considered to be constructed successfully, otherwise it is considered that a conflict occurs in the test case; in a specific implementation, an embodiment of the present invention may detect whether the data format of the first target test data conforms to a preset format before executing step S240, and only execute step S240 after the detection passes; whether the data format of the first target test data conforms to the preset format can be understood as: whether the data format written by the user in the process of modifying the first test data conforms to the format specification, for example, for json data, if the user does not write data in accordance with the json specification, it is considered that the data format of the first target test data does not conform to the preset format.
[0121] The first test data may be test data constructed by the user. In an optional implementation of determining the first test data, taking modification of a test case as an example, in order to avoid the user from rewriting the test data and reducing the user's workload, after the server obtains a request to modify the test case, it may determine multiple target test data recommended to the user from the stored target test data (for example, multiple target test data recommended to the user are determined from a data lake). The recommended target test data may be, for example, template data of the target test data, the simplest stored target test data, and the most complex stored target test data; thus, the user may select one target test data from the recommended multiple target test data as the second target test data, so that the server may modify the second target test data based on the user's modification operation on the second target test data to obtain the first test data;
[0122] Of course, the server may also determine a target test data recommended to the user from the stored target test data, and the recommended target test data may be directly used as the second target test data, so that the server may modify the second target test data based on the user's modification operation on the second target test data to obtain the first test data;
[0123] In the case of modifying a test case, an embodiment of the present invention may also support a user to directly select second target test data from the stored target test data, such as a user directly selecting second target test data from a data lake, so that the server may modify the second target test data based on the user's modification operation on the second target test data to obtain the first test data.
[0124] In another optional implementation, taking adding a test case as an example, after the server obtains a request to add a test case, it may allow the user to create new empty data, so that the server can obtain the newly created empty data. Based on the user's modification operation on the empty data, the server can modify the empty data to obtain the first test data.
[0125] In an optional implementation of step S240, the embodiment of the present invention needs to determine the key information of the first test data, such as determining the key information of each data record in the first test data, so as to compare the key information of the first test data with the key information of the original test data in the stored target test data to determine whether there are data records with repeated key information between the first test data and the original test data. If not, it is considered that there is no data conflict. If so, it is further detected whether the value information of the data records with repeated key information is the same; if the value information is the same, it is considered that there is no data conflict; if the value information is different, it is considered that there is a data conflict;
[0126] Optionally, in determining the key information of the first test data, there are several possible situations as follows:
[0127] The data record of the first test data has both key and value. In this case, the key of the data record can be directly determined;
[0128] The data record of the first test data has no key but has a value. At this time, if the value has a primary key, the primary key extraction plug-in can be called to extract the primary key from the data record;
[0129] The data record of the first test data has no key but has a value. At this time, if the value does not have a primary key, the md5 value of the value can be used as the primary key.
[0130] Construct scenarios based on test cases, Figure 8 The following figure shows an example of an optional process of test case construction. After the user sends a test case construction request to the server, Figure 8 As shown, for the case of modifying a test case, the data lake recommends target test data, and the user modifies the recommended target test data to obtain first test data; for the case of adding a test case, the user creates new empty data and modifies the empty data to obtain first test data; based on the first test data, the server determines the metadata of the first test data, and associates the metadata and the first test data as first target test data; data format detection and data conflict detection are performed on the first target test data. If the detection passes, the first target test data is stored in the data lake. If the detection fails, the user is prompted that a conflict occurs in the test case and is prompted whether to continue constructing the test case.
[0131] Based on the target test data provided by the embodiment of the present invention, the embodiment of the present invention can construct test cases centered on the target test data, so that different constructed test cases can reuse the same target test data, thereby reducing data redundancy.
[0132] In an alternative implementation, Fig. 9Another optional process of the test data application method provided by the embodiment of the present invention is shown. Fig. 9 The method shown can perform test tasks based on the target test data provided by the embodiment of the present invention, such as performing regression testing. Regression testing refers to executing multiple use cases at a time to ensure that functional changes in the business system do not affect the original functions of the business system; refer to Fig. 9 The method flow may include:
[0133] Step S300: determine multiple target use cases for executing the test task.
[0134] The embodiment of the present invention can set multiple target use cases for executing test tasks. For example, in a regression test scenario, all use cases can be used as target use cases. Of course, the embodiment of the present invention can also support non-regression test tasks and set target use cases for test tasks.
[0135] Step S310: Determine target test data associated with the multiple target use cases from the stored target test data.
[0136] The embodiment of the present invention can determine the target test data associated with each target use case from the stored target test data through the use case identifier of the target use case, thereby determining the target test data associated with the multiple target use cases; for example, the metadata of the target test data records the use case identifier of the use case, and by matching the use case identifier recorded in the metadata with the use case identifier of the target use case, the embodiment of the present invention can determine the target test data associated with each target use case from the target test data stored in the data lake, and obtain the target test data associated with the multiple target use cases.
[0137] Step S320: If the data attributes of the original test data in the determined target test data are all data full preparation attributes, the multiple target test cases are executed in parallel.
[0138] After determining the target test data associated with the multiple target use cases, if the data attributes of the original test data in the determined target test data are all full data preparation attributes, it means that the original test data in the determined target test data can be prepared in batches, so that the embodiment of the present invention can execute multiple target use cases in parallel and improve testing efficiency.
[0139] The embodiment of the present invention can perform test tasks such as regression testing based on the target test data stored in the data lake. Since the use case is designed as a method of associating the target test data with the test request and expected result of the use case, the target test data in the data lake can relatively easily realize data conflict detection, and can ensure that test tasks such as regression testing are executed with low data redundancy and without data conflicts, which can greatly improve the test efficiency. At the same time, when the data does not conflict, under the same environment configuration, if all the target test data associated with the target use case that executes the test task can be fully prepared, the target use case can be executed in parallel, further improving the test efficiency.
[0140] In an alternative implementation, Fig.10 Another optional process of the test data application method provided by the embodiment of the present invention is shown. Fig.10 The method shown can perform data recommendation based on the target test data provided by the embodiment of the present invention, such as data level recommendation based on the test data; Fig.10 The method flow may include:
[0141] Step S400: Obtain a data recommendation request, where the data recommendation request includes a recommendation condition.
[0142] Step S410: Scan the stored target test data to determine recommended test data that meets the recommendation condition from the stored target test data.
[0143] In the data recommendation scenario, after receiving a data recommendation request, the server can scan the target test data stored in the data lake, thereby determining the recommended test data that meets the recommendation conditions from the data lake, and realizing data recommendation based on the test data.
[0144] It is understandable that if the traditional test data setting method centered on use cases is followed, then when making data recommendations, the common practice is to traverse the test data in all use cases once, and then filter out the test data sets that meet the recommendation conditions. This will lead to poor efficiency and real-time performance of data recommendations when the number of use cases is large. However, based on the target test data-centric solution of the embodiment of the present invention, when making data recommendations, the embodiment of the present invention can directly scan the target test data stored in the data lake without having to worry about the number of use cases. Therefore, the efficiency and real-time performance of obtaining recommendation results can be improved, and the recommendation request can be responded to extremely quickly, and the recommendation results can be fed back, thereby improving the user experience of the data recommendation service.
[0145] The above describes multiple implementation schemes provided by the embodiments of the present invention. The various optional methods introduced in the implementation schemes can be combined and cross-referenced with each other without conflict, thereby extending a variety of possible implementation schemes, which can all be considered as implementation schemes disclosed and open in the embodiments of the present invention.
[0146] The following is an introduction to the test data setting device provided by the embodiment of the present invention. The content of the test data setting device described below can be considered as the functional modules required to be set in order to implement the test data setting method provided by the embodiment of the present invention. The content of the test data setting device described below can be referenced to the above content in correspondence with each other.
[0147] In an optional implementation, Fig.11 An optional block diagram of a test data setting device provided by an embodiment of the present invention is shown. Fig.11 As shown, the test data setting device may include:
[0148] The metadata determination module 100 is used to determine one or more use case identifiers corresponding to the use case that needs to be constructed based on the original test data, and to determine the metadata of the original test data at least according to the use case identifiers;
[0149] An associating module 110 is used to associate the metadata with the original test data to obtain target test data;
[0150] The data storage module 120 is used to store the target test data, wherein the target test data is associated with the test request and expected result required to construct the corresponding use case based on the use case identifier in the metadata.
[0151] Optionally, the metadata determination module 100, used to determine the metadata of the original test data at least according to the use case identifier, may specifically include:
[0152] Determining business description information and data preparation information of the original test data;
[0153] The business description information, the data preparation information and the use case identifier are associated to obtain metadata of the original test data.
[0154] Optionally, the metadata determination module 100, used to determine the data preparation information of the original test data, may specifically include:
[0155] Determine the data attributes of the original test data, call the plug-in, and the storage location information of the data after data preparation.
[0156] Optionally, the metadata determination module 100 is used to determine the data attributes of the original test data, which may specifically include:
[0157] Determine a data tag combination of the original test data, wherein the data tag combination includes one or more data tags; the data tags are used to indicate at least one of the following data attributes of the original test data: a hot data attribute, a restart load data attribute, a data full preparation attribute, and a data serial preparation attribute.
[0158] Optionally, the calling plug-in includes at least one of the following: a single preparation plug-in, a full preparation plug-in, a data aggregation plug-in, and a data standardization plug-in; wherein the single preparation plug-in is used to update a single data record of the original test data, the full preparation plug-in is used to batch update multiple data records of the original test data, the data aggregation plug-in is used to aggregate similar data records in the original test data, and the data standardization plug-in is used to determine the data elements of the data records in the original test data.
[0159] Optionally, the data storage module 120 is used to store the target test data, and may specifically include:
[0160] The target test data is stored in the data lake.
[0161] The embodiment of the present invention further provides a server, which can be loaded with the test data setting device described above. In an optional implementation, the hardware structure of the server can be as follows: Fig.12 As shown, it includes: at least one processor 1, at least one communication interface 2, at least one memory 3 and at least one communication bus 4;
[0162] Optionally, the communication interface 2 may be an interface of a communication module for performing network communication;
[0163] Optionally, processor 1 may be a CPU (central processing unit), a GPU (Graphics Processing Unit), an NPU (embedded neural network processor), an FPGA (Field Programmable Gate Array), a TPU (tensor processing unit), an AI chip, an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement an embodiment of the present invention.
[0164] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0165] The memory 3 stores one or more computer executable instructions, and the processor 1 calls the one or more computer executable instructions to execute the test data setting method provided in the embodiment of the present invention.
[0166] An embodiment of the present invention further provides a storage medium, which can store one or more computer executable instructions. The one or more computer executable instructions can be used to execute the test data setting method provided by the embodiment of the present invention.
[0167] In an optional implementation, the embodiment of the present invention further provides a test data application device, which can construct a test case based on the target test data provided by the embodiment of the present invention; optionally, Fig.13 An optional block diagram of a test data application device provided by an embodiment of the present invention is shown. Fig.13 As shown, the test data application device may include:
[0168] A request acquisition module 200 is used to acquire a test case construction request;
[0169] A first test data determination module 210, configured to determine first test data based on the test case construction request;
[0170] A metadata determination module 220, configured to determine metadata of the first test data, wherein the metadata at least includes one or more use case identifiers corresponding to use cases that need to be constructed based on the first test data;
[0171] An associating module 230, configured to associate the metadata with the first test data to obtain first target test data;
[0172] A conflict detection module 240, configured to perform data conflict detection on the first target test data and the stored target test data;
[0173] The construction result determination module 250 is used to determine the construction result of the test case according to the data conflict detection result.
[0174] Optionally, the first test data determining module 210 is configured to determine the first test data based on the test case construction request, specifically including:
[0175] Acquire second target test data, modify the second target test data, and obtain first test data; the second target test data is target test data recommended from the stored target test data, or target test data directly selected from the stored target test data;
[0176] Alternatively, newly created empty data is obtained, and the empty data is modified to obtain the first test data.
[0177] Optionally, the conflict detection module 240 is used to perform data conflict detection on the first target test data and the stored target test data, specifically including:
[0178] Comparing the key value information of the first test data with the key value information of the original test data in the stored target test data;
[0179] If the first test data and the original test data have data records with repeated key information but different value information, the data conflict detection result is determined to be a data conflict; if the first test data and the original test data do not have repeated key information, or there are data records with repeated key information and the same value information, the data conflict detection result is determined to be no data conflict.
[0180] Optionally, the construction result determination module 250 is used to determine the construction result of the test case according to the data conflict detection result, specifically including:
[0181] If the data conflict detection result is that the data does not conflict, storing the first target test data in the data lake storing the target test data;
[0182] If the data conflict detection result is a data conflict, it will prompt that a conflict occurs in the test case and prompt the user whether to continue constructing the test case.
[0183] Optionally, the test data application device provided by the embodiment of the present invention may also be used to: if the data conflict detection result is a data conflict, prompt construction of a use case affected by the first target test data according to the use case identifier in the metadata.
[0184] Optionally, before the conflict detection module performs data conflict detection on the first target test data and the stored target test data, the test data application device provided by the embodiment of the present invention can also be used to: detect whether the data format of the first target test data conforms to a preset format; wherein, if the data format of the first target test data conforms to the preset format, the conflict detection module enters the step of performing data conflict detection on the first target test data and the stored target test data.
[0185] Optionally, the embodiment of the present invention further provides a server, which can be loaded with the test data application device described above. In an optional implementation, the hardware structure of the server can be combined with Fig.12 As shown, it includes: at least one memory for storing one or more computer executable instructions; at least one processor for calling the one or more computer executable instructions to execute the test data application method for constructing test cases provided by an embodiment of the present invention.
[0186] An embodiment of the present invention further provides a storage medium, which can store one or more computer-executable instructions, and the one or more computer-executable instructions can be used to execute the test data application method for constructing test cases provided by an embodiment of the present invention.
[0187] In an optional implementation, the embodiment of the present invention also provides a test data application device, which can perform a test task, such as regression testing, based on the target test data provided by the embodiment of the present invention; optionally, Fig.14 Another optional block diagram of the test data application device provided by the embodiment of the present invention is shown as follows: Fig.14 As shown, the test data application device may include:
[0188] A target use case determination module 300 is used to determine multiple target use cases for executing a test task;
[0189] A test data determination module 310 is used to determine target test data associated with the multiple target use cases from the stored target test data;
[0190] The execution module 320 is used to execute the multiple target test cases in parallel if the data attributes of the original test data in the determined target test data are all data full preparation attributes.
[0191] Optionally, the embodiment of the present invention further provides a server, which can be loaded with the test data application device described above. In an optional implementation, the hardware structure of the server can be combined with Fig.12 As shown, it includes: at least one memory for storing one or more computer executable instructions; at least one processor for calling the one or more computer executable instructions to execute the test data application method for executing the test task provided by the embodiment of the present invention.
[0192] An embodiment of the present invention further provides a storage medium, which can store one or more computer executable instructions. The one or more computer executable instructions can be used to execute the test data application method for executing a test task provided by an embodiment of the present invention.
[0193] In an optional implementation, the embodiment of the present invention also provides a test data application device, which can perform data recommendation based on the target test data provided by the embodiment of the present invention, such as performing regression testing; optionally, Fig.15 Another optional block diagram of the test data application device provided by the embodiment of the present invention is shown. Fig.15 As shown, the test data application device may include:
[0194] A recommendation request acquisition module 400 is used to acquire a data recommendation request, wherein the data recommendation request includes a recommendation condition;
[0195] The scanning module 410 is used to scan the stored target test data to determine the recommended test data that meets the recommendation condition from the stored target test data.
[0196] Optionally, the embodiment of the present invention further provides a server, which can be loaded with the test data application device described above. In an optional implementation, the hardware structure of the server can be combined with Fig.12 As shown, it includes: at least one memory for storing one or more computer executable instructions; at least one processor for calling the one or more computer executable instructions to execute the test data application method for data recommendation provided by an embodiment of the present invention.
[0197] An embodiment of the present invention further provides a storage medium, which can store one or more computer-executable instructions, and the one or more computer-executable instructions can be used to execute the test data application method for data recommendation provided by an embodiment of the present invention.
[0198] Although the embodiments of the present invention are disclosed above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. A test data setting method, comprising: Determine one or more use case identifiers corresponding to use cases that need to be constructed based on the original test data, and determine metadata of the original test data at least according to the use case identifiers; Associating the metadata with the original test data to obtain target test data; The target test data is stored, wherein the target test data is associated with a test request and an expected result required to construct a corresponding use case based on the use case identifier in the metadata.
2. The test data setting method according to claim 1, wherein determining the metadata of the original test data at least according to the use case identifier comprises: Determine the business description information and data preparation information of the original test data; The business description information, the data preparation information and the use case identifier are associated to obtain metadata of the original test data.
3. The test data setting method according to claim 2, wherein the determining the data preparation information of the original test data comprises: Determine the data attributes of the original test data, call the plug-in, and the storage location information of the data after data preparation.
4. The test data setting method according to claim 3, wherein determining the data attributes of the original test data comprises: Determine a data tag combination of the original test data, wherein the data tag combination includes one or more data tags, and the data tags are used to indicate at least one of the following data attributes of the original test data: a hot data attribute, a restart load data attribute, a data full preparation attribute, and a data serial preparation attribute.
5. The test data setting method according to claim 3, wherein the calling plug-in includes at least one of the following: a single preparation plug-in, a full preparation plug-in, a data aggregation plug-in, and a data standardization plug-in; wherein, The single preparation plug-in is used to update a single data record of the original test data, the full preparation plug-in is used to batch update multiple data records of the original test data, the data aggregation plug-in is used to aggregate similar data records in the original test data, and the data standardization plug-in is used to determine the data elements of the data records in the original test data.
6. The test data setting method according to any one of claims 1 to 5, wherein storing the target test data comprises: The target test data is stored in the data lake.
7. A test data application method, based on the target test data set by the test data setting method according to any one of claims 1 to 6, constructing a test case, comprising: Get the test case construction request; Determine first test data based on the test case construction request; Determine metadata of the first test data, where the metadata at least includes one or more use case identifiers corresponding to use cases that need to be constructed based on the first test data; Associating the metadata with the first test data to obtain first target test data; Performing data conflict detection on the first target test data and the stored target test data; According to the data conflict detection results, the test case construction results are determined.
8. The test data application method according to claim 7, wherein determining the first test data based on the test case construction request comprises: Acquire second target test data, and modify the second target test data to obtain first test data; The second target test data is target test data recommended from the stored target test data, or target test data directly selected from the stored target test data; Alternatively, newly created empty data is obtained, and the empty data is modified to obtain the first test data.
9. The test data application method according to claim 7, wherein the step of performing data conflict detection between the first target test data and the stored target test data comprises: Comparing the key value information of the first test data with the key value information of the original test data in the stored target test data; If the first test data and the original test data have data records with repeated key information but different value information, the data conflict detection result is determined to be a data conflict; if the first test data and the original test data do not have repeated key information, or there are data records with repeated key information and the same value information, the data conflict detection result is determined to be no data conflict.
10. The test data application method according to claim 7, wherein determining the test case construction result according to the data conflict detection result comprises: If the data conflict detection result is that the data does not conflict, storing the first target test data in the data lake storing the target test data; If the data conflict detection result is a data conflict, it will prompt that a conflict occurs in the test case and prompt the user whether to continue constructing the test case.
11. The test data application method according to claim 10, further comprising: If the data conflict detection result is a data conflict, a prompt is provided to construct a use case affected by the first target test data according to the use case identifier in the metadata.
12. The test data application method according to claim 7, before performing data conflict detection on the first target test data and the stored target test data, the method further comprises: Detect whether the data format of the first target test data conforms to a preset format; wherein, if the data format of the first target test data conforms to the preset format, enter the step of performing data conflict detection on the first target test data and the stored target test data.
13. A test data application method, based on the target test data set by the test data setting method according to any one of claims 1 to 6, to execute a test task, comprising: Identify multiple target use cases for executing test tasks; Determining target test data associated with the multiple target use cases from the stored target test data; If the data attributes of the original test data in the determined target test data are all data full preparation attributes, the multiple target test cases are executed in parallel.
14. A test data application method, performing data recommendation based on the target test data set by the test data setting method according to any one of claims 1 to 6, comprising: Obtaining a data recommendation request, wherein the data recommendation request includes a recommendation condition; The stored target test data is scanned to determine recommended test data that meets the recommendation condition from the stored target test data.
15. A test data setting device, comprising: A metadata determination module, used to determine one or more use case identifiers corresponding to use cases that need to be constructed based on original test data, and to determine metadata of the original test data at least according to the use case identifiers; An association module, used for associating the metadata with the original test data to obtain target test data; The data storage module is used to store the target test data, wherein the target test data is associated with the test request and expected result required to construct the corresponding use case based on the use case identifier in the metadata.
16. A test data application device, comprising: Request acquisition module, used to obtain test case construction requests; A first test data determination module, configured to determine first test data based on the test case construction request; A metadata determination module, used to determine metadata of the first test data, wherein the metadata at least includes one or more use case identifiers corresponding to use cases that need to be constructed based on the first test data; an associating module, configured to associate the metadata with the first test data to obtain first target test data; a conflict detection module, used for performing data conflict detection between the first target test data and the stored target test data; The construction result determination module is used to determine the construction result of the test case according to the data conflict detection result.
17. A test data application device, comprising: A target use case determination module is used to determine multiple target use cases for executing a test task; A test data determination module, used to determine target test data associated with the multiple target use cases from the stored target test data; The execution module is used to execute the multiple target test cases in parallel if the data attributes of the original test data in the determined target test data are all data full preparation attributes.
18. A test data application device, comprising: A recommendation request acquisition module, used to acquire a data recommendation request, wherein the data recommendation request includes a recommendation condition; The scanning module is used to scan the stored target test data to determine the recommended test data that meets the recommendation condition from the stored target test data.
19. A server, comprising: at least one memory for storing one or more computer executable instructions; At least one processor is used to call the one or more computer executable instructions to execute the test data setting method as described in any one of claims 1 to 6, or the test data application method as described in any one of claims 7 to 12, or the test data application method as described in claim 13, or the test data application method as described in claim 14.
20. A storage medium storing one or more computer executable instructions, wherein the one or more computer executable instructions are used to execute the test data setting method according to any one of claims 1 to 6, or the test data application method according to any one of claims 7 to 12, or the test data application method according to claim 13, or the test data application method according to claim 14.
Citation Information
Patent Citations
Automatic test method and device, and computer readable storage medium
CN108038054A
