Data verification method and storage medium
By designing an automated data verification method, using execution trees and multiple comparators to work together, the problem of inefficient data verification caused by manual inspection is solved, and an efficient data verification process is realized.
Patent Information
- Application Number
- CN202411656902.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, data verification is relatively inefficient due to the use of manual inspection and comparison of data.
By designing a data verification method, using the entrance of the execution tree to obtain data and input it into the data comparator, an automated data verification process, including the coordinated work of database collectors, log collectors, basic comparators and complex comparators.
An automated data verification process is realized, reducing manual intervention and improving the efficiency of data verification.
Smart Images

Figure CN119782291A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data verification method and a storage medium. Background Art
[0002] In the field of data processing and analysis, data validation is a crucial link, which is directly related to the quality and accuracy of data. With the advent of the big data era, data sources have become diversified, including but not limited to databases, log files, API interfaces, sensor data, etc. These data are not only large in volume, but also in different formats, covering structured data (such as SQL databases), semi-structured data (such as JSON, XML) and unstructured data (such as text, images). Therefore, ensuring the accuracy and consistency of this data has become a complex and critical task.
[0003] At present, data validation mainly relies on traditional manual inspection. Manual inspection usually includes data comparison, rule verification and format verification. For example, using known correct data as a reference to compare the accuracy of new data one by one. Rule verification can include verifying the integrity of data, such as checking whether there are missing values or null values in the data, and verifying data consistency, such as ensuring the consistency of data between different fields and records, and even verifying the data range: checking whether the data is within a reasonable range, such as whether the date is reasonable, whether the value exceeds the expected range, and format verification is mainly to ensure that the data conforms to the expected format, such as date format, number format, etc.
[0004] Although manual inspection can meet the needs of data verification to a certain extent, the efficiency of data verification is relatively low because it requires manual inspection and comparison of data one by one. Summary of the invention
[0005] The embodiments of the present application provide a data verification method and a storage medium, which are intended to solve the problem of low efficiency of data verification caused by manual inspection and comparison of data.
[0006] In a first aspect, an embodiment of the present application provides a data verification method, wherein the data verification system includes: a database collector, a log collector, a basic comparator, a data comparator, and a controller, wherein the database collector, the log collector, the basic comparator, and the data comparator have execution nodes with a unified interface, and the execution nodes form an execution tree with a tree structure, and the controller is used to implement the following method;
[0007] Methods include:
[0008] The first data and the second data are respectively obtained by using the entry of the execution tree and input into the data comparator, wherein the first data is the predetermined order information of the target order or the response message of the formal environment; the second data is the order parameter provided to the supplier or the response message of the test environment;
[0009] Inputting the first data output by the data comparator and the second data into the basic comparator for comparison, and obtaining a comparison result output by the basic comparator;
[0010] The comparison result is input into the data comparator to obtain the verification result output by the data comparator.
[0011] A further technical solution is that when the first data is the scheduled order information of the target order and the second data is the order parameter provided to the supplier, the first data and the second data are respectively obtained by using the entry of the execution tree and input into the data comparator, including:
[0012] Obtaining scheduled order information of a target order from a database collector using an entry of the execution tree;
[0013] Based on the scheduled order information of the target order, the order parameters provided to the supplier are obtained from the log collector and input into the data comparator.
[0014] A further technical solution is that when the first data is a response message of the formal environment and the second data is a response message of the test environment, the first data and the second data are respectively obtained by using the entry of the execution tree and input into the data comparator, including:
[0015] Obtain the price verification request log of the formal environment from the log collector. The price verification request log contains the request message and the response message.
[0016] Use the test environment to send a request message again and get a response message from the test environment;
[0017] Parse the response message of the formal environment and the response message of the test environment into corresponding first field set objects and second field set objects respectively;
[0018] The first field collection object and the second field collection object are input into the data comparator.
[0019] A further technical solution is that the data verification system further includes a complex comparator, wherein the complex comparator has an execution node with a unified interface;
[0020] Before inputting the first data output by the data comparator and the second data into the base comparator for comparison, the method further includes:
[0021] inputting the first data and the second data outputted by the data comparator into the complex comparator;
[0022] Using the complex comparator, the first data and the second data are input into the basic comparator for comparison, and a comparison result output by the basic comparator is obtained;
[0023] The comparison result is input into the data comparator to obtain the verification result output by the data comparator, including:
[0024] Inputting the comparison result into the complex comparator to obtain a comparison result set output by the complex comparator;
[0025] The comparison result set is input into the data comparator to obtain the verification result output by the data comparator.
[0026] A further technical solution is that the reservation order information of the target order includes the order time, check-in time, and number of people staying in the target order; based on the reservation order information, the second data of the target order is obtained from the log collector and input into the data comparator, including:
[0027] Get the order time error range of the target order;
[0028] Based on the order number of the target order and the order time error range, search for the corresponding request log from the log collector;
[0029] Based on the found corresponding request log, the second data is obtained.
[0030] A further technical solution is that the data verification system further includes a universal parser, wherein the universal parser has an execution node with a unified interface;
[0031] The second data of the target order is obtained from the log collector and input into the data comparator, including:
[0032] Input the second data of the target order obtained from the log collector into the universal parser for parsing to obtain the parsed second data;
[0033] The parsed second data is input into the data comparator.
[0034] A further technical solution is that the first data and the parsed second data both include a first field, a second field and a third field; the basic comparator includes an equality comparator, a similarity comparator and a regular comparator;
[0035] Inputting the first data output by the data comparator and the second data into the basic comparator for comparison, and obtaining a comparison result output by the basic comparator, including:
[0036] Input the first field into the equality comparator for comparison, and obtain a first comparison result output by the equality comparator;
[0037] Inputting the second field into the similarity comparator for comparison, and obtaining a second comparison result output by the similarity comparator;
[0038] The third field is input into the regular comparator for comparison, and a third comparison result output by the regular comparator is obtained.
[0039] A further technical solution is to input the comparison result into a data comparator to obtain a verification result output by the data comparator, including:
[0040] If the comparison result meets the first preset requirement, the verification result output by the data comparator is passed;
[0041] If the comparison result does not meet the first preset requirement, the verification result output by the data comparator is failure;
[0042] If the comparison result meets the second preset requirement, the verification result output by the data comparator is completed.
[0043] A further technical solution is that the data verification system further includes a report output device, wherein the report output device has an execution node with a unified interface;
[0044] After the verification result output by the data comparator is failed, the method further includes:
[0045] Use the report exporter to send Lark reports.
[0046] In a second aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, and the computer program can implement the above method when executed by a processor.
[0047] The embodiment of the present application provides a data verification method and storage medium. The method includes: using the entry of the execution tree to obtain the first data and the second data respectively and input them into the data comparator, wherein the first data is the predetermined order information of the target order or the response message of the formal environment; the second data is the order parameter provided to the supplier or the response message of the test environment; the first data and the second data output by the data comparator are input into the basic comparator for comparison, and the comparison result output by the basic comparator is obtained; the comparison result is input into the data comparator to obtain the verification result output by the data comparator. In the embodiment of the present application, the database collector, the log collector, the basic comparator, the data comparator and the controller, the database collector, the log collector, the basic comparator and the data comparator are set as execution nodes with a unified interface, so that the execution nodes form an execution tree with a tree structure, and then the entry of the execution tree can be used to automatically perform data verification according to the preset process, and automatically coordinate the execution order of each execution node, to ensure the smooth progress of the verification process, reduce manual intervention, and improve the efficiency of data verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0049] 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0050] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0051] Figure 1 A flowchart of a data verification method provided in an embodiment of the present application.
[0052] Figure 2 A flowchart of an order reservation parameter verification scenario provided in an embodiment of the present application.
[0053] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0055] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0056] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0057] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0058] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0059] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0060] In order to solve the technical problem in the prior art that the efficiency of data verification is relatively low due to the use of manual inspection and comparison of data, the present application provides a data verification method that can improve the efficiency of data verification.
[0061] See also Figure 1 , Figure 1 The flowchart of the data verification method provided in the embodiment of the present application is as follows. The data verification system includes: a database collector, a log collector, a basic comparator, a data comparator and a controller. The database collector, the log collector, the basic comparator and the data comparator have execution nodes with a unified interface. The execution nodes form an execution tree with a tree structure. The controller is used to implement the following method steps. The first embodiment may specifically include the following steps:
[0062] Step 110: Utilize the entry of the execution tree to obtain the first data and the second data respectively and input them into the data comparator.
[0063] Among them, the first data is the scheduled order information of the target order or the response message of the formal environment; the second data is the order parameters provided to the supplier or the response message of the test environment.
[0064] Step 120: input the first data output by the data comparator and the second data into the basic comparator for comparison, and obtain a comparison result output by the basic comparator.
[0065] Step 130: Input the comparison result into the data comparator to obtain the verification result output by the data comparator.
[0066] The verification result may be passed, failed, partially passed, etc.
[0067] This embodiment configures the database collector, log collector, basic comparator, data comparator and controller as execution nodes with a unified interface, so that the execution nodes form an execution tree with a tree structure. The entry of the execution tree can then be used to automatically perform data verification according to a preset process, and automatically coordinate the execution order of each execution node to ensure the smooth progress of the verification process, reduce manual intervention, and improve the efficiency of data verification.
[0068] In some embodiments, when the first data is a response message of the formal environment and the second data is a response message of the test environment, step 110 uses the entry of the execution tree to obtain the first data and the second data respectively and inputs them into the data comparator, including:
[0069] Step 111: Obtain the price verification request log of the formal environment from the log collector. The price verification request log includes a request message and a response message.
[0070] Step 112: Use the test environment to send a request message again to obtain a response message from the test environment.
[0071] Step 113: Parse the response message of the formal environment and the response message of the test environment into corresponding first field set objects and second field set objects respectively.
[0072] Step 114: Input the first field set object and the second field set object into the data comparator.
[0073] In this way, after parsing the response message of the formal environment and the response message of the test environment into the corresponding first field set object and second field set object respectively, the response object of the formal environment and the response object of the test environment are compared. If the comparison fails, it can be determined that there is an erroneous code in the test environment, thereby reducing the workload of the test.
[0074] Among them, the response message of the formal environment and the response message of the test environment can be parsed into memory objects by a general parser (such as an XML parser, a JSON parser, a CSV parser, etc.).
[0075] In some embodiments, when the first data is the scheduled order information of the target order and the second data is the order parameters provided to the supplier, step 110 uses the entry of the execution tree to obtain the first data and the second data respectively and inputs them into the data comparator, including:
[0076] Step 101: Obtain the scheduled order information of the target order from the database collector using the entry of the execution tree.
[0077] Step 102: Based on the scheduled order information of the target order, the order parameters provided to the supplier are obtained from the log collector and input into the data comparator.
[0078] In this way, by comparing the scheduled order information of the target order stored in the database collector with the order parameters provided to the supplier, the accuracy of the parameters can be verified in advance to avoid losses caused by transmitting incorrect parameters.
[0079] In some embodiments, the scheduled order information of the target order includes order time, check-in time, and number of check-ins; step 102, based on the scheduled order information, obtains second data of the target order from the log collector and inputs it into the data comparator, including:
[0080] Step 1021: Obtain the order time error range of the target order.
[0081] Among them, the order time error range can be 10 minutes, 11 minutes, 12 minutes before and after the order time, etc.
[0082] Since there is a delay in program execution (for example, the order time may be 10:58:50, while the log record time is 10:59:20), and log retrieval is relatively fast, therefore, increasing the error before and after the order time can ensure that the corresponding request log is found.
[0083] In addition, while ensuring that the corresponding request log is found, in order to shorten the log retrieval time, the order time error range in the embodiment adopted by the present application is preferably within 10 minutes before and after the order time.
[0084] Step 1022: Based on the order number of the target order and the order time error range, search for the corresponding request log from the log collector.
[0085] Step 1023: Obtain second data based on the corresponding request log found.
[0086] In some embodiments, the data verification system further includes a complex comparator, and the complex comparator, the database collector, the log collector, the basic comparator, and the data comparator have execution nodes with a unified interface, and the execution nodes form an execution tree with a tree structure. For details, refer to the second embodiment, which may include the following steps:
[0087] Step 210: Use the entry of the execution tree to obtain the first data and the second data respectively and input them into the data comparator.
[0088] Step 220: Use the complex comparator to input the first data and the second data into the basic comparator for comparison, and obtain a comparison result output by the basic comparator.
[0089] The complex comparator may be an object comparator or an array comparator.
[0090] The object comparator is mainly used to compare all the properties and nested properties of two objects to ensure that all parts of the objects are consistent. It is suitable for scenarios such as data synchronization, configuration file verification, and API response verification.
[0091] The array comparator is mainly used to compare the contents of two arrays, supporting element-by-element comparison, comparison after sorting, comparison ignoring order, etc. It is suitable for scenarios such as log analysis, data migration, and batch verification.
[0092] By setting complex comparators, complex data structures can be effectively processed and verified to ensure data consistency and accuracy.
[0093] Step 230: Input the comparison result into the complex comparator to obtain a comparison result set output by the complex comparator.
[0094] For example, the comparison results include the comparison results of the number of occupants field, the comparison results of the occupants' names field and the comparison results of the serial number field. If the complex comparator is an object comparator, the object comparator will integrate the comparison results of the number of occupants field, the comparison results of the occupants' names field and the comparison results of the serial number field and send them to the data comparator.
[0095] Step 240: Input the comparison result set into the data comparator to obtain the verification result output by the data comparator.
[0096] In some embodiments, the data verification system further includes a universal parser. Referring to the third embodiment, the third embodiment may include the following steps:
[0097] Step 310: Obtain the scheduled order information of the target order from the database collector using the entry of the execution tree.
[0098] Step 320: Based on the scheduled order information of the target order, obtain order parameters provided to the supplier from the log collector.
[0099] Step 330: input the second data of the target order obtained from the log collector into the universal parser for parsing to obtain the parsed second data.
[0100] Step 340: Input the parsed second data into the data comparator.
[0101] Step 350: input the first data output by the data comparator and the parsed second data into a basic comparator for comparison, and obtain a comparison result output by the basic comparator.
[0102] In some embodiments, the first data and the parsed second data both include a first field, a second field, and a third field; the basic comparator includes an equality comparator, a similarity comparator, and a regular comparator.
[0103] Step 350 is to input the first data and the second data output by the data comparator into the basic comparator for comparison, and obtain the comparison result output by the basic comparator, which may include the following steps:
[0104] Step 351: Input the first field into the equality comparator for comparison, and obtain a first comparison result output by the equality comparator.
[0105] The equality comparator is used for precise comparison. The first field can be the number of days of stay, the number of guests, etc. The number of guests must be consistent with the number of guests provided to the supplier.
[0106] Step 352: Input the second field into the similarity comparator for comparison, and obtain a second comparison result output by the similarity comparator.
[0107] The second field can be a person's name, company name, address, etc., to prevent order errors caused by incorrect names, company names, addresses, etc.
[0108] In some implementations, the similarity comparator may use the following similarity comparison algorithm to calculate the similarity:
[0109] Levenshtein distance (edit distance): It is mainly the number of minimum single-character edits (insertions, deletions, or substitutions) required to transform one string into another.
[0110] Jaccard similarity: It mainly measures the similarity by calculating the ratio of the size of the intersection of two sets to the size of the union.
[0111] Cosine similarity: It mainly calculates the angle between two vectors and is often used for text similarity comparison.
[0112] Jaro-Winkeler distance: a string edit distance, mainly suitable for short strings such as names.
[0113] Hamming distance: It mainly calculates the number of different characters in the same position of two strings of equal length.
[0114] SS Rensen–Dice coefficient: a set similarity measure, mainly applicable to Boolean and binary data.
[0115] Step 353: Input the third field into the regular comparator for comparison, and obtain a third comparison result output by the regular comparator.
[0116] Among them, the regular comparator can verify a string field, for example, it must start with D IDA, must meet the year-month-day format, or the string must be any one of AA, BB, CC, etc.
[0117] In addition, the first data and the parsed second data may further include a fourth field, and the basic comparator may further include a size comparator.
[0118] Among them, the fourth field can be a numerical field.
[0119] The size comparator is used for inexact judgments, such as the date is before a certain date, the age is greater than 18, etc.
[0120] Step 360: Input the comparison result into the data comparator to obtain the verification result output by the data comparator.
[0121] Since fields can include multiple types such as key fields and fuzzy matching fields, by setting basic comparators including size comparator, equality comparator, regular comparator, similarity comparator, etc., the corresponding field type can be processed using appropriate basic comparators. In this way, different types of data fields can be processed effectively, and multiple basic comparators can process different fields in parallel, further improving the efficiency of data verification.
[0122] Referring to the fourth embodiment, the fourth embodiment may include the following steps:
[0123] Step 410: Utilize the entry of the execution tree to obtain the first data and the second data respectively and input them into the data comparator.
[0124] Among them, the first data is the scheduled order information of the target order or the response message of the formal environment; the second data is the order parameters provided to the supplier or the response message of the test environment.
[0125] Step 420: Input the first data output by the data comparator and the second data into the basic comparator for comparison, and obtain a comparison result output by the basic comparator.
[0126] Step 430: Input the comparison result into the data comparator to obtain the verification result output by the data comparator.
[0127] Wherein, step 430 may include the following:
[0128] Step 431: If the comparison result meets the first preset requirement, the verification result output by the data comparator is passed.
[0129] Among them, the first preset requirement may be an accuracy threshold.
[0130] Among them, when the first field is a key field, the accuracy threshold is 100%. For example, the first field is the number of guests, and the comparison result is: number of guests--database: 1008, sent to supplier: 1008, then the accuracy of the comparison result is 100%, which meets the first preset requirement, and the verification result is passed.
[0131] When the first field is a fuzzy matching field, the accuracy threshold may be 60%, 65%, 70%, 75%, 80%, or 85%.
[0132] For example, the first field is the address field, and the comparison result is: user address--database: Room 408, Building A, No. 123, Jianguo Road, Chaoyang District, Beijing, sent to supplier: No. 123, Jianguo Road, Chaoyang District, Beijing, and the accuracy threshold is 66%. It can be considered that the comparison result of the address field meets the first preset requirement, and the verification result output by the data comparator is passed.
[0133] Step 432: If the comparison result does not meet the first preset requirement, the verification result output by the data comparator is failure.
[0134] Among them, when the first field is a key field, if there is a mismatch in the key field, the comparison result is that the first preset requirement is not met, and the verification result is not passed. For example, the first field is the number of guests, and the comparison result is: number of guests--database: 1008, sent to the supplier: 1018. Although 1008 is different from 1018 by only one 1, since the number of guests is a key field, the comparison result is that the first preset requirement is not met, and the verification result is not passed.
[0135] In some embodiments, the data verification system may further include a report exporter having an execution node with a unified interface.
[0136] After the data comparator outputs the verification result as failed, you can also use the report outputter to send a Feishu report.
[0137] Among them, the Feishu report content can be: xxxx / xx / xx / xx hour / xx minute / xx second, order number: xxxxxxxxx's check-in person / check-in time verification failed, please check.
[0138] Resident - Database: Chen, sent to supplier: Li;
[0139] Check-in time - database: 2024-11-05, sent to supplier: 2024-11-01.
[0140] In addition, it should be noted that the specific content of the Feishu report and the recipients of the report can be configured according to actual needs. For example, the recipients of the report can be team members, project managers, customers, or other relevant personnel, etc. This application does not limit this.
[0141] Step 433: If the comparison result meets the second preset requirement, the verification result output by the data comparator is completed.
[0142] The second preset requirement may be an accuracy threshold, and the accuracy threshold of the second preset requirement may be the same as or different from the accuracy threshold of the first preset requirement.
[0143] Among them, the verification result of completion means that the report output device will always be triggered to send Feishu reports to relevant personnel.
[0144] For example, when the accuracy of field comparison exceeds the accuracy threshold such as 60%, 65%, 70%, 75%, 80%, 85%, the comparison result will be sent to relevant personnel in the form of a Feishu report.
[0145] Or when the comparison result is the person staying in the room - database: Chen Moumou, sent to the supplier: Chen Moumou; check-in time - database: 2024-11-05, sent to the supplier: 2024-11-05, the first preset requirement is met, and the verification result output by the data comparator can be completed, and then the comparison result is sent to the relevant personnel in the form of a Feishu report.
[0146] Based on the above embodiments, the data verification system provided by the present application may include a database collector, a data comparator, a log collector, a general parser, a complex comparator, a basic comparator, a report outputter and a controller, wherein the database collector, the data comparator, the log collector, the general parser, the complex comparator, the basic comparator and the report outputter have execution nodes with a unified interface, the execution nodes form an execution tree with a tree structure, and the controller is used to implement the method steps of the embodiment.
[0147] The data verification method provided in this application can be applied to many scenarios, such as regression testing, key interface request message and response message verification, monitoring and early warning, etc. The order reservation parameter verification scenario and regression test verification scenario are used as examples for illustration.
[0148] 1. Verify the request parameters of key business in B2B business.
[0149] Since each supplier has a different order interface, the order parameters sent to the supplier may be inconsistent with the information stored in the system database. Therefore, it is necessary to obtain the first data from the database and the second data from the log for comparison to verify whether the order parameters sent to the supplier are consistent with the information stored in the system database.
[0150] For example, if it is necessary to verify the order information with order number 123 and the order parameters provided to the supplier, the parameter 123 can be used to accurately find the reservation order information with order number 123 from the table specified by the database collector. The order number 123 is the target order, and the reservation order information includes information such as the order time, check-in time, and number of guests; then the corresponding request log is searched from the log collector within the order number in the reservation order information and the error time before and after the order time (i.e., the order time error range), so that the first data to be compared (i.e., the reservation order information with order number 123) and the second data (i.e., the order parameters provided to the supplier) can be obtained. By comparing the first data to be compared (i.e., the reservation order information with order number 123) and the second data (i.e., the order parameters provided to the supplier), the verification result can be obtained.
[0151] Specifically, refer to the above embodiments and Figure 2 The data verification system includes a database collector 10, a data comparator 20, a log collector 30, a JSON parser 40, an object comparator 50, an equality comparator 60, a regular comparator 70, a similarity comparator 80, a report outputter 90 and a controller, wherein the database collector 10, the data comparator 20, the log collector 30, the JSON parser 40, the object comparator 50, the equality comparator 60, the regular comparator 70, the similarity comparator 80 and the report outputter 90 have execution nodes with a unified interface, and the execution nodes form an execution tree with a tree structure. The order reservation parameter verification scenario mainly includes the following processes:
[0152] 1) Obtain the first data, namely, the scheduled order information of the target order, from the database collector by using the execution tree entry, and send it to the data comparator.
[0153] The first data read from the database collector is field set type data, and therefore, no parsing is required.
[0154] 2) According to the order number of the target order and the order time error range, the corresponding request log is searched from the log collector, and based on the corresponding request log found, the second data, i.e., the order parameters provided to the supplier, i.e., the data to be compared, is obtained.
[0155] 3) The second data obtained from the corresponding request log, ie, the order parameters provided to the supplier, is input into a general parser (such as a JSON parser) for parsing to obtain a parsing result, and the parsing result is returned to the log collector.
[0156] Among them, the general parser is mainly related to the document format and is responsible for parsing the data document into memory objects.
[0157] Exemplarily, the general parser may be an XML parser, a JSON parser, a CSV parser, or the like.
[0158] 4) The log collector receives the parsing result output by the JSON parser, and returns the parsed second data to the data comparator.
[0159] The parsed second data includes multiple target fields, such as a first field, a second field, and a third field.
[0160] 5) The data comparator transmits the first data obtained from the database collector and the parsed second data returned by the data comparator to a complex comparator (such as an object comparator).
[0161] 6) A complex comparator (such as an object comparator) inputs the fields corresponding to the first data and the second data into a basic comparator for comparison.
[0162] The first data and the parsed second data both include a first field, a second field and a third field; the basic comparator includes an equality comparator, a similarity comparator and a regular comparator.
[0163] For example, the first field is the number of occupants field, the second field is the occupant name field, and the third field is the serial number field. The number of occupants field is input into the equality comparator for comparison to obtain a first comparison result, and the first comparison result is returned to the complex comparator (such as an object comparator); the occupant name field is input into the similarity comparator for comparison to obtain a second comparison result, and the second comparison result is returned to the complex comparator (such as an object comparator); and the serial number field is input into the regular comparator for comparison to obtain a third comparison result, and the third comparison result is returned to the complex comparator (such as an object comparator).
[0164] 7) The complex comparator (such as the object comparator) integrates the comparison results returned by the equality comparator, the similarity comparator and the regular comparator, namely the first comparison result, the second comparison result and the third comparison result, into a comparison result set and sends it to the data comparator.
[0165] 8) The data comparator outputs the corresponding verification result according to the comparison result in the comparison result set.
[0166] 9) If the comparison result meets the first preset requirement, the verification result output by the data comparator is passed.
[0167] If the verification result is passed, no processing will be done, that is, no Feishu report will be sent.
[0168] 10) If the comparison result does not meet the first preset requirement, the verification result output by the data comparator is failure.
[0169] If the verification result is failed, a Feishu report will be sent using the report output device.
[0170] 11) If the comparison result meets the second preset requirement, the verification result output by the data comparator is completed.
[0171] Among them, the verification result of completion means that Feishu report can always be sent or no processing is done. For example, if the verification result is completed and the corresponding operation is no processing, Feishu report will not be sent regardless of whether the verification result passes or fails; if the verification result is completed and the corresponding operation is the occurrence of Feishu report, Feishu report will be sent regardless of whether the verification result passes or fails.
[0172] In the order reservation parameter verification scenario, by comparing the order parameters stored in the database collector with the order parameters provided to the supplier, the accuracy of the order parameters can be verified in advance to avoid losses caused by incorrect parameter transmission.
[0173] 2. In regression testing, perform expected verification of response parameters for requests with the same parameters. The specific process may include the following:
[0174] 1) Obtain a price verification request log of a formal environment from the log collector. The price verification request log contains the request message and the response message;
[0175] 2) Send the request message again in the test environment and obtain a response message from the test environment;
[0176] 3) The response message of the formal environment and the response message of the test environment are respectively input into the universal parser and parsed into field set objects, that is, the response message of the formal environment is parsed into the first field set object, and the response message of the test environment is parsed into the second field set object.
[0177] 4) Compare the response object of the formal environment with the response object of the test environment, that is, input the first field set object and the second field set object into the data comparator;
[0178] 5) The data comparator inputs the response object of the formal environment and the response object of the test environment into the complex comparator, and then inputs them into the basic comparator through the complex comparator for comparison to obtain a comparison result;
[0179] 6) The complex comparator integrates the comparison results output by the basic comparator and then feeds them back to the data comparator;
[0180] 7) The data comparator outputs the corresponding verification result based on the comparison result.
[0181] The verification result may be passed, failed or completed. For details, please refer to the above related statements, and this application will not go into details here.
[0182] If the verification result is failed, it can be determined that there is erroneous code in the test environment.
[0183] In regression testing verification, by simply configuring the execution tree, you can use the entry of the execution tree to implement regression testing for most scenarios, determine if there is erroneous code in the test environment, and thus reduce the testing workload.
[0184] like Figure 3 As shown, the embodiment of the present application provides a computer device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0185] Memory 113, used for storing computer programs;
[0186] In one embodiment of the present application, the processor 111 is used to implement the data verification method provided by any one of the aforementioned method embodiments when executing the program stored in the memory 113, including:
[0187] The first data and the second data are respectively obtained by using the entry of the execution tree and input into the data comparator, wherein the first data is the predetermined order information of the target order or the response message of the formal environment; the second data is the order parameter provided to the supplier or the response message of the test environment;
[0188] Inputting the first data output by the data comparator and the second data into the basic comparator for comparison, and obtaining a comparison result output by the basic comparator;
[0189] The comparison result is input into the data comparator to obtain the verification result output by the data comparator.
[0190] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0191] Therefore, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the data verification method provided in any of the aforementioned method embodiments are implemented.
[0192] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which can store program codes. The computer-readable storage medium can be non-volatile or volatile.
[0193] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0194] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0195] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present application can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0196] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
[0197] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0198] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0199] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A data verification method, characterized in that: The data verification system comprises: a database collector, a log collector, a basic comparator, a data comparator and a controller, wherein the database collector, the log collector, the basic comparator and the data comparator have execution nodes with a unified interface, the execution nodes form an execution tree with a tree structure, and the controller is used to implement the following method; The method comprises: The first data and the second data are respectively acquired by using the entry of the execution tree and input into the data comparator, wherein the first data is the predetermined order information of the target order or the response message of the formal environment; the second data is the order parameter provided to the supplier or the response message of the test environment; Inputting the first data and the second data output by the data comparator into the basic comparator for comparison, and obtaining a comparison result output by the basic comparator; The comparison result is input into the data comparator to obtain the verification result output by the data comparator.
2. The method according to claim 1, characterized in that When the first data is the scheduled order information of the target order, and the second data is the order parameters provided to the supplier, the using the entry of the execution tree to respectively obtain the first data and the second data and input them into the data comparator includes: Obtaining scheduled order information of a target order from the database collector using the entry of the execution tree; Based on the predetermined order information of the target order, order parameters provided to the supplier are obtained from the log collector and input into the data comparator.
3. The method according to claim 1, characterized in that When the first data is a response message of the formal environment, and the second data is a response message of the test environment, the using the entry of the execution tree to respectively obtain the first data and the second data and input them into the data comparator includes: Obtaining a price verification request log of a formal environment from the log collector, wherein the price verification request log includes a request message and a response message; Resend the request message in the test environment to obtain a response message from the test environment; Parsing the response message of the formal environment and the response message of the test environment into corresponding first field set objects and second field set objects respectively; The first field set object and the second field set object are input into the data comparator.
4. The method according to claim 1, characterized in that: The data verification system further includes a complex comparator having an execution node with a unified interface; Before inputting the first data and the second data output by the data comparator into the basic comparator for comparison, the method further includes: inputting the first data and the second data outputted by the data comparator into the complex comparator; Using the complex comparator, input the first data and the second data into the basic comparator for comparison, and obtain a comparison result output by the basic comparator; The step of inputting the comparison result into the data comparator to obtain the verification result output by the data comparator comprises: Inputting the comparison result into the complex comparator to obtain a comparison result set output by the complex comparator; The comparison result set is input into the data comparator to obtain the verification result output by the data comparator.
5. The method according to claim 2, characterized in that: The scheduled order information of the target order includes order time, check-in time, and number of check-ins; based on the scheduled order information, obtaining the second data of the target order from the log collector and inputting it into the data comparator includes: Obtaining the order placement time error range of the target order; Based on the order number of the target order and the order time error range, searching for a corresponding request log from the log collector; Based on the found corresponding request log, the second data is obtained.
6. The method according to claim 2, characterized in that The data verification system further includes a universal parser having an execution node with a unified interface; The step of acquiring the second data of the target order from the log collector and inputting the second data into the data comparator comprises: Inputting the second data of the target order obtained from the log collector into the universal parser for parsing to obtain the parsed second data; The parsed second data is input into the data comparator.
7. The method according to claim 6, characterized in that The first data and the parsed second data both include a first field, a second field and a third field; the basic comparator includes an equality comparator, a similarity comparator and a regular comparator; The step of inputting the first data and the second data output by the data comparator into the basic comparator for comparison to obtain a comparison result output by the basic comparator includes: Input the first field into the equality comparator for comparison, and obtain a first comparison result output by the equality comparator; Inputting the second field into the similarity comparator for comparison, and obtaining a second comparison result output by the similarity comparator; The third field is input into the regular comparator for comparison, and a third comparison result output by the regular comparator is obtained.
8. The method according to claim 1, characterized in that The step of inputting the comparison result into the data comparator to obtain the verification result output by the data comparator comprises: If the comparison result meets the first preset requirement, the verification result output by the data comparator is passed; If the comparison result does not meet the first preset requirement, the verification result output by the data comparator is failure; If the comparison result meets the second preset requirement, the verification result output by the data comparator is completion.
9. The method according to claim 8, characterized in that The data verification system further includes a report output device, wherein the report output device has an execution node with a unified interface; After the verification result output by the data comparator is failure, the method further includes: The report output device is used to send Feishu reports.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 can be implemented.