Data testing method and device

By dividing the data table into field sets or record sets and conducting corresponding tests, the problems of low test accuracy and mechanical logic in the existing technology are solved, the test efficiency and accuracy are improved, and data testing based on business logic is realized.

CN110688295BActive Publication Date: 2024-09-20BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201810737080.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-07-06
Publication Date
2024-09-20
Estimated Expiration
2038-07-06

AI Technical Summary

Technical Problem

In the existing technology, it is difficult for the test script to determine whether the business logic is met, resulting in low test accuracy, and it is difficult for testers to understand the test logic, which is inefficient and does not consider the correlation between fields or records in the result data table, resulting in mechanical test logic. .

Method used

By dividing the data table to be tested into multiple field sets or record sets, test based on the correlation between fields or records, obtain the expected result data set and compare it with the actual data set, determine whether the field set or record set passes the test, and After the test passes, remove unnecessary fields or records to optimize the testing process.

Benefits of technology

It improves the testing efficiency and accuracy, realizes data testing based on business logic, solves the problems caused by relying on test scripts in the existing technology, and simplifies the testing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110688295B
    Figure CN110688295B
Patent Text Reader

Abstract

The present invention discloses a data testing method and device, and relates to the field of computer technology. A specific implementation of the method includes: dividing a data table to be tested into multiple field sets; for any field set: if the field set does not depend on the other field sets or the dependent field sets have passed the test, then obtaining the expected result data set corresponding to the any field set from the data source, and when it is judged that the expected result data set is equal to the data set formed by the any field set, the any field set is determined to have passed the test; or, dividing the data table to be tested into multiple record sets; obtaining the expected result data set corresponding to any record set from the data source, and when it is judged that the expected result data set is equal to the data set formed by the record set, the record set is determined to have passed the test. This implementation can improve test efficiency and test accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a data testing method and device. Background Art

[0002] With the rapid development of Internet technology, the amount of data in various businesses has increased dramatically. In practical applications, it is often necessary to process the original data in the data source to generate the result data table of the dimensions required by the business. In this case, how to efficiently and accurately test the massive data in the result data table becomes a key issue. In the prior art, testers need to execute the test scripts pre-written by R&D personnel to perform automated testing on the result data table.

[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:

[0004] 1. In the existing testing process, it is impossible to determine whether the test script itself meets the business logic, resulting in low test accuracy. At the same time, it is difficult for testers to understand the entire logic in the test script, resulting in low test efficiency.

[0005] 2. The existing testing method does not consider the correlation between the fields or records in the result data table, which makes its testing logic more mechanical. Summary of the invention

[0006] In view of this, an embodiment of the present invention provides a data testing method and device, which can divide the data table to be tested into multiple field sets or record sets according to the correlation between different fields or different records, and then test each field set or record set separately, thereby improving test efficiency and test accuracy.

[0007] To achieve the above objective, according to one aspect of the present invention, a data testing method is provided.

[0008] The data testing method of the embodiment of the present invention comprises: dividing a data table to be tested into a plurality of field sets; wherein each field set comprises at least one field of the data table to be tested; for any field set: if the field set does not depend on the other field sets or the dependent field sets have passed the test, obtaining an expected result data set corresponding to the any field set from a data source, and when it is determined that the expected result data set is equal to the data set formed by the any field set, determining the any field set as having passed the test; or, dividing the data table to be tested into a plurality of record sets; wherein each record set comprises at least one record of the data table to be tested; obtaining an expected result data set corresponding to any record set from a data source, and when it is determined that the expected result data set is equal to the data set formed by the record set, determining the record set as having passed the test.

[0009] Optionally, the method further comprises: after determining any field set as having passed the test: if there is a field in the field set that the untested field set depends on, retaining the field and removing the remaining fields in the any field set; if there is no field in the any field set that the untested field set depends on, removing the any field set.

[0010] Optionally, the method further includes: for a field set that does not depend on other field sets or the dependent field sets have passed the test: dividing the data of the field set into multiple data row sets according to pre-set data labels, and testing each data row set respectively; when all the data row sets pass the test, determining the field set as passing the test.

[0011] Optionally, obtaining the expected result data set from the data source includes: directly obtaining the expected result data set from the data source; or obtaining original data corresponding to the field set or record set to be tested from the data source, and processing the original data using preset logic to generate the expected result data set.

[0012] Optionally, determining whether an expected result data set is equal to a data set formed by a field set or a record set includes: obtaining a difference set between the expected result data set and the formed data set, and a difference set between the formed data set and the expected result data set; when both difference sets are empty sets, determining that the expected result data set is equal to the formed data set.

[0013] Optionally, the to-be-tested data table and the expected result data set are both DataFrame objects in a distributed data processing framework Spark.

[0014] To achieve the above objective, according to another aspect of the present invention, a data testing device is provided.

[0015] The data testing device of the embodiment of the present invention may include: a column dimension reduction unit, which is used to divide the data table to be tested into multiple field sets; wherein each field set includes at least one field of the data table to be tested; for any field set: if the field set does not depend on the remaining field sets or the dependent field sets have passed the test, then the expected result data set corresponding to the any field set is obtained from the data source, and when it is judged that the expected result data set is equal to the data set formed by the any field set, the any field set is determined to have passed the test; or, a row dimension reduction unit, which is used to divide the data table to be tested into multiple record sets; wherein each record set includes at least one record of the data table to be tested; the expected result data set corresponding to any record set is obtained from the data source, and when it is judged that the expected result data set is equal to the data set formed by the record set, the record set is determined to have passed the test.

[0016] Optionally, the device may further include a field removal unit, which is used to, after determining that any field set has passed the test: if it is determined that there are fields in the field set that the untested field set depends on, retain the field and remove the remaining fields in the any field set; if it is determined that there are no fields in the any field set that the untested field set depends on, remove the any field set.

[0017] Optionally, the device may further include a subsequent dimensionality reduction unit, which is used for: for a field set that does not depend on other field sets or the dependent field set has passed the test: dividing the data of the field set into multiple data row sets according to pre-set data labels, and testing each data row set separately; when all the data row sets pass the test, determining the field set as passing the test.

[0018] Optionally, the column dimension reduction unit or the row dimension reduction unit can be further used to: directly obtain the expected result data set from the data source; or, obtain the original data corresponding to the field set or record set to be tested from the data source, and use preset logic to process the original data to generate the expected result data set.

[0019] Optionally, the column dimensionality reduction unit or the row dimensionality reduction unit can be further used to: obtain the difference between the expected result data set and the formed data set, and the difference between the formed data set and the expected result data set; when both difference sets are empty sets, determine the expected result data set and the formed data set to be equal.

[0020] Optionally, the to-be-tested data table and the expected result data set are both DataFrame objects in a distributed data processing framework Spark.

[0021] To achieve the above objective, according to another aspect of the present invention, an electronic device is provided.

[0022] An electronic device of the present invention comprises: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the data testing method provided by the present invention.

[0023] To achieve the above objective, according to yet another aspect of the present invention, a computer-readable storage medium is provided.

[0024] A computer-readable storage medium of the present invention stores a computer program, which implements the data testing method provided by the present invention when executed by a processor.

[0025] According to the technical solution of the present invention, one embodiment of the above invention has the following advantages or beneficial effects:

[0026] First, the data table to be tested can be divided into multiple field sets (i.e., column dimensionality reduction test) or record sets (i.e., row dimensionality reduction test) according to the correlation between fields or records and tested separately. Since the test logic of the same field set or record set is the same or similar, the above dimensionality reduction test can improve the test efficiency and test accuracy.

[0027] Secondly, when performing column dimensionality reduction tests, further row dimensionality reduction tests can be performed on each data row of a certain field set (i.e., the data of the field set is divided into multiple data row sets and tested separately); when performing row dimensionality reduction tests, further column dimensionality reduction tests can be performed on a certain record set (i.e., each field of the record set is divided and tested separately), thereby further optimizing the test process and improving the test accuracy.

[0028] Third, when any field set or record set passes the test, the fields or records that are no longer used can be removed, thereby reducing the amount of data and improving the data processing speed.

[0029] Fourth, in the process of testing any field set or record set, the tester can directly obtain the expected result data set (that is, the expected result in the test case) from the data source or process the original data in the data source according to the business logic to obtain the expected result data set. The expected result data set can be used to verify the field set or record set to be tested, thereby realizing data testing based on business logic and solving various problems caused by the existing testing methods that rely entirely on test scripts.

[0030] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0032] Figure 1 is a schematic diagram of the main steps of the data testing method according to an embodiment of the present invention;

[0033] Figure 2 is a schematic diagram of field set dependency in the first embodiment of the present invention;

[0034] Figure 3 is a schematic diagram of components of a data testing device according to an embodiment of the present invention;

[0035] Figure 4 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;

[0036] Figure 5 It is a schematic diagram of the structure of an electronic device used to implement the data testing method in the embodiment of the present invention. DETAILED DESCRIPTION

[0037] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0038] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.

[0039] Figure 1 Schematic diagram of main steps of a data testing method according to an embodiment of the present invention.

[0040] like Figure 1 As shown, the data testing method of the embodiment of the present invention can be specifically performed according to the following steps:

[0041] Step S101: Divide the data table to be tested into multiple field sets; for any field set: if the field set does not depend on other field sets or the dependent field sets have passed the test, obtain the expected result data set corresponding to the any field set from the data source, and when it is determined that the expected result data set is equal to the data set formed by the any field set, determine the any field set as having passed the test.

[0042] In practical applications, the data testing method of the embodiment of the present invention can be applied to the test tasks in the distributed data processing framework Spark (i.e., Apache Spark, which is a big data processing framework built around speed, ease of use, and complex analysis), and the data table to be tested can be a result data table composed of data of the business required dimensions extracted from the data source, and its data type can be the DataFrame in Spark (a data structure under the Spark platform). It is understandable that the above content does not limit the application scenario of the present invention and the data type of the data table to be tested. In fact, the data testing method of the present invention can be applied in various applicable computing frameworks or databases, and the data table to be tested can also be various tabular data objects.

[0043] In view of the defects of the prior art test method that completely relies on the test script, step S101 uses the column dimension reduction method to divide the data table to be tested into multiple field sets for separate testing. Specifically, step S101 can specifically perform the following steps:

[0044] 1. Divide the data table to be tested into multiple field sets according to business needs. Each field set includes at least one field of the data table to be tested. In practical applications, the above division can be performed based on the correlation between fields: fields with strong correlation are divided into one field set, and fields with weak correlation or irrelevant fields are divided into different field sets. For example, the product ID, product name, and product price fields corresponding to the same data source can be divided into one field set, and the warehouse ID and warehouse address corresponding to another data source can be divided into another field set. It can be understood that after the above division, similar or identical test logic can be implemented within the same field set to improve test efficiency.

[0045] 2. Determine the target field set in the data table to be tested that does not depend on the remaining field sets. It can be understood that for a field in the data table to be tested, if the correctness of the data in the field is determined by the data in another field, the field is said to be dependent on the other field. For example: for the three fields of unit price, quantity, and total price in the data table to be tested, the test of the total price field needs to be performed after the unit price field and the quantity field have been tested (obviously, it is meaningless to test the total price field when the unit price field or the quantity field has not been tested or the test has not passed), then the total price field is said to be dependent on the unit price field and the quantity field. For a field set, if any field in a field set depends on any field in another field set, then the field set is said to be dependent on the other field set. In addition, the remaining field sets mentioned above refer to any data set other than the target data set in the data table to be tested.

[0046] 3. Test the target field set. Specifically, first obtain the expected result data set corresponding to the target field set from the data source. The expected result data set refers to a data set consisting of the expected result data in the test case, and its data type can be DataFrame.

[0047] In specific applications, when generating a data table to be tested, if the data of a field in the target field set is directly copied from the data source, the corresponding expected result data set can be directly obtained from the data source. For example, the following select statement can be used to directly obtain the expected result data set: df2 = select distinct xxx from products, where df2 represents the expected result data set, distinct represents deduplication, xxx is the field of the data source corresponding to the xx field in the target field set, and products is the name of the data source.

[0048] When generating the data table to be tested, if the data of a field in the target field set is obtained by processing the original data in the data source, the corresponding expected result data set can be generated by processing the original data using the preset logic. For example, the following select statement can be used to obtain the expected result data set through data processing: df2 = select distinct udf (xxx) from products, where udf is a custom function as the preset logic.

[0049] After obtaining the expected result data set of the target field set, determine whether the data set formed by the target field set is equal to the expected result data set. When the judgment result is equal, the target field set is determined to have passed the test. In practical applications, the data set formed by the target field set can be extracted from the data table to be tested using the following select statement: df1 = select distinct xx from result, where df1 is the data set formed by the target field set, and result is the name of the data table to be tested. When making the above judgment, the difference set between the expected result data set and the data set formed by the target field set and the difference set between the data set formed by the target field set and the expected result data set can be calculated first. When both difference sets are empty sets, the data set formed by the target field set and the expected result data set can be determined to be equal. Exemplarily, the subtract operator can be used to calculate the difference set.

[0050] In the embodiment of the present invention, after the target field set passes the test, if there is a field that the untested field set depends on, the field is retained and the remaining fields in the target field set are removed; if each field in the target field set is not dependent on the untested field set, the target field set is removed. Through the above settings, the amount of data in the data table to be tested can be reduced and the data processing speed can be improved.

[0051] 4. Test each field set whose dependent field sets have passed the test. Specifically, for each untested field set, the test can be performed after listening to the field set on which it depends passed the test. After passing the test, the fields that are not dependent on the untested field set can be removed.

[0052] In particular, in an embodiment of the present invention, a further row dimension reduction test can be performed on a field set to be tested according to business needs. Specifically, first, the data rows can be divided into multiple data row sets according to the data labels pre-set for each data row in the field set, and each data row set includes at least one data row in the field set. After that, each data row set is tested separately. The testing process is similar to the testing process of the field set, that is, the expected result data set corresponding to the data row set is obtained, and it is determined whether the data set formed by the data row set is equal to the expected result data set, so as to obtain the test result. When all the data row sets of the field set pass the test, the field set can be determined to pass the test.

[0053] Through the above settings, each field set in the data table to be tested can be tested, thereby realizing data testing based on column dimension reduction. It can be seen that compared with the prior art, the above method can simplify the testing process and improve the testing accuracy and efficiency. In addition, in the above method, the tester can directly obtain the expected result data set from the data source or process the original data in the data source according to the business logic to obtain the expected result data set. The expected result data set can be used to verify the field set or record set to be tested, thereby realizing data testing based on business logic and solving various problems caused by the existing testing methods that rely entirely on test scripts.

[0054] Step S102: Divide the data table to be tested into multiple record sets; obtain an expected result data set corresponding to any record set from a data source, and when it is determined that the expected result data set is equal to the data set formed by the record set, determine that the record set has passed the test.

[0055] Different from the column dimension reduction method described in step S101, the data testing method based on row dimension reduction will be described below. In the actual testing process, either step S101 or this step can be selected for execution.

[0056] In view of the defects of the prior art test method that completely relies on the test script, step S102 uses the row dimension reduction method to divide the data table to be tested into multiple record sets for separate testing. Specifically, step S102 can specifically perform the following steps:

[0057] 1. Divide the data table to be tested into multiple record sets according to business needs. Each record set includes at least one record of the data table to be tested. In practical applications, the above division can be performed based on the correlation between records: fields with strong correlation are divided into one field set, and fields with weak correlation or irrelevant fields are divided into different field sets. For example: if the records in the data table to be tested have three sources, the data table to be tested can be divided into three record sets according to the different sources. It can be understood that after the above division, similar or identical test logic can be implemented within the same record set to improve test efficiency.

[0058] 2. Test each record set in the data table to be tested separately. Since there is no dependency between different record sets, each record set can be tested in parallel. Specifically, the expected result data set corresponding to the record set can be first obtained from the data source. Similarly, the expected result data set can be directly obtained from the data source or generated by processing the original data using preset logic. Then, it is determined whether the data set formed by the record set is equal to the expected result data set. When the judgment result is equal, the record set is determined to have passed the test. Similarly, when making the above judgment, the difference set between the expected result data set and the data set formed by the record set and the difference set between the data set formed by the record set and the expected result data set can be calculated first, and when both difference sets are empty sets, the data set formed by the record set and the expected result data set are determined to be equal.

[0059] In the embodiment of the present invention, after a record set passes the test, it can be removed from the to-be-tested data table to reduce the amount of data and improve the data processing speed.

[0060] In specific applications, a further column dimension reduction test can be performed on a certain record set to be tested according to business needs. Specifically, the fields in the record set are first divided into multiple field sets, each field set includes at least one field in the record set. After that, each field set is tested separately. The testing process is similar to the testing process of the field set, that is, the expected result data set corresponding to the field set is obtained, and it is determined whether the data set formed by the field set is equal to the expected result data set, so as to obtain the test result. When all the field sets of the record set pass the test, the record set can be determined to have passed the test.

[0061] Through the above settings, each record set in the test data table can be tested, thereby realizing data testing based on row dimension reduction. It can be seen that compared with the existing technology, the above method can simplify the testing process and improve the testing accuracy and efficiency.

[0062] The following introduces a data testing method based on column dimension reduction in the first embodiment of the present invention. The following table is a table of analysis results of slow-moving goods data as a data table to be tested in this embodiment.

[0063]

[0064] Among them, the data source of the product ID field and the product name field is the product details table; the data source of the warehouse ID field and the warehouse address field is the product warehouse and distribution center table; the data source of the 7-day sales field and the 14-day sales field is the sales table, and the data of the two fields is obtained by summing the sales data in the sales table; the data source of the inventory status field is the inventory table, and the value of each record in this field can be five data rows with data labels of spot, in transit, locked, damaged, and expiring; the sales identification field stores the identification of the predicted future sales of the product, such as the national serious unsalable identification, the national ordinary unsalable identification, the single warehouse unsalable identification, the dynamic sales (i.e. best-selling) identification, etc. The data of this field can be determined by the 7-day sales field and the 14-day sales field according to the preset algorithm; the return quantity corresponding to each product in the return quantity field is the sum of the following two parts: one is the sum of the damaged and expiring quantities of the product, and the other is the return quantity determined according to the "spot quantity + in transit quantity - locked quantity" of the product and the sales identification of the product.

[0065] When applying the column dimension reduction method for testing, you can first divide the product ID field and product name field into field set 1 according to business needs, divide the warehouse ID field and warehouse address field into field set 2, divide the 7-day sales field and 14-day sales field into field set 3, divide the inventory status field into field set 4, divide the sales identification field into field set 5, and divide the return quantity field into field set 6, forming the following data table composed of field sets:

[0066]

[0067] In the above data table, the dependencies of each field set are as follows Figure 2 As shown. Figure 2 It can be seen that field set 2 depends on field set 1, field set 3 depends on field sets 1 and 2, field set 4 depends on field sets 1 and 2, field set 5 depends on field set 3, and field set 6 depends on field sets 4 and 5. In terms of specific fields, field set 2 depends on the product ID in field set 1, field sets 3 and 4 both depend on the product ID in field set 1 and the warehouse ID in field set 2, and field set 5 depends on the 7-day sales field and the 14-day sales field in field set 3.

[0068] After that, you can test each field set separately. First, you can test field set 1, which does not depend on any field set. Specifically, you can directly obtain the expected result data set of field set 1 from the data source and compare it with it to achieve the test. After the field set 1 test passes, you can keep the product ID field that will be used later, and remove the remaining fields in field set 1 to get the following data table:

[0069]

[0070] Next, test field set 2 in a similar way. After the test passes, keep the warehouse ID and remove the remaining fields to get the following data table:

[0071]

[0072] After that, field set 3 can be tested. Specifically, the corresponding sales data in daily units is obtained from the data source, and the sales data of the past 7 days and the sales data of the past 14 days are calculated according to the preset business logic. The expected result data set is generated according to the calculation results for comparison with the data set formed by field set 3. After the test passes, since field set 5, which is not tested, depends on two fields of field set 3, the two fields of field set 3 are retained.

[0073] Next, field set 4 can be tested. Specifically, the data rows with data labels as spot, in transit, and locked can be divided into one data row set, and the data rows with data labels as defective and expiring can be divided into another data row set, and these two data row sets can be tested in parallel. After the test passes, the product ID field and warehouse ID field that will not be used later can be removed. Finally, use a similar method to test field sets 5 and 6 in turn, so as to achieve a complete test of the data table to be tested. It can be understood that, unlike the above example, the data table to be tested in actual applications often has hundreds or even thousands of fields. The use of the above test method can greatly improve the test efficiency and test accuracy.

[0074] In the technical solution of the embodiment of the present invention, the data table to be tested can be divided into multiple field sets or record sets according to business needs and tested separately (within the same field set or record set, the correlation between fields or records is stronger; for different field sets or record sets, the correlation between fields or records is weaker), thereby reducing the difficulty of big data testing and pointing out the direction for testing division of labor.

[0075] Figure 3 It is a schematic diagram of components of a data testing device in an embodiment of the present invention.

[0076] like Figure 3 As shown, the data testing device 300 of the embodiment of the present invention may include a column dimension reduction unit 301 or a row dimension reduction unit 302. Wherein:

[0077] The column dimension reduction unit 301 can be used to divide the data table to be tested into multiple field sets; wherein each field set includes at least one field of the data table to be tested; for any field set: if the field set does not depend on the other field sets or the dependent field sets have passed the test, then the expected result data set corresponding to the any field set is obtained from the data source, and when it is determined that the expected result data set is equal to the data set formed by the any field set, the any field set is determined to have passed the test.

[0078] The row dimension reduction unit 302 can be used to divide the data table to be tested into multiple record sets; wherein each record set includes at least one record of the data table to be tested; obtain the expected result data set corresponding to any record set from the data source, and when it is determined that the expected result data set is equal to the data set formed by the record set, the record set is determined to have passed the test.

[0079] In an embodiment of the present invention, the device 300 may further include a field removal unit, which is used to, after determining that any field set has passed the test: if it is determined that there are fields in the field set that the untested field set depends on, retain the field and remove the remaining fields in the any field set; if it is determined that there are no fields in the any field set that the untested field set depends on, remove the any field set.

[0080] As a preferred solution, the device 300 may further include a subsequent dimensionality reduction unit, which is used for: for a field set that does not depend on other field sets or the dependent field set has passed the test: dividing the data of the field set into multiple data row sets according to pre-set data labels, and testing each data row set separately; when all the data row sets pass the test, determining the field set as passing the test.

[0081] Preferably, the column dimension reduction unit 301 or the row dimension reduction unit 302 can be further used to: directly obtain the expected result data set from the data source; or, obtain the original data corresponding to the field set or record set to be tested from the data source, and use preset logic to process the original data to generate the expected result data set.

[0082] In an optional implementation, the column dimensionality reduction unit 301 or the row dimensionality reduction unit 302 may be further used to: obtain the difference between the expected result data set and the formed data set, and the difference between the formed data set and the expected result data set; when both difference sets are empty sets, determine the expected result data set and the formed data set to be equal.

[0083] In addition, in the embodiment of the present invention, the to-be-tested data table and the expected result data set are both DataFrame objects in the distributed data processing framework Spark.

[0084] In the technical solution of the embodiment of the present invention, the data table to be tested can be divided into multiple field sets or record sets according to business needs and tested separately, thereby reducing the difficulty of big data testing and providing a direction for test division of labor.

[0085] Figure 4 An exemplary system architecture 400 is shown to which the data testing method or data testing apparatus according to the embodiment of the present invention can be applied.

[0086] like Figure 4 As shown, the system architecture 400 may include terminal devices 401, 402, 403, a network 404 and a server 405 (this architecture is only an example, and the components included in the specific architecture may be adjusted according to the specific application). The network 404 is used to provide a medium for a communication link between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0087] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as data testing applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0088] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0089] The server 405 may be a server that provides various services, such as a data testing server (only an example) that provides support for data testing applications operated by users using the terminal devices 401, 402, and 403. The data testing server may process the received test request and feed back the processing result (such as the test result - only an example) to the terminal device.

[0090] It should be noted that the data testing method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the data testing device is generally disposed in the server 405 .

[0091] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0092] The present invention also provides an electronic device. The electronic device of an embodiment of the present invention comprises: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the data testing method provided by the present invention.

[0093] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of an electronic device suitable for implementing an embodiment of the present invention. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0094] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the computer system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0095] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed so that a computer program read therefrom is installed into the storage section 508 as needed.

[0096] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, the embodiments of the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the main step diagram. In the above embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit 501, the above functions defined in the system of the present invention are executed.

[0097] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0098] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0099] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be arranged in a processor, for example, may be described as: a processor includes a column dimension reduction unit or a row dimension reduction unit. The names of these units do not constitute a limitation on the units themselves in certain cases, for example, a column dimension reduction unit may also be described as a "unit for dividing the data columns of the data table to be tested and testing them separately".

[0100] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the device, the steps executed by the device include: dividing the data table to be tested into multiple field sets; wherein each field set includes at least one field of the data table to be tested; for any field set: if the field set does not depend on the other field sets or the dependent field sets have passed the test, then obtaining the expected result data set corresponding to the any field set from the data source, and when it is determined that the expected result data set is equal to the data set formed by the any field set, the any field set is determined to pass the test; or, dividing the data table to be tested into multiple record sets; wherein each record set includes at least one record of the data table to be tested; obtaining the expected result data set corresponding to any record set from the data source, and when it is determined that the expected result data set is equal to the data set formed by the record set, the record set is determined to pass the test.

[0101] In the technical solution of the embodiment of the present invention, the data table to be tested can be divided into multiple field sets or record sets according to business needs and tested separately, thereby reducing the difficulty of big data testing and providing a direction for test division of labor.

[0102] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data testing method, characterized in that: include: Divide the data table to be tested into multiple field sets according to the correlation between the included fields; wherein each field set includes at least one field of the data table to be tested; for any field set: if the field set does not depend on the other field sets or the dependent field sets have passed the test, obtain the expected result data set corresponding to the any field set from the data source, and when it is determined that the expected result data set is equal to the data set formed by the any field set, determine the any field set as having passed the test; for a field set that does not depend on the other field sets or the dependent field sets have passed the test: divide the data of the field set into multiple data row sets according to pre-set data tags, and test each data row set respectively; when all the data row sets pass the test, determine the field set as having passed the test; or, The data table to be tested is divided into multiple record sets according to the correlation between the records contained therein; wherein each record set includes at least one record of the data table to be tested; an expected result data set corresponding to any record set is obtained from a data source, and when it is determined that the expected result data set is equal to the data set formed by the record set, the record set is determined to have passed the test; the determination that the expected result data set is equal to the data set formed by the record set includes: obtaining a difference set between the expected result data set and the formed data set, and a difference set between the formed data set and the expected result data set; when both difference sets are empty sets, the expected result data set is determined to be equal to the formed data set.

2. The method according to claim 1, characterized in that The method further comprises: After any field set is determined to have passed the test: if there is a field in the field set that the untested field set depends on, the field is retained and the remaining fields in the any field set are removed; if there is no field in the any field set that the untested field set depends on, the any field set is removed.

3. The method according to claim 1, characterized in that Obtaining the expected result data set from the data source includes: Get the expected result data set directly from the data source; or, The original data corresponding to the field set or record set to be tested is obtained from the data source, and the original data is processed using preset logic to generate the expected result data set.

4. The method according to claim 1, characterized in that: The determining that the expected result data set is equal to the data set formed by any one of the field sets includes: Obtaining a difference between the expected result data set and the formed data set, and a difference between the formed data set and the expected result data set; When both difference sets are empty sets, the expected result data set and the formed data set are determined to be equal.

5. The method according to any one of claims 1 to 4, characterized in that: The data table to be tested and the expected result data set are both DataFrame objects in the distributed data processing framework Spark.

6. A data testing device, characterized in that: include: A column dimension reduction unit is used to divide the data table to be tested into multiple field sets according to the correlation between the included fields; wherein each field set includes at least one field of the data table to be tested; for any field set: if the field set does not depend on the other field sets or the dependent field sets have passed the test, then obtain the expected result data set corresponding to the any field set from the data source, and when it is determined that the expected result data set is equal to the data set formed by the any field set, determine the any field set as having passed the test; The subsequent dimension reduction unit is used for a field set that is not dependent on other field sets or a dependent field set that has passed the test: dividing the data of the field set into multiple data row sets according to a preset data label, and testing each data row set respectively; when all the data row sets pass the test, the field set is determined to pass the test; or, A row dimension reduction unit is used to divide the data table to be tested into multiple record sets according to the correlation between the records contained therein; wherein each record set includes at least one record of the data table to be tested; obtain an expected result data set corresponding to any record set from a data source, and when it is determined that the expected result data set is equal to the data set formed by the record set, determine that the record set has passed the test; The row dimension reduction unit is also used to: obtain the difference between the expected result data set and the formed data set, and the difference between the formed data set and the expected result data set; when both difference sets are empty sets, determine that the expected result data set and the formed data set are equal.

7. The device according to claim 6, characterized in that The device further comprises: The field removal unit is used for, after any field set is determined to have passed the test: if it is determined that there is a field in the field set that the untested field set depends on, then the field is retained and the remaining fields in the any field set are removed; if it is determined that there is no field in the field set that the untested field set depends on, then the any field set is removed.

8. The device according to claim 6, characterized in that The column dimension reduction unit or the row dimension reduction unit is further used to: Directly obtain the expected result data set from the data source; or, obtain the original data corresponding to the field set or record set to be tested from the data source, and use the preset logic to process the original data to generate the expected result data set.

9. The device according to claim 6, characterized in that The column dimension reduction unit is further used to: A difference set between the expected result data set and the formed data set, and a difference set between the formed data set and the expected result data set are obtained; when both difference sets are empty sets, the expected result data set and the formed data set are determined to be equal.

10. The device according to any one of claims 6 to 9, characterized in that: The data table to be tested and the expected result data set are both DataFrame objects in the distributed data processing framework Spark.

11. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.