Data processing method and device, electronic equipment, computer readable storage medium and computer program product

By querying the message modification field and custom exception field of the piling information, the limitations of existing piling test tools are solved, flexible modification and exception simulation of test messages are achieved, the application scenarios of piling tests are expanded, and the comprehensiveness and accuracy of the tests are improved.

CN120743741APending Publication Date: 2025-10-03TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410374452.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-28
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

Existing stub testing tools cannot support message modification, complex exception scenarios, non-HTTP protocol requests, and embedded hook functions. Their application scenarios are limited and they cannot meet diverse testing needs.

Method used

By obtaining the stubbing information of the request message, querying the stubbing fields, modifying the message and transmitting exceptions, supporting custom logic of multiple protocols and hook functions, the application scenarios of stubbing testing are expanded.

Benefits of technology

It enables flexible modification of test messages and exception simulation, expands the application scenarios of pile driving tests, and improves the comprehensiveness and accuracy of tests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743741A_ABST
    Figure CN120743741A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and device, electronic equipment, a computer program product and a computer readable storage medium. The method comprises the following steps: acquiring a request message sent by a first service, and acquiring piling information corresponding to the request message; a piling field of the piling information is inquired based on the request message, the piling field comprises a message modification field or a user-defined exception field, the message modification field is used for indicating modification of the test message, and the user-defined exception field is used for indicating exception transmission of the simulation test message; the test message comprises at least one of a request message and a response message of the request message; when the message modification field is queried, performing message modification on the test message based on a message modification mode corresponding to the message modification field; and when the user-defined abnormal field is queried, simulating the test message to perform abnormal transmission based on the user-defined abnormal transmission mode corresponding to the user-defined abnormal field. According to the invention, the application scene of the piling test can be expanded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, electronic device, computer-readable storage medium, and computer program product. Background Art

[0002] Stub testing is a testing technique based on simulated data, used to simulate or replace specific components or services in a system to isolate the test environment, improve test efficiency, and ensure comprehensiveness and accuracy. In software development, stub testing is commonly used in scenarios such as integration testing, unit testing, and API testing. By accurately simulating the data and behavior returned by the interface, it can effectively reduce testing costs and time, and improve the utilization of testing resources. However, stub testing in related technologies can only simply return simulated data, limiting its application scenarios. Summary of the Invention

[0003] The embodiments of the present application provide a data processing method, device, electronic device, computer-readable storage medium, and computer program product, which realize the application scenarios of extended pile driving testing.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present invention provides a data processing method, including:

[0006] Obtain a request message sent by the first service, and obtain stubbing information corresponding to the request message;

[0007] Based on the request message, querying a piling field of the piling information, wherein the piling field includes a message modification field or a custom exception field, the message modification field is used to indicate modification of a test message, the custom exception field is used to indicate simulation of abnormal transmission of the test message, and the test message includes at least one of the request message and a response message to the request message;

[0008] When the message modification field is found, modifying the test message based on the message modification mode corresponding to the message modification field;

[0009] When the custom exception field is found, the test message is simulated for exception transmission based on the custom exception transmission mode corresponding to the custom exception field.

[0010] An embodiment of the present application provides a data processing device, including:

[0011] A data receiving module, configured to obtain a request message sent by the first service and obtain stub information corresponding to the request message;

[0012] an information management module, configured to query a piling field of the piling information based on the request message, wherein the piling field includes a message modification field or a custom exception field, the message modification field is used to indicate modification of a test message, the custom exception field is used to indicate simulation of abnormal transmission of the test message, and the test message includes at least one of the request message and a response message to the request message;

[0013] a message modification module, configured to modify the test message based on the message modification mode corresponding to the message modification field when the message modification field is found;

[0014] The exception transmission module is used to simulate the test message to perform exception transmission based on the custom exception transmission mode corresponding to the custom exception field when the custom exception field is queried.

[0015] An embodiment of the present application provides an electronic device for data processing, the electronic device comprising:

[0016] a memory for storing computer-executable instructions;

[0017] The processor is used to implement the method provided in the embodiment of the present application when executing the computer-executable instructions stored in the memory.

[0018] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the data processing method provided in the embodiment of the present application when executed by a processor.

[0019] An embodiment of the present application provides a computer program product, including a computer program or computer-executable instructions. When the computer program or computer-executable instructions are executed by a processor, the data processing method provided in the embodiment of the present application is implemented.

[0020] The embodiments of the present application have the following beneficial effects:

[0021] Based on the piling information corresponding to the request message, the piling field of the piling information is queried. When the message modification field is queried, the test message is modified. When the custom exception field is queried, the test message is simulated for abnormal transmission, realizing the application scenario of message modification and simulation of abnormal data transmission, thereby expanding the application scenario of the piling test. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 This is a schematic diagram of the structure of the data processing system architecture provided by the embodiment of the present application;

[0023] Figure 2is a structural diagram of an electronic device for data processing provided in an embodiment of the present application;

[0024] Figure 3A This is a first flow chart of the data processing method provided in an embodiment of the present application;

[0025] Figure 3B This is a second flow chart of the data processing method provided in an embodiment of the present application;

[0026] Figure 3C 3 is a schematic diagram of a third flow chart of the data processing method provided in an embodiment of the present application;

[0027] Figure 3D 4 is a schematic diagram of a fourth flow chart of a data processing method provided in an embodiment of the present application;

[0028] Figure 3E 5 is a schematic diagram of a fifth flow chart of a data processing method provided in an embodiment of the present application;

[0029] Figure 3F 6 is a schematic diagram of a sixth flow chart of a data processing method provided in an embodiment of the present application;

[0030] Figure 4 This is a diagram of the overall solution architecture of the data processing method provided in the embodiment of the present application;

[0031] Figure 5 It is a flow chart of the overall solution of the data processing method provided in the embodiment of the present application.

[0032] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of distinction between the advantages and disadvantages of the solutions or the priority in the implementation process. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0034] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0035] If similar descriptions of "first / second" appear in the application documents, the following explanation is added. In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0036] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0037] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0038] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.

[0039] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0040] 1) Mock: In the field of automated testing, mocking refers to writing or generating stub code, replacing the code outside the test task but related to the test task with stub code, thereby achieving separated test tasks.

[0041] 2) Mock testing: This is a technique that uses simulated or fake objects to replace real components. It can be understood as a technique used to simulate and replace the interface of a component or service under development to return simulated response data or perform specific operations. Through mock testing, the dependencies of the tested code can be isolated, making the test more controllable, stable, and efficient.

[0042] 3) Mock information: also known as mock rules, mock rules refer to some guidelines and regulations that need to be followed when performing unit testing. For example, they can be rules used to indicate the data and behavior returned by the tested service interface in the mock test.

[0043] 4) Dynamic stubbing: A method of simulating objects in unit testing that can dynamically simulate the behavior of objects according to the test requirements and is strongly related to the business scenarios corresponding to the service interface under test. The strong correlation with the business scenarios corresponding to the service interface under test means that the instances of dynamic stubbing are generated based on specific business scenarios and often have a one-to-one correspondence with the business scenarios corresponding to the service interface under test.

[0044] 5) Hook function: It is a program used to process system messages. It is hooked into the system through system calls. In the embodiment of the present application, the hook function is used to implement message modification and serialization operations on test messages, and users can customize hook functions to implement special business logic.

[0045] Related technologies When performing automated testing, the main stubbing testing tools used are MockJS and Yapi's Mock function: MockJS intercepts specific AJAX requests and generates random numbers of a set type to simulate the data returned by the back-end interface. There are two ways to set the generated data type: one is to use a data template to set the generated simulated data. This method has a large degree of freedom in generating defined data, but the credibility is low; the other is to use MockJS's own Random tool class method to set the generated simulated data. This method has a small degree of freedom in generating data and can only randomly generate data types supported by MockJS; Yapi's Mock function can generate a Mock interface based on the interface information input by the user. The Mock interface will automatically generate simulated data, and the creator can freely construct the required data. The interface information input by the user includes a Uniform Resource Locator (URL), interface name, request header, request parameters, and return data rules.

[0046] However, in actual application, the relevant technologies still have the following technical problems:

[0047] 1) It does not support message modification and can only simply return simulated data, which has very limited application scenarios;

[0048] 2) Currently, all stub tools on the market only support requests based on the Hypertext Transfer Protocol (HTTP) and cannot support other protocols;

[0049] 3) It cannot support complex and abnormal piling business scenarios, and cannot support testing under abnormal business scenarios;

[0050] 4) Embedded hook functions are not supported, and businesses cannot customize stubbing logic.

[0051] In order to solve the above problems, the embodiments of the present application provide a data processing method, device, electronic device, computer-readable storage medium and computer program product, which realize the application scenarios of extended pile driving testing.

[0052] The following describes the data processing system provided by the embodiment of the present application. Figure 1 , Figure 1 This is an architectural diagram of a data processing system 10 provided in an embodiment of the present application. To support a data processing application, a terminal 100 is connected to a server 200 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.

[0053] The terminal 100 is used to obtain a request message for the first service, send the request message to the server 200 , and receive a response message returned by the server 200 .

[0054] The server 200 is used to obtain the request message sent by the first service in the terminal 100, and obtain the piling information corresponding to the request message, and then query the piling field of the piling information based on the request message: when the message modification field is queried, the test message is modified based on the message modification method corresponding to the message modification field, and the test message includes at least one of the request message and the response message of the request message; when the custom exception field is queried, based on the custom exception transmission method corresponding to the custom exception field, the test message is simulated for exception transmission.

[0055] The database 500 is used to store the piling information so that the server 200 can query the piling field of the piling information based on the request message.

[0056] In some embodiments, the terminal or server can implement the data processing method provided in the embodiments of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as an instant messaging application; it can also be a small program that can be embedded in any APP, that is, a program that can be run only by downloading it into a browser environment. In short, the above-mentioned computer program can be any form of application, module or plug-in.

[0057] In some embodiments, the terminal 100 can be implemented as various types of user terminals such as a laptop computer, a tablet computer, a desktop computer, a set-top box, a mobile device (e.g., a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device, a vehicle-mounted device), etc.

[0058] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal 100 can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, car terminal, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0059] In some embodiments, multiple servers may form a blockchain, with server 200 being a node on the blockchain. Information connections may exist between each node in the blockchain, and information may be transmitted between nodes via the information connections. Data related to the data processing method provided in the embodiments of the present application (e.g., data processing logic) may be stored on the blockchain.

[0060] Next, the electronic device that implements the data processing method provided in the embodiment of the present application is described. In practical applications, the electronic device can be a terminal or a server. Figure 2 , Figure 2 is a structural diagram of an electronic device 400 provided in an embodiment of the present application, Figure 2 The electronic device 400 shown includes: at least one processor 410, a memory 450, and at least one network interface 420. The various components in the terminal 100 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .

[0061] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0062] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0063] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0064] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.

[0065] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;

[0066] A network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include Bluetooth, Wi-Fi, and Universal Serial Bus (USB);

[0067] The input processing module 453 is configured to detect one or more user inputs or interactions from one of the one or more input devices 432 and to translate the detected inputs or interactions.

[0068] In some embodiments, the data processing device provided in the embodiments of the present application can be implemented in software. Figure 2The data processing device 454 stored in the memory 450 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: a data receiving module 4541, an information management module 4542, a message modification module 4543, and an exception transmission module 4544. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.

[0069] In other embodiments, the apparatus provided in the embodiments of the present application may be implemented in hardware. As an example, the apparatus provided in the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the data processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor may be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0070] The following describes the data processing method provided by the embodiment of the present application. As mentioned above, the electronic device that implements the data processing method of the embodiment of the present application can be a terminal, a server, or a combination of the two. Therefore, the execution entity of each step will not be repeated below.

[0071] See also Figure 3A , Figure 3A This is a first flow chart of the data processing method provided in the embodiment of the present application, which will be combined with Figure 3A The steps shown are explained.

[0072] In step 101, a request message sent by a first service is obtained, and stubbing information corresponding to the request message is obtained.

[0073] The first service may be a service to be tested.

[0074] As an example of a request message for obtaining a first service, a test case is written in a local electronic device, where the test case includes information such as the test case name, test case number, test case description, test case execution steps, expected results, actual results, and test status. Based on the information contained in the test case, a request message is generated and sent to the first service to simulate the first service obtaining a request message. The request message is used to request the downstream service (i.e., the second service) to return data (i.e., a response message).

[0075] In some embodiments, see Figure 3B , Figure 3B This is a second flow chart of the data processing method provided in the embodiment of the present application. Figure 3A The illustrated step 101 can be implemented by following the steps 1011 to 1012 , which are described in detail below.

[0076] In step 1011, based on the request protocol type of the request message, the request message is unpacked to obtain a parsed request message.

[0077] As an example, based on the request protocol type of the received request message, the request message is unpacked. Supported request protocol types include: Hypertext Transfer Protocol (HTTP), Hypertext Transfer Security Protocol (HTTPS), Buffer Protocol (PB), Transmission Control Protocol (TCP), and Remote Procedure Call Protocol (RPC). When the protocol type of the request message is HTTP, the Json.loads method is used to unpack the request message; when the protocol type of the request message is PB, a proto type file is used to unpack the request message.

[0078] In step 1012, based on the parsed request message, the stubbing information corresponding to the request message is obtained.

[0079] As an example, the obtained piling information can be a string in a lightweight data exchange format (JavaScript Object Notation, JSON), including an interface identifier field for identifying the identity information of the piling information. The parsed request message can be an object of dictionary type in a specific programming language (Python dictionary object). The interface identifier used to identify the identity of the current request message is obtained in the parsed request message. When the interface identifier of the request message is consistent with the value of the interface identifier of a certain piling information, the piling information that matches the interface identifier of the request message is obtained.

[0080] In step 102, based on the request message, the piling field of the piling information is queried.

[0081] Among them, the piling field includes a message modification field and a custom exception field. The message modification field is used to indicate the modification of the test message, and the custom exception field is used to indicate the abnormal transmission of the simulated test message. The test message includes at least one of a request message and a response message to the request message.

[0082] In step 103, when the message modification field is found, the test message is modified based on the message modification mode corresponding to the message modification field.

[0083] The test message can be a request message, a response message, or both a request message and a response message. When the message modification field indicates modification of the request message, the request message is modified; when the message modification field indicates modification of the response message, the response message is modified; and when the message modification field indicates modification of both the request message and the response message, both the request message and the response message are modified.

[0084] As an example of querying a message modification field, the piling information can be a JSON string, and the message modification field can be a one-to-one key-value pair data consisting of a key (Key) and a value (Value). When the key of the message modification field is queried in the piling information and the value corresponding to the key of the message modification field is not empty, the message modification field is queried in the current piling information; on the contrary, when the piling information does not contain the key of the message modification field or the value corresponding to the key of the message modification field is empty, the message modification field is not queried in the current piling information.

[0085] By querying the piling field of the piling information corresponding to the request message and then modifying the test message, a simulation of the test scenario in which the tested service (i.e., the first service) receives abnormal data is achieved, thereby expanding the application scenario of the piling test.

[0086] In some embodiments, see Figure 3C , Figure 3C This is a third flow chart of the data processing method provided in an embodiment of the present application. When the message modification field is used to indicate a modification of the response message, Figure 3A The illustrated step 103 can be implemented by following the steps 1031 to 1033 , which are described in detail below.

[0087] In step 1031, the request message is sent to the second service based on the message modification mode corresponding to the message modification field.

[0088] As an example, since the message modification field indicates to modify the response message, it is necessary to modify the response message based on the message modification method corresponding to the message modification field. Therefore, no modification operation is performed on the request message, and the received request message is only forwarded directly to the second service, where the second service can be the downstream service that the first service depends on.

[0089] In step 1032, a response message sent by the second service is received.

[0090] Among them, the response message is a message generated by the second service in response to the request message. As an example, in an online shopping payment scenario, the first service is a service for paying for the items in the shopping cart, and the second service is a service for querying the product information in the shopping cart. When the user pays, it is necessary to obtain the product information in the current shopping cart. At this time, after the first service generates a request message for requesting product information data, the second service responds to the received request message for requesting product information data, encapsulates the product information data into a response message and returns the response message.

[0091] In step 1033, the response message is modified to obtain a modified response message.

[0092] As an example, the modified response message is used to be sent to the first service, and the message modification method corresponding to the message modification field is a method of modifying the data encapsulated in the response body of the response message. Specifically, the message modification method can be to modify the value corresponding to at least one field contained in the data encapsulated in the response body of the response message, or it can be used to indicate the addition or deletion of fields contained in the response body of the response message. For example, the data encapsulated in the response body is {"apple":"5"; "chestnut":"10"}, then the message modification method can indicate that the "5" corresponding to "apple" is changed to "50", or it can be used to indicate the deletion of the field corresponding to "apple", that is, the data encapsulated in the response body is modified to {"chestnut":"10"}, or it can be used to indicate the addition of a "cantaloupe":"20" field, and the data encapsulated in the response body is modified to {"apple":"5"; "chestnut":"10"; "cantaloupe":"20"}.

[0093] In some embodiments, step 1033 may be implemented by: performing data modification on the response body of the response message to obtain a response message after primary modification; and performing secondary modification on the response message after primary modification to obtain a modified response message.

[0094] Here, the message modification processing of the response message can be divided into two steps: first, modifying the data of the response body of the response message; then, performing a second modification on the response message after the initial modification to obtain a modified response message.

[0095] As an example of modifying data in the response body of a response message, in an online shopping payment page, the product information encapsulated in the response body includes multiple product items, and the multiple product items can be product types and product quantities. The message modification of the response body encapsulating the product information can specifically include modifying the values ​​corresponding to the product types or product quantities encapsulated in the response body, or deleting or adding product items, which are not limited here.

[0096] Taking the modification of the product quantity encapsulated in the response body as an example, the value corresponding to the quantity of Product A in the response body before modification is the Arabic numeral 5. Based on the message modification method corresponding to the message modification field, the value corresponding to the quantity of Product A is modified to -1, or based on the message modification method corresponding to the message modification field, the value corresponding to the quantity of Product A is modified to the English letter a. By modifying the data in the response body of the response message, the first service is tested for its ability to handle and resolve abnormal data when receiving the modified response message.

[0097] In some embodiments, "performing a secondary modification on the response message after the initial modification to obtain a modified response message" can be achieved in the following ways: signing the response message after the initial modification to obtain a message digest of the response message after the initial modification; encrypting the message digest to obtain an encrypted message digest; and determining the modified response message based on the response message after the initial modification and the encrypted message digest.

[0098] For example, for some businesses, the response message generated after the initial modification cannot meet its security performance requirements, so the response message generated after the initial modification cannot be directly transmitted and used. Therefore, the response message after the initial modification needs to be modified for the second time. For example, based on the response message after the initial modification, the response message after the initial modification is signed using a hash function to generate a message digest of the response message after the initial modification, and then the message digest is encrypted with a private key to obtain the encrypted message digest, which is the digital signature of the response message after the initial modification. Based on the response message after the initial modification and the digital signature, the modified response message is determined.

[0099] Continuing with the above example, after obtaining the modified response message, before sending the response message to the first service, the response message can also be serialized through the response serialization hook function, and optionally, customized personalized processing logic for the response message can be added in the response serialization hook function.

[0100] In some embodiments, when the message modification field is used to indicate modification of a request message, step 103 can be implemented in the following manner: based on the message modification method corresponding to the message modification field, the request message is modified to obtain a modified request message, wherein the modified request message is used to send to the second service; and a response message sent by the second service is received, wherein the response message is a message generated by the second service in response to the modified request message, and the response message is used to send to the first service.

[0101] When the message modification field indicates that the request message is to be modified, the request message is modified. Specifically, the data encapsulated in the request body of the request message sent by the first service is modified, and then the modified request message is sent to the second service. The second service generates a response message for the received request message, does not perform any modification operation on the response message, and directly forwards the received response message to the first service.

[0102] In some embodiments, when the message modification field is used to indicate the modification of a request message and a response message, step 103 can be implemented in the following manner: based on the message modification method corresponding to the message modification field, the request message is modified to obtain a modified request message, wherein the modified request message is used to send to the second service; a response message sent by the second service is received, wherein the response message is a message generated by the second service to respond to the request message; the response message is modified to obtain a modified response message, wherein the modified response message is used to send to the first service.

[0103] When the message modification field indicates modification of the request message and the response message, the request message and the response message are modified. Specifically, the request data encapsulated in the request body of the request message sent by the first service is modified, and then the modified request message is sent to the second service; the second service generates a response message for the received request message; the response message sent by the second service is received, and the response data encapsulated in the response body of the response message is modified, and the modified response message is sent to the first service.

[0104] In some embodiments, test message modification is implemented through a message modification hook function. Optionally, customized processing logic for the test message can be added to the message modification hook function. Opening up the message modification hook function approach allows testing services to customize message modification logic based on their own business characteristics, seamlessly adapting to all business scenarios.

[0105] In step 104, when the custom exception field is found, a test message is simulated for exception transmission based on the custom exception transmission mode corresponding to the custom exception field.

[0106] As an example of querying a custom exception field, the piling information can be a JSON string, and the custom exception field can be a one-to-one key-value pair data consisting of a key (Key) and a value (Value). When the key of the custom exception field is queried in the piling information, and the value corresponding to the key of the custom exception field is not empty, the custom exception field is queried in the current piling information; on the contrary, when the piling information does not contain the key of the custom exception field or the value corresponding to the key of the custom exception field is empty, the custom exception field is not queried in the current piling information.

[0107] By querying the stubbing field of the stubbing information corresponding to the request message and simulating the behavior of the test message under abnormal transmission, the test scenario for the abnormal transmission behavior of the interface is completed, which is used to test the robustness of the interface and the security of the interface under network attacks.

[0108] In some embodiments, the custom exception field includes: a request reentry exception field and a request timeout exception field. When the custom exception field is queried, step 104 can be implemented in the following manner: when the request reentry exception field is queried, based on the request reentry transmission mode corresponding to the request reentry exception field, the number of request reentries is obtained, and based on the number of request reentries, the test message is sent multiple times; when the request timeout exception field is queried, based on the request timeout transmission mode corresponding to the request timeout exception field, the request timeout delay time is obtained, and based on the delay time, the test message is delayed and sent.

[0109] As an example, when the queried custom exception field includes a request re-entry exception field, the number of request re-entries included in the request re-entry exception field is obtained. For example, when the number of request re-entries is 3 times, the same test message is sent three times to simulate the abnormal transmission of the test message, wherein the test message is at least one of a request message and a response message.

[0110] As an example, when the queried custom exception field includes a request timeout exception field, the request timeout exception field is obtained including the delay of the request timeout. For example, when the delay time of the request timeout is 1 second, after receiving the test message, wait for 1 second and then send the test message to simulate the abnormal transmission of the test message, wherein the test message is at least one of the request message and the response message.

[0111] Among them, the custom exception fields include but are not limited to the request reentry exception field and the request timeout exception field. Users can customize the specific scenarios of abnormal transmission.

[0112] In some embodiments, see Figure 3D , Figure 3DThis is a fourth flow chart of the data processing method provided by the embodiment of the present application. The stubbing field also includes a data return field, which is used to indicate the simulation data carried in the constructed response message. Figure 3A After step 102 shown, step 105 is also included: in step 105, when the data return field is queried, a response message of the request message is generated based on the data return method corresponding to the data return field, and the response message is sent to the first service.

[0113] As an example of querying the data return field, the data return field can be a one-to-one key-value pair data consisting of a key (Key) and a value (Value). When the key of the data return field is queried in the piling information and the value corresponding to the key of the data return field is not empty, the data return field is queried in the current piling information; on the contrary, when the piling information does not contain the key of the data return field or the value corresponding to the key of the data return field is empty, the data return field is not queried in the current piling information.

[0114] As an example of the first service, the first service can be a service to be tested. When the relevant functions of the first service need to be automatically tested during the software development process, there is a situation where some functions of the second service on which the first service depends have not been developed. Therefore, the first service needs to replace the second service, receive the request message sent by the first service and send a response message to the first service to complete the testing process for the first service.

[0115] See also Figure 3E , Figure 3E This is a fifth flow chart of the data processing method provided in the embodiment of the present application. Figure 3D It is shown that step 105 can be implemented through steps 1051 to 1054.

[0116] In step 1051, simulated data of the request message is constructed and encapsulated into an initial response message.

[0117] As an example, the data return mode corresponding to the data return field is used to indicate the generation of simulation data, including the quantity and format of the generated simulation data.

[0118] In step 1052, the initial response message is signed to obtain a message digest of the initial response message.

[0119] As an example, based on the initial response message, a hash function may be used to generate a message digest of the initial response message, or a user-defined algorithm may be used to generate a message digest of the initial response message, which is not limited here.

[0120] In step 1053, the message digest of the initial response message is encrypted to obtain an encrypted message digest.

[0121] As an example, the message digest is symmetrically encrypted to obtain the encrypted message digest, which is the digital signature of the initial response message. Symmetric encryption refers to encrypting and decrypting the message digest using the same secret key.

[0122] As another example, the message digest may be asymmetrically encrypted to obtain a digital signature of the initial response message, wherein the asymmetric encryption algorithm uses paired keys (public key and private key) to encrypt and decrypt the message digest respectively.

[0123] In step 1054, a response message is determined based on the initial response message and the encrypted message digest.

[0124] As an example, based on the initial response message and the digital signature, the response message is determined. After obtaining the response message, before sending the response message to the first service, the response message needs to be serialized through the response serialization hook function. Optionally, customized personalized processing logic for the response message can be added in the response serialization hook function.

[0125] In some embodiments, before step 101, a piling information management method may be obtained, see Figure 3F , Figure 3F This is a sixth flow chart of the data processing method provided in the embodiment of the present application. Figure 3E The management method for obtaining piling information is shown and is described in detail below in conjunction with steps 301 to 302.

[0126] In step 301, a piling information management mapping table is obtained.

[0127] The piling information management mapping table includes corresponding relationships between different piling information and piling information management modes, and the piling information management modes include a static piling information management mode or a dynamic piling information management mode.

[0128] As an example, after obtaining the piling information, the piling information management mapping table is queried to obtain the piling information management method of the current piling information. The piling information management method of the piling information can be manually set by the user, or it can be automatically assigned according to the type of service corresponding to the piling information. For example, for some piling information corresponding to services for obtaining external data, a static piling information management method is automatically assigned. For example, in an application scenario that displays weather information in real time, the service for obtaining external data may be a service for obtaining the current temperature; for some piling information corresponding to services to be tested related to business scenarios, services under development, or services with large interface access volume, a dynamic piling information management method is automatically assigned. For example, an interface for online ticket purchase that is being developed needs to be assigned a dynamic piling information management method because its interface traffic is large and is strongly related to the business scenario.

[0129] In step 302, a piling information management mapping table is searched based on the piling information, and the searched piling information management mode is determined as a target piling information management mode of the piling information.

[0130] For example, based on the piling information query, the piling information management mapping table is used. When a static piling information management method is found, the static piling information management method is determined as the target piling information management method; when a dynamic piling information management method is found, the dynamic piling information management method is determined as the target piling information management method.

[0131] Among them, when the target piling information management mode is the static piling information management mode, the piling information is stored in the persistent storage space; when the target piling information management mode is the dynamic piling information management mode, the piling information is managed by dynamic planning.

[0132] As an example, the persistent storage space may be a storage space in a local hard disk.

[0133] In some embodiments, dynamic planning and management of piling information can be achieved in the following ways: storing the piling information in a temporary storage space, and destroying the piling information from the temporary storage space when a response message is sent to the first service; storing the piling information in a persistent storage space based on a timing mechanism, and destroying the piling information from the persistent storage space when the validity period set by the timing mechanism is exceeded.

[0134] Dynamic planning and management of piling information can realize the use-and-dispose of piling information. The use-and-dispose of piling information means that after the current service interface under test completes a piling test, the dynamic piling information corresponding to the current service interface under test is destroyed.

[0135] As an example, the piling information is stored in a temporary storage space, such as the memory on the server side or the local memory. When the request message of the first service is obtained, the corresponding piling information is directly read from the temporary storage space; when the response message is sent to the first service, the corresponding piling information is destroyed from the temporary storage space to realize the use-and-disposal of the piling information.

[0136] As an example, a timing mechanism can also be set. For example, if a 15-minute timing and a 30-minute validity period are set, then if the piling information stored in the temporary storage space is not used within 15 minutes, the piling information will be transferred from the persistent storage space to the persistent storage space (such as a hard disk) for persistent storage; if the piling information is not used within 30 minutes, the piling information will be destroyed from the persistent storage space.

[0137] By using the piling information immediately, we can solve the problem of high failure rate of automated testing due to poor environmental stability, and solve the consumption of terminal and server storage resources by the large amount of piling information generated by services with high interface throughput. This can achieve hundreds of millions of test services every day.

[0138] The following describes an exemplary application of the embodiments of the present application in an actual data processing application scenario.

[0139] The embodiments of the present application can be applied to various data processing application scenarios. For example, in the application scenario of automated testing, when it is necessary to test an undeveloped interface, it is difficult to manually generate a large amount of simulated data. Therefore, the Mock (piling) rules can be set through the Mock rule service (Mock_Rule_Server), that is, the piling rules. Based on the Mock rules, the Mock service (MockServer) automatically generates simulated data for testing, and can also hijack the request message sent by the unfinished interface and modify it, so as to realize the testing of the unfinished interface.

[0140] In order to solve the problems and limitations of the Mock function in the related art, the embodiment of the present application proposes a data processing method, which not only supports the simulation and return of Mock data (simulated data), supports message modification, but also supports business custom hook functions to facilitate business secondary unpacking and message modification; the method also supports custom extended Mock rules (i.e., custom exception rules), and by setting custom extended rule parameters in the custom exception rules, it is used to simulate request reentry and request timeout, etc., to facilitate business simulation of various exception test scenarios; the method also provides a standardized design and a multi-language client. Mock rules (studding rules) can be set through the local client during the startup phase (setup phase) of automated testing, and the Mock rules are automatically destroyed in the destruction phase (teardown phase) at the end of the automated testing.

[0141] The above-mentioned hook functions include a request message modification method (make_input), a response message modification method (make_output), a request message serialization method (serializer_request), and a response message serialization method (seiralizer_response). Specifically, the make_input method is used to modify the request message for the second time; the make_output method is used to modify the response message for the second time; the serializer_request method is used to implement the serialization of the request message; and the seiralizer_response method is used to implement the serialization of the response message.

[0142] The embodiment of the present application can localize the Mock rule service to collect and manage the Mock rules, such as Figure 4 As shown, Figure 4 This is the overall solution architecture diagram provided by the embodiment of the present application. The business can be based on a unified Mock framework, on which a personalized Mock interface (MockAPI) can be customized and developed. Among them, the MockAPI can be the corresponding interface of the locally customized Mock client for calling related piling services.

[0143] Test cases represented by interface use cases, manual use cases, exception use cases and scenario use cases can dynamically create Mock rules on the local application side (MockAPI), and call the Mock service corresponding to the current transmission protocol type and the Mock rule service based on the transmission type of the test case; and MockAPI supports Mock services and Mock rule services in both test environment and integration environment. For different transmission protocols, the corresponding Mock service modules are encapsulated respectively, such as Figure 4As shown in the figure, the HTTP transport protocol request (http_server) corresponds to the HTTP protocol Mock service (http_mock_server).

[0144] An embodiment of the present application provides a data processing method, in which a business develops a Mock service based on a unified Mock framework. The Mock framework loads the corresponding process according to the configuration file, and calls a Socket process for each transmission protocol to detect the received request in real time, so as to unpack the received request according to the different transmission protocol types, parse the request message into response meta information (Meta Date) and store it; based on the transmission protocol type, the request message is deserialized to obtain a dictionary type object. For example, when the transmission protocol of the request message is the HTTP protocol, json.loads is used for deserialization, and when the transmission protocol of the request message is the PB protocol, proto is used for deserialization, wherein the response meta information refers to the information used to describe the message.

[0145] After obtaining the parsed request message (that is, the dictionary type object), the Mock rule service is called uniformly for rule matching, which is divided into two cases:

[0146] Case 1: The rule does not match.

[0147] When the rule is not matched, the Mock service only plays a forwarding role, directly forwarding the original request message to the downstream without blocking the current test link.

[0148] Case 2: The rule matches.

[0149] Here, after matching the rules, when the Mock rule is set to a data return rule, the output_rule method is applied to generate a response message; the make_output method of the custom hook function is called to perform secondary modification on the response message; finally, the serializer_response method of the custom hook function is called to serialize the secondary modified response and return the serialized response message to the upstream service.

[0150] Here, after matching the rules, when the Mock rule sets a message modification rule, the input_rule method is applied to modify the current request message; the make_input method of the custom hook function is called to perform secondary modification on the modified request message; the serializer_request method of the custom hook function is called to serialize the request message after the secondary modification; the serialized request message is forwarded to the downstream, and after obtaining the response message sent by the downstream, the response message is unpacked into a Python dictionary object; then the output_rule method is called to modify the response message; the make_output method is called to modify the response message for the secondary modification; the serializer_response method of the custom hook function is called to serialize the response message after the secondary modification; and finally, the serialized response message is returned to the upstream service.

[0151] like Figure 5 As shown, Figure 5 This is a flowchart of automated testing when the Mock rule setting provided in the embodiment of the present application is a message modification rule, which is explained below in conjunction with steps 1 to 8.

[0152] Step 1. The test case sets the Mock rules through the Mock.set_rule method, and then the Mock rules are managed by the Mock rule service.

[0153] The management of Mock rules by the Mock rule service includes rule setting, rule matching, and saving and reading of Mock rules. The setting of Mock rules can be performed through the local client before the automated test.

[0154] Step 2: The test case sends a request message to service A.

[0155] Step 3. Service A calls the Service.request method to forward the request message to the Mock service. The Mock service uses the recv_pack method to receive the request message and uses the parse_request method to unpack it according to the different protocol types of the request protocol.

[0156] Step 4: In the Mock rule service module, perform Mock rule matching and obtain the Mock rule matching result. The Mock service performs subsequent process processing based on the above rule matching result.

[0157] For example, the Mock rule structure stored in the Mock rule service is {"service":"Interface identifier","protocol":"rpc","conditions":[{"json_path":"msg_no","op":"EQ","target":""}],"input_rule":{"rule_type":"FIELD","rule_content":{"user":"88932"}},"output_rule":{"rule_type":"STR","rule_content":""},"ext_ rule":{"repeat_count":1,"elapsed":300}}, where service is the interface identifier, used to determine the identity information corresponding to the Mock rule during rule matching; protocol is used to indicate the interface protocol type; input_rule is the set message modification rule; output_rule is the set data rule; ext_rule is the custom exception rule, used to set the number of reentry times and simulation delay time; conditions is the Mock rule matching condition. When there are multiple matching conditions, AND logic is used by default for matching. op supports multiple matching condition determination methods, as shown in Table 1:

[0158] Table 1. OP fields and judgment methods comparison table

[0159] op field Judgment method EQ "equal"#equal NE "not equal" LT "less than" LE "less than or equal" GT "greater than" GE "greater than or equal" C "contain" NC "not contain"#not contain S "subset"#Subset NS "not subset"#non-subset REGEX "regex"#Regular expression

[0160] Step 5. When the result of the Mock rule matching indicates that the current Mock rule is to modify the request message, the Mock service uses the input_rule method to modify the request message before sending the request message to downstream service B, and serializes the modified request message. Finally, the modified request message after serialization is forwarded to downstream service B.

[0161] On the contrary, when the result of the Mock rule matching indicates that the current Mock rule does not modify the request message, the Mock service directly forwards the request message to downstream service B.

[0162] Step 6. Service B calls the request sending (Service.request) method to forward the response message to the Mock service. The Mock service uses the message receiving (recv_pack) method to receive the response message and uses the response message analysis method (parse_response) to unpack the response message according to the different protocol types of the request protocol.

[0163] Step 7. When the result of the Mock rule matching indicates that the current Mock rule is to modify the response message, the Mock service uses the output_rule method to modify the response message before sending it to the upstream service A, and serializes the modified response message. Finally, the modified response message after serialization is sent to service A.

[0164] On the contrary, when the result of the Mock rule matching indicates that the current Mock rule does not modify the response message, the Mock service forwards the response message to service A.

[0165] Step 8. Service A sends a response message to the test case initiator and instructs the Mock rule service to destroy the Mock rule. An automated test is completed.

[0166] A data processing method proposed in an embodiment of the present application adopts a dynamic Mock rule management method to implement automated testing. Since the dynamic Mock rule traffic is large, the dynamic Mock rule can be directly put into the memory for management without the need for persistent storage. That is, the dynamic Mock rule information created by the automated use case is written into the memory and directly returned to the outside, and a timing mechanism is established to dump the dynamic Mock data stored in the memory into a local file to facilitate debugging and viewing. When the Mock service is started, when the Mock rule server pulls data, it will directly query the Mock rule data in the memory, or load the Mock rule data from the local file into the memory. In addition, since most of the dynamic Mock rules are one-time, the business is allowed to automatically delete the corresponding Mock rule after the rule is matched once, or it is allowed to set an validity period. The Mock rule service will automatically clean up expired Mock rules based on the set validity period.

[0167] In summary, the data processing method proposed in the embodiment of the present application uses a Mock service with an open hook function method to facilitate business customization of personalized logic, which can be seamlessly adapted to all businesses; it supports Mock messages of any transmission protocol, and the localized deployment method is naturally isolated according to the environment and business, without the problem of centralized deployment of disaster recovery; it not only supports simulated return data, but also supports message modification and customized exception rules, which provides effective support for financial security and exception testing; 4) It innovatively proposes the use-and-dispose of automated use cases, which solves the problem of high failure rate of automated testing due to poor environmental stability, and also solves the consumption of terminal and server storage resources by a large number of piling rules, realizing hundreds of millions of test services per day.

[0168] The following continues to describe the exemplary structure of the data processing device 454 provided in the embodiment of the present application implemented as a software module. In some embodiments, such as Figure 2As shown, the software modules stored in a data processing device 454 of the memory 440 may include:

[0169] The data receiving module 4541 is used to obtain the request message sent by the first service.

[0170] The rule management module 4542 is used to match the request message with the piling rules to obtain a rule matching result, wherein the piling rules include message modification rules and custom exception rules, the message modification rules are used to indicate the modification of the test message, and the custom exception rules are used to indicate the simulation of abnormal transmission of the test message, and the test message includes at least one of the request message and the response message of the request message.

[0171] The message modification module 4543 is configured to modify the test message based on the message modification rule when the rule matching result indicates that the request message matches the message modification rule.

[0172] The exception transmission module 4544 is configured to simulate the test message for exception transmission based on the custom exception rule when the rule matching result indicates that the request message matches the custom exception rule.

[0173] In some embodiments, the message modification module 4543 is also used to, when the message modification rule is used to indicate modification of the response message, send the request message to the second service based on the message modification rule; receive the response message sent by the second service, wherein the response message is a message generated by the second service to respond to the request message; perform message modification on the response message to obtain the modified response message, wherein the modified response message is used to send to the first service.

[0174] In some embodiments, the message modification module 4543 is further used to modify the data of the response body of the response message to obtain the response message after the initial modification; and perform a secondary modification on the response message after the initial modification to obtain the modified response message.

[0175] In some embodiments, the message modification module 4543 is also used to sign the response message after the initial modification to obtain the message digest of the response message after the initial modification; encrypt the message digest to obtain the encrypted message digest; and determine the modified response message based on the response message after the initial modification and the encrypted message digest.

[0176] In some embodiments, the exception transmission module 4544 is also used to obtain the number of request re-entries based on the request re-entry exception rule when the rule matching result indicates that the request message matches the request re-entry exception rule, and perform multiple sending operations on the test message based on the request re-entry number; when the rule matching result indicates that the request message matches the request timeout exception rule, obtain the delay time of the request timeout based on the request timeout exception rule, and perform a delayed sending operation on the test message based on the delay time.

[0177] In some embodiments, the data processing device also includes a data return module 4545, which is used to generate a response message to the request message based on the data return rule when the rule matching result indicates that the request message matches the data return rule, and send the response message to the first service.

[0178] In some embodiments, the data return module 4545 is also used to construct simulation data of the request message and encapsulate the simulation data into an initial response message; sign the initial response message to obtain a message digest of the initial response message; encrypt the message digest of the initial response message to obtain the encrypted message digest; and determine the response message based on the initial response message and the encrypted message digest.

[0179] In some embodiments, the rule management module 4542 is also used to obtain the piling rules of the request message and query the rule fields in the piling rules; when the piling rules contain a message modification rule field, the rule matching result is determined as the request message matches the message modification rule; when the piling rules contain a custom exception rule field, the rule matching result is determined as the request message matches the custom exception rule.

[0180] In some embodiments, the rule management module 4542 is also used to obtain the piling rules and the piling rule management mapping table, wherein the piling rule management mapping table includes different correspondences between the piling rules and the rule management methods, and the rule management methods include static rule management methods or dynamic rule management methods; based on the piling rules, the piling rule management mapping table is queried, and the queried rule management method is determined as the target rule management method of the piling rules; when the target rule management method is the static rule management method, the piling rules are stored in a persistent storage space; when the target rule management method is the dynamic rule management method, the piling rules are dynamically planned and managed.

[0181] In some embodiments, the rule management module 4542 is also used to store the piling rules in a temporary storage space, and when the response message is sent to the first service, the piling rules are destroyed from the temporary storage space; based on a timing mechanism, the piling rules are stored in a persistent storage space, and when the validity period set by the timing mechanism is exceeded, the piling rules are destroyed from the persistent storage space.

[0182] In some embodiments, the rule management module 4542 is further used to unpack the request message based on the request protocol type of the request message to obtain a parsed request message; and obtain the piling rules based on the parsed request message.

[0183] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the data processing method described in the embodiment of the present application.

[0184] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will be caused to execute the data processing method provided by the embodiment of the present application, for example, Figures 3A to 3E The data processing method is shown.

[0185] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0186] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0187] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).

[0188] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.

[0189] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.

Claims

1. A data processing method, characterized in that: The method comprises: Obtain a request message sent by the first service, and obtain stubbing information corresponding to the request message; Based on the request message, querying a piling field of the piling information, wherein the piling field includes a message modification field or a custom exception field, the message modification field is used to indicate modification of a test message, the custom exception field is used to indicate simulation of abnormal transmission of the test message, and the test message includes at least one of the request message and a response message to the request message; When the message modification field is found, modifying the test message based on the message modification mode corresponding to the message modification field; When the custom exception field is found, the test message is simulated for exception transmission based on the custom exception transmission mode corresponding to the custom exception field.

2. The method according to claim 1, characterized in that When the message modification field is used to indicate modification of the response message, modifying the test message based on the message modification mode corresponding to the message modification field includes: Sending the request message to the second service based on the message modification mode corresponding to the message modification field; receiving the response message sent by the second service, wherein the response message is a message generated by the second service in response to the request message; The response message is modified to obtain the modified response message, wherein the modified response message is used to be sent to the first service.

3. The method according to claim 2, characterized in that The modifying the response message to obtain the modified response message includes: Modifying the response body of the response message to obtain the response message after the initial modification; The response message after the initial modification is modified for the second time to obtain the modified response message.

4. The method according to claim 3, characterized in that The second modification of the response message after the initial modification to obtain the modified response message includes: Signing the response message after the initial modification to obtain a message digest of the response message after the initial modification; Encrypting the message digest to obtain an encrypted message digest; The modified response message is determined based on the response message after the initial modification and the encrypted message digest.

5. The method according to claim 1, wherein The custom exception fields include: a request reentry exception field and a request timeout exception field; When the custom exception field is found, simulating the test message to perform exception transmission based on the custom exception transmission mode corresponding to the custom exception field includes: When the request reentry exception field is found, obtaining the number of request reentries based on the request reentry transmission mode corresponding to the request reentry exception field, and performing a multiple sending operation on the test message based on the number of request reentries; When the request timeout exception field is queried, the request timeout delay time is obtained based on the request timeout transmission mode corresponding to the request timeout exception field, and the test message is delayed and sent based on the delay time.

6. The method according to claim 1, characterized in that The stubbing field also includes a data return field, and the data return field is used to indicate the construction of the simulation data carried in the response message; After querying the piling field of the piling information based on the request message, the method further includes: When the data return field is found, a response message to the request message is generated based on the data return mode corresponding to the data return field, and the response message is sent to the first service.

7. The method according to claim 6, characterized in that The generating of a response message to the request message includes: Constructing simulation data of the request message, and encapsulating the simulation data into an initial response message; Signing the initial response message to obtain a message digest of the initial response message; encrypting the message digest of the initial response message to obtain the encrypted message digest; The response message is determined based on the initial response message and the encrypted message digest.

8. The method according to claim 1, characterized in that Before obtaining the piling information corresponding to the request message, the method further includes: Obtaining a piling information management mapping table, wherein the piling information management mapping table includes a correspondence between different piling information and piling information management modes, and the piling information management mode includes a static piling information management mode or a dynamic piling information management mode; querying the piling information management mapping table based on the piling information, and determining the queried piling information management mode as the target piling information management mode of the piling information; When the target piling information management mode is the static piling information management mode, storing the piling information in a persistent storage space; When the target piling information management mode is the dynamic piling information management mode, the piling information is managed by dynamic planning.

9. The method according to claim 8, characterized in that The dynamic planning management of the piling information includes: storing the piling information in a temporary storage space, and clearing the piling information from the temporary storage space when sending the response message to the first service; Based on a timing mechanism, the piling information is stored in a persistent storage space, and when a validity period set by the timing mechanism is exceeded, the piling information is cleared from the persistent storage space.

10. The method according to claim 1, characterized in that The obtaining of the request message sent by the first service and obtaining the stubbing information corresponding to the request message includes: Unpacking the request message based on the request protocol type of the request message to obtain a parsed request message; Based on the parsed request message, the piling information corresponding to the request message is obtained.

11. A data processing device, characterized in that: The device comprises: A data receiving module, configured to obtain a request message sent by the first service and obtain stub information corresponding to the request message; an information management module, configured to query a piling field of the piling information based on the request message, wherein the piling field includes a message modification field or a custom exception field, the message modification field is used to indicate modification of a test message, the custom exception field is used to indicate simulation of abnormal transmission of the test message, and the test message includes at least one of the request message and a response message to the request message; a message modification module, configured to modify the test message based on the message modification mode corresponding to the message modification field when the message modification field is found; The exception transmission module is used to simulate the test message to perform exception transmission based on the custom exception transmission mode corresponding to the custom exception field when the custom exception field is queried.

12. An electronic device, characterized in that: The electronic device comprises: a memory for storing computer-executable instructions; The processor is configured to implement the data processing method according to any one of claims 1 to 10 when executing the computer-executable instructions or computer programs stored in the memory.

13. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the method according to any one of claims 1 to 10 is implemented.

14. A computer program product comprising computer executable instructions or a computer program, characterized in that When the computer executable instructions or computer program are executed by a processor, the data processing method according to any one of claims 1 to 10 is implemented.