Transaction compensation test method and device, electronic equipment and storage medium
By automatically obtaining and comparing transaction data, combining fault generation scenarios and injection statements, automated testing of distributed system transaction compensation is realized, solving the problems of cumbersome operations and low accuracy in the existing methods, and improving testing efficiency and accuracy.
Patent Information
- Application Number
- CN202411709084.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-04
AI Technical Summary
In the transaction compensation test and verification process of distributed systems, the existing methods have cumbersome operation steps and low efficiency. Manually performing logical verification may lead to missed testing and low accuracy.
By obtaining the scenario analysis information of the target transaction and pre-transaction data information, determine multiple fault generation scenarios and corresponding fault injection statements, automatically run the target transaction and inject the fault, obtain the post-transaction data information, and finally compare the data information before and after the transaction to obtain the transaction compensation test results.
It realizes automated testing of transaction compensation, automatically injects faults and verifys transaction compensation logic, improving the efficiency and accuracy of transaction compensation testing in distributed systems.
Smart Images

Figure CN119557223A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a transaction compensation test method, device, electronic device and storage medium. Background Art
[0002] In recent years, with the maturity of digitalization and distributed technologies, the banking industry is gradually transforming from a centralized core system architecture to a distributed system architecture that supports high concurrency and rapid expansion in order to meet the explosive growth of business needs. In the transaction compensation test verification phase of the distributed system, the method used is mainly to perform manual fault injection through components or tools, and manually perform the logic verification of the transaction step by step. The operation steps of the above method are relatively cumbersome, and the efficiency of the transaction compensation test is low; and manual execution of logic verification may result in missed tests, and the accuracy of the transaction compensation test is not high. Summary of the invention
[0003] The present invention provides a transaction compensation test method, device, electronic equipment and storage medium, which can improve the efficiency and accuracy of transaction compensation testing of distributed systems.
[0004] In a first aspect, an embodiment of the present invention provides a transaction compensation testing method, comprising:
[0005] Acquire scenario analysis information and pre-transaction data information corresponding to a target transaction to be subjected to a transaction compensation test, wherein the scenario analysis information indicates information related to a branch transaction of the target transaction;
[0006] Based on the scenario analysis information, determine multiple fault generation scenarios corresponding to the target transaction and a fault injection statement corresponding to each fault generation scenario;
[0007] Based on injecting the fault through the fault injection statement, automatically running the target transaction to obtain post-transaction data information;
[0008] The pre-transaction data information and the post-transaction data information are compared to obtain a transaction compensation test result of the target transaction.
[0009] In a second aspect, an embodiment of the present invention provides a transaction compensation testing device, including:
[0010] An acquisition module, configured to acquire scenario analysis information and pre-transaction data information corresponding to a target transaction to be subjected to a transaction compensation test, wherein the scenario analysis information indicates information related to a branch transaction of the target transaction;
[0011] A determination module, configured to determine, based on the scenario analysis information, a plurality of fault generation scenarios corresponding to the target transaction and a fault injection statement corresponding to each fault generation scenario;
[0012] An operation module, used for automatically running the target transaction to obtain post-transaction data information based on the fault injection statement injecting the fault;
[0013] The comparison module is used to compare the pre-transaction data information with the post-transaction data information to obtain a transaction compensation test result of the target transaction.
[0014] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method according to the first aspect.
[0018] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0019] The technical solution of the embodiment of the present invention can obtain multiple fault generation scenarios through the scenario analysis information corresponding to the target transaction, determine the fault injection statement corresponding to each fault generation scenario, automatically execute the target transaction on the basis of injecting the fault through the fault injection statement, so as to automatically call up the compensation of the branch transaction in the target transaction; it can automatically realize the acquisition and comparison of the pre-transaction data information and post-transaction data information corresponding to the target transaction, and obtain the transaction compensation test result of the target transaction. This solution can realize the automated test of the transaction compensation of the target transaction, automatically inject faults and verify whether the logic of the transaction compensation is wrong, and further improve the efficiency and accuracy of the transaction compensation test of the distributed system.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1is a flow chart of a transaction compensation testing method provided according to Embodiment 1 of the present invention;
[0023] Figure 2 is a structural diagram of a transaction compensation testing device provided according to Embodiment 2 of the present invention;
[0024] Figure 3 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the present invention are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] Embodiment 1
[0028] Figure 1 This is a flow chart of a transaction compensation test method provided according to the first embodiment of the present invention. This embodiment is applicable to the case of implementing a transaction compensation test. The method can be executed by a transaction compensation test device, which can be implemented in the form of software and / or hardware and integrated in an electronic device. Further, the electronic device includes but is not limited to: a computer, a laptop, a server, etc.
[0029] like Figure 1 As shown, the method includes:
[0030] S110. Obtain scenario analysis information and pre-transaction data information corresponding to a target transaction to be subjected to a transaction compensation test, wherein the scenario analysis information indicates information related to a branch transaction of the target transaction.
[0031] The target transaction may be a transaction to be tested for transaction compensation, and the specific content of the target transaction is not limited here. In practical applications, the target transaction may be decomposed into multiple sub-transactions, and each sub-transaction may be understood as a branch transaction of the target transaction. Transaction compensation may be understood as a reversible transaction operation of rolling back a sub-transaction when the sub-transaction of a transaction fails to execute.
[0032] In the embodiment of the present invention, the transaction compensation test can be considered to be implemented based on the Saga mode. The Saga mode can refer to a mode for processing complex transactions in a distributed system, which breaks down transactions into a series of small, reversible transaction steps. Each transaction step corresponds to a corresponding compensation operation, which is used to undo or roll back the operation of the step. When a step fails, the executed operation is rolled back based on the compensation of the previously successfully executed step. The distributed system can refer to a system of core banking businesses such as deposits and loans composed of distributed architecture technology.
[0033] The scenario analysis information may be information analyzing the scenario of the target transaction, indicating information related to the branch transaction of the target transaction. The pre-transaction data information may be information related to the data covered by the target transaction before the target transaction is executed.
[0034] In one embodiment, the scenario analysis information includes at least: the branch transactions of the target transaction, the execution order, transaction name, transaction category, main transaction interface and compensation interface corresponding to each branch transaction; the pre-transaction data information includes at least: the data table, business table and transaction details covered by the target transaction before the target transaction is executed.
[0035] Among them, the positive transaction interface can be the interface for the branch transaction to execute the positive transaction, that is, the interface for the normal execution of the branch transaction; the compensation interface can be the interface for the branch transaction to execute the compensation transaction, that is, the interface for implementing compensation behavior after the branch transaction execution fails.
[0036] The data table may be a database table related to data records affected by the operation of the target transaction. The business table may be a database table related to the business logic and rules of the target transaction. The transaction details may be a database table that records the specific details of the transaction.
[0037] Exemplarily, the pre-transaction data information may include the current account master file before the target transaction is executed, the voucher type table, the used passbook voucher registration table, the current transaction details table, the product number account number comparison table, etc.
[0038] In this step, a scenario analysis may be performed on the target transaction to determine scenario analysis information corresponding to the target transaction; and pre-transaction data information corresponding to the target transaction may be obtained from a database.
[0039] S120. Based on the scenario analysis information, determine multiple fault generation scenarios corresponding to the target transaction and a fault injection statement corresponding to each fault generation scenario.
[0040] The fault generation scenario may be a fault scenario that may occur when the target transaction is running. The fault injection statement may be a statement used to inject the fault corresponding to the fault generation scenario. In actual applications, the target transaction may correspond to multiple fault generation scenarios to test the performance of transaction compensation in the face of different faults. Among them, the fault may include timeout fault, service downtime, and fuse fault, etc., which are not limited here.
[0041] In this step, the scenario analysis information can be analyzed to determine the information related to the branch transactions of the target transaction, and based on this information, all possible fault generation scenarios that may exist when the target transaction is running are determined, and fault injection statements corresponding to each fault generation scenario are generated respectively.
[0042] In one embodiment, based on the scenario analysis information, determining multiple fault generation scenarios corresponding to the target transaction and a fault injection statement corresponding to each fault generation scenario includes:
[0043] Determine multiple fault generation scenarios corresponding to the target transaction based on the execution order corresponding to each branch transaction of the target transaction included in the scenario analysis information;
[0044] For each fault generation scenario, generate fault injection statements that are compatible with chaos engineering tools.
[0045] That is, based on the scenario analysis information, the branch transactions included in the target transaction and the execution order of each branch transaction are determined, and then all fault generation scenarios corresponding to the target transaction are automatically analyzed, and the fault injection statements adapted to the chaos engineering tool required for each fault generation scenario are generated.
[0046] Among them, the chaos engineering tool can be a fault drill tool that is built around the basic principles of chaos engineering and can be used for multiple clusters and multiple environments. Optionally, the chaos engineering tool can be a Chaosblade tool, and the fault injection statement is a Chaosblade statement. The Chaosblade tool can be a chaos engineering tool that discovers weaknesses, vulnerabilities, and potential failure points of a software system through experiments. In a distributed architecture environment, the dependencies between services are becoming increasingly complex, and it is difficult to measure the impact of a single failure on the entire system. Within a controllable range or environment, the ChaosBlade tool can be used to inject various failures into the system, continuously improve the fault tolerance and resilience of the distributed system, and build a highly available distributed system.
[0047] For example, the target transaction may include branch transaction 1 and branch transaction 2, which are executed sequentially. Faults such as timeout failure, service downtime, and circuit breaker are classified into two categories: timeout and transaction failure. Multiple fault generation scenarios corresponding to the target transaction may include the following:
[0048] Scenario 1: Transaction 1 succeeds, Transaction 2 fails, and Transaction 1 is compensated successfully;
[0049] Scenario 2: Transaction 1 succeeds, Transaction 2 fails, and Transaction 1 compensation fails;
[0050] Scenario 3: Transaction 1 succeeds, Transaction 2 times out (successfully), Transaction 2 is compensated successfully, and Transaction 1 is compensated successfully;
[0051] Scenario 4: Transaction 1 succeeds, Transaction 2 times out (successes), Transaction 2 compensation succeeds, Transaction 1 compensation fails;
[0052] Scenario 5: Transaction 1 succeeds, Transaction 2 times out (successfully), and Transaction 2 compensation fails;
[0053] Scenario 6: Transaction 1 succeeds, Transaction 2 times out (failure), Transaction 2 is compensated successfully, and Transaction 1 is compensated successfully;
[0054] Scenario 7: Transaction 1 succeeds, Transaction 2 times out (failed), Transaction 2 compensation succeeds, Transaction 1 compensation fails;
[0055] Scenario 8: Transaction 1 succeeds, Transaction 2 times out (failed), and Transaction 2 compensation fails;
[0056] Scenario 9: Transaction 1 fails;
[0057] Scenario 10: Transaction 1 times out (successfully), and transaction 1 is compensated successfully;
[0058] Scenario 11: Transaction 1 times out (success), and transaction 1 compensation fails;
[0059] Scenario 12: Transaction 1 times out (failed), and transaction 1 compensation succeeds;
[0060] Scenario 13: Transaction 1 times out (failure), and transaction 1 compensation fails.
[0061] S130. Based on injecting the fault through the fault injection statement, automatically running the target transaction to obtain post-transaction data information.
[0062] The post-transaction data information may be information related to the data covered by the target transaction after the target transaction is executed. In one embodiment, the post-transaction data information at least includes: a data table, a business table and transaction details covered by the target transaction after the target transaction is executed.
[0063] In this step, any one of the multiple fault generation scenarios corresponding to the target transaction can be selected, and the fault can be injected through the fault injection statement corresponding to the selected fault generation scenario; the target transaction is automatically run based on the injected fault, and then the post-transaction data information corresponding to the target transaction is obtained from the database.
[0064] In one embodiment, based on injecting a fault through the fault injection statement, automatically running the target transaction to obtain post-transaction data information includes:
[0065] Inject the fault corresponding to the fault injection statement through a chaos engineering tool;
[0066] Based on the injected fault, the positive transaction or the compensating transaction of the branch transaction in the target transaction is automatically run to obtain post-transaction data information.
[0067] That is, any one of multiple fault generation scenarios is simulated through chaos engineering tools, and the fault injection is completed through the fault injection statement corresponding to the selected fault generation scenario; based on the injected fault, a series of branch transactions of the target transaction are sequentially called up, and the positive transaction or compensation transaction of the branch transaction is automatically executed to obtain post-transaction data information.
[0068] Exemplarily, the target transaction may include branch transaction 1, branch transaction 2, and branch transaction 3, and each branch transaction is executed in sequence. The fault injected by the fault injection statement may be the failure of branch transaction 3. Then the process of the target transaction operation may be: branch transaction 1 and branch transaction 2 are executed normally; branch transaction 3 is executed, and if the execution fails, a retry is performed. After the number of retries reaches the upper limit, the compensation transaction of branch transaction 2 is executed, and then the compensation transaction of branch transaction 1 is executed; after the execution is completed, the post-transaction data information of the target transaction is obtained from the database.
[0069] S140: Compare the pre-transaction data information with the post-transaction data information to obtain a transaction compensation test result of the target transaction.
[0070] In this step, the pre-transaction data information and the post-transaction data information can be compared to determine whether the compensation transaction corresponding to the target transaction is initiated and whether the compensation logic is correct, thereby obtaining the transaction compensation test result of the target transaction.
[0071] The transaction compensation test result may be the result of a transaction compensation test on the target transaction. The transaction compensation test result may indicate that the compensation transaction corresponding to the target transaction is initiated and the compensation logic is correct; it may also indicate that the compensation transaction corresponding to the target transaction is not initiated, or that the compensation transaction corresponding to the target transaction is initiated but the compensation logic is incorrect. The compensation transaction corresponding to the target transaction may include a compensation transaction that needs to be executed when a branch transaction in the target transaction fails to execute.
[0072] In one embodiment, comparing the pre-transaction data information with the post-transaction data information to obtain a transaction compensation test result of the target transaction includes:
[0073] The pre-transaction data information and the post-transaction data information are compared through a target verification statement to obtain a transaction compensation test result of the target transaction, wherein the target verification statement is a verification statement corresponding to a fault generation scenario in which a fault is injected into the target transaction.
[0074] The target verification statement may be a statement used to compare pre-transaction data information with post-transaction data information to verify the effect of transaction compensation. In practical applications, different target verification statements may be set for different fault generation scenarios, and the target verification statement may be a Structured Query Language (SQL) statement.
[0075] In one embodiment, the method further includes: when the transaction compensation test result indicates that the compensation transaction corresponding to the target transaction is initiated and the compensation logic is correct, ending the transaction compensation test. In this case, the transaction compensation test for the target transaction achieves the expected effect and the test can be ended.
[0076] In one embodiment, the method further includes: when the transaction compensation test result indicates that the compensation transaction corresponding to the target transaction has not been initiated, or the compensation transaction corresponding to the target transaction has been initiated but the compensation logic is incorrect, returning to continue to execute the operation of obtaining the scenario analysis information and pre-transaction data information corresponding to the target transaction. In this case, the transaction compensation test for the target transaction has not achieved the expected effect, and it is necessary to continue to execute the transaction compensation test, that is, continue to execute S110 to S140.
[0077] The technical solution of the embodiment of the present invention can obtain multiple fault generation scenarios through the scenario analysis information corresponding to the target transaction, determine the fault injection statement corresponding to each fault generation scenario, automatically execute the target transaction on the basis of injecting the fault through the fault injection statement, so as to automatically call up the compensation of the branch transaction in the target transaction; it can automatically realize the acquisition and comparison of the pre-transaction data information and post-transaction data information corresponding to the target transaction, and obtain the transaction compensation test result of the target transaction. This solution can realize the automated test of the transaction compensation of the target transaction, automatically inject faults and verify whether the logic of the transaction compensation is wrong, and further improve the efficiency and accuracy of the transaction compensation test of the distributed system.
[0078] The technical solution of the embodiment of the present invention can lower the threshold of testing through the automatic implementation of fault injection. Testers only need to understand the test process without being familiar with the business and manually injecting faults. Through the automatic comparison of data before and after transactions, labor costs can be reduced, the test cycle can be shortened, and the test efficiency can be improved. Through the standardization of the transaction compensation test process, the consistency of the test process is ensured.
[0079] Embodiment 2
[0080] Figure 2 is a schematic diagram of the structure of a transaction compensation test device provided according to the second embodiment of the present invention. This embodiment can be applied to the case of implementing transaction compensation test, such as Figure 2 As shown, the specific structure of the device includes:
[0081] An acquisition module 21 is used to acquire scenario analysis information and pre-transaction data information corresponding to a target transaction to be subjected to a transaction compensation test, wherein the scenario analysis information indicates information related to a branch transaction of the target transaction;
[0082] A determination module 22, configured to determine, based on the scenario analysis information, a plurality of fault generation scenarios corresponding to the target transaction and a fault injection statement corresponding to each fault generation scenario;
[0083] An operation module 23 is used to automatically operate the target transaction to obtain post-transaction data information based on the fault injection statement injecting the fault;
[0084] The comparison module 24 is used to compare the pre-transaction data information with the post-transaction data information to obtain a transaction compensation test result of the target transaction.
[0085] The transaction compensation test device provided in this embodiment obtains the scenario analysis information and pre-transaction data information corresponding to the target transaction to be tested for transaction compensation through an acquisition module, wherein the scenario analysis information indicates information related to the branch transaction of the target transaction; determines multiple fault generation scenarios corresponding to the target transaction and the fault injection statement corresponding to each fault generation scenario based on the scenario analysis information through a determination module; automatically runs the target transaction to obtain post-transaction data information based on the fault injection statement through an operation module; and compares the pre-transaction data information with the post-transaction data information through a comparison module to obtain the transaction compensation test result of the target transaction. This solution can realize the automated test of transaction compensation of the target transaction, automatically inject faults and verify whether the logic of transaction compensation is wrong, and further improve the efficiency and accuracy of transaction compensation testing of distributed systems.
[0086] Furthermore, the scenario analysis information includes at least: branch transactions of the target transaction, execution order of each branch transaction, transaction name, transaction category, main transaction interface, and compensation interface;
[0087] The pre-transaction data information at least includes: data tables, business tables and transaction details covered by the target transaction before the target transaction is executed;
[0088] The post-transaction data information includes at least: data tables, business tables and transaction details covered by the target transaction after the target transaction is executed.
[0089] Further, the determination module 22 is specifically used for:
[0090] Determine multiple fault generation scenarios corresponding to the target transaction based on the execution order corresponding to each branch transaction of the target transaction included in the scenario analysis information;
[0091] For each fault generation scenario, generate fault injection statements that are compatible with chaos engineering tools.
[0092] Further, the operation module 23 is specifically used for:
[0093] Inject the fault corresponding to the fault injection statement through a chaos engineering tool;
[0094] Based on the injected fault, the positive transaction or the compensating transaction of the branch transaction in the target transaction is automatically run to obtain post-transaction data information.
[0095] Furthermore, the comparison module 24 is specifically used for:
[0096] The pre-transaction data information and the post-transaction data information are compared through a target verification statement to obtain a transaction compensation test result of the target transaction, wherein the target verification statement is a verification statement corresponding to a fault generation scenario in which a fault is injected into the target transaction.
[0097] Furthermore, the device also includes:
[0098] The test ending module is used to end the transaction compensation test when the transaction compensation test result indicates that the compensation transaction corresponding to the target transaction is initiated and the compensation logic is correct.
[0099] Furthermore, the device also includes:
[0100] The test continuation module is used to return to continue the operation of obtaining the scenario analysis information and pre-transaction data information corresponding to the target transaction when the transaction compensation test result indicates that the compensation transaction corresponding to the target transaction has not been initiated, or the compensation transaction corresponding to the target transaction has been initiated but the compensation logic is incorrect.
[0101] The transaction compensation testing device provided in the embodiment of the present invention can execute the transaction compensation testing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0102] Embodiment 3
[0103] Figure 3 Schematic diagram of the structure of the electronic device implementing the embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0104] like Figure 3 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0105] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0106] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the transaction compensation test method.
[0107] In some embodiments, the transaction compensation test method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the transaction compensation test method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the transaction compensation test method in any other appropriate manner (e.g., by means of firmware).
[0108] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0109] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0110] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0111] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0112] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0113] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0114] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0115] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A transaction compensation testing method, characterized in that: include: Acquire scenario analysis information and pre-transaction data information corresponding to a target transaction to be subjected to a transaction compensation test, wherein the scenario analysis information indicates information related to a branch transaction of the target transaction; Based on the scenario analysis information, determine multiple fault generation scenarios corresponding to the target transaction and a fault injection statement corresponding to each fault generation scenario; Based on injecting the fault through the fault injection statement, automatically running the target transaction to obtain post-transaction data information; The pre-transaction data information and the post-transaction data information are compared to obtain a transaction compensation test result of the target transaction.
2. The method according to claim 1, characterized in that: The scenario analysis information includes at least: branch transactions of the target transaction, the execution order of each branch transaction, the transaction name, the transaction type, the main transaction interface, and the compensation interface; The pre-transaction data information at least includes: data tables, business tables and transaction details covered by the target transaction before the target transaction is executed; The post-transaction data information includes at least: data tables, business tables and transaction details covered by the target transaction after the target transaction is executed.
3. The method according to claim 1, characterized in that Based on the scenario analysis information, determining multiple fault generation scenarios corresponding to the target transaction and a fault injection statement corresponding to each fault generation scenario includes: Determine multiple fault generation scenarios corresponding to the target transaction based on the execution order corresponding to each branch transaction of the target transaction included in the scenario analysis information; For each fault generation scenario, generate fault injection statements that are compatible with chaos engineering tools.
4. The method according to claim 1, characterized in that On the basis of injecting the fault through the fault injection statement, automatically running the target transaction to obtain post-transaction data information, including: Inject the fault corresponding to the fault injection statement through a chaos engineering tool; Based on the injected fault, the positive transaction or the compensating transaction of the branch transaction in the target transaction is automatically run to obtain post-transaction data information.
5. The method according to claim 1, characterized in that Comparing the pre-transaction data information with the post-transaction data information to obtain a transaction compensation test result of the target transaction, including: The pre-transaction data information and the post-transaction data information are compared through a target verification statement to obtain a transaction compensation test result of the target transaction, wherein the target verification statement is a verification statement corresponding to a fault generation scenario in which a fault is injected into the target transaction.
6. The method according to claim 1, characterized in that Also includes: When the transaction compensation test result indicates that the compensation transaction corresponding to the target transaction is initiated and the compensation logic is correct, the transaction compensation test is ended.
7. The method according to claim 1, characterized in that Also includes: When the transaction compensation test result indicates that the compensation transaction corresponding to the target transaction has not been initiated, or the compensation transaction corresponding to the target transaction has been initiated but the compensation logic is incorrect, return to continue executing the operation of obtaining the scenario analysis information and pre-transaction data information corresponding to the target transaction.
8. A transaction compensation testing device, characterized in that: include: An acquisition module, configured to acquire scenario analysis information and pre-transaction data information corresponding to a target transaction to be subjected to a transaction compensation test, wherein the scenario analysis information indicates information related to a branch transaction of the target transaction; A determination module, configured to determine, based on the scenario analysis information, a plurality of fault generation scenarios corresponding to the target transaction and a fault injection statement corresponding to each fault generation scenario; An operation module, used for automatically running the target transaction to obtain post-transaction data information based on the fault injection statement injecting the fault; The comparison module is used to compare the pre-transaction data information with the post-transaction data information to obtain a transaction compensation test result of the target transaction.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.