An automated prospective validation system based on full system full data volume comparison
The automated expectation verification system, which compares the entire system and all data volumes, solves the problem of not being able to fully detect the impact of data in automated interface testing. It enables detailed data verification and difference analysis of the tested system and supports multiple database types.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-07
- Publication Date
- 2026-04-07
AI Technical Summary
In existing automated interface testing, the expected verification methods cannot fully detect the different field values of a large number of tables in the system affected by the interface, and testers find it difficult to determine all the affected fields.
An automated expectation verification system based on full system-wide data comparison is provided, including a graphical interface, a computing server, an information input module, a connectivity testing module, a comparison preparation module, a memory comparison module, and an Excel output module. It comprehensively compares the table data of the expectation and result databases through multi-threaded double comparison mode and SQL comparison mode, and supports MySQL, SQL Server, SQLite, and Oracle database types.
It enables detailed data verification of the entire database of the system under test, observes all the impacts of interface execution on the data, saves resources and time, provides Excel export function for difference analysis, and supports multiple database types.
Smart Images

Figure CN116244197B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of automated testing technology, specifically relating to an automated data expectation verification system. Background Technology
[0002] In recent years, software testing technology has been developing rapidly, from simple interface testing and functional testing to interface testing and performance testing. Software testing technology is making rapid progress in ensuring the correctness of functions, the accuracy of data, and the stability of systems.
[0003] To ensure the accuracy of data and the stability of core functions within the system, using automated interface testing to test each interface and observe whether the output parameters are correct is a suitable testing method. Compared to simple interface testing, this method can observe the data values of more fields, and the correlation between fields is more obvious. Furthermore, testers have pre-set expectations for the test scenarios, and interface testing can undoubtedly better compare the differences between expectations and actual results. At the same time, it can also test for problems in data changes during the workflow of multiple interfaces.
[0004] However, current automated API testing mostly relies on assertions in the API's output parameters to determine if a specific parameter value is problematic. This approach is incomplete in identifying data discrepancies, as the API's impact may extend beyond just the output parameters. It could affect various fields across numerous tables in the system, which may not be reflected in the API's output parameters. Clearly, current parameter assertion methods are inadequate for detecting such situations. While methods involving database queries within assertions to check field values exist, this requires testers to know exactly which fields are affected. In most cases, testers cannot identify all the specific fields affected by the API. These issues are precisely what current automated API testing urgently needs to address. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides an automated expectation verification system based on a comparison of the entire system's total data volume.
[0006] An automated expectation verification system based on full system-wide data volume comparison includes a graphical interface, a computing server, an information input module, a connectivity testing module, a comparison preparation module, a memory comparison module, an SQL comparison module, and an Excel output module.
[0007] A graphical interface is provided to help users operate the automated expectation verification system; at the same time, all information output by the automated expectation verification system is fed back to the user through the graphical interface.
[0008] The computing server is used to support the operation and calculation of various modules of the automated expected verification system, and provides communication channels for external access and data storage capabilities.
[0009] The information entry module is used by the user to enter the database information of the system under test. This database information includes the database type, expected database address, result database address, characteristics of the table to be compared, the table name to be compared, and the primary key of the table to be compared. The database type supports MySQL, SQL Server, SQLite, and Oracle. The characteristics, table name, and primary key of the table to be compared are optional. The characteristics and table name are related; if the user enters the table name to be compared, the characteristics are invalid. In short, the table name has higher priority.
[0010] The connectivity testing module is used to perform connectivity tests on the database address filled in by the user. The connectivity test is to test whether the target database address is reachable. Specifically, the connectivity testing module will construct the corresponding database connector according to the database type filled in by the user, and connect to the expected database address and the result database address respectively. If the connection fails, it means that the target database address is unreachable, and subsequent work cannot be carried out. At this time, feedback will be given to the user through a graphical interface.
[0011] The comparison preparation module is used to process the table-related information input by the user. The table-related information includes the characteristics of the table names to be compared, the table names to be compared, and the primary keys of the tables to be compared. Based on the above information and the actual situation in the database, the comparison preparation module will organize and derive the comparison table name array, the primary keys corresponding to the comparison table names, the comparable fields, the expected additional fields in the corresponding table of the database, and the additional fields in the corresponding table of the result database.
[0012] The memory comparison module is used for comparing data volumes of less than 100,000 records. This module reads the table data of the expected database and the result database into memory in sequence, and uses a multi-threaded double comparison mode to compare the differences between the corresponding tables in the expected database and the result database according to the primary key matching of each row, the multiple rows in the expected database table that cannot be matched by the primary key in the corresponding table in the result database, and the multiple rows in the result database table that cannot be matched by the primary key in the corresponding table in the expected database.
[0013] The SQL comparison module is used for comparing data volumes of 100,000 or more. First, the tables in the expected database and the result database to be compared are copied to the same temporary database. Then, based on the comparison table name array, the primary key corresponding to the comparison table name, and the comparable fields prepared by the comparison preparation module, the comparison SQL is dynamically concatenated and the comparison SQL is run to obtain the difference data.
[0014] The Excel output module is used to save the expected database table data, the result database table data, and the difference data obtained from the comparison. As a human-computer interface module, this module saves the data obtained from the comparison preparation module, the memory comparison module, and the SQL comparison module, and renders different data with different colors.
[0015] Furthermore, the information entry module supports different methods for determining the tables to be compared. These different methods include automatically searching all table names in the database as the tables to be compared, searching the database for matching table names based on the characteristics of the table names to be compared, and searching the database for matching table names based on the table names to be compared.
[0016] The data entry module will automatically search all tables as the comparison table only when neither the feature of the table to be compared nor the table name to be compared is filled in. When both the feature of the table to be compared nor the table name to be compared is filled in, the data entry module will prioritize the table name to be compared for search and matching. The data entry module will only use the feature of the table name to be compared for search and matching when only the feature of the table name to be compared is filled in.
[0017] Furthermore, the information entry module supports four database types, including MySQL, SQL Server, SQLite, and Oracle. For different database types, the automated verification system will use different database connectors for connection work; therefore, the database used by the system under test must be one of the above four databases.
[0018] Furthermore, in the information entry module, the primary key of the comparison table is optional. If it is not filled in, the information entry module will automatically query the table primary key. If it is filled in, the primary key name of each table must be filled in using a fixed format. If only the primary key name of some tables is filled in, the primary key of the other tables will be determined by automatic query.
[0019] Furthermore, in the connectivity testing module, different database connectors will be constructed for different database types, and the corresponding connectors will be used to connect to the database address. The database address is only usable if there are no connection errors. This module needs to perform two connectivity tests in one operation: one test on the expected database and another test on the result database.
[0020] Furthermore, in the comparison preparation module, when the table name to be compared and the primary key of the table to be compared are filled in, the module will construct an SQL statement to query the filled table name in both the expected database and the result database, and query the primary key of the corresponding table to determine whether the primary key of the table to be compared is correct, and query all field names of the table; after the query is completed, the array of comparison table names and the primary keys corresponding to the comparison table names are obtained, and the queries in the expected database and the result database are compared to obtain the comparable fields, the additional fields in the corresponding table of the expected database, and the additional fields in the corresponding table of the result database.
[0021] In the comparison preparation module, when the primary key of the table to be compared is not filled in, the module will directly use the primary key obtained after querying the primary key as the primary key corresponding to the comparison table name for subsequent work.
[0022] In the comparison preparation module, when only the feature of the table name to be compared is filled in, but the table name to be compared is not filled in, the module will use the feature of the table name to be compared as a condition when constructing the query SQL statement, and will query all tables with similar features to the table name to be compared as the tables to be compared.
[0023] Furthermore, the memory comparison module only supports data comparison of less than 100,000 data points. This module reads all table data from the expected database and the result database into memory in sequence. To ensure the comprehensiveness of the comparison and to reduce the number of comparisons, the comparison is only performed after all data has been read, meaning the comparison is full.
[0024] To ensure the efficiency of the comparison, the memory comparison module is implemented in a multi-threaded manner. It determines the total order of magnitude to be compared and divides it appropriately. Each part after division is compared using a separate thread.
[0025] In the memory comparison module, two full comparisons will be performed. The first comparison will determine the differences between the corresponding tables in the expected database and the result database by matching each row according to the primary key, and will also determine the multiple rows in the expected database table that cannot be matched with each row in the corresponding table in the result database by the primary key. The second comparison will determine the multiple rows in the result database table that cannot be matched with each row in the corresponding table in the expected database by the primary key.
[0026] Furthermore, the SQL comparison module supports data comparison of more than 100,000 data entries. This module copies the corresponding tables of the expected database and the corresponding tables of the result database to the same temporary database, and uses SQL statements to compare them in the temporary database.
[0027] The comparison SQL statement needs to be dynamically generated by concatenating the data information obtained from the comparison preparation module. The data information includes the primary key fields of the two tables and the fields to be compared between the two tables.
[0028] Furthermore, whether it's the memory comparison module or the SQL comparison module, the core of the comparison lies in determining the primary key of the table to be compared, matching the row data in the expected and result tables according to the primary key, and comparing each field of the matched row data one by one to obtain the difference of each field.
[0029] Furthermore, the Excel output module needs to save the table data of the expected database and the table data of the result database, and the primary key will be rendered with different colors to distinguish them when saving; the module also needs to save the difference data obtained from the comparison, and the row number, primary key and difference need to be rendered with different colors to distinguish them when saving.
[0030] The beneficial effects of this invention are:
[0031] (1) To address the issue of incomplete expected verification, the automated expected verification system can perform data verification based on the entire database of the system under test. The data verification is refined to each field of each table. For the process of a system under test running a set of interface automation cases, the above method can directly observe all the impacts of these interfaces on the data of the system under test after execution.
[0032] (2) Regarding the amount of data, for verification of more than 100,000 data points, in order to save machine performance, the method provides SQL comparison. SQL is used to directly enter the temporary database to compare the corresponding expected and result tables, which can save more resources and time.
[0033] (3) Regarding the discrepancies generated by the verification, the method provides an Excel export function and uses special colors to mark important fields such as primary key, row number, and discrepancy data in the Excel spreadsheet, so that users can better observe and analyze the discrepancy data;
[0034] (4) For different databases, the method provides four database types to choose from: mysql, sqlserver, sqlite and oracle, which are more compatible with the user's tested system. Attached Figure Description
[0035] Figure 1 This is a flowchart illustrating an embodiment of the information entry module.
[0036] Figure 2 This is a flowchart illustrating an embodiment of the connectivity testing module.
[0037] Figure 3A flowchart illustrating a comparison preparation module embodiment.
[0038] Figure 4 This is a flowchart illustrating an embodiment of the memory comparison module.
[0039] Figure 5 This is a flowchart illustrating an example of an SQL comparison module implementation.
[0040] Figure 6 This is a flowchart illustrating an example of an Excel output module. Detailed Implementation
[0041] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0042] The automated expected verification system based on the comparison of the entire system and the entire amount of data will run on the computing server. Users need to use the graphical interface provided by the automated expected verification system to enter database information and comparison information. Among them, the database type, expected database address, and result database address are required fields. If they are not filled in, a prompt will appear indicating that the field is required. These three pieces of information mainly provide the automated expected verification system with the method and address for connecting to the expected database and the result database. The characteristics of the table name to be compared, the table name to be compared, and the primary key of the table to be compared are optional fields. These three fields mainly provide the tables to be compared in this expected comparison and the primary key information of each table.
[0043] For optional fields, if the name of the table to be compared is entered, the information for the characteristic of the table to be compared will be invalid, and it will have no effect even if the field is entered; the field will only take effect when the user only enters the characteristic of the table to be compared; the primary key of the table to be compared takes effect as soon as it is entered, and is not subject to other constraints.
[0044] For the table names to be compared, the user must fill in each table name clearly according to the rules. For the characteristics of the table names to be compared, the user only needs to fill in the uniform characteristics of the table names to be compared in the database, such as what characters they all start with, end with, and contain. For the primary keys of the tables to be compared, the user must fill in the primary keys of each table to be compared in sequence according to the rules.
[0045] Once the user has filled in the relevant information, they can save it. After saving, the configuration can be flexibly reused in different interface automations. Of course, the user can also execute the configuration immediately, and the automated expectation verification system will immediately use the configuration to compare the expectation database and the result database.
[0046] The expected database is the baseline database of the system being tested by the user or a database that the user considers to be accurate; the result database is the database that shows data changes after a certain automation is performed.
[0047] When the automated expectation verification system starts running, the connectivity testing module is the first to take effect. During each run, a connection test is performed on the expectation database and the result database entered by the user to determine whether the two databases are currently available. If the connection fails, the user is immediately notified and subsequent work is terminated.
[0048] If the expected and result database connections are normal, the automated expected verification system starts the comparison preparation module. This module first checks if the table name to be compared is filled in. If it is, it directly retrieves the table name to be compared and converts it into an array of comparison table names. Then, it iterates through this array, performing a query operation on each table. First, it checks if the table exists. If it does, it continues to query all primary key column names of the table and returns them, saving them to a temporary primary key corresponding to the comparison table name. Next, it checks if the primary key of the table to be compared is filled in. If it is, it checks if the current table is included. If it is, it retrieves the primary key of the current table and compares it with the temporary primary key corresponding to the comparison table name. If the primary key exists in the temporary primary key corresponding to the comparison table name, it is saved to the final primary key corresponding to the comparison table name. If the primary key of the table to be compared is not filled in or does not include the current table, the temporary primary key corresponding to the comparison table name is directly used as the final primary key corresponding to the comparison table name. After processing the primary key corresponding to the table name, continue to query all other fields of the table and save them as an array. Then, compare the array in the expected database with the array in the result database. The fields that exist in both databases are taken as comparable fields, and the extra fields in the corresponding table of the expected database and the extra fields in the corresponding table of the result database are obtained.
[0049] If the table name to be compared is not filled in, but the features of the table name to be compared exist, then first query all table names that meet the conditions based on the features of the table name to be compared, and then iterate through the table names, performing the same query operation as above for each table to obtain the primary key corresponding to the table name to be compared, the comparable fields, the additional fields in the expected database corresponding table, and the additional fields in the result database corresponding table.
[0050] If the name of the table to be compared is not filled in, and the characteristics of the table to be compared are also not filled in, then all table names in the database will be queried directly and iterated through. The same query operation will be performed on each table to obtain the primary key corresponding to the table name to be compared, the comparable fields, the additional fields in the expected database corresponding table, and the additional fields in the result database corresponding table.
[0051] Once the primary keys corresponding to the comparison table names, the comparable fields, the additional fields in the expected database table, and the additional fields in the result database table for each table are determined, the formal comparison process begins. First, the total number of records in the current table needs to be queried. If the number of records in the current table is less than 100,000, the memory comparison module is activated; otherwise, the SQL comparison module is activated.
[0052] If the current table has fewer than 100,000 records, the in-memory comparison module is entered. In this module, the database dependency is only for querying data. First, based on the primary key and comparable fields corresponding to the obtained comparison table names, a query statement is constructed to retrieve all data containing the primary key and comparable fields corresponding to the comparison table names. Of course, both the expected and result database tables need to be retrieved. After the query is completed, the first comparison begins.
[0053] The purpose of the first comparison is to determine the differences between the expected database table and the corresponding table in the result database based on primary key matching, and to identify any rows in the expected database table that cannot be matched by primary key matching in the result database table. Upon entering the first comparison stage, the total amount of data in each table is divided reasonably and evenly, and a thread is created for each part. Then, all expected data is traversed, and each row of expected data is matched against all data in the result table using its primary key. If a primary key match is successful, each field of the matching rows is compared and the differences are recorded. If the primary key of the expected row cannot be matched against any row in the result table, the expected row is recorded as one of the rows in the expected table that cannot be matched by primary key matching in the result table. Once all expected data has been traversed, the first comparison is complete.
[0054] The purpose of the second comparison is to find multiple rows in the result database table that cannot be matched by the primary key in the corresponding rows of the expected database table. This time, only the primary key needs to be compared. Similarly, when entering the comparison, threads need to be allocated reasonably. Then, the data in the result table is traversed, and the primary key of each row in the result table is matched against all rows in the expected table. If the primary key of a row in the result table cannot be matched against any row in the expected table, then the result row is recorded as multiple rows in the result table that cannot be matched by the primary key in the expected table.
[0055] If the current table contains 100,000 or more records, the SQL comparison module is invoked. In this module, all comparisons rely on SQL statements. Similar to the memory comparison module, it first constructs a query statement based on the primary key and comparable fields corresponding to the obtained comparison table names. This query retrieves data from all expected and result tables that contain the primary key and comparable fields corresponding to the comparison table names. After the query is complete, the first comparison begins.
[0056] In the SQL comparison module, both the first and second comparisons only require constructing and executing the comparison SQL statements to obtain the difference data. The first comparison uses the expected data as the baseline, filtering by ensuring the primary keys of the comparison tables in the expected and result databases are equal. A supplementary query (+) is used in the filter condition to retrieve all cases where the primary keys are equal or the expected primary keys do not match. For each field in these cases, a field query is performed to check for equality between the expected and result tables. If equal, either the expected or the result value is displayed; if not equal, the two values are joined using an inequality sign and displayed. Alternatively, the supplementary query can directly display the expected value. The second query uses the result data as the baseline, directly querying for cases where the result primary key is not the expected primary key. The displayed fields are then directly set to the result primary key.
[0057] Once the memory comparison module or SQL comparison module completes the comparison, the Excel export module begins its work. First, it exports the expected table data and the result table data as Excel worksheets, saving each table as a separate sheet with special color rendering for the primary keys. The expected table is exported as one file, and the result table as another. Next, it exports the comparison differences, again with each table's differences on a separate sheet, using different colors for primary keys, differences, and row numbers. During export, if the previous comparison module was a memory comparison module, it exports directly from memory; if the previous comparison module was an SQL comparison module, the results must first be output to memory before being exported from memory.
[0058] In some instances, combined Figure 1 In this case, the user only needs to fill in the database type, expected database address, and result database address, and then perform the save or run operation. At this time, the automated expected verification system runs normally and will not generate error messages.
[0059] In other instances, combined Figure 1 In this case, the user fills in the database type, expected database address, result database address, characteristics of the table names to be compared, the table names to be compared, and the primary key of the table to be compared. At this time, the automated expected verification system runs normally and does not generate any errors, but the characteristics of the table names to be compared have no effect in the subsequent process.
[0060] In some instances, the user fails to fill in one or more of the database type, expected database address, and result database address. In such cases, the automated expectation verification system will be unable to perform normal saving or any subsequent work.
[0061] In some instances, combined Figure 2 If the expected database address entered by the user is faulty and cannot be connected normally, the connectivity test module will return an error message to the user and will not proceed with any further work.
[0062] In other instances, combined Figure 2 If the expected database and the result database filled in by the user can be connected normally, the connectivity test module will return a connection success message to the user and proceed with subsequent work.
[0063] In some instances, combined Figure 3 If the user does not fill in the name of the table to be compared, but fills in the characteristics of the table to be compared, the comparison preparation module first queries all table names that meet the conditions based on the characteristics of the table names to be compared. Then it iterates through the table names and performs the same query operation for each table to obtain the array of comparison table names, the primary key corresponding to the comparison table name, the comparable fields, the additional fields in the expected database corresponding table, and the additional fields in the result database corresponding table.
[0064] In another instance, combined Figure 3 If the user does not fill in the table names to be compared or the characteristics of the table names to be compared, the comparison preparation module directly queries all table names in the database and iterates through them, performing the same query operation on each table to obtain the array of comparison table names, the primary key corresponding to the comparison table name, the comparable fields, the additional fields in the expected database corresponding table, and the additional fields in the result database corresponding table.
[0065] In some instances, combined Figure 4 If table A exists in the expected database but not in the result database, the memory comparison module will report that table A does not exist in the result database and automatically skip table A to proceed to the comparison of the next table.
[0066] In some instances, combined Figure 4 In the expected database, if table A exists and the primary key of row 50 cannot match any data in table A of the result database, then the memory comparison module records the difference between row 50 of table A in the expected database and the expected data.
[0067] In other instances, combined Figure 4 In the expected database, there is a table A. The primary key of row 50 matches the data in row 29 of table A in the result database. At this point, the difference between the remaining fields of the two records is recorded, and the row number, primary key value and difference are recorded in the difference data.
[0068] In some instances, combined Figure 5 In the second comparison, if the primary key of row 20 in result table A does not exist in the expected row, then row 20 of result table A is recorded as the row with the most results. No other operations can be performed during SQL execution; all difference data is returned all at once after SQL execution.
[0069] In other instances, combined Figure 5 In the first comparison, if the executed SQL query finds that the primary key of row 30 of the expected table A is the same as that of row 45 of the result table A, and the values of the fields to be compared are also completely identical, then there is no difference between the two data sets, and no record is needed.
[0070] In some instances, combined Figure 6 If there are differences in Table A, the Excel output module will create a new sheet named Table A in the exported Excel file. This sheet will store all row numbers, primary keys, and differences in Table A, and will distinguish them by color.
[0071] In other instances, combined Figure 6 If there are no differences in Table B, the Excel output module will not create a new table, but will skip Table B and save the differences for the next table.
[0072] The examples given above are preferred embodiments of this application and are only used to facilitate the illustration of this application. They are not intended to limit this application in any way. Any person with ordinary knowledge in the relevant technical field who makes partial modifications or alterations to the technical content disclosed in this application without departing from the scope of the technical features disclosed in this application shall still fall within the scope of the technical features of this application.
Claims
1. An automated expectation verification system based on comparison of the entire system's total data volume, characterized in that, It includes a graphical user interface, a computing server, an information input module, a connectivity testing module, a comparison preparation module, a memory comparison module, an SQL comparison module, and an Excel output module. A graphical interface is provided to help users operate the automated expectation verification system; at the same time, all information output by the automated expectation verification system is fed back to the user through the graphical interface. The computing server is used to support the operation and calculation of various modules of the automated expected verification system, and provides communication channels for external access and data storage capabilities. The information entry module is used by the user to enter the database information of the system under test. The database information includes the database type, expected database address, result database address, characteristics of the table to be compared, the table name to be compared, and the primary key of the table to be compared. The database type supports MySQL, SQL Server, SQLite, and Oracle. The characteristics, table name, and primary key of the table to be compared are optional. The characteristics and table name to be compared are related. When the user enters the table name to be compared, the characteristics of the table name to be compared are invalid. In short, the table name to be compared has higher priority. The connectivity testing module is used to perform connectivity tests on the database address filled in by the user. The connectivity test is to test whether the target database address is reachable. Specifically, the connectivity testing module will construct the corresponding database connector according to the database type filled in by the user, and connect to the expected database address and the result database address respectively. If the connection fails, it means that the target database address is unreachable, and subsequent work cannot be carried out. At this time, feedback will be given to the user through a graphical interface. The comparison preparation module is used to process the table-related information input by the user. The table-related information includes the characteristics of the table names to be compared, the table names to be compared, and the primary keys of the tables to be compared. Based on the above information and the actual situation in the database, the comparison preparation module will organize and derive the comparison table name array, the primary keys corresponding to the comparison table names, the comparable fields, the expected additional fields in the corresponding table of the database, and the additional fields in the corresponding table of the result database. The memory comparison module is used for comparing data volumes of less than 100,000 records. This module reads the table data of the expected database and the result database into memory in sequence, and uses a multi-threaded double comparison mode to compare the differences between the corresponding tables in the expected database and the result database according to the primary key matching of each row, the multiple rows in the expected database table that cannot be matched by the primary key in the corresponding table in the result database, and the multiple rows in the result database table that cannot be matched by the primary key in the corresponding table in the expected database. The SQL comparison module is used for comparing data volumes of 100,000 or more. First, the tables in the expected database and the result database to be compared are copied to the same temporary database. Then, based on the comparison table name array, the primary key corresponding to the comparison table name, and the comparable fields prepared by the comparison preparation module, the comparison SQL is dynamically concatenated and the comparison SQL is run to obtain the difference data. The Excel output module is used to save the expected database table data, the result database table data, and the difference data obtained from the comparison. As a human-computer interface module, this module saves the data obtained from the comparison preparation module, the memory comparison module, and the SQL comparison module, and renders different data with different colors.
2. The automated expectation verification system based on full system data volume comparison according to claim 1, characterized in that, The information entry module supports different methods for determining the tables to be compared. These different methods include automatically searching all table names in the database as the tables to be compared, searching the database for matching table names based on the characteristics of the table names to be compared, and searching the database for matching table names based on the table names to be compared. The data entry module will automatically search all tables as the comparison table only when neither the feature of the table to be compared nor the table name to be compared is filled in. When both the feature of the table to be compared nor the table name to be compared is filled in, the data entry module will prioritize the table name to be compared for search and matching. The data entry module will only use the feature of the table name to be compared for search and matching when only the feature of the table name to be compared is filled in.
3. The automated expectation verification system based on full system data volume comparison according to claim 2, characterized in that, The information entry module supports four database types, including MySQL, SQL Server, SQLite, and Oracle. For different database types, the automated verification system will use different database connectors for connection work; therefore, the database used by the system under test must be one of the above four databases.
4. The automated expectation verification system based on full system data volume comparison according to claim 3, characterized in that, In the information entry module, the primary key of the comparison table is optional. If it is not filled in, the information entry module will automatically query the table primary key. If it is filled in, the primary key name of each table must be filled in using a fixed format. If only the primary key name of some tables is filled in, the primary key of the other tables will be determined by automatic query.
5. The automated expectation verification system based on full system data volume comparison according to claim 1, characterized in that, In the connectivity testing module, different database connectors will be constructed for different database types, and the corresponding connectors will be used to connect to the database address. The database address is only usable if there are no connection errors. This module needs to perform two connectivity tests in one operation: one test on the expected database and another test on the result database.
6. The automated expectation verification system based on full system data volume comparison according to claim 1, characterized in that, In the comparison preparation module, when the table name and primary key of the table to be compared are filled in, the module will construct an SQL statement to query the filled table name in both the expected database and the result database, and query the primary key of the corresponding table to determine whether the primary key of the table to be compared is correct, and query all field names of the table; after the query is completed, the array of comparison table names and the primary keys corresponding to the comparison table names are obtained, and the queries in the expected database and the result database are compared to obtain the comparable fields, the additional fields in the corresponding table of the expected database, and the additional fields in the corresponding table of the result database; In the comparison preparation module, when the primary key of the table to be compared is not filled in, the module will directly use the primary key obtained after querying the primary key as the primary key corresponding to the comparison table name for subsequent work. In the comparison preparation module, when only the feature of the table name to be compared is filled in, but the table name to be compared is not filled in, the module will use the feature of the table name to be compared as a condition when constructing the query SQL statement, and will query all tables with similar features to the table name to be compared as the tables to be compared.
7. The automated expectation verification system based on full system data volume comparison according to claim 1, characterized in that, The memory comparison module only supports data comparison of less than 100,000 data points. This module reads all table data from the expected database and the result database into memory in sequence. To ensure the comprehensiveness of the comparison and to reduce the number of comparisons, the comparison is only performed after all data has been read. That is, the comparison is full. To ensure the efficiency of the comparison, the memory comparison module is implemented in a multi-threaded manner. It determines the total order of magnitude to be compared and divides it appropriately. Each part after division is compared using a separate thread. In the memory comparison module, two full comparisons will be performed. The first comparison will determine the differences between the corresponding tables in the expected database and the result database by matching each row according to the primary key, and will also determine the multiple rows in the expected database table that cannot be matched with each row in the corresponding table in the result database by the primary key. The second comparison will determine the multiple rows in the result database table that cannot be matched with each row in the corresponding table in the expected database by the primary key.
8. The automated expectation verification system based on full system data volume comparison according to claim 1, characterized in that, The SQL comparison module supports data comparison of more than 100,000 data points. This module copies the corresponding tables of the expected database and the corresponding tables of the result database to the same temporary database, and uses SQL statements to compare them in the temporary database. The comparison SQL statement needs to be dynamically generated by concatenating the data information obtained from the comparison preparation module. The data information includes the primary key fields of the two tables and the fields to be compared between the two tables.
9. An automated expectation verification system based on full system data volume comparison according to claim 1, 7, or 8, characterized in that, Whether it's the memory comparison module or the SQL comparison module, the core of the comparison lies in determining the primary key of the table to be compared, matching the row data in the expected and result tables according to the primary key, and comparing each field of the matched row data one by one to obtain the difference of each field.
10. An automated expectation verification system based on full system data volume comparison according to claim 1, characterized in that, The Excel output module needs to save the table data of the expected database and the table data of the result database. When saving, the primary key will be rendered with different colors to distinguish them. The module also needs to save the difference data obtained from the comparison. When saving, the row number, primary key and difference need to be rendered with different colors to distinguish them.
Citation Information
Patent Citations
Method and device for full data comparison based on database, equipment and storage medium
CN111177119A
Data comparison method and system, electronic equipment and computer storage medium
CN112732678A