Database detection method and device, equipment and storage medium
By using the target test data in database detection to determine the target expected data and compare the actual change data, the problem of low detection efficiency in the prior art is solved, and efficient automatic detection of interface-related databases is realized.
Patent Information
- Application Number
- CN202411308866.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-01-10
AI Technical Summary
Existing database detection methods require testers to write a large number of verification scripts, resulting in low detection efficiency, especially when the number of database tables and fields is huge, which is time-consuming and labor-consuming.
When the target interface is regression testing, the target expected data is determined based on the target test data, and after calling the interface response, the actual change data and the target expected data are compared to achieve efficient detection of the database.
Through automated comparison, the database detection process is simplified, the technical threshold is reduced, the detection efficiency is improved, the manpower needs are reduced, and efficient detection of interface-related databases is achieved.
Smart Images

Figure CN119293012A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a database detection method, device, equipment and storage medium. Background Art
[0002] In today's software development and testing process, interface testing is a key link to ensure the correctness of interaction between systems, and its importance is self-evident. However, with the increase in business complexity, database detection after interface testing has become a heavy and time-consuming task.
[0003] Conventional database testing methods require testers to write a large number of verification scripts to compare the fields in the database one by one to verify the correctness of the database table. However, the number of tables and fields involved in the database is often large, so testers need to spend a lot of time and energy to write and maintain verification scripts, resulting in low database testing efficiency.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of this application is to provide a database detection method, device, equipment and storage medium, aiming to achieve efficient detection of the database.
[0006] To achieve the above purpose, the present application embodiment proposes a database detection method, which includes:
[0007] In the case of performing regression testing on a target interface, determining target expected data of a database associated with the target interface in this regression test according to target test data required for this regression test;
[0008] Calling the target interface to respond to the target test data, and determining the actual changed data of the database after the interface responds;
[0009] The actual changed data and the target expected data are compared to determine the detection result of the database.
[0010] In one embodiment, before the step of determining target expected data of the database associated with the target interface in the regression test according to the target test data required for the regression test, the step further includes:
[0011] When the target interface responds to the target test data for the first time and the first response is successful, target expected data matching the target test data is generated according to the current changed data of the database after the interface responds for the first time.
[0012] In one embodiment, before the step of generating target expected data matching the target test data, the method further includes:
[0013] Determine the changed fields in each target field included in the current changed data;
[0014] The current changed data after removing the changed fields is determined as the target expected data.
[0015] In one embodiment, the step of determining the changed fields in each target field included in the current changed data includes:
[0016] Determine the historical data change rate of a field in the database that is of the same field type as the target field;
[0017] In the case where the historical data change rate is greater than or equal to a preset change threshold, determining the target field as a change field; or,
[0018] When the historical data change rate is less than a preset change threshold, the target field is determined to be a non-changing field.
[0019] In one embodiment, the step of comparing the actual changed data with the target expected data to determine the detection result of the database includes:
[0020] Comparing the data belonging to the same field type in the actual changed data and the target expected data, and determining the data similarity between the actual changed data and the target expected data;
[0021] When the data similarity is greater than or equal to a preset similarity threshold, determining that the detection result of the database is detection passed; or,
[0022] When the data similarity is less than a preset similarity threshold, it is determined that the detection result of the database is detection failure.
[0023] In one embodiment, after the step of determining the detection result of the database, the method further includes:
[0024] When the detection result of the database is that the detection fails, the target interface is determined as a suspected defective interface, and an abnormal prompt signal is output.
[0025] In one embodiment, before the step of determining target expected data of the database associated with the target interface in the regression test according to the target test data required for the regression test, the step further includes:
[0026] According to the received regression test instruction for the target interface, target test data is determined from historical test data of the target interface.
[0027] In addition, to achieve the above-mentioned purpose, the embodiment of the present application further proposes a database detection device, which is applied to an electronic device and includes:
[0028] A determination module is configured to determine target expected data of a database associated with the target interface in this regression test according to target test data required for this regression test when a regression test is performed on the target interface;
[0029] A calling module is configured to call the target interface to respond to the target test data and determine the actual changed data of the database after the interface responds;
[0030] The comparison module is configured to compare the actual changed data with the target expected data to determine the detection result of the database.
[0031] In addition, to achieve the above-mentioned purpose, an embodiment of the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the database detection method described above.
[0032] In addition, to achieve the above-mentioned purpose, an embodiment of the present application further proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the database detection method described above are implemented.
[0033] In addition, to achieve the above-mentioned purpose, an embodiment of the present application further proposes a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the database detection method described above are implemented.
[0034] One or more technical solutions proposed in the embodiments of the present application have at least the following technical effects: by determining the target expected data of the database associated with the target interface in this regression test according to the target test data required for this regression test when performing regression testing on the target interface; and then during the regression test, calling the target interface to respond to the target test data, and determining the actual change data of the database after the interface responds; and then comparing the actual change data with the target expected data, the detection result of the database can be obtained, and efficient detection of the database associated with the interface can be achieved. The embodiments of the present application take into account that when the same test data is used to test the interface, the table data in the database associated with the interface should be the same; therefore, the embodiments of the present application pre-store the expected table data (i.e., target expected data) of the database associated with the interface when the target interface is tested by the target test data, and then when the target interface is regression tested, it is only necessary to call the target expected data that matches the target test data as a reference, and compare it with the actual change data obtained in the regression test, so as to achieve automatic and efficient detection of the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0037] Figure 1 A schematic diagram of a process flow provided for the first embodiment of the database detection method of the present application;
[0038] Figure 2 A schematic diagram of the process flow provided for the second embodiment of the database detection method of the present application;
[0039] Figure 3 This is a flow chart of a more complete embodiment of the present application;
[0040] Figure 4 This is a schematic diagram of the framework structure of the database detection device in the embodiment of the present application;
[0041] Figure 5 Schematic diagram of the device structure of the hardware operating environment of the electronic device involved in the database detection method in the embodiment of the present application.
[0042] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0043] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0044] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0045] In conventional technologies, database testing requires testers to write a large number of verification scripts and then compare the fields in the database one by one to verify the correctness of the database table. However, the number of tables and fields involved in the database is often large, so testers need to spend a lot of time and energy to write and maintain verification scripts, resulting in low database testing efficiency.
[0046] The embodiment of the present application provides a solution, by determining the target expected data of the database associated with the target interface in this regression test according to the target test data required for this regression test when performing regression testing on the target interface; then during the regression test, the target interface is called to respond to the target test data, and the actual change data of the database after the interface responds is determined; then the actual change data and the target expected data are compared to obtain the detection result of the database, and efficient detection of the database associated with the interface is achieved. The embodiment of the present application takes into account that when the same test data is used to test the interface, the table data in the database associated with the interface should be the same; therefore, the embodiment of the present application pre-stores the expected table data (i.e., target expected data) of the database associated with the interface when the target interface is tested by the target test data, and then when the target interface is regression tested, it is only necessary to call the target expected data that matches the target test data as a reference, and compare it with the actual change data obtained in the regression test, so as to achieve automatic and efficient detection of the database.
[0047] Reference Figure 1 , Figure 1 This is a flowchart of the first embodiment of the database detection method of the present application.
[0048] It should be noted that the execution subject of the database detection method may be an electronic device, and the electronic device may be a local device or a network device, which is not limited in this embodiment. For the sake of convenience, the following description of each embodiment is omitted. The database detection method includes:
[0049] Step S10, in the case of performing regression testing on the target interface, determining target expected data of the database associated with the target interface in this regression test according to target test data required for this regression test;
[0050] It should be understood that the interface refers to the point of interaction between different components in the software system. Different components use the interface to transfer and share data, which defines how software components communicate with each other. Interface testing is a key link to ensure that the various components of the system can correctly and effectively interact with each other. The test content may include: verifying whether the interface input parameters are correctly received and processed, checking whether the interface is executed according to the expected functional logic, verifying whether the output results of the interface meet expectations, etc. Therefore, on the basis of the successful implementation of the test interface function, it is necessary to further determine whether the table data in the database associated with the interface is correct, that is, to perform a database check.
[0051] Regression testing is mainly used to verify whether the interfaces of the software system can still work properly and no new errors are introduced after the interfaces are updated or modified. Since it is a retest of the interface, the historical test data of the interface can be used for repeated testing in regression testing.
[0052] In a feasible embodiment, when performing regression testing on the target interface, the target test data required for this regression test is determined, and the target expected data of the database associated with the target interface is obtained based on the target test data, wherein the target expected data is the expected table data of the database when the interface successfully responds to the target test data.
[0053] In a feasible implementation manner, before the step of determining target expected data of the database associated with the target interface in the regression test in step S10 according to the target test data required for the regression test, the method further includes:
[0054] Step S11 : determining target test data from historical test data of the target interface according to the received regression test instruction for the target interface.
[0055] In a feasible embodiment, in order to improve the efficiency of checking the database in regression testing, the target test data is determined from the historical test data of the target interface according to the received regression test instruction for the target interface. By using the historical test data of the target interface, it is ensured that the expected data matching it is pre-stored.
[0056] Step S20, calling the target interface to respond to the target test data, and determining the actual changed data of the database after the interface responds;
[0057] In a feasible embodiment, the target interface is called to respond to the target test data to implement regression testing of the target interface and obtain the actual table data (ie, actual changed data) in the database after the interface responds.
[0058] Exemplarily, the target interface is called to respond to the target test data, and when the interface response is successful, the actual changed data of the database after the interface response is determined; when the interface response fails, it can be determined that the detection result of the database is failure to pass the test.
[0059] Step S30, comparing the actual changed data with the target expected data to determine the detection result of the database.
[0060] In a feasible embodiment, since the regression test for the target interface uses the same test data as the historical interface test, the table data in the database should be the same, and then the test results of the database in this interface test can be quickly determined by comparing the actual change data of the database with the target expected data. Compared with conventional testing methods, the embodiment of the present application simplifies the difficulty of checking the database associated with the interface. Testers do not need to write detailed verification scripts when checking the database, which not only lowers the technical threshold of the test, but also reduces manpower requirements, greatly improving the detection efficiency of the database.
[0061] In this embodiment, by performing regression testing on the target interface, according to the target test data required for this regression test, the target expected data of the database associated with the target interface in this regression test is determined; then during the regression test, the target interface is called to respond to the target test data, and the actual change data of the database after the interface responds is determined; then the actual change data and the target expected data are compared to obtain the detection result of the database, and efficient detection of the database associated with the interface is achieved. The embodiment of the present application takes into account that when the same test data is used to test the interface, the table data in the database associated with the interface should be the same; therefore, the embodiment of the present application pre-stores the expected table data (i.e., target expected data) of the database associated with the interface when the target interface is tested by the target test data, and then when the target interface is regression tested, it is only necessary to call the target expected data that matches the target test data as a reference, and compare it with the actual change data obtained in the regression test, so as to achieve automatic and efficient detection of the database.
[0062] Based on the above first embodiment, a second embodiment of the database detection method of the present application is proposed. In this embodiment, before the step of determining the target expected data of the database associated with the target interface in this regression test in step S10 according to the target test data required for this regression test, the method further includes:
[0063] Step S12, when the target interface responds to the target test data for the first time and the first response is successful, generating target expected data matching the target test data according to the current change data of the database after the interface responds for the first time.
[0064] In a feasible embodiment, when the target interface is tested for the first time using target test data and the first test is successful (i.e., the first response is successful), the current change data of the database after the interface responds for the first time is obtained; and then, based on the current change data, target expected data matching the target test data is generated as reference data in the subsequent regression testing process.
[0065] Exemplarily, when the target interface responds to the target test data for the first time and the first response is successful, the current change data of the database after the first response of the interface is obtained and sent to the verification terminal for the verification personnel to review the data again to ensure the accuracy of the data; and then, when the confirmation instruction of the verification terminal is received, the target expected data matching the target test data is generated according to the current change data.
[0066] In one possible implementation, referring to Figure 2 , before the step of generating target expected data matching the target test data in step S10, the method further includes:
[0067] Step S121, determining the changed fields in each target field included in the current changed data;
[0068] In a feasible embodiment, the current change data of the database usually includes a variety of different field types, among which some fields will change with each interface test, such as maintenance time, transaction time, update time, etc., while other fields will remain fixed when the test data is the same, such as transaction amount, transaction status, account type, etc. In order to prevent such dynamically changing fields from affecting the test results, the changed fields in each target field included in the current change data are determined.
[0069] Exemplarily, the changed fields in the target field may be manually screened out.
[0070] In one feasible implementation, step S121, the step of determining the changed fields in each target field included in the current changed data, includes:
[0071] Step A10, determining the historical data change rate of a field in the database that is of the same field type as the target field;
[0072] In a feasible embodiment, in order to determine the changed fields in the target field, fields of the same field type as the target field are screened out from the database; for example, if the target field is transaction time, fields of the same field type are screened out from the database, including update time, maintenance time, etc. The historical data change rate of the fields of the same field type is further determined.
[0073] Exemplarily, the field similarity between fields can be determined, and when the field similarity is greater than or equal to a preset threshold, the field is treated as a field of the same field type as the target field; or, when the field similarity is less than the preset threshold, the field is treated as a field of a different field type than the target field.
[0074] Step A20, when the historical data change rate is greater than or equal to a preset change threshold, determining the target field as a change field; or,
[0075] Step A30: When the historical data change rate is less than a preset change threshold, determine that the target field is a non-changing field.
[0076] In a feasible embodiment, the size relationship between the historical data change rate and the preset change threshold is compared. When the historical data change rate is greater than or equal to the preset change threshold, it indicates that the type field will basically change with each test, and the target field is determined to be a change field. When the historical data change rate is less than the preset change threshold, it indicates that the type field has a small degree of change in multiple tests and there are multiple repetitions, and the target field is determined to be a non-change field.
[0077] In this embodiment, the changed fields in the target data are automatically identified and removed through the historical data change rate of the same field, so as to avoid the dynamically changing fields from affecting the detection results and improve the detection accuracy of the database.
[0078] Step S122, determining the current changed data after removing the changed fields as the target expected data.
[0079] In a feasible embodiment, the current changed data after removing the changed fields is determined as the target expected data and stored for use in database detection during subsequent interface regression testing.
[0080] In this embodiment, by pre-storing the expected table data (i.e., target expected data) of the database associated with the interface when testing the target interface through target test data, when performing regression testing on the target interface, it is only necessary to call the target expected data matching the target test data as a reference and compare it with the actual change data obtained in the regression test, thereby achieving automatic and efficient detection of the database.
[0081] Based on the above first and / or second embodiments, a third embodiment of the database detection method of the present application is proposed. In this embodiment, referring to Figure 3 In step S30, the step of comparing the actual change data with the target expected data and determining the detection result of the database includes:
[0082] Step S31, comparing the data belonging to the same field type in the actual changed data and the target expected data, and determining the data similarity between the actual changed data and the target expected data;
[0083] In a feasible embodiment, the data belonging to the same field type in the actual change data and the target expected data are compared to obtain the similarity between the data of the same field type, and then the data similarity between the actual change data and the target expected data can be determined by summing, averaging, etc.
[0084] Step S32, when the data similarity is greater than or equal to the preset similarity threshold, determining the detection result of the database as detection passed; or,
[0085] Step S33: when the data similarity is less than a preset similarity threshold, determine that the detection result of the database is detection failure.
[0086] In a feasible embodiment, when the data similarity is greater than or equal to the preset similarity threshold, it indicates that the similarity between the actual change data and the target expected data is high, and the detection result of the database is determined to be passed. When the data similarity is less than the preset similarity threshold, it indicates that the similarity between the actual change data and the target expected data is low and the difference is large, and the detection result of the database is determined to be failed.
[0087] It should be understood that the preset similarity threshold can be set according to the actual situation, for example, 100%, 99%, 98%, 95%, 90%, etc. If the preset similarity threshold is set to 100%, the actual change data and the target expected data need to be exactly the same. If the preset similarity threshold is set to less than 100%, a certain fault tolerance can be provided to avoid the target expected data containing some changed fields, resulting in misjudgment of the results, thereby improving the accuracy of database detection.
[0088] In a feasible implementation manner, after the step of determining the detection result of the database in step S30, the method further includes:
[0089] Step S34, when the detection result of the database is that the detection fails, the target interface is determined as a suspected defective interface and an abnormal prompt signal is output.
[0090] In a feasible embodiment, when the detection result of the database is that the detection fails, the target interface is determined as a suspected defective interface, and an abnormal prompt signal is output to prompt the inspector to conduct a manual check. Furthermore, the actual change data can also be added to a preset suspected defect tracking table and highlighted with a preset color to facilitate the tester to conduct in-depth investigation and follow-up.
[0091] The present application embodiment provides a database detection device, referring to Figure 4 , the device is applied to electronic equipment, the device comprises:
[0092] The determination module 10 is configured to determine the target expected data of the database associated with the target interface in the regression test according to the target test data required for the regression test when the regression test is performed on the target interface;
[0093] The calling module 20 is configured to call the target interface to respond to the target test data and determine the actual changed data of the database after the interface responds;
[0094] The comparison module 30 is configured to compare the actual changed data with the target expected data to determine the detection result of the database.
[0095] The database detection device provided in the embodiment of the present application adopts the database detection method in the above embodiment to achieve efficient detection of the database. Compared with conventional technology, the beneficial effects of the database detection device provided in the embodiment of the present application are the same as the beneficial effects of the database detection method provided in the above embodiment, and other technical features in the database detection device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0096] An embodiment of the present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the database detection method in the above-mentioned embodiment 1.
[0097] Reference below Figure 5 , respectively show the structural schematic diagrams of electronic devices suitable for implementing the embodiments of the present application. The electronic devices in the embodiments of the present application may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0098] like Figure 5As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0099] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0100] The electronic device provided in the embodiment of the present application adopts the database detection method in the above embodiment to achieve efficient detection of the database. Compared with conventional technology, the beneficial effects of the electronic device provided in the embodiment of the present application are the same as the beneficial effects of the database detection method provided in the above embodiment, and other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0101] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0102] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0103] An embodiment of the present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the database detection method in the above embodiment.
[0104] The computer-readable storage medium provided in the embodiment of the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium that includes or stores a program that can be used by or in combination with an instruction execution system, system or device. The program code included on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0105] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0106] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: when performing regression testing on the target interface, determines the target expected data of the database associated with the target interface in this regression test according to the target test data required for this regression test; calls the target interface to respond to the target test data, and determines the actual change data of the database after the interface responds; compares the actual change data with the target expected data to determine the detection result of the database.
[0107] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0108] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code includes one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0109] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0110] The readable storage medium provided in the embodiment of the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned database detection method, and can realize efficient detection of the database. Compared with conventional technologies, the beneficial effects of the computer-readable storage medium provided in the embodiment of the present application are the same as the beneficial effects of the database detection method provided in the above-mentioned embodiment, and will not be repeated here.
[0111] The above are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A database detection method, characterized in that: The method includes: In the case of performing regression testing on a target interface, determining target expected data of a database associated with the target interface in this regression test according to target test data required for this regression test; Calling the target interface to respond to the target test data, and determining the actual changed data of the database after the interface responds; The actual changed data and the target expected data are compared to determine the detection result of the database.
2. The method according to claim 1, characterized in that Before the step of determining target expected data of the database associated with the target interface in the regression test according to the target test data required for the regression test, the step further includes: When the target interface responds to the target test data for the first time and the first response is successful, target expected data matching the target test data is generated according to the current changed data of the database after the interface responds for the first time.
3. The method according to claim 2, characterized in that Before the step of generating target expected data matching the target test data, the method further includes: Determine the changed fields in each target field included in the current changed data; The current changed data after removing the changed fields is determined as the target expected data.
4. The method according to claim 3, characterized in that The step of determining the changed fields in each target field included in the current changed data comprises: Determine the historical data change rate of a field in the database that is of the same field type as the target field; In the case where the historical data change rate is greater than or equal to a preset change threshold, determining the target field as a change field; or, When the historical data change rate is less than a preset change threshold, the target field is determined to be a non-changing field.
5. The method according to claim 1, characterized in that The step of comparing the actual changed data with the target expected data to determine the detection result of the database includes: Comparing the data belonging to the same field type in the actual changed data and the target expected data, and determining the data similarity between the actual changed data and the target expected data; When the data similarity is greater than or equal to a preset similarity threshold, determining that the detection result of the database is detection passed; or, When the data similarity is less than a preset similarity threshold, it is determined that the detection result of the database is detection failure.
6. The method according to claim 1, characterized in that After the step of determining the detection result of the database, the method further includes: When the detection result of the database is that the detection fails, the target interface is determined as a suspected defective interface, and an abnormal prompt signal is output.
7. The method according to claim 1, characterized in that Before the step of determining target expected data of the database associated with the target interface in the regression test according to the target test data required for the regression test, the step further includes: According to the received regression test instruction for the target interface, target test data is determined from historical test data of the target interface.
8. A database detection device, characterized in that: The device comprises: A determination module is configured to determine target expected data of a database associated with the target interface in this regression test according to target test data required for this regression test when a regression test is performed on the target interface; A calling module is configured to call the target interface to respond to the target test data and determine the actual changed data of the database after the interface responds; The comparison module is configured to compare the actual changed data with the target expected data to determine the detection result of the database.
9. An electronic device, characterized in that: The electronic device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the database detection method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the database detection method according to any one of claims 1 to 7 are implemented.