A method of managing reentry testing and related apparatus

By acquiring and parsing the sequence of executed functions and injecting test cases using aspect-oriented programming, the problem of time-consuming manual breakpoint setting was solved, achieving efficient reentrancy testing.

CN115964266BActive Publication Date: 2026-07-07TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2021-10-12
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

In complex business scenarios, manually setting breakpoints is time-consuming and affects the efficiency of reentrancy testing.

Method used

By obtaining the sequence of execution functions in the target scenario during execution, parsing the breakpoints, and injecting test cases using aspect-oriented programming, automated reentrancy testing is achieved.

Benefits of technology

It achieves precise instrumentation at specified function locations, automatically constructs a large number of interrupt and reentrancy scenarios, and improves the efficiency and accuracy of reentrancy testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115964266B_ABST
    Figure CN115964266B_ABST
Patent Text Reader

Abstract

The application discloses a management method of reentrant testing and a related device, which can be applied to the field of maps. The method comprises the following steps: acquiring an execution function sequence corresponding to a target scene in an execution process, wherein the execution function sequence comprises at least two execution functions; analyzing the execution function sequence to determine breakpoints between the execution functions; and injecting test cases into the breakpoints through an aspect-oriented programming mode to perform reentrant testing on the target scene based on the test cases. Thus, the reentrant testing process of the execution functions can be acquired in real time. Since accurate plugging is performed at a specified function position, a large number of interruption and reentrant scenes can be automatically constructed and verified, the reentrant testing is more accurate, the testing can be performed quickly, in batches and automatically, and the efficiency of the reentrant testing is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a management method and related apparatus for reentry testing. Background Technology

[0002] With the rapid development of computer technology, people have increasingly higher requirements for the stability and security of computer programs. Among these requirements, reentrancy testing for business scenarios is a very important part of verifying business stability and security.

[0003] Generally, reentrancy tests can be constructed by manually setting breakpoints using debugging tools. This requires manually specifying the breakpoint location, manually setting breakpoints or pre-setting breakpoint locations in the reentrancy test case, and initiating scenario interruption and reentrancy requests multiple times.

[0004] However, in complex business scenarios, as the number of breakpoints increases, manually setting breakpoints becomes time-consuming, impacting the efficiency of reentrancy testing.

[0005] Example Content

[0006] In view of this, this application provides a management method for reentrancy testing, which can effectively improve the efficiency of reentrancy testing.

[0007] The first aspect of this application provides a reentry test management method, which can be applied to a system or program in a terminal device that includes a reentry test management function, specifically including:

[0008] Obtain the sequence of execution functions corresponding to the target scenario during execution, wherein the sequence of execution functions includes at least two execution functions;

[0009] The sequence of executed functions is parsed to determine the breakpoints between the executed functions;

[0010] Test cases are injected into the breakpoints using aspect-oriented programming to perform reentrancy tests for the target scenario based on the test cases.

[0011] Optionally, in some possible implementations of this application, obtaining the sequence of execution functions corresponding to the target scenario during execution includes:

[0012] Obtain the execution chain corresponding to the target scenario during execution;

[0013] The execution functions are collected based on the execution chain to obtain the function names corresponding to the execution functions;

[0014] The sequence of execution functions is determined by integrating the function names.

[0015] The step of parsing the sequence of execution functions to determine the breakpoints between the execution functions includes:

[0016] The function names contained in the sequence of executed functions are parsed to determine the breakpoints between the executed functions.

[0017] Optionally, in some possible implementations of this application, resolving the function names contained in the sequence of executed functions to determine the breakpoints between the executed functions includes:

[0018] Determine the process information corresponding to the target scenario;

[0019] Based on the process information, determine the configuration rules corresponding to the target scenario;

[0020] The function names are filtered according to the configuration rules to obtain the interrupt function sequence;

[0021] The function names contained in the interrupt function sequence are parsed to determine the interruption points between the execution functions.

[0022] Optionally, in some possible implementations of this application, the method further includes:

[0023] Configuration is performed in response to a target operation to obtain interruption sequence information, which includes at least one of an exception identifier, a location identifier, a sequence identifier, or a type identifier;

[0024] The interrupt points are configured based on the interruption sequence information in order to update the interrupt points.

[0025] Optionally, in some possible implementations of this application, the step of injecting test cases into the breakpoint using aspect-oriented programming to perform reentrancy tests for the target scenario based on the test cases includes:

[0026] The executable file used to instruct the reentrancy test is compiled using aspect-oriented programming.

[0027] The test case is injected into the breakpoint based on the executable file. The test case contains test case pairs, and the test case pairs include an interrupt test case and a reentrancy test case that are matched with each other based on the breakpoint.

[0028] The interruption test case and the reentry test case in the test case pair are executed to obtain verification test information, which is used to indicate the result of the reentry test of the target scenario.

[0029] Optionally, in some possible implementations of this application, the method further includes:

[0030] Record the correspondence between the target scene and the interruption point to generate reentry configuration information;

[0031] In response to the test operation, determine the reentry test information set for the target scenario;

[0032] If the reentrancy test information matches the reentrancy configuration information, then the test case corresponding to the test operation is injected at the interrupt point to perform a reentrancy test for the target scenario based on the test case corresponding to the test operation.

[0033] Optionally, in some possible implementations of this application, the target scenario is a payment scenario, the execution function sequence includes an order query function, an order placement function, an inspection function, and a deduction function, and the re-entry test is to verify and compare the exception information configured for the order query function, the order placement function, the inspection function, and the deduction function respectively.

[0034] A second aspect of this application provides a management device for reentrancy testing, comprising: an acquisition unit, configured to acquire an execution function sequence corresponding to a target scenario during execution, wherein the execution function sequence includes at least two execution functions;

[0035] A determining unit is used to parse the sequence of execution functions to determine the breakpoints between the execution functions;

[0036] The management unit is used to inject test cases into the breakpoints using aspect-oriented programming, and to perform reentrancy tests for the target scenario based on the test cases.

[0037] Optionally, in some possible implementations of this application, the acquisition unit is specifically used to acquire the execution link corresponding to the target scenario during execution;

[0038] The acquisition unit is specifically used to collect the execution functions based on the execution chain in order to obtain the function names corresponding to the execution functions;

[0039] The acquisition unit is specifically used to integrate based on the function names to determine the sequence of execution functions;

[0040] The determining unit is specifically used to parse the function names contained in the sequence of executed functions in order to determine the breakpoints between the executed functions.

[0041] Optionally, in some possible implementations of this application, the determining unit is specifically used to determine the process information corresponding to the target scenario;

[0042] The determining unit is specifically used to determine the configuration rules corresponding to the target scenario based on the process information;

[0043] The determining unit is specifically used to filter the function names according to the configuration rules to obtain the interrupt function sequence;

[0044] The determining unit is specifically used to parse the function names contained in the interrupt function sequence in order to determine the interruption point between the execution functions.

[0045] Optionally, in some possible implementations of this application, the determining unit is specifically configured in response to the target operation to obtain interruption sequence information, wherein the interruption sequence information includes at least one of an exception identifier, a location identifier, a sequence identifier, or a type identifier.

[0046] The determining unit is specifically used to configure the interruption point based on the interruption order information, so as to update the interruption point.

[0047] Optionally, in some possible implementations of this application, the management unit is specifically used to compile an executable file for instructing the reentrancy test using aspect-oriented programming.

[0048] The management unit is specifically used to inject the test case into the breakpoint based on the executable file. The test case includes test case pairs, and the test case pairs include interrupt test cases and reentry test cases that are matched with each other based on the breakpoint.

[0049] The management unit is specifically used to execute the interruption test case and the reentry test case in the test case pair to obtain verification test information, which is used to indicate the result of the reentry test of the target scenario.

[0050] Optionally, in some possible implementations of this application, the management unit is specifically used to record the correspondence between the target scene and the interruption point in order to generate reentrancy configuration information;

[0051] The management unit is specifically used to determine reentry test information set for the target scenario in response to test operations;

[0052] The management unit is specifically used to call the interrupt point to inject the test case corresponding to the test operation if the reentry test information matches the reentry configuration information, so as to execute the reentry test for the target scenario based on the test case corresponding to the test operation.

[0053] A third aspect of this application provides a computer device, comprising: a memory, a processor, and a bus system; the memory is used to store program code; the processor is used to execute the management method for reentry testing as described in the first aspect or any one of the first aspects according to instructions in the program code.

[0054] A fourth aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the management method for reentry testing as described in the first aspect or any one of the first aspects.

[0055] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the reentry test management method provided in the first aspect or various optional implementations thereof.

[0056] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0057] By acquiring the sequence of execution functions corresponding to the target scenario during execution, where each sequence includes at least two execution functions, and then parsing the sequence to determine the breakpoints between these functions, test cases are injected into these breakpoints using aspect-oriented programming (AOP). This allows for reentrancy testing of the target scenario based on these test cases. This enables real-time acquisition of the reentrancy testing process of the execution functions. By combining AOP-based automatic injection technology with link interruption reentrancy scenario testing, precise instrumentation can be performed at specified function locations. This allows for the automatic construction and verification of numerous interruption and reentrancy scenarios, making reentrancy testing more accurate and enabling rapid, automated batch testing, thus improving the efficiency of reentrancy testing. Attached Figure Description

[0058] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0059] Figure 1 Network architecture diagram for the management system running during reentry testing;

[0060] Figure 2A flowchart illustrating the management process of reentrancy testing, provided for an embodiment of this application;

[0061] Figure 3 A flowchart illustrating a reentry test management method provided in an embodiment of this application;

[0062] Figure 4 A schematic diagram illustrating a scenario for a reentry test management method provided in an embodiment of this application;

[0063] Figure 5 A schematic diagram illustrating a scenario for another reentrancy test management method provided in an embodiment of this application;

[0064] Figure 6 A schematic diagram illustrating a scenario for another reentrancy test management method provided in an embodiment of this application;

[0065] Figure 7 A schematic diagram illustrating a scenario for another reentrancy test management method provided in an embodiment of this application;

[0066] Figure 8 A flowchart illustrating another reentry test management method provided in this application embodiment;

[0067] Figure 9 A schematic diagram illustrating a scenario for another reentrancy test management method provided in an embodiment of this application;

[0068] Figure 10 A schematic diagram of the structure of a management device for reentry testing provided in an embodiment of this application;

[0069] Figure 11 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application;

[0070] Figure 12 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation

[0071] This application provides a method and related apparatus for managing reentrancy testing, which can be applied to systems or programs in terminal devices that include reentrancy testing management functions. The method involves obtaining the sequence of execution functions corresponding to a target scenario during execution, where each sequence includes at least two execution functions; then parsing the sequence to determine breakpoints between the functions; and finally injecting test cases into these breakpoints using aspect-oriented programming (AOP) to perform reentrancy testing on the target scenario based on these test cases. This achieves real-time acquisition of the reentrancy testing process of the execution functions. By combining AOP-based automatic injection technology with link interruption reentrancy scenario testing, precise instrumentation can be performed at specified function locations. This allows for the automatic construction and verification of numerous interruption and reentrancy scenarios, making reentrancy testing more accurate and enabling rapid, automated batch testing, thus improving the efficiency of reentrancy testing.

[0072] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “corresponding to,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0073] First, some terms that may appear in the embodiments of this application will be explained.

[0074] Aspect-Oriented Programming (AOP): also known as aspect-oriented programming, is a technique that allows for the dynamic and unified addition of functionality to a program without modifying the source code, through pre-compilation and runtime dynamic proxies.

[0075] It should be understood that the reentry test management method provided in this application can be applied to systems or programs in terminal devices that include reentry test management functions, such as payment management platforms. Specifically, the reentry test management system can run on systems such as... Figure 1 In the network architecture shown, such as Figure 1The diagram shown illustrates the network architecture of the reentrancy test management system. As can be seen, the system can manage reentrancy tests from multiple information sources. Specifically, it triggers the server to execute corresponding business logic through test operations on the terminal side, thereby parsing the execution function and injecting the test instance. This can be understood as... Figure 1 The document shows various terminal devices, which can be computer devices. In real-world scenarios, more or fewer types of terminal devices may participate in the reentry test management process. The specific number and types depend on the actual scenario and are not limited here. Figure 1 The image shows one server, but in real-world scenarios, multiple servers can be involved, with the specific number depending on the actual situation.

[0076] In this embodiment, the server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, and the terminal and server can be connected to form a blockchain network; this application does not impose any restrictions.

[0077] It is understandable that the aforementioned reentry test management system can run on a personal mobile terminal, such as an application like a payment management platform, or it can run on a server, or it can run on a third-party device to provide reentry test management and obtain the reentry test management and processing results of the information source. Specifically, the reentry test management system can run as a program on the aforementioned device, or it can run as a system component of the aforementioned device, or it can run as a cloud service program. The specific operating mode depends on the actual scenario and is not limited here.

[0078] With the rapid development of computer technology, people have increasingly higher requirements for the stability and security of computer programs. Among these requirements, reentrancy testing for business scenarios is a very important part of verifying business stability and security.

[0079] Generally, reentrancy tests can be constructed by manually setting breakpoints using debugging tools. This requires manually specifying the breakpoint location, manually setting breakpoints or pre-setting breakpoint locations in the reentrancy test case, and initiating scenario interruption and reentrancy requests multiple times.

[0080] However, in complex business scenarios, as the number of breakpoints increases, manually setting breakpoints becomes time-consuming, impacting the efficiency of reentrancy testing.

[0081] To address the aforementioned issues, this application proposes a management method for reentrancy testing, which is applied to... Figure 2 The reentrancy test management process framework shown is as follows: Figure 2 The diagram shown is a flowchart of a reentrancy test management process provided in an embodiment of this application. Users perform test operations on relevant services through terminals, and the corresponding services are executed in real time on the server side to obtain the real-time execution function sequence. The interruption point is then parsed to inject an instance of reentrancy test, thereby realizing an automated reentrancy test process.

[0082] Understandably, scenario re-entry testing is a very important part of business verification. During the execution of a certain scenario test case, this embodiment uses AOP automatic injection to obtain and record all execution function sequences corresponding to the scenario. The re-entry engine supports configuring and setting various types of interrupt points (such as functions called by interfaces, functions matched by regular expressions, etc.). Based on the pre-set interrupt points and the obtained function execution sequences, it accurately instrumentes at the specified function positions to realize request interruption and re-entry of the same batch of requests. It can automatically construct a large number of interruption and re-entry scenarios and verify their correctness.

[0083] It is understood that the method provided in this application can be a program written as processing logic in a hardware system, or a reentrancy test management device, implemented in an integrated or external manner to achieve the aforementioned processing logic. As one implementation, the reentrancy test management device obtains the execution function sequence corresponding to the target scenario during execution, wherein the execution function sequence includes at least two execution functions; then it parses the execution function sequence to determine the breakpoints between the execution functions; and then injects test cases into the breakpoints using aspect-oriented programming (AOP) to execute reentrancy tests for the target scenario based on the test cases. This achieves real-time acquisition of the execution function reentrancy test process. By combining AOP automatic injection technology with link interruption reentrancy scenario testing, precise instrumentation can be performed at specified function locations. It can automatically construct a large number of interruption and reentrancy scenarios and verify their correctness, making reentrancy testing more accurate and enabling rapid, batch, and automated testing, thus improving the efficiency of reentrancy testing.

[0084] Based on the above process architecture, the management method for reentrancy testing in this application will be described below. Please refer to [link / reference]. Figure 3 , Figure 3 The flowchart illustrates a reentry test management method provided in this application embodiment. This management method can be executed by a terminal or a server. This application embodiment includes at least the following steps:

[0085] 301. Obtain the sequence of execution functions corresponding to the target scenario during execution.

[0086] In this embodiment, the execution function sequence includes at least two execution functions; the execution function sequence is obtained during the execution of the target scenario, and it is a real-time acquisition process. That is, before verifying the business that needs to be re-entered for testing, the business will be executed normally to obtain the business function information at the current moment (version, status), thus ensuring the effectiveness and accuracy of the re-entry test.

[0087] Understandably, in the current microservice architecture, the completion of a business function requires processing by multiple programs, and each program has multiple steps (functions). Interruptions can occur at any point during the request processing (due to network timeouts, jitter, etc.). When the caller initiates a retry after an interruption, it actually expects to return the same result as when the processing was successful on the first attempt. This means that all scenarios and interfaces must be idempotent. Therefore, re-entry testing of the link interruption is an important part of system testing.

[0088] Furthermore, if manual testing is used, reentrancy test cases will become invalid if the function name or line number changes, affecting the effectiveness of reentrancy testing. Therefore, the execution function sequence in this application is automatically obtained during the execution of the target scenario, which improves the efficiency of reentrancy testing while ensuring effectiveness.

[0089] Specifically, the process of obtaining the execution function sequence can begin by obtaining the execution chain corresponding to the target scenario during execution; then, execution functions can be collected based on the execution chain to obtain the function names corresponding to the execution functions; furthermore, the function names can be integrated to determine the execution function sequence; correspondingly, the function names contained in the execution function sequence can be parsed to determine the breakpoints between execution functions, so as to facilitate the subsequent test injection process.

[0090] It is understandable that, for the above embodiments, the function execution sequence is first obtained based on the execution trajectory of normal scenario use cases, and then interruption reentry test is performed based on the function name. The interruption point (function name) can be obtained in real time, and the code of the tested object is automatically adapted when it changes. The combination of AOP automatic injection technology and link interruption reentry scenario test makes the reentry test more accurate and can quickly perform batch automated testing.

[0091] 302. Analyze the sequence of executed functions to determine the breakpoints between them.

[0092] In this embodiment, the process of parsing the sequence of executed functions can be to parse the function names contained in the sequence of executed functions, thereby determining the breakpoints between the executed functions.

[0093] Furthermore, considering that there may be non-interruption point execution functions in the execution function sequence, it is necessary to filter the function names. Specifically, we can first determine the process information corresponding to the target scenario. For example, the process information corresponding to the payment scenario includes order inquiry, order placement, inspection, and deduction. Then, based on the process information, we can determine the configuration rules corresponding to the target scenario. For example, in the payment scenario, we can only extract the function names corresponding to the order inquiry, order placement, inspection, and deduction processes, thereby excluding unnecessary processes (such as exporting orders). Therefore, we can filter the function names according to the configuration rules to obtain the interruption function sequence. Then, we can parse the function names contained in the interruption function sequence to determine the interruption point between execution functions, thereby ensuring the accuracy of the interruption point determination.

[0094] In one possible scenario, reentrancy testing may require configuration of position and order. Therefore, configuration can be performed in response to the target operation to obtain interruption order information, which includes at least one of exception identifier, position identifier, order identifier, or type identifier. Then, the interruption point is configured based on the interruption order information to update the interruption point.

[0095] For example in Figure 4 In the scene shown, Figure 4 This is a schematic diagram of a reentrancy test management method provided in an embodiment of this application; regular expression matching is performed on the execution function sequence and configuration items (the function name is filtered according to the configuration rules) to obtain the interruption function sequence, and the configured interruption order information may include whether an exception is set (exception identifier), where the exception function name is set (location identifier), how many times the exception is set (order identifier), and what type of exception is set (type identifier, such as interruption, reentrancy, tampering, etc.).

[0096] Specifically, the execution sequence of process 1 contains four functions (A--B--A--C). Assuming each function is an atomic operation, the interrupt reentry scenarios corresponding to these four scenarios need to be tested. The interrupt order information can be configured:

[0097] First interruption: The first execution of function A is interrupted.

[0098] First re-entry: Clear the breakpoint, re-enter the original request, and verify whether the re-entry process can be executed correctly (the correctness of the execution result is verified in the test case).

[0099] By configuring the interruption sequence information, the controllability of the reentrancy test process can be guaranteed, enabling full-process reentrancy testing of business scenarios.

[0100] 303. Inject test cases into breakpoints using aspect-oriented programming to perform reentrancy tests for the target scenario based on the test cases.

[0101] In this embodiment, since aspect-oriented programming can dynamically and uniformly add functions to the program without modifying the source code, the process of injecting test cases will not affect the original code structure of the business, thus improving the accuracy of reentrancy testing.

[0102] Specifically, the process of injecting test cases into breakpoints using aspect-oriented programming (AOP) can be initiated by first compiling an executable file to instruct reentrancy testing. Then, test cases are injected into the breakpoints based on the executable file. Each test case contains test case pairs, which include breakpoint and reentrancy test cases that are matched based on the breakpoints. Finally, the breakpoint and reentrancy test cases in the test case pairs are executed to obtain verification test information. This verification test information is used to instruct the target scenario on the results of reentrancy testing. In other words, a corresponding test case pair can be configured for each process in the business logic. For example, for the order inquiry and order placement processes in the payment process, corresponding test case pairs can be configured separately to ensure the comprehensiveness of reentrancy testing.

[0103] The following describes this embodiment using a possible hardware architecture, where the implementation of the above embodiment is achieved through the following modules. This hardware architecture includes an execution engine, a code instrumentation module, an exception injection module, an automated test case library, and the object under test. Specifically, the execution engine drives the entire automated interruption and re-entry test process and interacts with multiple modules. The code instrumentation module instrumentes the object under test, injecting functions to trace code, and then obtains the dynamic function call relationship of the test case during execution. This can be implemented using AOP instrumentation tools such as AspectJ and AspectC++. The exception injection module injects specified exceptions into the object under test, thereby triggering the corresponding exception during test case execution to achieve the purpose of exception testing. This can also be implemented using AOP instrumentation tools such as AspectJ and AspectC++. The automated test case library contains automated test cases used to drive normal test and interruption / re-entry scenarios. The object under test is the business test object.

[0104] In one possible scenario, the execution logic of the execution engine is as follows: Figure 5 As shown, Figure 5This is a schematic diagram of another reentrancy test management method provided in this application embodiment; that is, for the configuration file set in the scenario, the execution engine is first input, and then the function name is obtained based on the automated test cases, and then the execution function sequence file is generated and the execution function sequence file is read and analyzed to determine the breakpoint; therefore, automated test cases for interruption or reentry can be configured based on the breakpoint. The above automated test cases are all compiled and injected through AOP, which will not affect the business code. Therefore, the above embodiment can be applied to any link and scenario that needs to verify interruption and reentry, and perform batch reentry verification of business scenarios.

[0105] Specifically, the process of performing global testing on a scenario where the execution sequence of process 1 contains four functions (A--B--A--C), such as... Figure 6 As shown, Figure 6 This is a schematic diagram of another reentrancy test management method provided in the embodiments of this application; that is, the configured automated test cases include interruption test cases and reentrancy test cases in four execution test case pairs. For example, execution test case 1 includes interruption test cases (interruption A) and reentrancy test cases (execution A--B--A--C), and reentrancy tests are performed on each process step in the business in sequence.

[0106] The following example of a typical payment transaction is divided into four main steps: order inquiry, order placement, order verification, and payment deduction. Interruptions can occur at any step, and the possible points of interruption are as follows: Figure 7 As shown, Figure 7 This is a schematic diagram of another management method for reentrancy testing provided in this application embodiment; that is, the execution function sequence includes an order query function, an order placement function, an inspection function, and a deduction function, and the reentrancy test is to verify and compare the exception information configured for the order query function, the order placement function, the inspection function, and the deduction function respectively.

[0107] The above embodiments utilize AOP technology for automatic exception injection. Through configuration, it can adaptively implement multiple automated interruptions and re-entries even when the source code changes, improving testing efficiency. In one possible scenario, taking a refund request as an example, if 5 breakpoints need to be tested, the original manual debugging tool (gdb) would take 8 minutes * 5 = 40 minutes, while this method, with configuration and execution, takes only 1 minute.

[0108] As described in the above embodiments, by obtaining the execution function sequence corresponding to the target scenario during execution, where the execution function sequence includes at least two execution functions; then parsing the execution function sequence to determine the breakpoints between the execution functions; and then injecting test cases into the breakpoints using aspect-oriented programming (AOP) to perform reentrancy testing for the target scenario based on the test cases. This achieves real-time acquisition of the reentrancy testing process of the execution functions. Because AOP's automatic injection technology is combined with link interruption reentrancy scenario testing, precise instrumentation can be performed at specified function locations. A large number of interruption and reentrancy scenarios can be automatically constructed and their correctness verified, making reentrancy testing more accurate. Rapid batch automated testing can be performed, improving the efficiency of reentrancy testing.

[0109] In one possible scenario, breakpoints can also be invoked quickly, as explained below. Please refer to [link / reference]. Figure 8 , Figure 8 A flowchart illustrating another reentry test management method provided in this application embodiment, which includes at least the following steps:

[0110] 801. Record the correspondence between the target scene and the interruption point to generate reentry configuration information.

[0111] In this embodiment, the correspondence between the target scene and the interruption point is recorded, including the version of the target scene, the configuration time period, the update project, etc., so as to facilitate matching during the call process and thus ensure the accuracy of the re-entry configuration information.

[0112] 802. In response to test operations, determine the reentrancy test information set for the target scenario.

[0113] In this embodiment, the test operation is to perform a re-entry test on the target scene. At this time, the settings corresponding to the test operation, i.e., the re-entry test information, can be obtained.

[0114] 803. If the reentrancy test information matches the reentrancy configuration information, the test case corresponding to the interrupt point injection test operation is invoked to perform a reentrancy test for the target scenario based on the test case corresponding to the test operation.

[0115] In this embodiment, the matching process between reentrancy test information and reentrancy configuration information requires comparing the version, configuration time period, update items, etc. of the target scenario. For example, if the update cycle of the target scenario is 24 hours, the configuration time period needs to match whether the time difference between the reentrancy test information and the reentrancy configuration information is within 24 hours. Therefore, it is not necessary to obtain the execution function sequence again, and the corresponding interrupt point can be called directly, which improves the efficiency of reentrancy testing.

[0116] In one possible scenario, the parameters involved in the above embodiments can be adopted. Figure 9 The scene shown is displayed on the interface. Figure 9 This is a schematic diagram of another reentrancy test management method provided in this application embodiment; the diagram shows the details of the reentrancy test and the corresponding verification results. If the test case (order query failure) and the reentrancy test case (order query - order placement - check - payment successful) have the same result, it means that the verification is passed, thus ensuring the visibility of the reentrancy test process.

[0117] To better implement the above-described solutions of the embodiments of this application, related apparatus for implementing the above solutions is also provided below. Please refer to... Figure 10 , Figure 10 This is a schematic diagram of a reentry test management device provided in an embodiment of this application. The reentry test management device 1000 includes:

[0118] The acquisition unit 1001 is used to acquire the sequence of execution functions corresponding to the target scene during the execution process, wherein the sequence of execution functions includes at least two execution functions;

[0119] The determining unit 1002 is used to parse the sequence of execution functions to determine the breakpoints between the execution functions;

[0120] The management unit 1003 is used to inject test cases into the breakpoints through aspect-oriented programming, so as to perform reentrancy tests for the target scenario based on the test cases.

[0121] Optionally, in some possible implementations of this application, the acquisition unit 1001 is specifically used to acquire the execution link corresponding to the target scene during the execution process;

[0122] The acquisition unit 1001 is specifically used to collect the execution functions based on the execution chain in order to obtain the function names corresponding to the execution functions;

[0123] The acquisition unit 1001 is specifically used to integrate based on the function names to determine the sequence of execution functions;

[0124] The determining unit 1002 is specifically used to parse the function names contained in the sequence of executed functions in order to determine the breakpoints between the executed functions.

[0125] Optionally, in some possible implementations of this application, the determining unit 1002 is specifically used to determine the process information corresponding to the target scenario;

[0126] The determining unit 1002 is specifically used to determine the configuration rules corresponding to the target scenario based on the process information;

[0127] The determining unit 1002 is specifically used to filter the function names according to the configuration rules to obtain the interrupt function sequence;

[0128] The determining unit 1002 is specifically used to parse the function names contained in the interrupt function sequence in order to determine the interruption point between the execution functions.

[0129] Optionally, in some possible implementations of this application, the determining unit 1002 is specifically configured to perform configuration in response to the target operation to obtain interruption sequence information, wherein the interruption sequence information includes at least one of an exception identifier, a location identifier, a sequence identifier, or a type identifier.

[0130] The determining unit 1002 is specifically used to configure the interruption point based on the interruption order information, so as to update the interruption point.

[0131] Optionally, in some possible implementations of this application, the management unit 1003 is specifically used to compile an executable file for instructing the reentrancy test using aspect-oriented programming.

[0132] The management unit 1003 is specifically used to inject the test case into the breakpoint based on the executable file. The test case includes test case pairs, and the test case pairs include interrupt test cases and reentry test cases that are matched with each other based on the breakpoint.

[0133] The management unit 1003 is specifically used to execute the interruption test case and the reentry test case in the test case pair to obtain verification test information, which is used to indicate the result of the reentry test of the target scenario.

[0134] Optionally, in some possible implementations of this application, the management unit 1003 is specifically used to record the correspondence between the target scene and the interruption point in order to generate reentrancy configuration information;

[0135] The management unit 1003 is specifically used to determine reentry test information set for the target scenario in response to a test operation;

[0136] The management unit 1003 is specifically used to call the interrupt point to inject the test case corresponding to the test operation if the reentry test information matches the reentry configuration information, so as to execute the reentry test for the target scenario based on the test case corresponding to the test operation.

[0137] By acquiring the sequence of execution functions corresponding to the target scenario during execution, where each sequence includes at least two execution functions, and then parsing the sequence to determine the breakpoints between these functions, test cases are injected into these breakpoints using aspect-oriented programming (AOP). This allows for reentrancy testing of the target scenario based on these test cases. This enables real-time acquisition of the reentrancy testing process of the execution functions. By combining AOP-based automatic injection technology with link interruption reentrancy scenario testing, precise instrumentation can be performed at specified function locations. This allows for the automatic construction and verification of numerous interruption and reentrancy scenarios, making reentrancy testing more accurate and enabling rapid, automated batch testing, thus improving the efficiency of reentrancy testing.

[0138] This application also provides a terminal device, such as... Figure 11 The diagram shown is a structural schematic of another terminal device provided in an embodiment of this application. For ease of explanation, only the parts related to the embodiment of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiment of this application. The terminal can be any terminal device including mobile phones, tablets, personal digital assistants (PDAs), point-of-sale (POS) terminals, in-vehicle computers, etc. Taking a mobile phone as an example:

[0139] Figure 11 This is a block diagram illustrating a portion of the structure of a mobile phone related to the terminal provided in the embodiments of this application. (Reference) Figure 11 The mobile phone includes components such as a radio frequency (RF) circuit 1110, a memory 1120, an input unit 1130, a display unit 1140, a sensor 1150, an audio circuit 1160, a wireless fidelity (WiFi) module 1170, a processor 1180, and a power supply 1190. Those skilled in the art will understand that... Figure 11 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0140] The following is combined Figure 11 A detailed introduction to each component of a mobile phone:

[0141] RF circuit 1110 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with processor 1180; additionally, it transmits uplink data to the base station. Typically, RF circuit 1110 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 1110 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), etc.

[0142] The memory 1120 can be used to store software programs and modules. The processor 1180 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1120. The memory 1120 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0143] The input unit 1130 can be used to receive input numerical or character information, and generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1130 may include a touch panel 1131 and other input devices 1132. The touch panel 1131, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1131, and air touch operations within a certain range on the touch panel 1131), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1131 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 1180, and can receive and execute commands sent by the processor 1180. In addition, the touch panel 1131 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. Besides the touch panel 1131, the input unit 1130 may also include other input devices 1132. Specifically, other input devices 1132 may include, but are not limited to, one or more of the following: a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick.

[0144] The display unit 1140 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1140 may include a display panel 1141, which may optionally be configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar form. Further, a touch panel 1131 may cover the display panel 1141. When the touch panel 1131 detects a touch operation on or near it, it transmits the information to the processor 1180 to determine the type of touch event. Subsequently, the processor 1180 provides corresponding visual output on the display panel 1141 based on the type of touch event. Although in Figure 11 In this embodiment, the touch panel 1131 and the display panel 1141 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1131 and the display panel 1141 can be integrated to realize the input and output functions of the mobile phone.

[0145] The mobile phone may also include at least one sensor 1150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1141 according to the ambient light level, and the proximity sensor can turn off the display panel 1141 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0146] Audio circuit 1160, speaker 1161, and microphone 1162 provide an audio interface between the user and the mobile phone. Audio circuit 1160 converts received audio data into electrical signals and transmits them to speaker 1161, where speaker 1161 converts them into sound signals for output. On the other hand, microphone 1162 converts collected sound signals into electrical signals, which are received by audio circuit 1160, converted into audio data, and then processed by processor 1180 before being transmitted via RF circuit 1110 to, for example, another mobile phone, or the audio data can be output to memory 1120 for further processing.

[0147] WiFi is a short-range wireless transmission technology. Through the WiFi module 1170, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 11 WiFi module 1170 is shown, but it is understood that it is not an essential component of the mobile phone and can be omitted as needed without changing the nature of the embodiment.

[0148] The processor 1180 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes various functions and processes data by running or executing software programs and / or modules stored in the memory 1120, and by calling data stored in the memory 1120. Optionally, the processor 1180 may include one or more processing units; optionally, the processor 1180 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may also not be integrated into the processor 1180.

[0149] The mobile phone also includes a power supply 1190 (such as a battery) that supplies power to various components. Optionally, the power supply can be logically connected to the processor 1180 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.

[0150] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.

[0151] In this embodiment of the application, the processor 1180 included in the terminal also has the function of performing the various steps of the page processing method described above.

[0152] This application also provides a server; please refer to [link / reference]. Figure 12 , Figure 12 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1200 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1222 (e.g., one or more processors) and memory 1232, and one or more storage media 1230 (e.g., one or more mass storage devices) for storing application programs 1242 or data 1244. The memory 1232 and storage media 1230 can be temporary or persistent storage. The program stored in the storage media 1230 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the server. Furthermore, the CPU 1222 may be configured to communicate with the storage media 1230 and execute the series of instruction operations in the storage media 1230 on the server 1200.

[0153] Server 1200 may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input / output interfaces 1258, and / or one or more operating systems 1241, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0154] The steps performed by the management device in the above embodiments can be based on this Figure 12 The server structure shown.

[0155] This application embodiment also provides a computer-readable storage medium storing management instructions for reentrancy testing, which, when executed on a computer, cause the computer to perform the aforementioned actions. Figures 3 to 9 The steps performed by the management device for reentry testing in the method described in the illustrated embodiment.

[0156] This application also provides a computer program product that includes management instructions for reentry testing, which, when run on a computer, causes the computer to perform the aforementioned actions. Figures 3 to 9 The steps performed by the management device for reentry testing in the method described in the illustrated embodiment.

[0157] This application embodiment also provides a reentry test management system, which may include... Figure 10 The management device for reentry testing in the described embodiments, or Figure 11 The terminal device in the described embodiments, or Figure 12 The server described.

[0158] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0159] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0160] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0161] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0162] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a reentry test management device, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0163] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application 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 this application.

Claims

1. A method for managing reentrancy tests, characterized in that, include: Obtain the execution chain corresponding to the target scenario during execution; Based on the execution chain, the execution functions are collected to obtain the function names corresponding to the execution functions; The function names are integrated to determine the sequence of execution functions; the sequence of execution functions includes at least two execution functions. Determine the process information corresponding to the target scenario; Based on the process information, determine the configuration rules corresponding to the target scenario; The function names contained in the execution function sequence are filtered according to the configuration rules to obtain the interrupt function sequence; The function names contained in the interrupt function sequence are parsed to determine the interruption points between the execution functions; Test cases are injected into the breakpoints using aspect-oriented programming to perform reentrancy tests for the target scenario based on the test cases.

2. The method according to claim 1, characterized in that, The method further includes: Configuration is performed in response to a target operation to obtain interruption sequence information, which includes at least one of an exception identifier, a location identifier, a sequence identifier, or a type identifier; The interrupt points are configured based on the interruption sequence information in order to update the interrupt points.

3. The method according to claim 1, characterized in that, The step of injecting test cases into the breakpoints using aspect-oriented programming, and then executing reentrancy tests for the target scenario based on the test cases, includes: The executable file used to instruct the reentrancy test is compiled using aspect-oriented programming. The test case is injected into the breakpoint based on the executable file. The test case contains test case pairs, and the test case pairs include an interrupt test case and a reentrancy test case that are matched with each other based on the breakpoint. The interruption test case and the reentry test case in the test case pair are executed to obtain verification test information, which is used to indicate the result of the reentry test of the target scenario.

4. The method according to any one of claims 1-3, characterized in that, The method further includes: Record the correspondence between the target scene and the interruption point to generate reentry configuration information; In response to the test operation, determine the reentry test information set for the target scenario; If the reentrancy test information matches the reentrancy configuration information, then the test case corresponding to the test operation is injected at the interrupt point to perform a reentrancy test for the target scenario based on the test case corresponding to the test operation.

5. The method according to claim 1, characterized in that, The target scenario is a payment scenario, and the execution function sequence includes an order query function, an order placement function, an inspection function, and a deduction function. The re-entry test is to verify and compare the exception information configured for the order query function, the order placement function, the inspection function, and the deduction function, respectively.

6. A management device for reentry testing, characterized in that, include: The acquisition unit is used to acquire the execution chain corresponding to the target scenario during the execution process; Based on the execution chain, the execution functions are collected to obtain the function names corresponding to the execution functions; The function names are integrated to determine the sequence of execution functions, which includes at least two execution functions. A determining unit is used to determine the process information corresponding to the target scenario; Based on the process information, the configuration rules corresponding to the target scenario are determined; the function names contained in the execution function sequence are filtered according to the configuration rules to obtain the interruption function sequence; the function names contained in the interruption function sequence are parsed to determine the interruption points between the execution functions; The management unit is used to inject test cases into the breakpoints using aspect-oriented programming, and to perform reentrancy tests for the target scenario based on the test cases.

7. The apparatus according to claim 6, characterized in that, The determining unit is specifically configured in response to the target operation to obtain interruption sequence information, wherein the interruption sequence information includes at least one of an exception identifier, a location identifier, a sequence identifier, or a type identifier. The determining unit is specifically used to configure the interruption point based on the interruption order information, so as to update the interruption point.

8. The apparatus according to claim 6, characterized in that, The management unit is specifically used to compile an executable file that instructs the reentrancy test using aspect-oriented programming. The management unit is specifically used to inject the test case into the breakpoint based on the executable file. The test case includes test case pairs, and the test case pairs include interrupt test cases and reentry test cases that are matched with each other based on the breakpoint. The management unit is specifically used to execute the interruption test case and the reentry test case in the test case pair to obtain verification test information, which is used to indicate the result of the reentry test of the target scenario.

9. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store program code; the processor is used to execute the reentry test management method according to any one of claims 1 to 5 according to the instructions in the program code.

10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the reentry test management method according to any one of claims 1 to 5.