Automatic interface testing method, system and equipment for automatically retrieving data table change and medium

By automatically retrieving data table changes and alerting in automated interface testing, the problem of test cases failure caused by business changes in the existing technology is solved, and more efficient and accurate automated interface testing is achieved.

CN119862120APending Publication Date: 2025-04-22JIANGSU HONGXIN SYST INTEGRATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411902200.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

The existing automation interface testing methods cannot promptly detect data table changes caused by business changes in the system under test, resulting in the failure of the automation test cases and not being detected.

Method used

By executing data initialization scripts, deploying test databases in containerized, inserting initialization data, and automatically retrieving data table changes in automated interface tests, comparing the differences between table names and field attributes, recording exception logs, alerting testers in time and correcting test cases.

Benefits of technology

It realizes timely discovering interface problems of the system under test, correcting invalid automated interface test cases, and improving the quality and accuracy of automated interface tests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862120A_ABST
    Figure CN119862120A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic interface testing method, system and device for automatically retrieving data table changes and a medium. The method comprises the following steps that a data initialization script of a tested system is executed, a new testing database is deployed in a containerized mode, and initialization data is inserted; after the data initialization script is executed, the current table name and the field attribute of each table are compared with the expected values of the archived table name and field attribute, and if the comparison result is different, an alarm is given to prompt a tester to check; after the execution check of the to-be-initialized script is correct, a new round of automatic interface test cases is executed, and after each test case is executed, the script sequentially executes query of sql statements of full-table data aiming at each data table, calculates a hash value based on a query result, and compares the hash value with an expected hash value of the query result of the test case. According to the method, the interface problem of the tested system can be found in time, the invalid automatic test case is corrected, and the quality of the automatic interface test is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and in particular to an automated interface testing method, system, equipment and medium for automatically retrieving data table changes. Background Art

[0002] The automated testing technology in software testing is to save the investment in subsequent testing of the same interface by writing automated test cases for the interface. Compared with humans, automated test scripts are less likely to have incorrect operations and missed tests, which can greatly improve testing efficiency and quality.

[0003] Common automated interface tests generally only focus on whether the input parameters and return values ​​when calling the interface meet expectations. Sometimes the return value has not changed, but the business has changed. At this time, the automated test case has become invalid, but the automated testing platform is not aware of it. Summary of the invention

[0004] When the business of the system under test changes, the data table will usually change, which is mainly reflected in the changes of table structure, table field attributes, and data record addition, deletion, modification and query. Based on this, the present invention proposes an automated interface testing method, system, equipment and medium for automatically retrieving data table changes, so as to timely discover interface problems of the system under test, correct invalid automated test cases, and improve the quality of automated interface testing.

[0005] To achieve the above purpose, the technical solution provided by the present invention is:

[0006] The first aspect of the present application provides an automated interface testing method for automatically retrieving data table changes, comprising the following steps:

[0007] Execute the data initialization script of the system under test, deploy the new test database in a containerized manner, and insert the initialization data;

[0008] After executing the data initialization script, the current table name and field attributes of each table are compared with the archived table name and expected values ​​of field attributes. If there are differences, an alarm will be issued to prompt the tester to check;

[0009] After the initialization script is executed and verified to be correct, a new round of automated interface test cases is executed. After each test case is executed, the script executes the SQL statement to query the entire table data for each data table in turn, calculates the hash value based on the query result, and compares it with the expected hash value of the query result of this test case. If they are different, they are recorded in the exception log. If this test case cannot be found in the latest round of archived test cases, the test case information, query results and hash value are recorded in the new log.

[0010] To optimize the above technical solutions, the specific measures taken also include:

[0011] The current table name and field attributes of each table are compared with the expected values ​​of the archived table names and field attributes. If there are differences, the alarm will clearly indicate the specific table name and specific fields involved in the change, and clearly list the differences between the expected value data and the current data, so that testers can evaluate the impact.

[0012] Furthermore, when the tester checks, if the table changes do not affect subsequent automated test cases, the tester can choose to continue execution, and the new table name and table field attributes will be used as expected values ​​for the next round of testing; if the table changes affect subsequent automated test cases, the tester can know and modify the test cases in time.

[0013] Furthermore, in some cases, if a business test item is composed of multiple interface test cases, and one of the test cases executes abnormally, the subsequent steps are skipped and the business function that failed the test is recorded in the exception log.

[0014] Furthermore, according to the test steps and processes of the automated interface test, after each business function test is completed, a cleanup script is called to restore the test database to an initialized state.

[0015] After all test cases in a round are executed, they are as follows according to the execution status:

[0016] (1) If both the exception log and the new log are empty, the test ends;

[0017] (2) If the newly added log contains data, the tester will check it:

[0018] Test cases, query results, and hash values ​​that meet test expectations are selected by testers and filed in the test case expected values;

[0019] After the tester selects the problematic test cases, they are submitted to the test case set to be modified, and the business functions that failed the test are also marked;

[0020] (3) If there is data in the exception log, the tester will check it:

[0021] If the abnormal information is verified to be normal, the data table query results of the new test case execution will be archived into the test case expected value, overwriting the original expected value;

[0022] After checking the abnormal information, the test cases that are indeed problematic are checked by the tester and submitted to the test case set to be modified. The business functions that failed the test are also marked.

[0023] Furthermore, the automated testing script automatically assigns the modification requirements of the corresponding test cases to the corresponding testers according to the author information of each test case in the test case set to be modified, and notifies them via email. Both the email and the modification work order will give the expected query results and current query results of this test case, making it convenient for testers to quickly locate and modify interface test cases.

[0024] Furthermore, after the tester modifies the interface test case and executes the modified test case, the test case involving the business function that failed the test will execute all the test cases involved in this business function as a whole. The data table query results after the test case is executed will be archived into the expected value of the table data query result of the test case after verification by the tester, overwriting the original expected value.

[0025] A second aspect of the present application provides an automated interface testing system for automatically retrieving data table changes, comprising:

[0026] The data initialization module is used to execute the data initialization script of the system under test, deploy the new test database in a containerized manner, and insert the initialization data;

[0027] The interface test execution module is used to execute interface test cases in sequence according to the business functions of the system under test;

[0028] The test data comparison module is used to compare the current table name and field attributes of each table with the expected values ​​of the archived table name and field attributes after executing the data initialization script. If there is a difference, an alarm will be issued to prompt the tester to check. After the initialization script is executed and checked, a new round of automated interface test cases will be executed. After each test case is executed, the script will execute the SQL statement for querying the entire table data for each data table in turn, calculate the hash value based on the query result, and compare it with the expected hash value of the query result of this test case.

[0029] The test data cleanup module is used to call the cleanup script and restore the test database to the initialization state after each business function test is completed according to the test steps and processes of the automated interface test;

[0030] The manual review module is used to forward the test results and use case modification tasks that require manual review to the corresponding review responsible person according to the configured review process; the review responsible person conducts manual review and decides whether to modify the automated interface test case.

[0031] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the automated interface testing method for automatically retrieving data table changes as described above is implemented.

[0032] A fourth aspect of the present application provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the automated interface testing method for automatically retrieving data table changes as described above.

[0033] Compared with the prior art, the present invention has the following beneficial effects:

[0034] The present invention can reduce the workload of testers, improve the stability of interface testing, improve the efficiency of interface testing, timely discover interface problems of the system under test, correct invalid automated interface test cases, improve the quality of automated interface testing, and more accurately discover business and functional problems of the system under test by automatically retrieving data table changes and automated scripts during automated interface testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a flow chart of the automatic interface testing method for automatically retrieving data table changes of the present invention.

[0036] Figure 2 It is a structural schematic diagram of the automatic interface testing system for automatically retrieving data table changes of the present invention. DETAILED DESCRIPTION

[0037] The above contents of the present invention are further described in detail below in the form of embodiments, but this should not be understood as the scope of the above subject matter of the present invention being limited to the following embodiments, and all technologies realized based on the above contents of the present invention belong to the scope of the present invention.

[0038] The present invention proposes an automatic interface testing method for automatically retrieving data table changes, comprising the following steps:

[0039] Execute the data initialization script of the system under test, deploy the new test database in a containerized manner, and insert the initialization data;

[0040] After executing the data initialization script, the current table name and field attributes of each table are compared with the archived table name and expected values ​​of field attributes. If there are differences, an alarm will be issued to prompt the tester to check;

[0041] When the tester checks, if the table changes do not affect the subsequent automated test cases, the tester can choose to continue the execution, and the new table name and table field attributes will be used as the expected values ​​for the next round of testing; if the table changes affect the subsequent automated test cases, the tester can know and modify the test cases in time;

[0042] After the initialization script is executed and verified to be correct, a new round of automated interface test cases is executed. After each test case is executed, the script executes the SQL statement to query the entire table data for each data table in turn, calculates a hash value based on the query result, and compares it with the expected hash value of the query result of this test case. If they are different, they are recorded in the exception log. If this test case cannot be found in the latest round of archived test cases, the test case information, query results and hash value are recorded in the new log.

[0043] The current table name and field attributes of each table are compared with the expected values ​​of the archived table names and field attributes. If there are differences, the alarm will clearly indicate the specific table name and specific fields involved in the change, and clearly list the differences between the expected value data and the current data, so that testers can evaluate the impact.

[0044] In some implementations, for some business function tests, a business test item is composed of multiple interface test cases. If a test case is executed abnormally, the subsequent steps are skipped and the business function that failed the test is recorded in the exception log.

[0045] According to the test steps and processes of automated interface testing, after each business function test is completed, the cleanup script is called to restore the test database to the initialization state.

[0046] After all test cases in a round are executed, they are as follows according to the execution status:

[0047] (1) If both the exception log and the new log are empty, the test ends;

[0048] (2) If the newly added log contains data, the tester will check it:

[0049] Test cases, query results, and hash values ​​that meet test expectations are selected by testers and filed in the test case expected values;

[0050] After the tester selects the problematic test cases, they are submitted to the test case set to be modified, and the business functions that failed the test are also marked;

[0051] (3) If there is data in the exception log, the tester will check it:

[0052] If the abnormal information is verified to be normal, the data table query results of the new test case execution will be archived into the test case expected value, overwriting the original expected value;

[0053] After checking the abnormal information, the test cases that are indeed problematic are checked by the tester and submitted to the test case set to be modified. The business functions that failed the test are also marked.

[0054] In some embodiments, the automated testing script automatically assigns the modification requirements of the corresponding test cases to the corresponding testers based on the author information of each test case in the test case set to be modified, and notifies them via email. Both the email and the modification work order will give the expected query results and current query results of this test case, making it convenient for testers to quickly locate and modify interface test cases.

[0055] In some implementations, after the tester modifies the interface test case and executes the modified test case, for the test case involving the business function that failed the test, all test cases involving this business function will be executed as a whole. The data table query results after the test case is executed will be archived into the expected value of the table data query result of the test case after verification by the tester, overwriting the original expected value.

[0056] An automated interface testing system that automatically retrieves data table changes, such as Figure 1 As shown, including:

[0057] The data initialization module is used to execute the data initialization script of the system under test, deploy the new test database in a containerized manner, and insert the initialization data;

[0058] The interface test execution module is used to execute interface test cases in sequence according to the business functions of the system under test to prevent historical data from affecting the comparison of data table changes;

[0059] The test data comparison module is used to compare the current table name and field attributes of each table with the expected values ​​of the archived table name and field attributes after executing the data initialization script. If there is a difference, an alarm will be issued to prompt the tester to check. After the initialization script is executed and checked, a new round of automated interface test cases will be executed. After each test case is executed, the script will execute the SQL statement for querying the entire table data for each data table in turn, calculate the hash value based on the query result, and compare it with the expected hash value of the query result of this test case.

[0060] Among them, after each interface test case is executed, the "fields that need to be filtered" are eliminated, the current table data is queried, the hash value is calculated, and compared with the archived expected hash value. The efficiency is improved by comparing the hash values; if there is a difference in the comparison, the tester is prompted to check.

[0061] The test data cleaning module is used to call the cleaning script after each business function test is completed according to the test steps and processes of the automated interface test, and restore the test database to the initial state to prevent junk data from interfering with the test;

[0062] The manual review module is used to forward the test results and use case modification tasks that require manual review to the corresponding review responsible person according to the configured review process; the review responsible person conducts manual review and decides whether to modify the automated interface test case.

[0063] The present invention also proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the automated interface testing method for automatically retrieving data table changes as described above is implemented.

[0064] The present invention provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the automatic interface testing method for automatically retrieving data table changes as described above.

[0065] The technical solution of the present invention is further described in detail below in conjunction with specific embodiments:

[0066] See also Figure 1 , an automated interface testing method for automatically retrieving data table changes, comprising:

[0067] Step S100:

[0068] Execute the data initialization script of the system under test, deploy a new test database in a containerized manner, and insert initialization data to prevent historical data from affecting the comparison of data table changes.

[0069] Compare the current table name and field attributes of each table (including field name, data type, field length, constraints, default values, etc.) with the archived table name and expected values ​​of field attributes. If there are differences, an alarm will be issued to prompt the tester to check. The alarm will clearly indicate the specific table name and specific fields involved in the change, and clearly list the differences between the expected value data and the current data, so that the tester can evaluate the impact.

[0070] If the table changes do not affect subsequent automated test cases, the tester can choose to continue execution, and the new table name and table field attributes will be used as expected values ​​for the next round of testing.

[0071] If table changes affect subsequent automated test cases, testers can be informed and modify the test cases in a timely manner.

[0072] After the initialization script is executed and verified to be correct, a new round of automated interface test cases is executed.

[0073] Step S200:

[0074] After executing each test case, the script executes the SQL statement for querying the entire table data for each data table in turn (fields marked as "need to be filtered" will not be queried, such as auto-increment primary key ID, creation time, update time, etc.), calculates a hash value based on the query result, and compares it with the expected hash value of the query result of this test case. If they are different, they are recorded in the exception log; if this test case cannot be found in the latest round of archived test cases, the test case information, query results and hash value are recorded in the new log.

[0075] For some business function tests, a business test item is composed of multiple interface test cases. If one of the test cases is executed abnormally, the subsequent steps will be skipped, and the business function that failed the test will be recorded in the exception log.

[0076] According to the test steps and processes of automated interface testing, after each business function test is completed, the cleanup script is called to restore the test database to the initialization state.

[0077] Step S300:

[0078] After all test cases in this round are executed:

[0079] If the newly added log contains data, it will be checked by the tester:

[0080] ① Test cases, query results and hash values ​​that meet test expectations are selected by the tester and archived in the test

[0081] For example, expected value;

[0082] ② After the tester selects the problematic test cases, they are submitted to the test case set to be modified, and the business functions that failed the test are also marked;

[0083] If there is data in the exception log, the tester will check it:

[0084] ① If the abnormal information is verified to be normal, the data table query results of the new test case execution will be archived into the test case expected value, overwriting the original expected value;

[0085] ② After checking the abnormal information, the test cases that are indeed problematic are selected by the tester and submitted to the test case set to be modified. The business functions that failed the test are also marked.

[0086] Step S400:

[0087] The automated test script automatically sends the modification requirements of the corresponding test cases to the corresponding testers based on the author information of each test case in the test case set to be modified, and notifies them via email. Both the email and the modification work order will give the expected query results and current query results of this test case, making it convenient for testers to quickly locate and modify interface test cases.

[0088] After the tester modifies the interface test case and executes the modified test case, for the test case involving the business function that failed the test, all the test cases involving this business function will be executed as a whole. The data table query results after the test case is executed will be archived into the expected value of the table data query result of the test case after verification by the tester, overwriting the original expected value.

[0089] Step S500:

[0090] After the test case is executed, if both the exception log and the new log are empty, this round of testing ends.

[0091] Relevant interface test cases are archived, and the data table changes of this round of interface testing are archived as a baseline for comparison in the next round of testing.

[0092] In the embodiments disclosed in the present application, the computer storage medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. The computer storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above. More specific examples of computer storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.

[0093] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any technician familiar with the profession, without departing from the scope of the technical solution of the present invention, according to the technical essence of the present invention, any simple modification, equivalent replacement and improvement made to the above embodiment still falls within the protection scope of the technical solution of the present invention.

Claims

1. An automated interface testing method for automatically retrieving data table changes, characterized in that: The following steps are involved: Execute the data initialization script of the system under test, deploy the new test database in a containerized manner, and insert the initialization data; After executing the data initialization script, the current table name and field attributes of each table are compared with the archived table name and expected values ​​of field attributes. If there are differences, an alarm will be issued to prompt the tester to check; After the initialization script is executed and verified to be correct, a new round of automated interface test cases is executed. After each test case is executed, the script executes the SQL statement to query the entire table data for each data table in turn, calculates the hash value based on the query result, and compares it with the expected hash value of the query result of this test case. If they are different, they are recorded in the exception log. If this test case cannot be found in the latest round of archived test cases, the test case information, query results and hash value are recorded in the new log.

2. The automated interface testing method for automatically retrieving data table changes according to claim 1, characterized in that: The current table name and field attributes of each table are compared with the expected values ​​of the archived table names and field attributes. If there are differences, the alarm will clearly indicate the specific table name and specific fields involved in the change, and clearly list the differences between the expected value data and the current data, so that testers can evaluate the impact.

3. The automated interface testing method for automatically retrieving data table changes according to claim 1, characterized in that: When the tester checks, if the table changes do not affect subsequent automated test cases, the tester can choose to continue execution, and the new table name and table field attributes will be used as expected values ​​for the next round of testing; if the table changes affect subsequent automated test cases, the tester can know and modify the test cases in time.

4. The automated interface testing method for automatically retrieving data table changes according to claim 1, characterized in that: According to the test steps and processes of automated interface testing, after each business function test is completed, the cleanup script is called to restore the test database to the initialization state.

5. The automated interface testing method for automatically retrieving data table changes according to claim 1, characterized in that: After all test cases in a round are executed, they are as follows according to the execution status: (1) If both the exception log and the new log are empty, the test ends. (2) If the newly added log contains data, the tester will check it: Test cases, query results, and hash values ​​that meet test expectations are selected by testers and filed in the test case expected values; After the tester selects the problematic test cases, they are submitted to the test case set to be modified, and the business functions that failed the test are also marked; (3) If there is data in the exception log, the tester will check it: If the abnormal information is verified to be normal, the data table query results of the new test case execution will be archived into the test case expected value, overwriting the original expected value; After checking the abnormal information, the testers will check the test cases that are indeed problematic and submit them to the test case set to be modified. The business functions that failed the test will also be marked.

6. The automated interface testing method for automatically retrieving data table changes according to claim 1, characterized in that: The automated test script automatically sends the modification requirements of the corresponding test cases to the corresponding testers based on the author information of each test case in the test case set to be modified, and notifies them via email. Both the email and the modification work order will give the expected query results and current query results of this test case, making it convenient for testers to quickly locate and modify interface test cases.

7. The automated interface testing method for automatically retrieving data table changes according to claim 1, characterized in that: After the tester modifies the interface test case and executes the modified test case, for the test case involving the business function that failed the test, all the test cases involving this business function will be executed as a whole. The data table query results after the test case is executed will be archived into the expected value of the table data query result of the test case after verification by the tester, overwriting the original expected value.

8. An automated interface testing system for automatically retrieving data table changes, characterized in that: include: The data initialization module is used to execute the data initialization script of the system under test, deploy the new test database in a containerized manner, and insert the initialization data; The interface test execution module is used to execute interface test cases in sequence according to the business functions of the system under test; The test data comparison module is used to compare the current table name and field attributes of each table with the expected values ​​of the archived table name and field attributes after executing the data initialization script. If there is a difference, an alarm will be issued to prompt the tester to check. After the initialization script is executed and checked, a new round of automated interface test cases will be executed. After each test case is executed, the script will execute the SQL statement for querying the entire table data for each data table in turn, calculate the hash value based on the query result, and compare it with the expected hash value of the query result of this test case. The test data cleanup module is used to call the cleanup script and restore the test database to the initialization state after each business function test is completed according to the test steps and processes of the automated interface test; The manual review module is used to forward the test results and use case modification tasks that require manual review to the corresponding review responsible person according to the configured review process; The person responsible for reviewing the test will conduct a manual review and decide whether to modify the automated interface test cases.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the automated interface testing method for automatically retrieving data table changes as described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the automated interface testing method for automatically retrieving data table changes according to any one of claims 1 to 7.