Traffic playback test method and device, electronic equipment and storage medium

By comparing response messages in the test environment and the benchmark environment, identifying and removing personalized logic noise fields, the inconsistency caused by the interface personalized logic in the traffic playback test is solved, and the accuracy and success rate of the test are improved.

CN120301788APending Publication Date: 2025-07-11GUANGZHOU PINWEI SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510699860.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

In the existing traffic playback test, the playback test results are inconsistent due to the interface personalized logic, and it is impossible to accurately judge whether the code changes affect the interface behavior, which increases the difficulty of problem positioning.

Method used

Ensure the accuracy of the test results by sending the same request in the test environment and the two benchmark environments, obtaining and comparing the response messages, identifying and removing noise fields caused by personalized logic.

Benefits of technology

It improves the success rate of traffic playback tests, reduces the impact of personalized business logic on test results, and accurately locates code changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120301788A_ABST
    Figure CN120301788A_ABST
Patent Text Reader

Abstract

The invention discloses a flow playback test method, which comprises the following steps of: when a code change version is inconsistent with a test response message of a current running environment, triggering reference verification instead of directly considering that the test fails, and comparing the response messages returned by two online environments running the same online version code, and determining whether a noise field affects the test result or not according to the test result, so as to perform noise reduction on the code change version and the test response message of the current running environment to reduce the influence of personalized service logic on the test result, thereby reducing the time for positioning the test problem and improving the success rate of the playback test.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of software testing technology, and particularly relates to a traffic replay testing method, device, electronic device and storage medium. Background Technique

[0002] Traffic replay is a testing and verification technology mainly used to replay historical request traffic to evaluate the impact of new code, configuration changes or architecture adjustments on the system. It can help development and testing teams reproduce real business traffic without affecting the online environment and verify the correctness and performance of the new version. The core idea of traffic replay is to first record real user request data, replay the historical traffic in the new version or test environment, and compare the responses before and after replay to analyze whether the code changes have unexpected effects.

[0003] In some API interfaces of the system, although the request parameters (input parameters) are the same, due to personalized processing in the backend interface logic (such as user identity, randomly generated fields, timestamps, environmental status, etc.), the returned result structure may be different each time. For example, the response contains dynamically generated IDs, timestamps, etc., which will change every time during replay. These dynamic response information will affect the replay comparison result. In addition, even if the request parameters remain unchanged, the business logic will return different contents according to the context (such as database status, user status). Due to the difference in the returned data structure, when the replay tool compares the replay result with the original traffic response, it cannot match the consistency, resulting in the failure of the replay test, and it is impossible to clearly determine whether the current code change has actually affected the interface behavior, increasing the difficulty of problem location. Summary of the Invention

[0004] Based on this, the present invention aims to propose a traffic replay testing method, device, electronic device and storage medium based on multi-environment comparison, which finds the noise structure by comparing the messages in the test environment and the online environment, so as to reduce the noise of the replay response, and at least solve the problem that the replay test fails due to the personalized logic of the interface in the prior art.

[0005] In a first aspect, the present invention proposes a traffic replay testing method, including:

[0006] Synchronously send the same request to the test environment, the first reference environment and the second reference environment, where the first reference environment and the second reference environment run the same online version code;

[0007] Obtain a first response message, a second response message and a third response message respectively responded by the test environment, the first reference environment and the second reference environment;

[0008] Compare the first response message and the second response message to obtain a first comparison result. When the first comparison result is consistent, directly output the test result; otherwise, trigger baseline verification.

[0009] Baseline verification: Compare the second response message and the third response message to obtain a second comparison result, and output the test result according to the second comparison result.

[0010] Further, the baseline verification process specifically includes:

[0011] Compare the message contents of the second response message and the third response message to obtain a second comparison result;

[0012] When the second comparison result is consistent, output the test result; otherwise, generate a noise set according to the differences between the second response message and the third response message;

[0013] Denoise the first response message and the second response message simultaneously according to the noise set to obtain a first denoised message and a second denoised message corresponding to the first response message and the second response message respectively;

[0014] Compare the first denoised message and the second denoised message to obtain a third comparison result, and output the test result according to the third comparison result.

[0015] Further, generating a noise set according to the differences between the second response message and the third response message includes:

[0016] Compare the data structures of the second response message and the third response message to obtain a fourth comparison result;

[0017] When the fourth comparison result is consistent, query the field differences among the first response message, the second response message, and the third response message, and output the test result according to the field differences; otherwise, perform noise object query;

[0018] Noise object query: Query the field differences between the second response message and the third response message and save them as a first noise set; traverse the object list of the second response message, and save the fields with structural differences as a second noise set; merge the first noise set and the second noise set into a noise set.

[0019] Further, querying the field differences between the second response message and the third response message and saving them as a first noise set includes:

[0020] Traverse the fields of the second response message and the third response message, and save the missing fields and / or redundant fields as a first noise set.

[0021] Further, outputting the test result according to the field differences includes:

[0022] Query the field differences between the first response message and the second response message and save them as the first difference result. Save the field differences between the second response message and the third response message as the second difference result;

[0023] Compare the first difference result and the second difference result to obtain the fifth comparison result;

[0024] Output the test result according to the fifth comparison result.

[0025] Further, denoise the first response message and the second response message simultaneously according to the noise set to obtain a first denoised message and a second denoised message corresponding to the first response message and the second response message respectively, including:

[0026] Simultaneously remove the fields included in the noise set from the first response message and the second response message to obtain a first denoised message and a second denoised message corresponding to the first response message and the second response message respectively.

[0027] Further, comparing the first denoised message and the second denoised message to obtain the third comparison result includes:

[0028] Compare the data structures of the first denoised message and the second denoised message to obtain the third comparison result.

[0029] In a second aspect, the present invention provides a traffic playback test device, including:

[0030] A request sending module, configured to synchronously send the same request to a test environment, a first reference environment, and a second reference environment, where the first reference environment and the second reference environment run the same online version code;

[0031] A response acquisition module, configured to acquire a first response message, a second response message, and a third response message respectively responded by the test environment, the first reference environment, and the second reference environment;

[0032] A message comparison module, configured to compare the first response message and the second response message to obtain a first comparison result. When the first comparison result is consistent, directly output the test result; otherwise, trigger a reference verification;

[0033] A reference verification module, configured to perform a reference verification: compare the second response message and the third response message to obtain a second comparison result, and output the test result according to the second comparison result.

[0034] In a third aspect, the present invention provides an electronic device, including a memory storing computer-executable instructions and a processor. When the computer-executable instructions are executed by the processor, the device executes each step of the traffic playback test method provided in the first aspect.

[0035] Fourthly, the present invention provides a readable storage medium storing a computer-executable program, which can implement each step of the traffic playback test method provided in the first aspect when executed.

[0036] Compared with the existing traffic playback test methods, the present invention has the following beneficial effects:

[0037] The present invention provides a traffic playback test method. When the test response message of the code change version is inconsistent with that of the current running environment, the benchmark verification is triggered instead of directly considering the test as failed. By comparing the response messages returned by two online environments running the same online version of the code, it is determined whether there are noise fields affecting the test results, so as to denoise the test response messages of the code change version and the current running environment, reduce the influence of personalized business logic on the test results, thereby reducing the time for locating test problems and improving the success rate of the playback test. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.

[0039] Figure 1 is a flowchart for implementing the traffic playback test method provided by an embodiment of the present invention;

[0040] Figure 2 is a flowchart for implementing the traffic playback test method provided by another embodiment of the present invention;

[0041] Figure 3 is a schematic structural diagram of the traffic playback test device provided by an embodiment of the present invention;

[0042] Figure 4 is an architecture diagram of the electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0043] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0044] Refer to Figure 1 , an embodiment of the present invention provides a traffic playback test method, including the following steps:

[0045] Step S110. Synchronously send the same request to the test environment, the first baseline environment, and the second baseline environment, where the first baseline environment and the second baseline environment run the same online version of the code.

[0046] The request sent in this step can be the online historical traffic from the business system, obtained through API access logs, traffic replay tools, historical query records, etc.; it can also be the real-time collected online real user traffic, which can often be run in the gray-scale test version scenario to test the behavior of the new code without affecting the user experience; it can also be artificially constructed test traffic, such as test cases generated by testers or automated test scripts.

[0047] In addition to replaying the request to the test environment and the online environment in this step, a verification environment of the online environment is introduced, that is, two baseline environments running the same online version of the code are adopted. The test environment deploys the new version of the code to be verified for the software service application, which is usually generated by code changes. The test environment can include new functions, new optimizations, new fixes, etc. of the software service application, and may also include logs and debugging information for analyzing code behavior. Replaying the request in the test environment is mainly to verify the exceptions caused by code changes, such as whether there are different responses to the same request content. The first baseline environment and the second baseline environment run the same online version of the code. The online version mentioned here is the unchanged code version relative to the test environment. The test environment is usually the code change version, while the baseline environment is the version that is currently running stably on the user side.

[0048] Two identical baseline environments are provided in this step to verify whether the failure of the traffic replay test is caused by code changes or personalized business logic. The role of the first baseline environment is to provide a control group for the test environment of the code change version to ensure that the changes of the new code can be compared with the existing logical behavior. Theoretically, the response of the second baseline environment is the same as that of the first baseline environment. When the comparison between the test environment and the first baseline environment is inconsistent, the second baseline environment is used for baseline verification to confirm whether the test results are affected by the interface personalized logic.

[0049] In a further embodiment, the test environment, the first baseline environment, and the second baseline environment can run on different physical servers, or multiple environments can run in different virtual machines on the same physical server, or the environments can be deployed in the cloud. Specifically, it can be selected according to the performance of the service node and the environment configuration.

[0050] In an example aspect, in an e-commerce promotion system test scenario, the test environment can be deployed in an independent K8s cluster, and the first and second benchmark environments are deployed in production cluster Pods. The promotion rewriting mechanism is used to prevent test traffic from interfering. In another example aspect, in a verification test scenario of a financial transaction system, the same request can adopt an asynchronous distribution mode.

[0051] Step S120. Obtain a first response message, a second response message, and a third response message respectively responded by the test environment, the first benchmark environment, and the second benchmark environment.

[0052] Step S130. Compare the first response message and the second response message to obtain a first comparison result. When the first comparison result is consistent, directly output the test result; otherwise, trigger benchmark verification.

[0053] In this step, comparing the first response message and the second response message is to check whether the responses of the same request in the test environment and the online environment are consistent. When the two are compared and consistent, it means that the code changes have not caused unexpected impacts, and at the same time, it can also be considered that there is no noise, and the test is considered successful at this time; if the comparison is inconsistent, it may be caused by code changes or interface personalization. In order to accurately locate the problem, it is necessary to trigger benchmark verification to confirm whether the inconsistency is caused by personalized business logic. In the embodiments of the present invention, the response inconsistency caused by personalized business logic is saved as noise in the comparison process, and these noises are queried through benchmark verification to denoise the message, so as to accurately locate the impact of code changes and improve the success rate of traffic playback testing.

[0054] Interface personalization refers to the legal differences returned by the same interface in different environments, different instances, or different requests. Such differences may be caused by dynamic fields, personalized business logic, environment dependencies, etc. Benchmark verification is to identify interface personalization differences in order to isolate them from the real exceptions caused by version changes.

[0055] In a further embodiment, before comparing the response messages, the messages returned by the three environments can also be sorted. The returned response messages are often an unordered set of key-value pairs. Even if the semantics are the same, they may be different in string representation. If string comparison is directly performed when comparing data objects, it may be misjudged as inconsistent due to the different order of keys, even if the actual content is the same. Therefore, in order to eliminate the differences caused by different key orders, the response messages can be sorted before actual comparison to perform data normalization.

[0056] Step S140. Benchmark verification: Compare the second response message and the third response message to obtain a second comparison result, and output the test result according to the second comparison result.

[0057] This step of comparing the second response message and the third response message is actually comparing the response messages of two benchmark environments to verify the environmental stability. The comparison results can be completely consistent, partially consistent, or inconsistent. The specific differences include fields and their types, such as numerical differences, missing fields, type mismatches, etc., so as to identify the inherent differences in the environment, such as dynamic fields, random values, etc.

[0058] Specifically, when the second comparison result is consistent, it indicates that there is no personalized logic in the interface of the benchmark environment. Then the difference between the first response message and the second response message is caused by code changes, and the code changes have an unexpected impact, and the test result is failed; if the second comparison result is inconsistent, it means that there is personalized business logic in the interface, and this personalized difference needs to be identified to denoise the message.

[0059] In a further embodiment, step S140 includes the following steps:

[0060] Step S141. Compare the message contents of the second response message and the third response message to obtain a second comparison result.

[0061] This step makes a detailed comparison of the message body parts of the second response message and the third response message to identify the differences between the two. The message body usually contains business data and is the core part for verifying functional consistency.

[0062] Step S142. When the second comparison result is consistent, output the test result; otherwise, generate a noise set according to the differences between the second response message and the third response message.

[0063] Specifically, when the message contents of the response messages of the two benchmark environments are consistent, it indicates that there is no personalized business logic in the interface; if they are inconsistent, it means that there is personalized business logic, and the noise characteristics need to be queried according to the differences between the two.

[0064] Further, step S142 includes the following steps:

[0065] Step S1421. Compare the data structures of the second response message and the third response message to obtain a fourth comparison result;

[0066] Step S1422. When the fourth comparison result is consistent, query the field differences among the first response message, the second response message, and the third response message, and output the test result according to the field differences; otherwise, perform a noise object query;

[0067] Step S1423. Noise object query: Query the field differences between the second response message and the third response message and save them as the first noise set; traverse the object list of the second response message and save the fields with structural differences as the second noise set; merge the first noise set and the second noise set into a noise set.

[0068] Specifically, when the message contents of the response messages of two baseline environments are inconsistent, it indicates the existence of personalized business logic. At this time, further determine whether there is personalized logic in the data structure returned by the interface. If the data structures are the same, the key values corresponding to this key can be ignored when comparing the response messages of the test environment and the production environment. If the data structures are different, the different data structures can be saved as noise, and this part of the noise can be ignored when comparing the response messages of the test environment and the production environment.

[0069] Specifically, according to the field differences, the test result is output as follows: the field differences between the first response message and the second response message are saved as the first difference result, and the field differences between the second response message and the third response message are saved as the second difference result. Verify whether the first difference result is a subset of the second difference result. The field differences between the second response message and the third response message are considered as personalized data noise and can be ignored when comparing the first response message and the second response message. Therefore, when the first difference result is a subset of the second difference result, this part of the noise can be ignored during the comparison. At this time, it is considered that the response messages of the test environment and the production environment, that is, the first response message and the second response message, are compared and consistent, and the test result is successful. Otherwise, it is considered that the comparison is inconsistent and the test fails, indicating that the code change has an unexpected impact.

[0070] The noise object query extracts the inherent noise characteristics of the environment from the differences between the second response message and the third response message, such as missing or redundant fields, mismatched field types, etc. Specifically, the field differences between two production environments can be queried first and saved as the first noise set. Then, traverse the object list of the second response message, such as arrays, nested objects, etc., and save the fields with structural differences as the second noise set. The first noise set and the second noise set are merged into the final noise set.

[0071] Exemplarily, if the interface logic is to return a product identifier, and the content returned by the second response message and the third response message is different but the structure is the same, then when comparing the first response message and the second response message, whether the interfaces are consistent can be considered, and the content of this data field can be ignored. Another exemplary aspect is that if the interface logic returns product information, such as product title, promotional copy, benefits, etc., the data structures and message contents of the second response message and the third response message may both be inconsistent. The inconsistent parts are saved as a noise set, and these noises are ignored when comparing the response messages in the test environment and the online environment. For example, the data structure returned by the second response message includes the product ID, title, and label, and the values corresponding to the three keys are 12345, title, and 50% discount respectively, while the data structure returned by the third response message includes the product ID and title, and the corresponding values are 23456 and title respectively. Then the message contents and data structures of the second response message and the third response message are both inconsistent. The label key represents the benefits of the product. In e-commerce promotion tests, different products may have different benefits, or some products may have no benefits. Then the label field key is considered as the noise of the message, and the comparison of this field can be ignored when comparing the first response message and the second response message.

[0072] Step S143. Denoise the first response message and the second response message simultaneously according to the noise set, and obtain a first denoised message and a second denoised message corresponding to the first response message and the second response message respectively.

[0073] Step S144. Compare the first denoised message and the second denoised message to obtain a third comparison result, and output a test result according to the third comparison result.

[0074] The noise set obtained in the foregoing steps includes interfering fields. The denoising operation in this step is specifically to generate a new message by removing the interfering fields in the noise set from the original response message, which retains the core business data and eliminates the influence of environmental noise.

[0075] Specifically, the denoising process includes:

[0076] Traverse the noise set, record the field paths to be removed, such as JSON Path, locate the fields to be removed in the first response message and the second response message, perform removal on the located noise fields, and generate a denoised message while retaining the integrity of the original structure. For null values, if an array or object becomes empty due to denoising, retain its empty structure to maintain data structure (schema) consistency.

[0077] Finally, compare the data structures of the response messages in the denoised test environment and the online environment, including field levels, nesting relationships, data types, etc. The core objective is to verify whether the denoised messages are consistent at the core business logic level and exclude the true differences after eliminating environmental noise interference. If the third comparison result is consistent, it means that the core business fields are completely consistent, the code change has no side effects, and the test result is successful. If they are inconsistent, it indicates that there are differences in key business fields and the code logic needs to be repaired.

[0078] The following further introduces the traffic replay test method provided by the present invention through a specific embodiment.

[0079] As Figure 2 shown, an embodiment of the present invention provides a traffic replay test method, including the following test processes:

[0080] Step S21. Send the same business request to 3 servers. Among them, machine A deploys the version with code changes, and machines B and C deploy the online code version, and obtain the corresponding response messages A, B, and C.

[0081] Step S22. Perform JSON sorting on messages A, B, and C.

[0082] Specifically, messages A, B, and C are all stored in JSON format, and the data is organized in a key-value pair (key-value) manner. Moreover, the JSON specification is an unordered set of key-value pairs. In order to eliminate the influence of key order on the comparison result, a recursive sorting algorithm is used to sort the messages, align the structured data, and make the message comparison focus on the field content rather than the storage order.

[0083] Step S23. Compare the JSON of messages A and B. If they are consistent, the test is successful; otherwise, enter step S24.

[0084] Step S24. Compare the JSON of messages B and C. If they are consistent, the test fails; otherwise, enter step S25.

[0085] When the JSON of messages B and C is consistent and the JSON of messages A and B is inconsistent, it indicates that the exception is caused by the code change, and the code change has an unexpected impact, and the code logic needs to be repaired. When the JSON of messages B and C is inconsistent, it is necessary to further confirm whether the structures are inconsistent.

[0086] Step S25. Compare the schema structures of messages B and C. If they are consistent, enter step S26; otherwise, enter step S27.

[0087] A schema is a specification used to describe the structure of JSON data, defining rules such as the format of JSON data, field types, required fields, constraints, etc., to ensure that the data conforms to expectations. Comparing the schema structures of two messages means verifying whether the field names are the same, whether the field data types are the same, whether the field levels are the same, and whether the structures of arrays and objects are the same.

[0088] Step S26. Determine whether the JSON difference fields between message A and B are a subset of the JSON difference fields between message B and C. If satisfied, the test is successful; otherwise, the test fails.

[0089] The JSON difference fields between message B and C are considered noise caused by personalized logic and can be ignored when comparing message A and B. Therefore, if the differences between message A and B are a subset of those between message B and C, it is considered that this noise can necessarily be ignored, and the code change has not caused an exception in the core business logic, that is, it is considered that the code change has no side effects, and the traffic playback test is considered successful; if there are differences between message A and B that do not exist in the difference subset between B and C, it can be considered that the code change has had an unexpected impact, and the code logic needs to be modified, and the traffic playback test fails.

[0090] Step S27. Traverse all keys of message B and C, and save the missing or redundant fields as the noise set e1; traverse the array of message B, and save the keys with different structures as the noise set e2. The union of e1 and e2 is the final noise set e.

[0091] A key is the field name of a JSON message, used to uniquely identify data, while an array is a list in JSON used to store multiple values, and each element can be an object, a string, a number, etc.

[0092] Traversing the missing or redundant fields is to identify structural changes at the field level, filter out non-core differences caused by API version changes or data format adjustments, and ensure more accurate subsequent comparisons. If one message has a certain field while the other message does not, it is considered a missing field; if one message has a field while the other message contains a different field, it can be considered a redundant field. Exemplarily, message B has a user.age field, but message C does not have this field, or the field names are different, for example, message B is user.age and C is user.age_1, then the user.age field is saved in the noise set e1.

[0093] Traversing the array in message B means traversing the array field, checking the structural differences of the array elements, and saving them in the noise set e2. Exemplarily, message B has an array field orders, and this array contains multiple objects. For example, orders has two elements, respectively:

[0094] { "id": 1, "amount": 100.0}, { "id": 2, "total": 200.0}

[0095] If the structure of an element in the array is inconsistent with that of other elements (for example, an object lacks a field or the field data type is different), it is regarded as a structural difference. As shown in the orders array field above, the amount element is replaced by total, which is regarded as a structural difference, and the changes in amount and total are saved in the noise set e2.

[0096] Step S28. Remove the fields in the noise set e from message A and B, and then compare the schemas of the two messages. If they are consistent, the test is successful; otherwise, the test fails.

[0097] Specifically, remove the fields in the noise set e from message A and B respectively. After removal, compare the schema structures of the two. At this time, if the denoised messages are still inconsistent, it means that the code change has side effects. If they are consistent, it means that the code change has no unexpected impact. Based on this, the test result of the traffic replay can be output.

[0098] The above embodiments provide a traffic replay test method. When the test response messages of the code change version and the current running environment are inconsistent, the baseline check is triggered instead of directly considering the test as failed. By comparing the response messages returned by two online environments running the same online version of the code, it is determined whether there are noise fields affecting the test result, so as to denoise the test response messages of the code change version and the current running environment, reduce the impact of personalized business logic on the test result, thereby reducing the time for locating test problems and improving the success rate of the replay test.

[0099] The above disclosed method can be implemented by devices in various forms. Therefore, the present invention also discloses a traffic replay test device corresponding to the above method, and specific embodiments are given below for detailed description.

[0100] As Figure 3 shown, an embodiment of the present invention provides a traffic replay test device, including:

[0101] A request sending module 302, configured to synchronously send the same request to a test environment, a first baseline environment, and a second baseline environment, where the first baseline environment and the second baseline environment run the same online version of the code;

[0102] A response obtaining module 304, configured to obtain a first response message, a second response message, and a third response message respectively responded by the test environment, the first baseline environment, and the second baseline environment;

[0103] The message comparison module 306 is used to compare the first response message and the second response message to obtain a first comparison result. When the first comparison result is consistent, the test result is directly output; otherwise, the reference verification is triggered.

[0104] The reference verification module 308 is used to perform reference verification: compare the second response message and the third response message to obtain a second comparison result, and output the test result according to the second comparison result.

[0105] The device provided by the embodiment of the present application has the same implementation principle and the same technical effects as those of the foregoing method embodiment. For the sake of brief description, for the parts not mentioned in the device embodiment, reference may be made to the corresponding content in the foregoing method embodiment.

[0106] The methods and related devices mentioned in the foregoing embodiments are described with reference to the method flowcharts and / or structural schematic diagrams provided by the embodiments of the present application. Specifically, each process and / or block of the method flowchart and / or structural schematic diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or structural schematic Figure 1 one block or multiple blocks. These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing devices to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the functions specified in Figure 1 one process or multiple processes and / or structural schematic Figure 1 one block or multiple blocks. These computer program instructions can also be loaded onto a computer or other programmable data processing devices, so that a series of operation steps are executed on the computer or other programmable devices to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable devices provide steps for implementing the functions specified in Figure 1 one process or multiple processes and / or structural schematic one block or multiple blocks.

[0107] The following embodiments are described by taking the application of the method to a computer device as an example. It can be understood that the computer device can be any device with computing and processing functions, and can be, but is not limited to, a server or a personal laptop computer, etc. In one of the embodiments, the computer device can be an application server, and the application server can be a server for running an application program to be tested.

[0108] Refer to Figure 4 , which shows a hardware block diagram of an electronic device. The electronic device is intended to represent various forms of digital computers, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described herein and / or claimed.

[0109] As Figure 4 shown, the electronic device includes: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4;

[0110] In the embodiments of the present application, the number of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 is at least one, and the processor 1, the communication interface 2, and the memory 3 complete mutual communication through the communication bus 4;

[0111] The processor 1 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention, etc.;

[0112] The memory 3 may include high-speed RAM memory, and may also include non-volatile memory, etc., such as at least one disk memory;

[0113] Wherein, the memory stores a program, and the processor can call the program stored in the memory, and the program is used to: implement each processing flow of the foregoing traffic playback test solution.

[0114] The embodiments of the present invention also provide a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements each processing flow of the traffic playback test solution provided by any possible implementation manner of the foregoing embodiments and / or combined embodiments.

[0115] The above-described embodiments have described the present invention in particular detail with respect to possible scenarios. Those skilled in the art will recognize that the present invention can be practiced through other embodiments. The specific naming of components, the case of terms, attributes, data structures, or any other programming or structural aspects are not mandatory or important. The mechanisms or features for practicing the present invention can have different names, forms, or procedures. The system can be implemented through a combination of hardware and software (as described), entirely through hardware elements, or entirely through software elements. The specific division of functions among the various system components described herein is merely exemplary and not mandatory; conversely, the functions performed by a single system component can be performed by multiple components, or the functions performed by multiple components can be performed by a single component.

[0116] Those skilled in the art should understand that each step of the above-disclosed method can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Optionally, they can be implemented with program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module for implementation. Thus, the disclosure of the embodiments of the present invention is not limited to any specific combination of hardware and software.

[0117] These programs executable by the computing device (also referred to as programs, software, software applications, or code) include machine instructions for a programmable processor and can be implemented using high-level procedural and / or object-oriented programming languages and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0118] Certain aspects of the present invention include the process steps and instructions described herein in the form of algorithms. It should be noted that the process steps and instructions of the present invention can be implemented in software, firmware, and / or hardware. When implemented in software, it can be downloaded and thus saved on different platforms used by various operating systems and operated from said platforms.

[0119] Those skilled in the art can understand that the structures shown in the respective drawings are merely block diagrams of some of the structures related to the solution of this application, and do not constitute a limitation on the terminal devices to which the solution of this application is applied. The specific terminal devices may include more or fewer components than those shown in the figures, or combine some components, or have different component arrangements.

[0120] In the description of this specification, the description referring to terms such as "one embodiment", "some embodiments", "example", "specific example", or "possible design", etc. means that the specific features, structures, materials, or characteristics described in connection with that embodiment or example are included in at least one embodiment or example of this 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, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0121] Finally, it should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the said element.

[0122] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A traffic playback test method, characterized in that Including: Synchronously send the same request to the test environment, the first reference environment, and the second reference environment, where the first reference environment and the second reference environment run the same online version of the code; Obtain the first response message, the second response message, and the third response message respectively responded by the test environment, the first reference environment, and the second reference environment; Compare the first response message and the second response message to obtain a first comparison result. When the first comparison result is consistent, directly output the test result; otherwise, trigger reference verification; The reference verification includes: Compare the second response message and the third response message to obtain a second comparison result, and output the test result according to the second comparison result.

2. The method according to claim 1, wherein The specific reference verification includes: Compare the message contents of the second response message and the third response message to obtain a second comparison result; When the second comparison result is consistent, output the test result; otherwise, generate a noise set according to the differences between the second response message and the third response message; Denoise the first response message and the second response message simultaneously according to the noise set to obtain a first denoised message and a second denoised message corresponding to the first response message and the second response message respectively; Compare the first denoised message and the second denoised message to obtain a third comparison result, and output the test result according to the third comparison result.

3. The method according to claim 2, characterized in that, The generating a noise set according to the differences between the second response message and the third response message includes: Compare the data structures of the second response message and the third response message to obtain a fourth comparison result; When the fourth comparison result is consistent, query the field differences of the first response message, the second response message, and the third response message, and output the test result according to the field differences; otherwise, perform noise object query; The noise object query includes: Query the field differences between the second response message and the third response message and save them as a first noise set; traverse the object list of the second response message, and save the fields with structural differences as a second noise set; merge the first noise set and the second noise set into a noise set.

4. The method according to claim 3, wherein The querying the field differences between the second response message and the third response message and saving them as a first noise set includes: Traverse the fields of the second response message and the third response message, and save the missing fields and / or redundant fields as a first noise set.

5. The method according to claim 3, wherein The outputting the test result according to the field differences includes: Query the field differences between the first response message and the second response message and save them as a first difference result, and the field differences between the second response message and the third response message and save them as a second difference result; Compare the first difference result and the second difference result to obtain a fifth comparison result; Output the test result according to the fifth comparison result.

6. The method according to claim 2, wherein The denoising the first response message and the second response message simultaneously according to the noise set to obtain a first denoised message and a second denoised message corresponding to the first response message and the second response message respectively includes: Simultaneously remove the fields included in the noise set from the first response message and the second response message to obtain a first denoised message and a second denoised message corresponding to the first response message and the second response message respectively.

7. The method according to claim 2, wherein Said comparing the first denoised message and the second denoised message to obtain a third comparison result includes: Comparing the data structures of the first denoised message and the second denoised message to obtain a third comparison result.

8. A traffic playback test device, characterized in that, Including: A request sending module, configured to synchronously send the same request to a test environment, a first reference environment, and a second reference environment, where the first reference environment and the second reference environment run the same online version code; A response obtaining module, configured to obtain a first response message, a second response message, and a third response message respectively responded by the test environment, the first reference environment, and the second reference environment; A message comparison module, configured to compare the first response message and the second response message to obtain a first comparison result. When the first comparison result is consistent, directly output the test result; otherwise, trigger reference verification; A reference verification module, configured to perform the reference verification: compare the second response message and the third response message to obtain a second comparison result, and output the test result according to the second comparison result.

9. An electronic device, characterized in that, Including a memory and a processor storing computer-executable instructions, and when the computer-executable instructions are executed by the processor, the device is caused to execute the traffic playback test method according to any one of claims 1 to 7.

10. A readable storage medium, characterized in that, Storing a computer-executable program, and when the program is executed, the traffic playback test method according to any one of claims 1 to 7 can be implemented.