A database testing method, apparatus, device and medium
Patent Information
- Application Number
- CN202610901268.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-22
- Publication Date
- 2026-10-13
AI Technical Summary
[0004]本发明实施例提供一种数据库测试方法、装置、设备及介质,以解决如何提高数据库测试的可视化程度,以便于数据库测试分析的问题
[0009]上述数据库测试方法,通过获取测试场景描述信息,根据预设测试配置参数,启动M个业务执行进程和N个校验进程,将预设业务测试用例分配给M个业务执行进程,以及将预设校验测试用例分配给N个校验进程,M个业务执行进程对预设业务测试用例进行并发执行,每个业务执行进程根据预设业务测试用例对对应目标数据库节点上的数据执行业务操作,在M个业务进程并发执行过程中,N个校验进程根据预设校验测试用例,实时获取在每个目标数据库节点上执行业务操作后所产生的数据,对在每个目标数据库节点上执行业务操作后所产生的数据进行一致性校验,得到校验结果,若校验结果不满足预设条件,则冻结当前测试环境,获取并输出M个业务执行进程和N个校验进程的当前上下文信息。
Smart Images

Figure CN122903306A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of database technology, and in particular to a database testing method, apparatus, device, and medium. Background Technology
[0002] Transaction consistency is one of the core characteristics of database system management, ensuring that the database maintains data correctness and integrity even when multiple transactions are executed concurrently or when system failures occur. With the rapid development of cloud computing, big data analytics, and distributed systems, transaction consistency issues have become increasingly prominent in complex environments, placing higher demands on database consistency testing. Existing technologies for transaction consistency testing can employ the following methods: obtaining the execution order of each Structured Query Language (SQL) statement, starting a predetermined number of threads based on this execution order, concurrently executing at least one transaction's SQL statements, obtaining the execution results of the SQL statements, and then performing transaction consistency testing on the database under test based on these results. However, the above testing methods only focus on the eventual consistency of transactions, that is, only verifying whether the data state after the transaction execution meets expectations, which is not conducive to tracing the testing process and analyzing the root causes of problems.
[0003] Therefore, improving the visualization of database testing to facilitate database test analysis has become an urgent problem to be solved. Summary of the Invention
[0004] This invention provides a database testing method, apparatus, device, and medium to address the problem of how to improve the visualization of database testing to facilitate database test analysis.
[0005] A database testing method, comprising: Obtain test scenario description information, which includes at least preset business test cases, preset verification test cases, and preset test configuration parameters; According to the preset test configuration parameters, start M business execution processes and N verification processes, assign the preset business test cases to the M business execution processes, and assign the preset verification test cases to the N verification processes, where M and N are both integers greater than 1; The M business execution processes concurrently execute the preset business test cases, and each business execution process performs business operations on the data on the corresponding target database node according to the preset business test cases; During the concurrent execution of the M business processes, the N verification processes acquire the data generated after the business operation is performed on each target database node in real time according to the preset verification test cases, and perform consistency verification on the data generated after the business operation is performed on each target database node to obtain the verification result. If the verification result does not meet the preset conditions, the current test environment is frozen, and the current context information of the M business execution processes and the N verification processes is obtained and output. The current context information is used to perform test analysis on the test process.
[0006] A database testing device, comprising: The first acquisition module is used to acquire test scenario description information, which includes at least preset business test cases, preset verification test cases, and preset test configuration parameters. The first startup module is used to start M business execution processes and N verification processes according to the preset test configuration parameters, and to assign the preset business test cases to the M business execution processes and the preset verification test cases to the N verification processes, where M and N are both integers greater than 1; The business execution module is used for the M business execution processes to concurrently execute the preset business test cases. Each business execution process performs business operations on the data on the corresponding target database node according to the preset business test cases. The consistency verification module is used to, during the concurrent execution of the M business processes, the N verification processes acquire the data generated after the business operation is performed on each target database node in real time according to the preset verification test cases, and perform consistency verification on the data generated after the business operation is performed on each target database node to obtain the verification result; The environment freezing module is used to freeze the current test environment if the verification result does not meet the preset conditions, and to obtain and output the current context information of the M business execution processes and the N verification processes. The current context information is used to perform test analysis on the test process.
[0007] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the database testing method described above.
[0008] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned database testing method.
[0009] The aforementioned database testing method obtains test scenario description information, starts M business execution processes and N verification processes according to preset test configuration parameters, assigns preset business test cases to the M business execution processes, and assigns preset verification test cases to the N verification processes. The M business execution processes execute the preset business test cases concurrently. Each business execution process performs business operations on the data on the corresponding target database node according to the preset business test cases. During the concurrent execution of the M business processes, the N verification processes obtain the data generated after the business operations are performed on each target database node in real time according to the preset verification test cases, and perform consistency verification on the data generated after the business operations are performed on each target database node to obtain the verification result. If the verification result does not meet the preset conditions, the current test environment is frozen, and the current context information of the M business execution processes and N verification processes is obtained and output.
[0010] In particular, by performing real-time consistency checks on the data generated during business execution in each target database node during the concurrent execution of preset business test cases in the business execution process, based on the verification process, it is possible to discover instantaneous data inconsistencies in the transaction execution process that traditional testing cannot detect. This improves the transparency and visualization of the testing process and establishes a complete context information tracking mechanism. When an inconsistency problem is detected, the test environment is automatically frozen and context information such as SQL execution traces, transaction status, and node logs is saved, providing comprehensive data support for problem localization. This enables timely discovery and localization of problems in the testing process, facilitating the traceability of the testing process and the analysis of the root causes of problems. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic diagram of an application environment for a database testing method according to an embodiment of the present invention; Figure 2 This is a flowchart of a database testing method according to an embodiment of the present invention; Figure 3 This is a functional architecture diagram of a database testing method according to an embodiment of the present invention; Figure 4 This is another flowchart of a database testing method in one embodiment of the present invention; Figure 5 This is a schematic diagram of a database testing device in one embodiment of the present invention; Figure 6 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation
[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] The database testing method provided in this embodiment of the invention can be applied to, for example... Figure 1 The application environment shown includes, for example: Figure 1 The diagram illustrates a client and server that communicate over a network to improve the visualization of database testing, thereby facilitating database test analysis. The client, also known as the user terminal, is the program that provides local services to the client, corresponding to the server. The client can be installed on, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0015] In one embodiment, such as Figure 2 As shown, a database testing method is provided, applied to a server as shown in Figure 1, including the following steps: Step S201: Obtain test scenario description information.
[0016] In this embodiment, the test scenario description information can refer to a data set used to define the overall database consistency test plan, including at least preset business test cases, preset verification test cases, and preset test configuration parameters. The preset business test cases can refer to test cases used to simulate business execution, the preset verification test cases can refer to test cases used to verify the consistency of data generated during business execution, and the preset test configuration parameters can refer to parameters describing the running mode of the test cases.
[0017] Specifically, based on the preset test case template, preset business test cases and preset verification test cases can be configured. The number of concurrent processes and the running time set for the preset business test cases and preset verification test cases can be obtained respectively. The number of concurrent processes and the running time set for the preset business test cases and preset verification test cases can be formed into preset test configuration parameters. The preset business test cases, preset verification test cases and preset test configuration parameters can be formed into test scenario description information.
[0018] That is, preset standardized test case templates can be used to configure preset business test cases and preset verification test cases, and pre-test cases and post-test cases can be configured for the preset business test cases and preset verification test cases. In the preset business test cases, test objects, data volume, transaction type, collision rate and collision range of different SQL positions, rollback method, rollback rate, transaction isolation level, execution plan of business coverage, consistency verification statements, etc. can be defined, and the number of concurrent processes and running time set for the preset business test cases and preset verification test cases can be obtained. The number of concurrent processes and running time are written into the configuration file as preset test configuration parameters. The preset business test cases, preset verification test cases, pre-test cases, post-test cases and preset test configuration parameters are combined to obtain test scenario description information.
[0019] Step S202: According to the preset test configuration parameters, start M business execution processes and N verification processes, assign preset business test cases to the M business execution processes, and assign preset verification test cases to the N verification processes.
[0020] Step S203: M business execution processes concurrently execute preset business test cases. Each business execution process performs business operations on the data on the corresponding target database node according to the preset business test cases.
[0021] In this embodiment, the target database node can refer to the database node in the database cluster operated by the business execution process when executing the preset business test cases, where M and N are both integers greater than 1.
[0022] Specifically, based on the number of concurrent processes in the preset test configuration parameters, M business execution processes and N verification processes are started. Preset business test cases are assigned to the M business execution processes, and preset verification test cases are assigned to the N verification processes. The M business execution processes concurrently execute the business SQL statements in the preset business test cases. Each business process maintains an independent database session, simulates concurrent access by real users, and randomly selects data on the target database node for operation based on a certain collision probability. During the execution of the business execution processes, the business SQL execution trajectory and transaction status information are recorded.
[0023] Step S204: During the concurrent execution of M business processes, N verification processes acquire the data generated after the business operations are performed on each target database node in real time according to the preset verification test cases, and perform consistency verification on the data generated after the business operations are performed on each target database node to obtain the verification result.
[0024] In this embodiment, the verification result can refer to the consistency verification result of the data generated after performing business operations on the target database node.
[0025] Specifically, during the concurrent execution of M business processes, N verification processes continuously execute verification SQL statements on each target database node according to preset verification test cases, capture the instantaneous state during transaction execution, obtain the data generated after the business operations are performed on each target database node in real time, and perform consistency verification on the data generated after the business operations are performed on each target database node, such as verifying the data sum, counting patterns and correlations, and obtain the verification results.
[0026] Step S205: If the verification result does not meet the preset conditions, freeze the current test environment, obtain and output the current context information of M business execution processes and N verification processes.
[0027] In this embodiment, the preset conditions can refer to the conditions used to determine whether the data consistency verification has passed, and the current context information can refer to the data related to the business execution process and the verification process obtained when the test environment is frozen, which may include SQL execution traces, transaction status and node logs, etc.
[0028] Specifically, if there is data that fails the consistency check, it is determined that the check result of the data does not meet the preset conditions. The current test environment is then automatically frozen, and the execution trajectory and transaction status of each business execution process and the check process, as well as the node log of each target database node, are obtained. The execution trajectory, transaction status, and node log are saved as the current context information for subsequent database test analysis.
[0029] If the consistency check of all currently acquired data passes, then return to the execution of step S204 above and continue to monitor the data consistency throughout the entire lifecycle of the business execution until the test ends.
[0030] For example, such as Figure 3 The diagram shown is a functional framework diagram of a database test provided in this embodiment. Based on this framework diagram, the overall process of the database test can be as follows: 1. Test Configuration Management: (1) Write SQL test cases according to the standardized test case template, including pre-environment preparation SQL, concurrent business SQL, consistency verification SQL and post-cleanup SQL. The test cases can define: test object, data volume, transaction type, collision rate and collision range of different positions of SQL, rollback method, rollback rate, transaction isolation level, execution plan of business coverage, consistency verification statement, etc.
[0031] (2) Specify the running mode, running time, number of concurrent users, fault type, fault triggering conditions, fault duration and recovery time of the test case in the configuration file.
[0032] (3) The test scenario assembly module automatically parses the test case content and configuration parameters, intelligently assembles them into complete test scenario description information and transmits it to the unified task scheduling center.
[0033] 2. Unified Task Scheduling Center: The unified task scheduling center receives complete test scenario configurations and starts the corresponding business execution processes, consistency verification processes, and fault injection processes according to the configurations.
[0034] 3. Concurrent execution of business operations: Multiple business execution processes concurrently execute user-defined business SQL. Each process maintains an independent database session, simulating real concurrent user access. During execution, the SQL execution trajectory and transaction status information are recorded.
[0035] 4. Consistency Verification: The consistency verification process continuously executes user-defined consistency verification SQL on each node. The verification SQL is constructed based on business rules, such as verifying data sums, counting patterns, and relationships.
[0036] (1) High-frequency checks: The consistency verification process continuously executes verification SQL on each node to capture the instantaneous state during the transaction execution process.
[0037] (2) Full process coverage: Consistency monitoring is performed throughout the entire lifecycle from the start of the transaction to the commit, not limited to the final result.
[0038] (3) Multi-node parallel verification: Simultaneously perform consistency checks on all database nodes to ensure that the data is consistent across different nodes (master / standby nodes, distributed environment, cluster multi-instance, etc.).
[0039] 5. Intelligent Fault Injection: The fault injection process monitors the business execution status and system resource usage. When the fault triggering conditions are met, it randomly selects and combines the configured fault types from the fault knowledge base to inject the fault. After the fault time is reached, it performs fault recovery.
[0040] 6. Real-time monitoring and feedback phase: When the consistency verification process detects inconsistent data results (such as query results not meeting preset conditions), it immediately triggers a rapid response mechanism, automatically freezes the current test environment, and saves complete context information, including SQL execution traces, transaction status, node logs, etc. If no inconsistency is detected, execution continues until the test is completed.
[0041] In this embodiment, by performing real-time consistency checks on the data generated during business execution in each target database node during the concurrent execution of preset business test cases in the business execution process, based on the verification process, it is possible to discover instantaneous data inconsistencies in the transaction execution process that cannot be detected by traditional testing. This improves the transparency and visualization of the testing process and establishes a complete context information tracking mechanism. When an inconsistency problem is detected, the test environment is automatically frozen and context information such as SQL execution traces, transaction status, and node logs is saved, providing comprehensive data support for problem localization. This enables timely discovery and localization of problems in the testing process, facilitating the tracing of the testing process and the analysis of the root causes of problems.
[0042] In one embodiment, such as Figure 4 As shown, a database testing method is provided, which includes the following steps before obtaining the test scenario description information in step S201 above: Step S401: Obtain preset fault data.
[0043] Step S402: Combine the number of concurrent processes and running time set in the preset business test cases and preset verification test cases, as well as the preset fault data, to form preset test configuration parameters.
[0044] Step S403: Combine the preset business test cases, preset verification test cases, and preset test configuration parameters to form test scenario description information.
[0045] In this embodiment, the fault data includes fault type, fault duration, and fault triggering conditions. Fault type can refer to the category of fault to be injected, such as CPU overload fault, memory leak fault, network latency fault, or disk input / output fault. Fault duration can refer to the length of time maintained from the start of fault injection to the end of fault recovery. Fault triggering conditions can refer to the criteria used to determine whether to perform fault injection.
[0046] Specifically, the number of concurrent processes and running time set by the preset business test cases and preset verification test cases, as well as the preset fault data, are used to form preset test configuration parameters. The preset business test cases, preset verification test cases, pre-test cases, post-test cases, and preset test configuration parameters are used to form test scenario description information.
[0047] Optionally, after obtaining the test scenario description information, the following may also be included: Based on the preset test configuration parameters, the fault injection process is started. During the concurrent execution of M business processes, the fault injection process monitors the execution status of the M business execution processes in real time. When the execution state meets the fault triggering conditions, the fault corresponding to the fault type is triggered, and the fault is restored when the fault triggering time reaches the fault duration.
[0048] That is, according to the preset test configuration parameters, the fault injection process is started. During the concurrent execution of M business processes, the fault injection process monitors the execution status in real time. For example, it monitors the usage of system resources (such as memory) during business execution. When the memory used meets a certain threshold, the corresponding fault triggering condition with memory as the trigger point is triggered. The fault injection process executes the fault corresponding to the fault type. The business execution process is executed concurrently according to the preset business test cases. The verification process performs data consistency verification on each database node according to the preset verification test cases. When the fault trigger time reaches the fault duration, fault recovery is performed.
[0049] In this embodiment, by configuring fault data, fault injection is intelligently performed during the testing process, and a real-time consistency verification mechanism is combined to detect consistency issues in fault scenarios, thereby achieving effective coverage and verification of data consistency in fault scenarios.
[0050] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0051] In one embodiment, a database testing apparatus is provided, applied to Figure 1 The server in the example corresponds one-to-one with the database testing method described in the above embodiments. For example... Figure 5 As shown, the database testing device includes a first acquisition module 51, a first startup module 52, a business execution module 53, a consistency verification module 54, and an environment freezing module 55. Detailed descriptions of each functional module are as follows: The first acquisition module 51 is used to acquire test scenario description information, which includes at least preset business test cases, preset verification test cases and preset test configuration parameters. The first startup module 52 is used to start M business execution processes and N verification processes according to the preset test configuration parameters, allocate the preset business test cases to the M business execution processes, and allocate the preset verification test cases to the N verification processes, where M and N are both integers greater than 1; Business execution module 53 is used for the M business execution processes to concurrently execute the preset business test cases, and each business execution process performs business operations on the data on the corresponding target database node according to the preset business test cases; The consistency verification module 54 is used to, during the concurrent execution of the M business processes, the N verification processes acquire the data generated after the business operation is executed on each target database node in real time according to the preset verification test cases, perform consistency verification on the data generated after the business operation is executed on each target database node, and obtain the verification result; The environment freezing module 55 is used to freeze the current test environment if the verification result does not meet the preset conditions, and to obtain and output the current context information of the M business execution processes and the N verification processes. The current context information is used to perform test analysis on the test process.
[0052] Optionally, the database testing apparatus further includes: The test case configuration module is used to configure the preset business test cases and the preset verification test cases according to the preset test case template. The second acquisition module is used to acquire the number of concurrent processes and the running time set for the preset business test case and the preset verification test case, respectively. The first configuration module is used to form the preset test configuration parameters by setting the number of concurrent processes and the running time of the preset business test cases and the preset verification test cases; The second configuration module is used to form the test scenario description information by combining the preset business test cases, the preset verification test cases, and the preset test configuration parameters.
[0053] Optionally, the database testing apparatus further includes: The third acquisition module is used to acquire preset fault data, which includes fault type, fault duration and fault triggering conditions. The third configuration module is used to form the preset test configuration parameters by combining the number of concurrent processes and the running time set by the preset business test cases and the preset verification test cases, as well as the preset fault data. The fourth configuration module is used to form the test scenario description information by combining the preset business test cases, the preset verification test cases, and the preset test configuration parameters.
[0054] Optionally, the database testing apparatus further includes: The second startup module is used to start the fault injection process according to the preset test configuration parameters. During the concurrent execution of the M business processes, the fault injection process monitors the execution status of the M business execution processes in real time. The fault injection module is used to trigger the fault corresponding to the fault type when the execution state meets the fault triggering condition, and to restore the fault when the fault triggering time reaches the fault duration.
[0055] Optionally, the aforementioned environment freezing module 55 includes: The fourth acquisition unit is used to acquire the execution trajectory of each business execution process and verification process, as well as the node log of each target database node; The fifth configuration unit is used to set the execution trajectory and the node log as the current context information.
[0056] Optionally, the database testing apparatus further includes: The loop module is used to return to the step of real-time acquisition of the data generated after the business operation is performed on each target database node if the verification result meets the preset conditions, until the test ends.
[0057] Specific limitations regarding the database testing device can be found in the limitations of the database testing method described above, and will not be repeated here. Each module in the aforementioned database testing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0058] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The database stores a first acquisition module, a first startup module, a business execution module, a consistency verification module, and an environment freezing module. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a database testing method.
[0059] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the database testing method described in the above embodiment, for example... Figure 2 As shown in S201-S205, or Figures 3 to 4 As shown, to avoid repetition, it will not be described again here. Alternatively, when the processor executes a computer program, it implements the functions of each module / unit in this embodiment of the data management device, for example, Figure 5 The functions of the first acquisition module 51, the first startup module 52, the business execution module 53, the consistency verification module 54, and the environment freeze module 55 shown are not described again here to avoid repetition.
[0060] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program implements the database testing method described in the above embodiment, for example... Figure 2 As shown in S201-S205, or Figures 3 to 4 As shown, to avoid repetition, it will not be described again here. Alternatively, when the processor executes a computer program, it implements the functions of each module / unit in this embodiment of the data management device, for example, Figure 5 The functions of the first acquisition module 51, the first startup module 52, the business execution module 53, the consistency verification module 54, and the environment freeze module 55 shown are not described again here to avoid repetition.
[0061] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0062] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0063] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A database testing method, characterized in that, include: Obtain test scenario description information, which includes at least preset business test cases, preset verification test cases, and preset test configuration parameters; According to the preset test configuration parameters, start M business execution processes and N verification processes, assign the preset business test cases to the M business execution processes, and assign the preset verification test cases to the N verification processes, where M and N are both integers greater than 1; The M business execution processes concurrently execute the preset business test cases, and each business execution process performs business operations on the data on the corresponding target database node according to the preset business test cases; During the concurrent execution of the M business processes, the N verification processes acquire the data generated after the business operation is performed on each target database node in real time according to the preset verification test cases, and perform consistency verification on the data generated after the business operation is performed on each target database node to obtain the verification result. If the verification result does not meet the preset conditions, the current test environment is frozen, and the current context information of the M business execution processes and the N verification processes is obtained and output. The current context information is used to perform test analysis on the test process.
2. The database testing method according to claim 1, characterized in that, Before obtaining the test scenario description information, the following is also included: Based on the preset test case template, the preset business test cases and the preset verification test cases are configured and obtained; Obtain the number of concurrent processes and the running time set for the preset business test cases and the preset verification test cases, respectively; The preset test configuration parameters are formed by setting the number of concurrent processes and the running time of the preset business test cases and the preset verification test cases; The preset business test cases, the preset verification test cases, and the preset test configuration parameters are used to form the test scenario description information.
3. The database testing method according to claim 1, characterized in that, Before obtaining the test scenario description information, the following is also included: Acquire preset fault data, which includes fault type, fault duration, and fault triggering conditions; The preset test configuration parameters are formed by combining the number of concurrent processes and the running time set in the preset business test cases and the preset verification test cases, as well as the preset fault data. The preset business test cases, the preset verification test cases, and the preset test configuration parameters are used to form the test scenario description information.
4. The database testing method according to claim 3, characterized in that, After obtaining the test scenario description information, the following is also included: According to the preset test configuration parameters, the fault injection process is started. During the concurrent execution of the M business processes, the fault injection process monitors the execution status of the M business execution processes in real time. When the execution state meets the fault triggering condition, the fault corresponding to the fault type is triggered, and when the fault triggering time reaches the fault duration, the fault is restored.
5. The database testing method according to claim 1, characterized in that, The step of acquiring and outputting the current context information of the M service execution processes and the N verification processes includes: Obtain the execution trajectory of each business execution process and verification process, as well as the node logs of each target database node; The execution trajectory and the node log are used as the current context information.
6. The database testing method according to claim 1, characterized in that, After performing a consistency check on the data generated after executing the business operation on each target database node and obtaining the check result, the method further includes: If the verification result meets the preset conditions, then return to the step of obtaining the data generated after the business operation is performed on each target database node in real time, until the test ends.
7. A database testing device, characterized in that, include: The first acquisition module is used to acquire test scenario description information, which includes at least preset business test cases, preset verification test cases, and preset test configuration parameters. The first startup module is used to start M business execution processes and N verification processes according to the preset test configuration parameters, and to assign the preset business test cases to the M business execution processes and the preset verification test cases to the N verification processes, where M and N are both integers greater than 1; The business execution module is used for the M business execution processes to concurrently execute the preset business test cases. Each business execution process performs business operations on the data on the corresponding target database node according to the preset business test cases. The consistency verification module is used to, during the concurrent execution of the M business processes, the N verification processes acquire the data generated after the business operation is performed on each target database node in real time according to the preset verification test cases, and perform consistency verification on the data generated after the business operation is performed on each target database node to obtain the verification result; The environment freezing module is used to freeze the current test environment if the verification result does not meet the preset conditions, and to obtain and output the current context information of the M business execution processes and the N verification processes. The current context information is used to perform test analysis on the test process.
8. The database testing apparatus according to claim 7, characterized in that, The database testing device further includes: The test case configuration module is used to configure the preset business test cases and the preset verification test cases according to the preset test case template. The second acquisition module is used to acquire the number of concurrent processes and the running time set for the preset business test case and the preset verification test case, respectively. The first configuration module is used to form the preset test configuration parameters by setting the number of concurrent processes and the running time of the preset business test cases and the preset verification test cases; The second configuration module is used to form the test scenario description information by combining the preset business test cases, the preset verification test cases, and the preset test configuration parameters.
9. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the database testing method as described in any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the database testing method as described in any one of claims 1 to 6.