Mock testing method and device for distributed systems
By receiving and parsing messages in a distributed system and using a preprocessor to determine the Mock information match, Mock testing is implemented, which solves the problems of cumbersome and poor compatibility of Mock testing in the existing technology and improves system performance and stability.
Patent Information
- Application Number
- CN202410580455.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-11
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-05-11
AI Technical Summary
In the existing technology, mock testing of distributed systems requires the use of third-party tools, which makes deployment and removal cumbersome, affects system performance and stability, and has poor compatibility.
Provided are a mock testing method and device for a distributed system. The method receives a message containing explicit and implicit information, generates a call request, parses and stores the implicit information, and uses a preprocessor to determine whether the mock information matches, thereby implementing mock testing. This reduces testing workload and improves system performance and stability.
It simplifies mock testing operations, reduces testing workload, avoids compatibility issues with third-party tools, improves system performance and stability, and does not affect normal transactions.
Smart Images

Figure CN118503101B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of software development and software testing and can be used in the field of financial technology, and in particular to a mock testing method and device for a distributed system. Background Art
[0002] This section is intended to provide a background or context for embodiments of the present invention. No description herein is admitted to be prior art by virtue of its inclusion in this section.
[0003] In a distributed system, a single method call often involves multiple method calls across multiple nodes, forming a long call chain. When testing an existing distributed system, it's often unnecessary to focus on the entire call chain; only the modified portion is sufficient.
[0004] Mock testing can truncate the call chain, enabling testing of a specific segment of the call chain. However, currently, no distributed system natively supports mock testing, requiring the use of third-party mock testing tools. These tools require deployment before testing and removal afterward, making them cumbersome. Due to the large number of nodes in a distributed system, repeated deployment and removal of these tools is time-consuming and labor-intensive. Furthermore, third-party mock testing tools vary in their compatibility with the system, significantly impacting system performance and stability, even after removal. Summary of the Invention
[0005] An embodiment of the present invention provides a mock testing method for a distributed system, which is used to reduce the workload of mock testing and improve system performance and stability. The method includes:
[0006] Receive a message, the message including explicit information and implicit information, the explicit information including input parameters of the remote node, and the implicit information including Mock information;
[0007] Repeat the following steps until a remote node in the distributed system completes the Mock test and returns the thread:
[0008] Generate a call request based on the message and send the call request to the remote node. After the remote node receives the call request, it requests a thread from the distributed system's thread pool and calls the remote node based on the explicit information in the message and the requested thread.
[0009] Parse the call request received by the remote node, obtain the implicit information in the message corresponding to the call request, store the implicit information in the message in the thread context, and continue to call the remote node;
[0010] In the process of calling a remote node, when a new remote node call occurs, a proxy object of the called new remote node is obtained, the proxy object includes a preprocessor, the preprocessor is executed, and it is determined whether there is Mock information in the context of the thread. If there is Mock information in the context of the thread, it is determined whether the Mock information in the context of the thread matches the new remote node;
[0011] If the Mock information in the thread context matches the new remote node, the Mock test is completed according to the Mock information in the thread context and the thread is returned;
[0012] If the Mock information in the thread context does not match the new remote node, the thread context and the message calling the new remote node are concatenated into a new message, and the new message is used as the received message.
[0013] An embodiment of the present invention further provides a mock testing device for a distributed system, which is used to reduce the workload of mock testing and improve system performance and stability. The device includes:
[0014] A receiving module, configured to receive a message, wherein the message includes explicit information and implicit information, wherein the explicit information includes input parameters of the remote node, and the implicit information includes Mock information;
[0015] The loop judgment module is used to repeatedly execute the following steps until a remote node in the distributed system completes the Mock test and returns the thread:
[0016] The node call module is used to generate a call request based on the message and send the call request to the remote node. After the remote node receives the call request, it requests a thread from the thread pool of the distributed system and calls the remote node based on the explicit information in the message and the requested thread.
[0017] The information parsing module is used to parse the call request received by the remote node, obtain the implicit information in the message corresponding to the call request, store the implicit information in the message in the context of the thread, and continue to call the remote node;
[0018] An information judgment module is used to obtain a proxy object of the called new remote node when a new remote node call occurs during the process of calling a remote node, wherein the proxy object includes a preprocessor, execute the preprocessor, and judge whether there is Mock information in the context of the thread; if there is Mock information in the context of the thread, judge whether the Mock information in the context of the thread matches the new remote node;
[0019] The Mock test module is used to complete the Mock test and return the thread according to the Mock information in the thread context if the Mock information in the thread context matches the new remote node;
[0020] The message splicing module is used to splice the thread context and the message of calling the new remote node into a new message if the Mock information in the thread context does not match the new remote node, and use the new message as the received message.
[0021] An embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned Mock testing method for the distributed system when executing the computer program.
[0022] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the computer program implements the above-mentioned Mock testing method for the distributed system.
[0023] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the computer program implements the above-mentioned Mock testing method for the distributed system.
[0024] In an embodiment of the present invention, a message is received, the message including explicit information and implicit information, the explicit information including the input parameter of the remote node, and the implicit information including the Mock information; the following steps are repeatedly performed until a remote node in the distributed system completes the Mock test and returns the thread: a call request is generated according to the message, the call request is sent to the remote node, after the remote node receives the call request, a thread is applied for from the thread pool of the distributed system, and the remote node is called according to the explicit information in the message and the applied thread; the call request received by the remote node is parsed to obtain the implicit information in the message corresponding to the call request, the implicit information in the message is stored in the context of the thread, and the remote node is continued to be called; in the call During a remote node call, when a new remote node call occurs, a proxy object of the called new remote node is obtained, the proxy object including a preprocessor is executed to determine whether there is mock information in the thread context. If there is mock information in the thread context, the preprocessor determines whether the mock information in the thread context matches the new remote node. If the mock information in the thread context matches the new remote node, the mock test is completed according to the mock information in the thread context, and the thread is returned. If the mock information in the thread context does not match the new remote node, the thread context and the message for calling the new remote node are spliced into a new message, and the new message is used as the received message. In this way, by obtaining mock information from the message during the remote node call and storing it in the thread context, when a remote node call occurs, the thread context and the mock method of the current node are compared to determine whether they are the same. If they are the same, the mock test is performed, and if they are not, a new message is spliced. This enables the transmission of mock information between nodes, reduces testing workload, and improves software development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0026] Figure 1 This is a flowchart of a Mock testing method for a distributed system provided in an embodiment of the present invention;
[0027] Figure 2 A schematic diagram of a remote call provided in an embodiment of the present invention;
[0028] Figure 3 A schematic diagram of a Mock testing device for a distributed system provided in an embodiment of the present invention;
[0029] Figure 4 Another schematic diagram of a mock testing device for a distributed system provided in an embodiment of the present invention;
[0030] Figure 5 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0031] To make the purpose, technical solutions and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0032] The term "and / or" herein simply describes an association relationship, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, and the existence of B alone. In addition, the term "at least one" herein refers to any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C.
[0033] In the description of this specification, the terms "include", "including", "have", "contain", etc. are all open terms, which mean including but not limited to. The descriptions with reference to the terms "one embodiment", "a specific embodiment", "some embodiments", "for example", etc. mean that the specific features, structures or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. The order of steps involved in each embodiment is used to schematically illustrate the implementation of the present application, and the order of steps therein is not limited and can be appropriately adjusted as needed.
[0034] The embodiment of the present invention provides a Mock testing method for a distributed system. Figure 1 Shown, including:
[0035] Step 101: Receive a message, the message including explicit information and implicit information, the explicit information including input parameters of the remote node, and the implicit information including Mock information;
[0036] Step 102: Repeat the following steps until a remote node in the distributed system completes the Mock test and returns the thread:
[0037] Step 1021: Generate a call request based on the message and send the call request to the remote node. After receiving the call request, the remote node requests a thread from the thread pool of the distributed system and calls the remote node based on the explicit information in the message and the requested thread.
[0038] Step 1022: Parse the call request received by the remote node to obtain implicit information in the message corresponding to the call request, store the implicit information in the message in the thread context, and continue to call the remote node;
[0039] Step 1023: When a new remote node call occurs during the process of calling a remote node, a proxy object of the called new remote node is obtained. The proxy object includes a preprocessor. The preprocessor is executed to determine whether there is mock information in the thread context. If there is mock information in the thread context, the preprocessor is executed to determine whether the mock information in the thread context matches the new remote node.
[0040] Step 1024: If the Mock information in the thread context matches the new remote node, complete the Mock test based on the Mock information in the thread context and return the thread;
[0041] Step 1025: If the Mock information in the thread context does not match the new remote node, the thread context and the message for calling the new remote node are concatenated into a new message, and the new message is used as the received message.
[0042] The Mock testing method for a distributed system proposed in an embodiment of the present invention starts the system interceptor and adds a preprocessor to all proxy objects after turning on the system's Mock testing switch. After receiving a request, the interceptor will try to obtain the Mock information from the request message and store it in the thread context. When a remote method call is about to occur, the preprocessor of the proxy object will compare whether the current method and the Mock method in the thread context are the same. If they are the same, Mock will be performed. If they are different, the Mock information in the thread context will be obtained, and a new message will be spliced to realize the transmission of Mock information between nodes. There is no need to deploy a third-party Mock testing tool to test a specific call chain, eliminate the impact of subsequent call chains, reduce testing workload, and improve software development efficiency. Compared with the existing technology, it has the following advantages:
[0043] 1. Simple operation and easy use, greatly reducing the testing workload;
[0044] 2. No need to use third-party mock testing tools, no compatibility issues;
[0045] 3. The native Mock test function provided by the system has good performance and stability;
[0046] 4. When the switch is turned on, it will not affect normal transactions;
[0047] 5. When the switch is turned off, there is no performance loss at all.
[0048] In one embodiment, parsing the call request received by the remote node includes:
[0049] An interceptor is set up at the remote node to intercept the call request and obtain the implicit information in the call request according to the preset message format;
[0050] Store implicit information in the thread context and continue calling the remote node, including:
[0051] After the implicit information is stored in the thread context, the call request is released and the remote node is called according to the call request.
[0052] In one embodiment, it further includes:
[0053] Until the call to the remote node is completed and no new remote node call occurs, the preset processing result is returned.
[0054] In one embodiment, the mock information includes: a unique identifier of the mock method, a return value of the mock method, and a response waiting time of the mock method.
[0055] In one embodiment, determining whether the Mock information in the thread context matches the new remote node includes:
[0056] Based on the unique identifier of the Mock method, determine whether the Mock information in the thread context matches the new remote node.
[0057] Figure 2 A schematic diagram of a remote call provided in an embodiment of the present invention is shown in FIG. Figure 2 For example, during the specific implementation, the tester prepares a message. The message contains two parts, explicit and implicit. The explicit information is the input parameter of the currently called remote method. The implicit information is the Mock-related information, including but not limited to: 1) the unique identifier of the Mock method, 2) the method return value, and 3) the response waiting time. The message format can be arbitrarily specified, but the caller and the callee must agree in advance. The unique identifier of the Mock method is used to determine the method that needs to be mocked. A string composed of the full name, version number, etc. of the method can be used as the unique identifier; the method return value is used to ensure the normal execution of the method, and the real method return value can be used; the response waiting time is used to simulate the execution time of the method, and the average execution time of the method can be used.
[0058] A remote method call is initiated, and a request message carrying the message is sent over the network to the node where the remote method is located. Each time the system on the node receives a request, it requests a new thread from the thread pool to process the request. After the request is processed, the thread is returned to the thread pool.
[0059] The interceptor intercepts the request, obtains the implicit information in the request message according to the message format convention, and stores it in the thread context of the new thread. The interceptor then releases the request. The mock information in the thread context may be read multiple times. For security reasons, the mock information can be set to an immutable data type.
[0060] In one embodiment, it further includes:
[0061] Generate a proxy object using any of the following methods:
[0062] Generate proxy objects when the distributed system starts;
[0063] Generate a proxy object when obtaining it for the first time.
[0064] In practice, the logic in the method contained in the remote node continues to execute. If no new remote method calls are encountered by the end of the method, a normal return is made, and the current thread is returned. If a new remote method call is encountered, a proxy object for the called remote method is retrieved from the system. The proxy object consists of two parts: a preprocessor and an encapsulation of the remote method call logic. The proxy object can be generated in eager mode at system startup, or in lazy mode at the first retrieval. After the proxy object is generated, it is placed in the cache and subsequently retrieved from the cache for reuse.
[0065] In one embodiment, it further includes:
[0066] When there is no Mock information in the thread context, exit the preprocessor and continue to call the new remote node.
[0067] In specific implementation, the preprocessor of the proxy object is executed to determine whether there is mock information in the thread context. If not, the preprocessor exits and the normal remote method call continues. If it exists, it further determines whether the mock method is the current method. If so, it obtains the method return value and response wait time from the thread context. After the wait time, it returns the method return value and then returns to the current thread, completing the mock test. If not, the current message and the information in the thread context are spliced into a new message, and then the second step is repeated to initiate a new round of remote method calls.
[0068] The present invention also provides a distributed system mock test device, as described in the following embodiments. Since the principle of the device to solve the problem is similar to the distributed system mock test method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0069] It should be noted that the distributed system mock testing method provided in the embodiment of the present invention can be used in the financial field, and can also be used in any technical field other than the financial field. The embodiment of the present invention does not limit the application field of the virtual reality-based bank training system and its training method.
[0070] Figure 3 Schematic diagram of a Mock test device for a distributed system provided in an embodiment of the present invention, as shown in FIG. Figure 3 As shown, the device includes:
[0071] The receiving module 301 is configured to receive a message, wherein the message includes explicit information and implicit information, wherein the explicit information includes input parameters of the remote node, and the implicit information includes Mock information;
[0072] The loop judgment module 302 is used to repeatedly execute the following steps until a remote node in the distributed system completes the Mock test and returns the thread:
[0073] The node calling module 3021 is used to generate a call request based on the message and send the call request to the remote node. After the remote node receives the call request, it requests a thread from the thread pool of the distributed system and calls the remote node based on the explicit information in the message and the requested thread.
[0074] The information parsing module 3022 is used to parse the call request received by the remote node, obtain the implicit information in the message corresponding to the call request, store the implicit information in the message in the thread context, and continue to call the remote node;
[0075] The information determination module 3023 is configured to, when a new remote node call occurs during the process of calling a remote node, obtain a proxy object of the called new remote node, wherein the proxy object includes a preprocessor, execute the preprocessor, and determine whether there is mock information in the thread context; if there is mock information in the thread context, determine whether the mock information in the thread context matches the new remote node;
[0076] The Mock test module 3024 is used to complete the Mock test according to the Mock information in the thread context and return the thread if the Mock information in the thread context matches the new remote node;
[0077] The message splicing module 3025 is used to splice the thread context and the message calling the new remote node into a new message if the Mock information in the thread context does not match the new remote node, and use the new message as the received message.
[0078] In one embodiment, the information parsing module 3022 is specifically configured to:
[0079] An interceptor is set up at the remote node to intercept the call request and obtain the implicit information in the call request according to the preset message format;
[0080] After the implicit information is stored in the thread context, the call request is released and the remote node is called according to the call request.
[0081] In one embodiment, a return module is further included, specifically configured to:
[0082] Until the call to the remote node is completed and no new remote node call occurs, the preset processing result is returned.
[0083] In one embodiment, the mock information includes: a unique identifier of the mock method, a return value of the mock method, and a response waiting time of the mock method.
[0084] In one embodiment, the information determination module 3023 is specifically configured to:
[0085] Based on the unique identifier of the Mock method, determine whether the Mock information in the thread context matches the new remote node.
[0086] Figure 4 Another schematic diagram of the Mock testing device for the distributed system provided in an embodiment of the present invention is shown in FIG. Figure 4 As shown, the distributed system provided in the embodiment of the present invention further includes a proxy object generation module 401, which is specifically used to:
[0087] Generate a proxy object using any of the following methods:
[0088] Generate proxy objects when the distributed system starts;
[0089] Generate a proxy object when obtaining it for the first time.
[0090] In one embodiment, a recall module is further included, specifically configured to:
[0091] When there is no Mock information in the thread context, exit the preprocessor and continue to call the new remote node.
[0092] Based on the above invention concept, Figure 5As shown, the present invention also proposes a computer device 500, including a memory 510, a processor 520 and a computer program 530 stored in the memory 510 and executable on the processor 520, wherein the processor 520 implements the aforementioned distributed system mock testing method when executing the computer program 530.
[0093] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the computer program implements the above-mentioned Mock testing method for the distributed system.
[0094] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the computer program implements the above-mentioned Mock testing method for the distributed system.
[0095] In summary, in an embodiment of the present invention, a message is received, the message including explicit information and implicit information, the explicit information including the input parameters of the remote node, and the implicit information including the Mock information; the following steps are repeatedly performed until a remote node in the distributed system completes the Mock test and returns the thread: a call request is generated according to the message, the call request is sent to the remote node, after the remote node receives the call request, a thread is applied for from the thread pool of the distributed system, and the remote node is called according to the explicit information in the message and the applied thread; the call request received by the remote node is parsed to obtain the implicit information in the message corresponding to the call request, the implicit information in the message is stored in the context of the thread, and the remote node is continued to be called; In the process of calling a remote node, when a new remote node call occurs, a proxy object of the called new remote node is obtained, the proxy object includes a preprocessor, the preprocessor is executed, and whether there is mock information in the thread context. If there is mock information in the thread context, it is determined whether the mock information in the thread context matches the new remote node; if the mock information in the thread context matches the new remote node, the mock test is completed according to the mock information in the thread context, and the thread is returned; if the mock information in the thread context does not match the new remote node, the thread context and the message of calling the new remote node are spliced into a new message, and the new message is used as the received message. In this way, by obtaining mock information from the message during the process of calling the remote node and storing it in the thread context, when a remote node call occurs, the thread context and the mock method of the current node are compared to see if they are the same. If they are the same, the mock test is performed, and if they are not, a new message is spliced, thereby realizing the transmission of mock information between nodes, reducing the testing workload, and improving software development efficiency.
[0096] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0097] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0098] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0099] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0100] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A Mock testing method for a distributed system, characterized in that: include: Receive a message, the message including explicit information and implicit information, the explicit information including input parameters of the remote node, and the implicit information including Mock information; Repeat the following steps until a remote node in the distributed system completes the Mock test and returns the thread: Generate a call request based on the message and send the call request to the remote node. After the remote node receives the call request, it requests a thread from the distributed system's thread pool and calls the remote node based on the explicit information in the message and the requested thread. Parse the call request received by the remote node, obtain the implicit information in the message corresponding to the call request, store the implicit information in the message in the thread context, and continue to call the remote node; In the process of calling a remote node, when a new remote node call occurs, a proxy object of the called new remote node is obtained, the proxy object includes a preprocessor, the preprocessor is executed, and it is determined whether there is Mock information in the context of the thread. If there is Mock information in the context of the thread, it is determined whether the Mock information in the context of the thread matches the new remote node; If the Mock information in the thread context matches the new remote node, the Mock test is completed according to the Mock information in the thread context and the thread is returned; If the Mock information in the thread context does not match the new remote node, the thread context and the message calling the new remote node are concatenated into a new message, and the new message is used as the received message.
2. The method according to claim 1, wherein Parse the call request received by the remote node, including: An interceptor is set up at the remote node to intercept the call request and obtain the implicit information in the call request according to the preset message format; Store implicit information in the thread context and continue calling the remote node, including: After the implicit information is stored in the thread context, the call request is released and the remote node is called according to the call request.
3. The method according to claim 1, wherein Also includes: Until the call to the remote node is completed and no new remote node call occurs, the preset processing result is returned.
4. The method according to claim 1, wherein Mock information includes: the unique identifier of the Mock method, the return value of the Mock method, and the response waiting time of the Mock method.
5. The method according to claim 4, wherein Determine whether the Mock information in the thread context matches the new remote node, including: Based on the unique identifier of the Mock method, determine whether the Mock information in the thread context matches the new remote node.
6. The method according to claim 1, wherein Also includes: Generate a proxy object using any of the following methods: Generate proxy objects when the distributed system starts; Generate a proxy object when obtaining it for the first time.
7. The method according to claim 1, wherein Also includes: When there is no Mock information in the thread context, exit the preprocessor and continue to call the new remote node.
8. A Mock testing device for a distributed system, characterized in that: include: A receiving module, configured to receive a message, wherein the message includes explicit information and implicit information, wherein the explicit information includes input parameters of the remote node, and the implicit information includes Mock information; The loop judgment module is used to repeatedly execute the following steps until a remote node in the distributed system completes the Mock test and returns the thread: The node call module is used to generate a call request based on the message and send the call request to the remote node. After the remote node receives the call request, it requests a thread from the thread pool of the distributed system and calls the remote node based on the explicit information in the message and the requested thread. The information parsing module is used to parse the call request received by the remote node, obtain the implicit information in the message corresponding to the call request, store the implicit information in the message in the context of the thread, and continue to call the remote node; An information judgment module is used to obtain a proxy object of the called new remote node when a new remote node call occurs during the process of calling a remote node, wherein the proxy object includes a preprocessor, execute the preprocessor, and judge whether there is Mock information in the context of the thread; if there is Mock information in the context of the thread, judge whether the Mock information in the context of the thread matches the new remote node; The Mock test module is used to complete the Mock test and return the thread according to the Mock information in the thread context if the Mock information in the thread context matches the new remote node; The message splicing module is used to splice the thread context and the message of calling the new remote node into a new message if the Mock information in the thread context does not match the new remote node, and use the new message as the received message.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Electronic device, multi-qualification interface Mock test method and storage medium
CN110191013A
Mock test method and related equipment thereof
CN116166569A