Data verification method and device
By comparing the interface return data on the large-screen display device and the database return data, the problem of inaccurate detection of incorrect display data in the prior art is solved, and the accuracy and efficiency of data verification are achieved.
Patent Information
- Application Number
- CN202111460153.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-02
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2041-12-02
AI Technical Summary
The prior art lacks a method that can accurately detect whether an error display data occurs on a large-screen display device.
By determining the interface request and database statement corresponding to the interface to be detected, data is obtained from the target storage and the target database, and comparing the interface returns data and database returns data to determine whether the interface to be detected has passed the data verification.
It realizes accurate detection of data displayed on large-screen display devices, can identify errors or outdated data, improves the efficiency of data verification and facilitates maintenance.
Smart Images

Figure CN114153879B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a data verification method and apparatus. Background Art
[0002] With the needs of people's work and life, more and more large-screen display devices are installed in various places such as outdoor building facades, indoor halls, conference rooms, transportation stations, government agencies and enterprises, and have become the most common display media for information dissemination, news release and advertising. However, due to reasons such as network latency and system failures, incorrect display data may appear on large-screen display devices. Currently, there is a lack of a method that can accurately detect whether incorrect display data appears on large-screen display devices. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a data verification method and apparatus, which can detect whether incorrect display data appears on a large-screen display device.
[0004] In a first aspect, an embodiment of the present invention provides a data verification method, which is used to verify display data on a large-screen display device. The display data is sourced from a target storage, and the data in the target storage is sourced from a target database. The method includes:
[0005] Determine an interface request corresponding to a to-be-detected interface, and use the interface request to obtain interface return data from the target storage; wherein, the large-screen display device obtains display data from the target storage through the to-be-detected interface;
[0006] Determine a database statement corresponding to the to-be-detected interface, and use the database statement to obtain database return data from the target database;
[0007] Compare the interface return data and the database return data to obtain a comparison result;
[0008] Determine whether the to-be-detected interface passes the data verification according to the comparison result.
[0009] Optionally, before determining the interface request corresponding to the to-be-detected interface, the method further includes:
[0010] Receive verification information input by a user for the to-be-detected interface. The verification information includes: an interface address, interface request parameters, and a database statement;
[0011] Generate a configuration file corresponding to the to-be-detected interface. The configuration file includes: the interface address, the interface request parameters, and the database statement;
[0012] The determining the interface request corresponding to the to-be-detected interface includes:
[0013] Obtain the interface address and interface request parameters corresponding to the interface to be detected from the configuration file;
[0014] Generate an interface request corresponding to the interface to be detected according to the interface address and interface request parameters corresponding to the interface to be detected;
[0015] Determine the database statement corresponding to the interface to be detected;
[0016] Obtain the database statement corresponding to the interface to be detected from the configuration file.
[0017] Optionally, the interface return data includes at least one interface record, and the database return data includes at least one database record;
[0018] Compare the interface return data and the database return data to obtain a comparison result, including:
[0019] Determine whether the interface record and the database record are in a one-to-one correspondence;
[0020] If so, determine that the comparison result indicates that the interface return data is consistent with the database return data;
[0021] If not, determine that the comparison result indicates that the interface return data is inconsistent with the database return data.
[0022] Optionally, determining whether the interface record and the database record are in a one-to-one correspondence includes:
[0023] For each interface record in the interface return data: determine the current interface record; determine whether there is a corresponding database record in the database return data; if so, determine that the current interface record corresponds to the database return data;
[0024] Determine whether each interface record in the interface return data corresponds to the database return data;
[0025] If so, determine that the interface record and the database record are in a one-to-one correspondence;
[0026] If not, determine that the interface record and the database record are not in a one-to-one correspondence.
[0027] Optionally, the interface record includes at least one interface field, and the database record includes at least one database field;
[0028] Determining whether there is a database record corresponding to the current interface record in the data returned by the database includes:
[0029] Determining a first value of a current field in the current interface record, where the current field is located at a first position in the current interface record;
[0030] In the data returned by the database, determining at least one alternative database record that matches the current field, where the value of the field at a second position in the alternative database record is the first value, and the field at the first position in the current interface record corresponds to the field at the second position in the alternative database record;
[0031] In the current interface record, determining whether there is a next field of the current field;
[0032] If there is, then in the alternative database records of the current field, determining at least one alternative database record that matches the next field;
[0033] And so on, until there is an alternative database record that matches all fields in the current interface record, then determining that there is a database record corresponding to the current interface record in the data returned by the database.
[0034] Optionally, before determining whether each interface record in the interface return data corresponds to the database return data, it further includes:
[0035] Determining the first number of interface records in the interface return data;
[0036] Determining the second number of database return data in the database return data;
[0037] Determining whether the first number is equal to the second number;
[0038] If so, performing the step of determining whether each interface record in the interface return data corresponds to the database return data;
[0039] If not, determining that the interface record and the database record are not in a one-to-one correspondence.
[0040] Optionally, before determining whether the interface record and the database record are in a one-to-one correspondence, it further includes:
[0041] Performing a conversion process on the interface return data so that the processed interface return data includes at least one interface record, and the number of columns of the fields in the interface record is equal to the number of columns of the fields in the database record.
[0042] Second aspect, an embodiment of the present invention provides a data verification device for verifying display data on a large-screen display device. The display data is sourced from a target storage, and the data in the target storage is sourced from a target database, including:
[0043] An interface acquisition module, configured to determine an interface request corresponding to a to-be-detected interface, and use the interface request to obtain interface return data from the target storage; wherein, the large-screen display device obtains display data from the target storage through the to-be-detected interface;
[0044] A database acquisition module, configured to determine a database statement corresponding to the to-be-detected interface, and use the database statement to obtain database return data from the target database;
[0045] A comparison module, configured to compare the interface return data and the database return data to obtain a comparison result;
[0046] A detection module, configured to determine whether the to-be-detected interface passes the data verification according to the comparison result.
[0047] Third aspect, an embodiment of the present invention provides an electronic device, including:
[0048] One or more processors;
[0049] A storage device, configured to store one or more programs,
[0050] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.
[0051] Fourth aspect, an embodiment of the present invention provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above embodiments is implemented.
[0052] One of the above embodiments of the present invention has the following advantages or beneficial effects: obtaining interface return data from the target storage corresponding to the display data by using an interface request, and obtaining database return data from the database corresponding to the display data by using a database statement. By comparing the interface return data and the database return data, it can be determined whether there is incorrect display data on the large-screen display device.
[0053] The further effects of the above non-conventional optional methods will be described in combination with specific embodiments below. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:
[0055] Figure 1 It is a schematic diagram of the process of a data verification method provided by an embodiment of the present invention;
[0056] Figure 2 It is a schematic diagram of the process of another data verification method provided by an embodiment of the present invention;
[0057] Figure 3 It is a schematic diagram of the process of yet another data verification method provided by an embodiment of the present invention;
[0058] Figure 4 It is a schematic diagram of the matching between interface records and database records provided by an embodiment of the present invention;
[0059] Figure 5 It is a schematic diagram of the matching between interface records and database records provided by another embodiment of the present invention;
[0060] Figure 6 It is a schematic diagram of the structure of a data verification device provided by an embodiment of the present invention;
[0061] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing the embodiments of the present invention. Detailed implementation manners
[0062] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted below.
[0063] Figure 1 It is a schematic diagram of the process of a data verification method provided by an embodiment of the present invention. As Figure 1 shown, the method includes:
[0064] Step 101: Determine the interface request corresponding to the interface to be detected, and use the interface request to obtain interface return data from the target storage.
[0065] The method of the embodiment of the present invention is used to verify the display data on the large-screen display device. The display data comes from the target storage, and the data in the target storage comes from the target database. The large-screen display device obtains the display data from the target storage through the interface to be detected. Multiple different interfaces to be detected can be set to meet different display requirements of the large-screen display device.
[0066] Step 102: Determine the database statement corresponding to the interface to be detected, and use the database statement to obtain database return data from the target database.
[0067] The target storage can be a server or a terminal. The above server or terminal uses the database statement corresponding to the interface to be detected to obtain return data from the target database. The large-screen display device obtains the above return data as display data and displays it on the screen of the large-screen display device.
[0068] The target storage can also be a storage device set inside the large-screen display device or an external storage device connected to the large-screen display device. The above storage device uses the database statement corresponding to the interface to be detected to obtain return data from the target database. The large-screen display device obtains the above return data as display data and displays it on the screen of the large-screen display device.
[0069] Step 103: Compare the interface return data and the database return data to obtain a comparison result.
[0070] Under normal circumstances, the interface return data and the database return data should be the same, obtaining a comparison result that they are consistent. However, due to reasons such as network latency, system failures, and untimely updates of the target storage, the interface return data and the database return data may be inconsistent. In this case, the database return data is the correct data, while the interface return data is incorrect or outdated data.
[0071] Step 104: Determine whether the interface to be detected passes the data verification according to the comparison result.
[0072] If the comparison result indicates that the interface return data is consistent with the database return data, it is determined that the interface to be detected passes the data verification; if the comparison result indicates that the interface return data is inconsistent with the database return data, it is determined that the interface to be detected fails the data verification, and the display data corresponding to the interface to be detected is incorrect or outdated data.
[0073] In the embodiment of the present invention, the interface return data is obtained from the target storage corresponding to the display data by using an interface request, and the database return data is obtained from the database corresponding to the display data by using a database statement. By comparing the interface return data and the database return data, it can be determined whether there is incorrect display data on the large-screen display device.
[0074] In an embodiment of the present invention, before determining the interface request corresponding to the interface to be detected, the following steps are further included: receiving the verification information input by the user for the interface to be detected, where the verification information includes: interface address, interface request parameters, and database statements; generating a configuration file corresponding to the interface to be detected, where the configuration file includes: interface address, interface request parameters, and database statements; determining the interface request corresponding to the interface to be detected includes: obtaining the interface address and interface request parameters corresponding to the interface to be detected from the configuration file; generating the interface request corresponding to the interface to be detected according to the interface address and interface request parameters corresponding to the interface to be detected; determining the database statement corresponding to the interface to be detected; obtaining the database statement corresponding to the interface to be detected from the configuration file.
[0075] Since each interface has its own data name and return format, the test cases need to be continuously updated, which is rather cumbersome. In the test cases, the key (primary key) returned by the interface to be detected is associated with the specified column in the database, and then the correctness of the corresponding value and the data at the specified position is compared. The maintenance and update work is rather heavy, and corresponding test cases need to be added each time a new interface is developed.
[0076] In the data verification method of the embodiment of the present invention, during use, only the interface information, request parameters, and database statements of the interface to be detected need to be updated in the configuration file, and then data verification can be performed. The system can automatically obtain the interface return data and the database return data through the data in the configuration file to complete the data verification of the large-screen display device. This method is convenient for maintenance and has high efficiency.
[0077] In an embodiment of the present invention, the interface return data includes at least one interface record, and the database return data includes at least one database record; comparing the interface return data and the database return data to obtain a comparison result, including: determining whether the interface record and the database record are in a one-to-one correspondence; if so, determining that the comparison result indicates that the interface return data is consistent with the database return data; if not, determining that the comparison result indicates that the interface return data is inconsistent with the database return data.
[0078] The interface record and the database record being in a one-to-one correspondence means that each interface record exactly matches each database record, without any unmatched interface records or unmatched database records. If the interface record and the database record are in a one-to-one correspondence, it is determined that the comparison result indicates that the interface return data is consistent with the database return data; if the interface record and the database record are not in a one-to-one correspondence, it is determined that the comparison result indicates that the interface return data is inconsistent with the database return data.
[0079] In an embodiment of the present invention, before determining whether the interface record and the database record are in a one-to-one correspondence relationship, it further includes: performing conversion processing on the interface return data so that the processed interface return data includes at least one interface record, and the number of columns of the fields in the interface record is equal to the number of columns of the fields in the database record.
[0080] There may be other data in the interface return data, and these other data do not need to be compared with the database return data. The other data may include: status information, return codes, message identifiers, etc. Remove the other data in the interface return data to generate at least one interface record, and the number of columns of the fields in the interface record is equal to the number of columns of the fields in the database record, so as to facilitate comparing the generated interface record with the database record.
[0081] Figure 2 It is a schematic diagram of the process of a data verification method provided by an embodiment of the present invention. As Figure 2 shown, the method includes:
[0082] Step 201: Determine the interface request corresponding to the interface to be detected, and use the interface request to obtain the interface return data from the target storage.
[0083] Step 202: Determine the database statement corresponding to the interface to be detected, and use the database statement to obtain the database return data from the target database.
[0084] Step 203: Determine the current interface record.
[0085] Step 204: Determine whether there is a database record corresponding to the current interface record in the database return data.
[0086] If there is a database record corresponding to the current interface record in the database return data, then execute Step 205. If there is no database record corresponding to the current interface record in the database return data, then execute Step 206.
[0087] Step 205: Determine that the current interface record corresponds to the database return data.
[0088] Step 206: Determine that the interface return data is inconsistent with the database return data.
[0089] Step 207: Determine whether there is a next interface record of the current interface record.
[0090] If there is a next interface record of the current interface record, then execute Step 208. If there is no next interface record of the current interface record, it means that all the interface records in the interface return data have been compared, and execute Step 209.
[0091] Step 208: Obtain the next interface record recorded by the current interface, and determine the next interface record as the current interface record.
[0092] Re-execute Step 204 to obtain the comparison result of the next interface record.
[0093] Step 209: Determine that the interface return data is consistent with the database return data.
[0094] In the embodiment of the present invention, the interface records in the interface return data are compared one by one. Only when all the interface records in the interface return data have been compared and all the interface records correspond to the database return data, it is determined that the interface return data is consistent with the database return data.
[0095] In an embodiment of the present invention, the interface record includes at least one interface field, and the database record includes at least one database field. The above Step 205 may include: determining the first value of the current field in the current interface record, where the current field is located at the first position in the current interface record; in the database return data, determining at least one alternative database record that matches the current field, and the value of the field at the second position in the alternative database record is the first value, and the field at the first position in the current interface record corresponds to the field at the second position in the alternative database record; in the current interface record, determining whether there is a next field of the current field; if so, in the alternative database records of the current field, determining at least one alternative database record that matches the next field; and so on, until there is an alternative database record that matches all the fields in the current interface record, then it is determined that there is a database record corresponding to the current interface record in the database return data.
[0096] The above method determines a method for verifying a single interface record. The interface fields in the interface record are compared one by one. Only when there is an alternative database record that matches all the fields in the interface record, can it be determined that there is a database record corresponding to the interface record in the database return data.
[0097] In an embodiment of the present invention, before determining whether each interface record in the interface return data corresponds to the database return data, it further includes: determining the first number of interface records in the interface return data; determining the second number of database return data in the database return data; determining whether the first number is equal to the second number; if so, execute the step of determining whether each interface record in the interface return data corresponds to the database return data; if not, determine that the interface record and the database record are not in a one-to-one correspondence relationship.
[0098] Before determining whether each interface record in the interface return data corresponds to the database return data, first determine the number of records in the interface return data and the number of records in the database return data. If the two are equal, then further determine whether each interface record in the return data corresponds to the database return data. The method of the embodiment of the present invention can improve the efficiency of data comparison.
[0099] To make the method of the embodiment of the present invention easier to understand, the implementation method of a specific embodiment is described below. Figure 3 It is a schematic diagram of the process of another data verification method provided by an embodiment of the present invention. As Figure 3 shown, the data recorded in the configuration file is the interface address, interface request parameters, and database statement. The interface address and interface request parameters are used to make an http request through the front end, which is the same as the way the front end obtains data. The database statement can be implemented through an sql statement, and the sql statement is used to directly send a request to the database to obtain the database return data.
[0100] Scope of application of the algorithm: The interface return data itself can be in the json format without sub-json data, or in the queue format composed of multiple non-sub-json. Since many large-screen display devices are developed using a low-code platform, currently the interface return data usually does not have the situation of multi-level json, and it can be applied to most environments.
[0101] The two data formats obtained from the interface and the database are different. The interface return data is in json format, including key (key) and value (value), and the format can be: A = {"msg": "success", "code": 200, "data": [{"key1": "value1", "key2": "value2"}, {"key3": "value3", "key4": "value4"}... ]}.
[0102] The database return data is a list of multiple database records in the format of: B = {("value1", "value2"), ("value3", "value4")...}
[0103] Extract the data to be compared from the data A returned by the interface to form data C={(value1,value2),(value3,value4)...} in the same format as the data B returned by the database. Take the first interface record (value1,value2) from data C and poll and compare value1 with the database records in the data B returned by the database. If there is a database record that matches value1, record a number m in the first array, where m is the record identifier of the database record that matches value1 in the B array. Then poll and compare value2. If there is a database record that matches value2, record a number n in the second array, where n is the database identifier that matches value2. There may be multiple values in the first array or the second array respectively. To reduce the possibility of matching to the wrong position, determine the database record that matches the first interface record through the intersection of the first array and the second array.
[0104] If there is an intersection between the first array and the second array, it means that the data returned by the interface has a record in the data returned by the database. Only when all interface records can be found in the data returned by the database will it be determined that the verification of the interface to be detected passes. Figure 4 It is a schematic diagram of the matching between interface records and database records provided by an embodiment of the present invention. As Figure 4 shown, the first interface record (1,2) in the data returned by the interface matches the second database record (1,2) in the data returned by the database. However, the second interface record (3,4) in the data returned by the interface has no matching record in the data returned by the database. Therefore, the verification of the interface to be detected fails, and the data returned by this interface is incorrect.
[0105] If there is no intersection between the first array and the second array, it means that the data returned by the interface does not appear in the database result, and the data returned by this interface is incorrect. Figure 5 It is another schematic diagram of the matching between interface records and database records provided by an embodiment of the present invention. As Figure 5As shown, the first interface field in the second interface record (3, 4) in the interface return data is 3, and the first database field in the third database record (3, 8) in the database return data is 3. Therefore, the first interface field in the second interface record matches the first database field in the third database record. In addition, the second interface field in the second interface record (3, 4) in the interface return data is 4, and the second database field in the third database record (3, 8) in the database return data is 8. Therefore, the second interface field in the second interface record does not match the second database field in the third database record. That is, there is no intersection between the first array and the second array, indicating that the data returned by the interface does not appear in the database result, and the return of this interface is incorrect.
[0106] It should be noted that for the convenience of explanation, in the embodiments of the present invention, both the interface record and the database record only include two fields. In the actual application process, according to requirements, any number of fields can be set in the interface record and the database record.
[0107] The embodiments of the present invention design a data verification method in an unordered situation. This method can verify any two groups of multi-dimensional data to confirm the correlation between the two groups of data, and further improve the verification method of the interface and the database. The solution of the embodiments of the present invention confirms the relevance of the data by circular comparison and recording the key position values, thus getting rid of the problem of strong association between the interface fields and the database fields.
[0108] Figure 6 It is a schematic structural diagram of a data verification device provided by an embodiment of the present invention. As Figure 6 shown, this device is used to verify the display data on the large-screen display device. The display data comes from the target storage, and the data in the target storage comes from the target database. This device includes:
[0109] An interface acquisition module 601, configured to determine an interface request corresponding to the interface to be detected, and use the interface request to acquire interface return data from the target storage; wherein, the large-screen display device acquires display data from the target storage through the interface to be detected;
[0110] A database acquisition module 602, configured to determine a database statement corresponding to the interface to be detected, and use the database statement to acquire database return data from the target database;
[0111] A comparison module 603, configured to compare the interface return data and the database return data to obtain a comparison result;
[0112] A detection module 604, configured to determine whether the interface to be detected passes the data verification according to the comparison result.
[0113] Optionally, the apparatus further includes:
[0114] A file generation module 605, configured to receive verification information input by a user for the interface to be detected, where the verification information includes: an interface address, interface request parameters, and a database statement;
[0115] Generate a configuration file corresponding to the interface to be detected, where the configuration file includes: the interface address, the interface request parameters, and the database statement;
[0116] The interface acquisition module 601 is specifically configured to: acquire, from the configuration file, the interface address and interface request parameters corresponding to the interface to be detected;
[0117] Generate an interface request corresponding to the interface to be detected according to the interface address and interface request parameters corresponding to the interface to be detected;
[0118] The database acquisition module 602 is specifically configured to: acquire, from the configuration file, the database statement corresponding to the interface to be detected.
[0119] Optionally, the interface return data includes at least one interface record, and the database return data includes at least one database record;
[0120] The comparison module 603 is specifically configured to:
[0121] Determine whether the interface record and the database record are in a one-to-one correspondence;
[0122] If so, determine that the comparison result indicates that the interface return data is consistent with the database return data;
[0123] If not, determine that the comparison result indicates that the interface return data is inconsistent with the database return data.
[0124] Optionally, the comparison module 603 is specifically configured to:
[0125] For each interface record in the interface return data: determine the current interface record; determine whether there is a corresponding database record in the database return data for the current interface record; if so, determine that the current interface record corresponds to the database return data;
[0126] Determine whether each interface record in the interface return data corresponds to the database return data;
[0127] If so, determine that the interface record and the database record are in a one-to-one correspondence;
[0128] If not, determine that the interface record and the database record are not in a one-to-one correspondence.
[0129] Optionally, the interface record includes at least one interface field, and the database record includes at least one database field;
[0130] The comparison module 603 is specifically configured to:
[0131] Determine a first value of a current field in the current interface record, where the current field is located at a first position in the current interface record;
[0132] In the data returned by the database, determine at least one alternative database record that matches the current field, where the value of the field at the second position in the alternative database record is the first value, and the field at the first position in the current interface record corresponds to the field at the second position in the alternative database record;
[0133] In the current interface record, determine whether there is a next field of the current field;
[0134] If there is, in the alternative database records of the current field, determine at least one alternative database record that matches the next field;
[0135] And so on, until there is an alternative database record that matches all fields in the current interface record, then determine that there is a database record corresponding to the current interface record in the data returned by the database.
[0136] Optionally, the comparison module 603 is specifically configured to:
[0137] Determine the first number of interface records in the interface return data;
[0138] Determine the second number of database return data in the data returned by the database;
[0139] Determine whether the first number is equal to the second number;
[0140] If so, perform the step of determining whether each interface record in the interface return data corresponds to the data returned by the database;
[0141] If not, determine that the interface record and the database record are not in a one-to-one correspondence.
[0142] Optionally, the apparatus further includes:
[0143] A conversion module 606, configured to perform conversion processing on the data returned by the interface, so that the processed data returned by the interface includes at least one interface record, and the number of columns of the fields in the interface record is equal to the number of columns of the fields in the database record.
[0144] An embodiment of the present invention provides an electronic device, including:
[0145] One or more processors;
[0146] A storage device, configured to store one or more programs,
[0147] 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 of the above embodiments.
[0148] Reference is made below to Figure 7 , which shows a schematic structural diagram of a computer system 700 of a terminal device suitable for implementing the embodiments of the present invention. Figure 7 The terminal device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0149] As Figure 7 shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage section 708 into the random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, ROM 702, and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0150] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as required. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as required, so that the computer program read from it can be installed into the storage section 708 as required.
[0151] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes program code for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are performed.
[0152] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection having 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 can be any tangible medium that contains or stores a program, and the program can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable medium can 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 can be transmitted by any appropriate medium, including but not limited to: wireless, wire, optical fiber cable, RF, etc., or any suitable combination of the above.
[0153] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code, and the above-mentioned module, segment of a program, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as combinations of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0154] The modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be set in a processor. For example, they can be described as: an interface acquisition module, a database acquisition module, a comparison module, and a detection module. Among them, the names of these modules do not constitute a limitation on the module itself in some cases. For example, the interface acquisition module can also be described as "a module that determines an interface request corresponding to the interface to be detected and uses the interface request to obtain interface return data from the target storage".
[0155] As another aspect, the present invention also provides a computer-readable medium, which can be included in the device described in the above embodiments; or can exist separately without being assembled into the device. The above computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the device includes:
[0156] Determine an interface request corresponding to the interface to be detected, and use the interface request to obtain interface return data from the target storage; wherein, the large-screen display device obtains display data from the target storage through the interface to be detected;
[0157] Determine a database statement corresponding to the interface to be detected, and use the database statement to obtain database return data from the target database;
[0158] Compare the interface return data and the database return data to obtain a comparison result;
[0159] Determine whether the interface to be detected passes the data verification according to the comparison result.
[0160] According to the technical solution of the embodiment of the present invention, the interface return data is obtained from the target storage corresponding to the display data by using an interface request, and the database return data is obtained from the database corresponding to the display data by using a database statement. By comparing the interface return data and the database return data, it can be determined whether there is error data on the large-screen display device.
[0161] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A data verification method, characterized in that, The method is used to verify the display data on a large-screen display device. The display data is sourced from a target storage, and the data in the target storage is sourced from a target database. The method includes: Determine an interface request corresponding to the interface to be detected, and use the interface request to obtain interface return data from the target storage; wherein, the large-screen display device obtains display data from the target storage through the interface to be detected; Determine a database statement corresponding to the interface to be detected, and use the database statement to obtain database return data from the target database; Compare the interface return data and the database return data to obtain a comparison result; Determine whether the interface to be detected passes the data verification according to the comparison result; Before determining the interface request corresponding to the interface to be detected, it further includes: Receive verification information input by the user for the interface to be detected. The verification information includes: interface address, interface request parameters, and database statement; Generate a configuration file corresponding to the interface to be detected. The configuration file includes: the interface address, the interface request parameters, and the database statement; The determination of the interface request corresponding to the interface to be detected includes: Obtain the interface address and interface request parameters corresponding to the interface to be detected from the configuration file; Generate an interface request corresponding to the interface to be detected according to the interface address and interface request parameters corresponding to the interface to be detected; The determination of the database statement corresponding to the interface to be detected includes: Obtain the database statement corresponding to the interface to be detected from the configuration file.
2. The method according to claim 1, characterized in that, The interface return data includes at least one interface record, and the database return data includes at least one database record; The comparison of the interface return data and the database return data to obtain a comparison result includes: Determine whether the interface record and the database record are in a one-to-one correspondence; If so, determine that the comparison result indicates that the interface return data is consistent with the database return data; If not, determine that the comparison result indicates that the interface return data is inconsistent with the database return data.
3. The method according to claim 2, characterized in that, The determination of whether the interface record and the database record are in a one-to-one correspondence includes: For each interface record in the interface return data: determine the current interface record; determine whether there is a corresponding database record in the database return data for the current interface record; if there is, determine that the current interface record corresponds to the database return data; Determine whether each interface record in the interface return data corresponds to the database return data; If so, determine that the interface record and the database record are in a one-to-one correspondence; If not, determine that the interface record and the database record are not in a one-to-one correspondence.
4. The method according to claim 3, characterized in that, The interface record includes at least one interface field, and the database record includes at least one database field; The determination of whether there is a corresponding database record in the database return data for the current interface record includes: Determine the first value of the current field in the current interface record, where the current field is located at the first position in the current interface record; In the data returned by the database, determine at least one alternative database record that matches the current field, where the value of the field at the second position in the alternative database record is the first value, and the field at the first position in the current interface record corresponds to the field at the second position in the alternative database record; In the current interface record, determine whether there is a next field of the current field; If so, in the alternative database records of the current field, determine at least one alternative database record that matches the next field; And so on, until there is an alternative database record that matches all fields in the current interface record, then determine that there is a database record corresponding to the current interface record in the data returned by the database.
5. The method according to claim 3, characterized in that, Before determining whether each interface record in the interface return data corresponds to the data returned by the database, it further includes: Determine the first number of interface records in the interface return data; Determine the second number of the data returned by the database in the data returned by the database; Determine whether the first number is equal to the second number; If so, execute the step of determining whether each interface record in the interface return data corresponds to the data returned by the database; If not, determine that the interface record and the database record are not in a one-to-one correspondence relationship.
6. The method according to claim 2, wherein, Before determining whether the interface record and the database record are in a one-to-one correspondence relationship, it further includes: Perform conversion processing on the interface return data so that the processed interface return data includes at least one interface record, and the number of columns of the fields in the interface record is equal to the number of columns of the fields in the database record.
7. A data verification device, characterized in that, The device is used to verify the display data on the large screen display device, and the display data is sourced from the target storage, and the data in the target storage is sourced from the target database, including: An interface acquisition module, configured to determine an interface request corresponding to the interface to be detected, and use the interface request to obtain interface return data from the target storage; wherein, the large screen display device obtains display data from the target storage through the interface to be detected; A database acquisition module, configured to determine a database statement corresponding to the interface to be detected, and use the database statement to obtain database return data from the target database; A comparison module, configured to compare the interface return data and the database return data to obtain a comparison result; A detection module, configured to determine whether the interface to be detected passes the data verification according to the comparison result; A file generation module, configured to receive verification information input by the user for the interface to be detected, where the verification information includes: an interface address, interface request parameters, and a database statement; generate a configuration file corresponding to the interface to be detected, and the configuration file includes: the interface address, the interface request parameters, and the database statement; The interface acquisition module is specifically configured to: obtain the interface address and interface request parameters corresponding to the interface to be detected from the configuration file; generate an interface request corresponding to the interface to be detected according to the interface address and interface request parameters corresponding to the interface to be detected. The database acquisition module is specifically configured to: obtain the database statement corresponding to the interface to be detected from the configuration file.
8. An electronic device, characterized in that, Comprising: 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-6.
9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, the method according to any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Interface data testing method and device and readable storage medium
CN110908892A
Data verification method, device and equipment and computer readable storage medium
CN113535841A