A method, device, electronic device and storage medium for traffic playback

By parameterizing the associated data in the message data, the correlation relationship between the message data of each interface is determined, and the problem of traffic playback in the multi-interface workflow scenario cannot be realized in the prior art, multiple traffic playbacks are realized, and testing and work efficiency are improved.

CN115883687BActive Publication Date: 2025-04-25PING AN BANK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211551918.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-05
Publication Date
2025-04-25
Estimated Expiration
2042-12-05

AI Technical Summary

Technical Problem

The existing traffic playback method is only suitable for business scenarios with a single interface, and it is impossible to implement workflow scenarios with multiple interfaces.

Method used

By parameterizing the associated data in the message data, the association relationship between the message data of each interface is determined, and multiple traffic playbacks are realized.

Benefits of technology

It realizes multiple traffic playback in multi-interface workflow scenarios, improving testing efficiency and working efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115883687B_ABST
    Figure CN115883687B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and storage medium for traffic playback, the method comprising: responding to a business operation for a target business, recording target traffic data corresponding to the business operation; the target traffic data contains message data of each interface in the business process; analyzing the message data of each interface, determining the association relationship and associated data between the message data of each interface, and parameterizing the associated data to obtain parameter data corresponding to the associated data; responding to the first playback operation for the target business, sending the message data of each interface again according to the association relationship and the initial value corresponding to the parameter data, and completing the first traffic playback. The present application analyzes the message data in the interface and parameterizes the associated data in the message data, thereby realizing multiple traffic playbacks and improving work efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing technology, and in particular to a method, device, electronic device and storage medium for traffic playback. Background Art

[0002] With the development of Internet technology, various applications have gradually enriched our lives. The successful launch of an application requires a series of testing links. In order to reduce the time of generating test data and improve test efficiency, traffic replay is often used. Traffic replay: Test data is no longer artificially generated, but directly copied from online traffic data. The copied part of the traffic is sent to the tested cluster, which is equivalent to a replay of the online traffic in the test environment, thereby achieving the effect of automatic replay. Then this part of the traffic is precipitated to form a use case so that it can be used next time.

[0003] The existing traffic playback method, after recording the traffic data, plays back the recorded original traffic data. This traffic playback method is only applicable to the case where the business scenario is a single interface. When the business scenario is a workflow, this traffic playback method will not be implemented. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a method, device, electronic device and storage medium for traffic playback, which parameterizes the associated data in the message data, thereby realizing multiple traffic playbacks and improving work efficiency.

[0005] In a first aspect, an embodiment of the present application provides a method for traffic playback, the method comprising:

[0006] In response to a business operation for a target business, target flow data corresponding to the business operation is recorded; the target flow data contains message data of each interface in the business process;

[0007] Analyze the message data of each interface, determine the association relationship and associated data between the message data of each interface, and parameterize the associated data to obtain parameter data corresponding to the associated data;

[0008] In response to the first playback operation for the target service, the message data of each interface is sent again according to the association relationship and the initial value corresponding to the parameter data to complete the first traffic playback.

[0009] In some technical solutions of the present application, the above method includes:

[0010] Updating the initial value of the parameter data to obtain an updated value of the parameter data;

[0011] In response to the replay operation for the target service, the message data of each interface is sent again according to the association relationship and the updated value corresponding to the parameter data to complete the replay of the traffic.

[0012] In some technical solutions of the present application, the message data includes a request header, and the message data of each interface is analyzed to determine the association relationship and associated data between the message data of each interface, including:

[0013] The request headers of two adjacent interfaces are compared. If the request headers of the two interfaces are inconsistent and the request headers of the two interfaces contain the same value, the two interfaces have an association relationship, and the same value is used as association data.

[0014] In some technical solutions of the present application, the message data includes a request body and a response body, and the message data of each interface is analyzed to determine the association relationship and associated data between the message data of each interface, including:

[0015] The request bodies or the request bodies and response bodies of two adjacent interfaces are compared. If the request body of one interface contains the same value as the request body or response body of another interface, the two interfaces have an association relationship, and the same value is used as association data.

[0016] In some technical solutions of the present application, the above method further includes:

[0017] If the request bodies of the two interfaces do not contain the same value, the two interfaces are not associated;

[0018] The comparison is continued using the target interface which is located earlier of the two interfaces and the previous interface of the target interface.

[0019] In some technical solutions of the present application, the message data includes a request address and a response body, and the message data of each interface is analyzed to determine the association relationship and associated data between the message data of each interface, including:

[0020] The request addresses and response bodies of two adjacent interfaces are compared. If the request address of one interface has the same value as the return message response body of the previous interface, the two interfaces have an association relationship, and the same value is used as association data.

[0021] In some technical solutions of the present application, the above method further includes:

[0022] If the request address of an interface does not have the same value as the return message response body of the previous interface, the two interfaces are not associated;

[0023] The comparison is continued using the target interface which is located earlier of the two interfaces and the previous interface of the target interface.

[0024] In some technical solutions of the present application, the above-mentioned response is for the business operation of the target business, and the target traffic data corresponding to the business operation is recorded, including:

[0025] In response to a business operation for a target business, recording initial traffic data corresponding to the business operation;

[0026] According to the similarity between the initial flows and a preset similarity threshold, target flow data is screened out from the initial flow data.

[0027] In a second aspect, an embodiment of the present application provides a device for traffic playback, the device comprising:

[0028] A recording module, used to respond to a business operation for a target business and record target flow data corresponding to the business operation; the target flow data contains message data of each interface in the business process;

[0029] An analysis module is used to analyze the message data of each interface, determine the association relationship and associated data between the message data of each interface, and perform parameterization processing on the associated data to obtain parameter data corresponding to the associated data;

[0030] The playback module is used to respond to the first playback operation for the target service, and according to the association relationship and the initial value corresponding to the parameter data, send the message data of each interface again to complete the first flow playback.

[0031] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned traffic playback method when executing the computer program.

[0032] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned traffic playback method are executed.

[0033] The technical solution provided by the embodiments of the present application may have the following beneficial effects:

[0034] The method of the present application includes responding to a business operation for a target business, recording target traffic data corresponding to the business operation; the target traffic data contains message data of each interface in the business process; analyzing the message data of each interface, determining the association relationship and associated data between the message data of each interface, and parameterizing the associated data to obtain parameter data corresponding to the associated data; responding to the first playback operation for the target business, according to the association relationship and the initial value corresponding to the parameter data, sending the message data of each interface again to complete the first traffic playback. The present application analyzes the message data in the interface and parameterizes the associated data in the message data, thereby realizing multiple traffic playbacks and improving work efficiency.

[0035] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 A flow chart of a method for traffic playback provided in an embodiment of the present application is shown;

[0038] Figure 2 A schematic diagram of obtaining target flow data provided by an embodiment of the present application is shown;

[0039] Figure 3 A schematic diagram of a traffic playback device provided in an embodiment of the present application is shown;

[0040] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0042] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0043] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0044] With the development of Internet technology, various applications have gradually enriched our lives. The successful launch of an application requires a series of testing links. In order to reduce the time of generating test data and improve test efficiency, traffic replay is often used. Traffic replay: Test data is no longer artificially generated, but directly copied from online traffic data. The copied part of the traffic is sent to the tested cluster, which is equivalent to a replay of the online traffic in the test environment, thereby achieving the effect of automatic replay. Then this part of the traffic is precipitated to form a use case so that it can be used next time.

[0045] The specific application scenarios of traffic playback include: for example, a user wants to query the credit status of Zhang San through the credit service through the client. The client records the message corresponding to the query operation performed by the user. When querying again, the recorded message can be directly sent to realize the process of re-querying. There is no need to go to the interactive interface to perform the query operation again, which simplifies the workflow and improves work efficiency. On the other hand, when performing software testing, it is necessary to manually generate test data and record the process of manually generating test data. When generating test data again, the recorded process of generating the test data can be replayed.

[0046] The existing traffic playback method, after recording the traffic data, plays back the recorded original traffic data. This traffic playback method is only applicable to the case where the business scenario is a single interface. When the business scenario is a workflow, this traffic playback method will not be implemented.

[0047] Based on this, the embodiments of the present application provide a method, device, electronic device and storage medium for traffic playback, which are described below through embodiments.

[0048] Figure 1 A flow chart of a method for traffic playback provided in an embodiment of the present application is shown, wherein the method includes steps S101-S103; specifically:

[0049] S101, responding to a business operation for a target business, recording target flow data corresponding to the business operation; the target flow data contains message data of each interface in the business process;

[0050] S102, analyzing the message data of each interface, determining the association relationship and associated data between the message data of each interface, and parameterizing the associated data to obtain parameter data corresponding to the associated data;

[0051] S103 . In response to the first playback operation for the target service, the message data of each interface is sent again according to the association relationship and the initial value corresponding to the parameter data to complete the first traffic playback.

[0052] The present application analyzes the message data in the interface and parameterizes the associated data in the message data, thereby realizing multiple traffic playbacks and improving work efficiency.

[0053] Some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0054] S101. Respond to a service operation for a target service and record target flow data corresponding to the service operation; the target flow data contains message data of each interface in the service process.

[0055] Traffic playback is the process of recording the interface messages sent by the client to the server and then using these messages to send requests to the server again. The role of the client device is to perform related business operations for the user. For example, the client device can be a device with data transmission function close to the user side, such as a mobile terminal, TV, computer, PDA, etc. When performing business operations, the user operates the client to send messages to the server.

[0056] Existing businesses generally correspond to a business flow, that is, multiple interface requests are required to complete a business process. For example, customer A wants to apply for a loan from a bank. This business process requires the account manager to create a credit application task (task number: e001). Then this application task needs to be approved by the branch, the sub-branch and the head office in turn, and finally the credit application for customer A can be confirmed. In this approval process, the approval process can only be completed by going through the approval nodes of the account manager, branch, sub-branch and head office. In this approval process, the client needs to send different interface messages to the server to complete the approval process. If only part of the process is recorded during recording (for example, only e001 is recorded), when replaying, the system will prompt that the part of the process has been completed (that is, number e001 has been approved), and it cannot be approved again. The reason for this situation is that when the traffic is replayed, number e001 is a fixed value, and the fixed value is used every time it is replayed, resulting in the existence of e001. In fact, there are many parameters before and after a business process, far more than the quota application number e001.

[0057] For the above business flow, this application records the target flow data corresponding to the business operation when the user performs business operations on the client. The recording tool here can be a Fiddler tool, or a built-in tool library, etc. The target flow data in this application contains the message data of each interface in the business process.

[0058] When recording traffic, there may be duplication in the traffic. In order to avoid redundant processing and improve processing efficiency, this application obtains the target traffic data in the following way. Figure 2 As shown. Including S201 and S202:

[0059] S201, responding to a service operation for a target service, recording initial traffic data corresponding to the service operation;

[0060] S202: Filter out target flow data from the initial flow data according to the similarity between the initial flows and a preset similarity threshold.

[0061] That is to say, when recording the business process, the present application first records the initial traffic data, and then screens the initial traffic data according to the similarity between the initial traffic data, removes the initial traffic data with higher similarity, and then obtains the target traffic data.

[0062] S102: Analyze the message data of each interface, determine the association relationship and associated data between the message data of each interface, and perform parameterization processing on the associated data to obtain parameter data corresponding to the associated data.

[0063] After obtaining the message data of each interface, the present application needs to analyze the message data to determine whether there is an association relationship and associated data between the message data of each interface. The message data in the present application includes request headers, request body, response body and request address (url).

[0064] Analyze the message data of each interface to determine the association relationship and associated data between the message data of each interface, including:

[0065] The request headers of two adjacent interfaces are compared. If the request headers of the two interfaces are inconsistent and the request headers of the two interfaces contain the same value, the two interfaces have an association relationship, and the same value is used as association data.

[0066] The request bodies or the request bodies and response bodies of two adjacent interfaces are compared. If the request body of one interface contains the same value as the request body or response body of another interface, the two interfaces have an association relationship, and the same value is used as association data.

[0067] If the request bodies of the two interfaces do not contain the same value, the two interfaces are not associated;

[0068] The comparison is continued using the target interface which is located earlier of the two interfaces and the previous interface of the target interface.

[0069] The request addresses and response bodies of two adjacent interfaces are compared. If the request address of one interface has the same value as the return message response body of the previous interface, the two interfaces have an association relationship, and the same value is used as association data.

[0070] If the request address of an interface does not have the same value as the return message response body of the previous interface, the two interfaces are not associated;

[0071] The comparison is continued using the target interface which is located earlier of the two interfaces and the previous interface of the target interface.

[0072] When it comes to specific implementation, the recorded interfaces are analyzed to find out the interfaces that are associated with the previous and next messages, and the associated data is parameterized, such as the credit application number e001. The interfaces that are associated with the previous and next messages mainly analyze the request header, request body, and response body of the message. Traverse the interface: compare the request header of the latter interface with the request header of the previous interface to see if they are consistent. If not, determine whether certain values ​​in the request header of the latter interface appear in the response body of the return message of the previous interface. If so, then identify that the two interfaces are associated, and parameterize the same values ​​they have (parameterization means that when you build a model or write a program, you use variables to represent the feature size, and drive the model or program changes by changing the variables). In other words, this application replaces the same values ​​of the two with variables, and by assigning different values ​​to the variables, it can avoid the problem of data being considered to already exist during traffic playback. You can also judge the content in the request body of the latter interface to determine whether the content in the request body of the interface appears in the request body of the return message of the previous interface, or determine whether the content in the request body of the interface appears in the request body of the request message of the previous interface. If so, then identify that the two interfaces have an association relationship, and parameterize the same content (value) in the two. If not, continue to traverse to the previous interface. You can also determine whether the fields in the current request address url appear in the request body of the return message of the previous interface. If so, then identify that the two interfaces have an association relationship, and parameterize the same values ​​in the two. If not, traverse to the previous interface again.

[0073] S103 . In response to the first playback operation for the target service, the message data of each interface is sent again according to the association relationship and the initial value corresponding to the parameter data to complete the first traffic playback.

[0074] Use jvm-sandbox-repeater to replay the traffic. If the replay result is consistent with the recorded result, it means that the code change does not affect the original business process. If the replay result is different from the recorded result, it means that the code change affects the original business process. You need to analyze the reasons for the impact on the original business based on the difference in results.

[0075] In the embodiment of the present application, as an optional embodiment, the initial value of the parameter data is updated to obtain the updated value of the parameter data;

[0076] In response to the replay operation for the target service, the message data of each interface is sent again according to the association relationship and the updated value corresponding to the parameter data to complete the replay of the traffic.

[0077] The present application obtains parameter data corresponding to the associated data by parameterizing the associated data. Multiple traffic playbacks can be realized. When the traffic is first played back, the initial value of the parameter data is used. When the traffic is played back again, the initial value of the multi-parameter data needs to be updated, and the initial value is updated to the updated value, and the traffic is played back again based on the updated value.

[0078] In the embodiment of the present application, as an optional embodiment, the specific parameterization process in the present application is: deeply traverse the request body, take the value value and match it with the corresponding data, and mark the value value of the request body. The value value of the corresponding data is identified by using the jsonpath expression as the key value, and the corresponding data value is stored in a public variable during subsequent operation. When the value value of the marked request body is encountered, it is replaced with the corresponding value value.

[0079] Figure 3 A schematic diagram of the structure of a traffic playback device provided in an embodiment of the present application is shown, wherein the device comprises:

[0080] A recording module, used to respond to a business operation for a target business and record target flow data corresponding to the business operation; the target flow data contains message data of each interface in the business process;

[0081] An analysis module is used to analyze the message data of each interface, determine the association relationship and associated data between the message data of each interface, and perform parameterization processing on the associated data to obtain parameter data corresponding to the associated data;

[0082] The playback module is used to respond to the first playback operation for the target service, and according to the association relationship and the initial value corresponding to the parameter data, send the message data of each interface again to complete the first flow playback.

[0083] The device further comprises: an updating module, configured to update the initial value of the parameter data to obtain an updated value of the parameter data;

[0084] The playback module is also used to respond to the replay operation for the target service, and resend the message data of each interface according to the association relationship and the updated value corresponding to the parameter data to complete the replay of the traffic.

[0085] The message data includes a request header, and the message data of each interface is analyzed to determine the association relationship and associated data between the message data of each interface, including:

[0086] The request headers of two adjacent interfaces are compared. If the request headers of the two interfaces are inconsistent and the request headers of the two interfaces contain the same value, the two interfaces have an association relationship, and the same value is used as association data.

[0087] The message data includes a request body and a response body, and the message data of each interface is analyzed to determine the association relationship and associated data between the message data of each interface, including:

[0088] The request bodies or the request bodies and response bodies of two adjacent interfaces are compared. If the request body of one interface contains the same value as the request body or response body of another interface, the two interfaces have an association relationship, and the same value is used as association data.

[0089] If the request bodies of the two interfaces do not contain the same value, the two interfaces are not associated;

[0090] The comparison is continued using the target interface which is located earlier of the two interfaces and the previous interface of the target interface.

[0091] The message data includes a request address and a response body, and the message data of each interface is analyzed to determine the association relationship and associated data between the message data of each interface, including:

[0092] The request addresses and response bodies of two adjacent interfaces are compared. If the request address of one interface has the same value as the return message response body of the previous interface, the two interfaces have an association relationship, and the same value is used as association data.

[0093] If the request address of an interface does not have the same value as the return message response body of the previous interface, the two interfaces are not associated;

[0094] The comparison is continued using the target interface which is located earlier of the two interfaces and the previous interface of the target interface.

[0095] The response is directed to a business operation of a target business, and records target traffic data corresponding to the business operation, including:

[0096] In response to a business operation for a target business, recording initial traffic data corresponding to the business operation;

[0097] According to the similarity between the initial flows and a preset similarity threshold, target flow data is screened out from the initial flow data.

[0098] like Figure 4 As shown, an embodiment of the present application provides an electronic device for executing the traffic replay method in the present application, the device comprising a memory, a processor, a bus, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the traffic replay method when executing the computer program.

[0099] Specifically, the above-mentioned memory and processor may be general-purpose memory and processor, which are not specifically limited here. When the processor runs the computer program stored in the memory, the above-mentioned traffic playback method can be executed.

[0100] Corresponding to the method of traffic replay in the present application, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned method of traffic replay are executed.

[0101] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is run, the above-mentioned traffic playback method can be executed.

[0102] In the embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. The system embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

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

[0104] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0105] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0106] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0107] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should all be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for traffic playback, characterized in that: The method comprises: In response to a business operation for a target business, target flow data corresponding to the business operation is recorded; the target flow data contains message data of each interface in the business process; Analyze the message data of each interface, determine the association relationship and associated data between the message data of each interface, and parameterize the associated data to obtain parameter data corresponding to the associated data; In response to the first playback operation for the target service, according to the association relationship and the initial value corresponding to the parameter data, the message data of each interface is sent again to complete the first traffic playback; The method further comprises: Updating the initial value of the parameter data to obtain an updated value of the parameter data; In response to the replay operation for the target service, the message data of each interface is sent again according to the association relationship and the updated value corresponding to the parameter data to complete the replay of the traffic.

2. The method according to claim 1, characterized in that The message data includes a request header, and the message data of each interface is analyzed to determine the association relationship and associated data between the message data of each interface, including: The request headers of two adjacent interfaces are compared. If the request headers of the two interfaces are inconsistent and the request headers of the two interfaces contain the same value, the two interfaces have an association relationship, and the same value is used as association data.

3. The method according to claim 1, characterized in that The message data includes a request body and a response body, and the message data of each interface is analyzed to determine the association relationship and associated data between the message data of each interface, including: The request bodies or the request bodies and response bodies of two adjacent interfaces are compared. If the request body of one interface contains the same value as the request body or response body of another interface, the two interfaces have an association relationship, and the same value is used as the association data.

4. The method according to claim 3, characterized in that The method further comprises: If the request bodies of the two interfaces do not contain the same value, the two interfaces are not associated; The comparison is continued using the target interface which is located earlier of the two interfaces and the previous interface of the target interface.

5. The method according to claim 1, characterized in that The message data includes a request address and a response body, and the message data of each interface is analyzed to determine the association relationship and associated data between the message data of each interface, including: The request addresses and response bodies of two adjacent interfaces are compared. If the request address of one interface has the same value as the return message response body of the previous interface, the two interfaces have an association relationship, and the same value is used as association data.

6. The method according to claim 5, characterized in that The method further comprises: If the request address of an interface does not have the same value as the return message response body of the previous interface, the two interfaces are not associated; The comparison is continued using the target interface which is located earlier of the two interfaces and the previous interface of the target interface.

7. The method according to claim 1, characterized in that The response is directed to a business operation of a target business, and records target traffic data corresponding to the business operation, including: In response to a business operation for a target business, recording initial traffic data corresponding to the business operation; According to the similarity between the initial flows and a preset similarity threshold, target flow data is screened out from the initial flow data.

8. A flow playback device, characterized in that: The device comprises: A recording module, used to respond to a business operation for a target business and record target flow data corresponding to the business operation; the target flow data contains message data of each interface in the business process; An analysis module is used to analyze the message data of each interface, determine the association relationship and associated data between the message data of each interface, and perform parameterization processing on the associated data to obtain parameter data corresponding to the associated data; A playback module, used to respond to the first playback operation for the target service, and send the message data of each interface again according to the association relationship and the initial value corresponding to the parameter data to complete the first flow playback; An updating module, used for updating the initial value of the parameter data to obtain an updated value of the parameter data; The playback module is also used to respond to the replay operation for the target service, and resend the message data of each interface according to the association relationship and the updated value corresponding to the parameter data to complete the replay of the traffic.

9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method for traffic playback as described in any one of claims 1 to 7 are performed.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the traffic playback method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Interface test case generation method and device, controller and medium

    CN110232016A