Order flow playback method and device

By backing up and parsing order logs in the e-commerce system and adjusting the timestamps to process expired content, the problem of strong time related to the new architecture of the e-commerce system is solved, ensuring the accuracy of order data and the test success rate.

CN114445184BActive Publication Date: 2024-08-23JUHAOKAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210102644.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-27
Publication Date
2024-08-23
Estimated Expiration
2042-01-27

AI Technical Summary

Technical Problem

In the new architecture test of e-commerce systems, since some of the content of the order scenario is strongly related to time, expired content during the test cannot be played back, resulting in the request for adding orders being rejected, and ultimately the new architecture test fails.

Method used

Add order logs by pre-backup online, parse the order content contained in the log, extract the historical timestamp and content validity period, judge the status of the order content based on the current timestamp, and adjust the current timestamp to make it valid, so that it can be played back When adding orders using the adjusted timestamp.

Benefits of technology

This avoids the problem of request rejection due to the expiration of time-related content, reduces the failure of new architecture tests, and ensures the accuracy of order data and the success rate of tests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114445184B
    Figure CN114445184B
Patent Text Reader

Abstract

An embodiment of the present application provides an order flow playback method and device, the method comprising: parsing the order log, extracting and adding the order content contained in the order log, the order content having a historical timestamp and a content validity period. Determine whether the current state of the order content is a valid state based on the current timestamp and the content validity period. When it is determined that the current state of the order content is an invalid state, adjust the current timestamp based on the historical timestamp. When it is determined that the current state of the order content is a valid state, do not adjust the current timestamp. Finally, replay the order adding process based on the order content after adjusting the current timestamp, or replay the order adding process based on the original order content. The order flow playback method and device provided in the present application can change the timestamp in time after detecting that the content that is strongly related to time has expired, thereby avoiding the rejection of the request for offline playback to add an order and reducing the occurrence of new architecture test failures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automated testing technology, and in particular to an order flow playback method and device. Background Art

[0002] When the e-commerce system is refactoring orders, all order interfaces and data need to be migrated to the new architecture. After the reconstruction, the new architecture needs to be tested. However, due to the large number of terminal versions, there is currently no automated test case that can cover all terminal scenarios. Therefore, traffic playback technology is currently used to test the new architecture.

[0003] Traffic replay technology refers to a testing technology that records business traffic in a production environment and replays the recorded business traffic in a production environment or a test environment. In the new architecture testing of e-commerce systems, traffic replay specifically involves backing up the online order logs, adding orders to deploy a new architecture in a test environment, and then replaying the backed-up order logs to the new architecture.

[0004] However, since some contents of the order scenarios in the e-commerce architecture are strongly related to time, if these contents that are strongly related to time expire during the test, the request to add an order will be rejected during offline playback, ultimately causing the new architecture test to fail. Summary of the invention

[0005] The present application provides an order traffic playback method and device, which are used to solve the problem that some traffic cannot be played back during the test due to the strong correlation between data of order scenarios in the e-commerce architecture and time, which ultimately leads to inaccurate order data.

[0006] In a first aspect, an embodiment of the present application provides an order flow playback method, in which an order adding log is backed up online in advance, and the backed up order adding log is played back during testing, the method comprising:

[0007] Parsing the add order log, extracting order content contained in the add order log, the order content having a historical timestamp and a content validity period, wherein the historical timestamp is a creation time of the add order log;

[0008] Replaying the order adding process according to the order content, determining whether the current state of the order content is valid according to the current timestamp and the validity period of the content;

[0009] When it is determined that the current state of the order content is an invalid state, adjusting the current timestamp according to the historical timestamp so that the current state of the order content is updated from an invalid state to a valid state, wherein the current timestamp is the creation time of the order in the playback order adding process;

[0010] When determining that the current state of the order content is a valid state, the current timestamp is not adjusted.

[0011] The order adding process is replayed according to the order content after the current timestamp is adjusted, or the order adding process is replayed according to the original order content.

[0012] In a second aspect, an embodiment of the present application provides an order flow playback device, which backs up an order addition log online in advance, and plays back the backed-up order addition log during testing, the device comprising:

[0013] The add order log parsing unit is used to perform: parsing the add order log, extracting the order content contained in the add order log, the order content has a historical timestamp and a content validity period, wherein the historical timestamp is the creation time of the add order log;

[0014] An order content status determination unit, configured to perform: replaying the order adding process according to the order content, and determining whether the current status of the order content is a valid status according to the current timestamp and the validity period of the content;

[0015] A timestamp adjustment unit, configured to: when determining that the current state of the order content is an invalid state, adjust the current timestamp according to the historical timestamp so that the current state of the order content is updated from an invalid state to a valid state, wherein the current timestamp is a creation time of the order in the playback order adding process; when determining that the current state of the order content is a valid state, do not adjust the current timestamp;

[0016] The traffic playback unit is used to execute: playback the order adding process according to the order content after adjusting the current timestamp, or playback the order adding process according to the original order content.

[0017] The technical solution provided by the present application includes the following beneficial effects: back up the order log online in advance, and replay the backed-up order log during testing. Parse the order log, extract the order content contained in the order log, and the order content has a historical timestamp and a content validity period, wherein the historical timestamp is the creation time of the order log. In the process of replaying the order addition according to the order content, it is necessary to determine whether the current state of the order content is a valid state according to the current timestamp and the content. When it is determined that the current state of the order content is an invalid state, adjust the current timestamp according to the historical timestamp so that the current state of the order content is updated from an invalid state to a valid state. The current timestamp is the creation time of the order in the process of replaying the order addition. When it is determined that the current state of the order content is a valid state, the current timestamp is not adjusted. Finally, the order addition process is replayed according to the order content after adjusting the current timestamp, or the order addition process is replayed according to the original order content. The order flow playback method and device provided by the present application can change the timestamp in time after detecting that the content strongly related to time has expired, so as to avoid the rejection of the request for offline playback to add the order and reduce the occurrence of failures in the new architecture test. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0019] Figure 1 A schematic diagram of a method for replaying order flow provided in an embodiment of the present application is shown;

[0020] Figure 2 A schematic diagram of an order flow playback device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0022] References throughout this specification to "multiple embodiments", "some embodiments", "one embodiment" or "an embodiment", etc., mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in at least one embodiment. Therefore, phrases such as "in multiple embodiments", "in some embodiments", "in at least another embodiment" or "in an embodiment" that appear throughout this specification do not necessarily all refer to the same embodiment. In addition, in one or more embodiments, specific features, structures or characteristics may be combined in any suitable manner. Therefore, without limitation, specific features, structures or characteristics shown or described in conjunction with one embodiment may be combined in whole or in part with features, structures or characteristics of one or more other embodiments. Such modifications and variations are intended to be included within the scope of this application.

[0023] When the e-commerce system is refactoring orders, all order interfaces and data need to be migrated to the new architecture. After the reconstruction, the new architecture needs to be tested. However, due to the large number of terminal versions, there is currently no automated test case that can cover all terminal scenarios. Therefore, traffic playback technology is currently used to test the new architecture.

[0024] Traffic replay technology refers to a testing technology that records the business traffic in the production environment and uses the recorded business traffic for replay in the production environment or test environment. There are currently two main ways to implement traffic replay and generation methods. One is traffic generation based on mathematical models, and the other is traffic replay driven by real traffic. Mathematical traffic models cannot meet the flexible, diverse, complex and changeable characteristics of large-scale user behaviors and have certain scenario limitations. Traffic replay driven by real traffic directly comes from the real environment, and can almost reproduce the real network scenario one-to-one while ensuring the accuracy of the replay.

[0025] In the new architecture test of the e-commerce system, the traffic playback is to back up the online order log, add the order to deploy the new architecture in the test environment, and then play back the backup order log to the new architecture. However, since some content of the order scene in the e-commerce architecture is strongly related to time, if these time-related contents expire during the test, the request to add the order will be rejected during offline playback, which will eventually lead to the failure of the new architecture test.

[0026] In order to solve the above problems, the present application provides an order traffic playback method, which can promptly change the timestamp after detecting that the content strongly related to time has expired, thereby avoiding the rejection of offline playback requests to add orders and reducing the occurrence of new architecture test failures.

[0027] like Figure 1 A flowchart of an order flow playback method is shown, the method comprising the following steps:

[0028] Step S101, parse the add order log, and extract the order content contained in the add order log. Parsing the add order log is actually parsing the replayed http request. The add order log replayed to the new architecture under test is the http request of the user visit recorded in advance on the online architecture. During the test, the recorded http request is replayed and processed by the method provided by the present invention before being sent to the architecture under test.

[0029] The http request contains the order content. The following methods can be used to extract the order content, but are not limited to:

[0030] Use the servlet specification to parse, first receive the http request, then convert the http request into the corresponding http object according to the http protocol, such as converting the http request into httpservletrequest or converting the http response into httpservletresponse, then you can directly get the http object (httpservletrequest or

[0031] httpservletresponse) to extract all http information, from which the order content can be obtained. There are many ways to parse http requests. In addition to the above methods, any other methods that can parse http requests can also be used, which will not be repeated here.

[0032] The parsed order content has a historical timestamp and content validity period. The historical timestamp is the creation time of the order log added by the online system. For example, a certain added order log is an order record of a user purchasing product A on Taobao. The historical timestamp can be the time t1 when the user successfully placed an order to purchase product A. The content validity period is the validity period of the data related to product A when purchasing product A. For example, the price of product A, related activities, and single-point benefits.

[0033] Step S102, replaying the order adding process according to the order content, and determining whether the current state of the order content is a valid state according to the current timestamp and the validity period of the content.

[0034] After parsing the order content, it is necessary to replay the order adding process according to the order content in the new architecture to test the new architecture. At this time, it is necessary to determine whether the current state of the order content is valid based on the current timestamp and the validity period of the order content. It should be noted that the current timestamp is the time when the order is successfully placed when replaying the order adding process according to the order content. For example, replay the process of a user purchasing product A on Taobao in the new architecture. Then the current timestamp can be the time t2 when the order to purchase product A is successfully placed.

[0035] In some embodiments, the start time and end time of the order content specified by the content validity period, that is, the order content is specified with a time limit. Determine whether the current state of the order content is a valid state according to the current timestamp and the content validity period, and the specific steps are: if the current timestamp is within the time range of the content validity period, determine that the current state of the order content is a valid state. If the current timestamp is outside the time range of the content validity period, determine that the current state of the order content is an invalid state.

[0036] If the order content includes a price, for example, the price of product A purchased by the user online is X, and the content validity period of product A's price X is t3-t4. Since the user has purchased product A online, the historical timestamp t1 must be within the content validity period t3-t4.

[0037] If the current timestamp t2 during the order adding process is played back in the new architecture, and is within the content validity period t3-t4, it means that the order content is valid at the current timestamp, that is, you can still place an order for product A at price X. If the current timestamp t2 is outside the content validity period t3-t4, it means that the order content is invalid at the current timestamp, that is, you cannot place an order for product A at price X.

[0038] If the order content includes an associated activity, for example, when the user purchases product B online, he participates in a buy one get one free activity, and the content of the activity is valid for t5-t6. At this time, the historical timestamp t1 must also be within the content validity period t5-t6. If the current timestamp t2 is within the range of t5-t6, it means that the state of the order content at the current timestamp is valid, that is, the current order can still enjoy the activity. If the current timestamp t2 is outside the range of t5-t6, it means that the state of the order content at the current timestamp is invalid, that is, the current order can no longer enjoy the activity.

[0039] In some embodiments, if the order content includes a single-point benefit, and the current timestamp is within the validity period of the single-point benefit, the order cannot be placed currently. On the contrary, if the current timestamp is outside the validity period of the single-point benefit, the order can be placed currently.

[0040] Step S103, when it is determined that the current state of the order content is an invalid state, adjusting the current timestamp according to the historical timestamp, so that the current state of the order content is updated from an invalid state to a valid state.

[0041] Specifically, adjusting the current timestamp according to the historical timestamp may be to calibrate the value of the current timestamp to the value of the historical timestamp. For example, the order content in the above example includes associated activities, and the user participates in a buy-one-get-one-free activity when purchasing product B online, and the content of the activity is valid for t5-t6. At this time, the historical timestamp t1 must also be within the scope of the content validity period t5-t6. If the current timestamp t2 is outside the range of t5-t6, the current order can no longer enjoy the activity, so the request to add an order will be rejected. At this time, the value of the current timestamp t2 can be adjusted to the value of the historical timestamp t1, so that the current timestamp t2 is within the range of t5-t6. Thereby, the current state of the order content is updated from an invalid state to a valid state, that is, the associated activity can still be enjoyed at the current time, so that the process of adding an order can be successfully replayed.

[0042] Step S104: when it is determined that the current state of the order content is valid, the current timestamp is not adjusted. If the current state of the order content is valid, it means that the content in the order content has not exceeded the validity period, and the request to add the order will not be rejected when placing the order, so there is no need to adjust the current timestamp.

[0043] In some embodiments, the order content includes multiple sub-order contents, and each sub-order content has an independent content validity period. Then, whether the current state of the order content is a valid state is determined based on the current timestamp and the content validity period, and a comprehensive judgment is required based on the current state of a certain sub-order content. Specifically, if it is determined that the current state of each sub-order content is a valid state, then the current state of the order content is determined to be a valid state. If it is determined that the current state of at least one sub-order content is an invalid state, then the current state of the order content can be determined to be an invalid state.

[0044] Exemplarily, the order content of a certain order includes price and associated activities. If the current status of the price is valid and the current status of the associated activities is also valid, then the current status of the entire order content can be determined to be valid. If the current status of at least one of the price and the associated activities is invalid, then the current status of the entire order content can be determined to be invalid.

[0045] It should be noted that in the new structure test process based on traffic playback, the priority of ensuring the accuracy of the order of the playback data packets is higher than the accuracy of the timing. Because the timestamp of the collected data packets is recorded according to the time when the network card receives the data packet, it is impossible to obtain the actual sending time of the data packet, and some protocols such as the TCP protocol have a delayed confirmation mechanism. Small time errors (microseconds) usually have little effect on the state of a session flow. However, the order of requests and responses will determine the protocol state of the session flow. Therefore, the principle of designing the playback algorithm should be to reduce the time accuracy error as much as possible while ensuring the consistency of the order of the playback data packets. The fidelity of the user behavior simulation is guaranteed by maintaining the replayed session state. Therefore, the message sending function of the present invention is sent based on the time interval between adjacent messages, rather than the time interval from the first message. This method can effectively ensure the accuracy of the message sequence.

[0046] It should also be noted that the system receives an http request, which is parsed to obtain the order content. The order content can include an order number, which can then be used to query the order information corresponding to the order. When testing the new architecture, a large number of recorded http requests are required, that is, a large number of online orders are required.

[0047] Step S105, replaying the order adding process according to the order content after adjusting the current timestamp, or replaying the order adding process according to the original order content.

[0048] Specifically, after the above-mentioned process of adjusting the timestamp, the order content with the adjusted timestamp is used to return to the architecture to be tested, and the response returned by the system under test is parsed to verify whether the response meets expectations. During the test, since the http request played back to the architecture under test is pre-recorded on the online architecture, the source IP address in the played back http request is the IP address of the real online user. In order to prevent the architecture under test from returning the corresponding response to the real user, a new http request needs to be constructed in the test environment and sent to the architecture under test. Since it is a reconstructed http request, the source IP address in the new http request defaults to the IP address of the device where the device provided by the present invention is located, so that when the architecture under test returns a response, it will not affect the real online user.

[0049] The above embodiment runs as follows in the automated testing framework: the traffic pulling module pulls the traffic logs of real online users, and the traffic cleaning module cleans the pulled online logs and saves them as traffic templates. Then, the traffic editing module generates a random interface path and then randomly blocks the account parameters in the interface to form random traffic. Then, the traffic playback module is called to play back the obtained random traffic. After the playback is completed, the playback results are sent to the test report management module to form a test report for display to the user.

[0050] It should be noted that the order flow playback method of the present invention is performed in the created isolation unit. N isolation units can be created, and the operation data of all users performing order addition operations in the database are mapped to each isolation unit respectively. When the isolation unit plays back the order content, it will not affect the real user, nor will it affect other ongoing online order addition processes.

[0051] The present application provides an order flow playback device for executing Figure 1 The corresponding embodiments are as follows: Figure 2 As shown, the order flow playback device provided by this application includes:

[0052] The add order log parsing unit 201 is used to perform: parsing the add order log, extracting the order content contained in the add order log, the order content has a historical timestamp and a content validity period, wherein the historical timestamp is the creation time of the add order log.

[0053] The order content status determination unit 202 is used to perform: during the playback of the order adding process according to the order content, determine whether the current status of the order content is a valid status according to the current timestamp and the content validity period, wherein the current timestamp is the creation time of the order during the playback of the order adding process.

[0054] The timestamp adjustment unit 203 is used to perform: when it is determined that the current state of the order content is an invalid state, adjusting the current timestamp according to the historical timestamp, so that the current state of the order content is updated from the invalid state to the valid state;

[0055] When it is determined that the current state of the order content is a valid state, the current timestamp is not adjusted.

[0056] The traffic playback unit 204 is used to execute: playback the order adding process according to the order content after adjusting the current timestamp, or playback the order adding process according to the original order content.

[0057] In some embodiments, the content validity period specifies the start time and end time of the order content; judging whether the current state of the order content is valid according to the current timestamp and the content validity period, the specific steps are:

[0058] When the current timestamp is within the content validity period, determining that the current state of the order content is a valid state;

[0059] When the current timestamp is outside the content validity period, it is determined that the current state of the order content is an invalid state.

[0060] In some embodiments, the order content includes multiple sub-order contents, each of which has an independent content validity period;

[0061] Determine whether the current state of the order content is valid according to the current timestamp and the validity period of the content, specifically the steps of: determine whether the current state of each sub-order content in the order content is valid according to the current timestamp and the validity period of the content;

[0062] When it is determined according to the current timestamp and the validity period of the content that the current status of each sub-order content in the order content is a valid status, determining that the current status of the order content is a valid status;

[0063] When it is determined that the current state of at least one sub-order content in the order content is invalid according to the current timestamp and the content validity period, the current state of the order content is determined to be invalid.

[0064] What has been described above includes examples of implementations of the present invention. For the purpose of describing the claimed subject matter, it is certainly not possible to describe every conceivable combination of components or methods, but it is to be appreciated that many additional combinations and permutations of the present innovation are possible. Accordingly, the claimed subject matter is intended to include all such changes, modifications, and variations that fall within the spirit and scope of the appended claims. In addition, the above description of the illustrated implementations of the present application, including the things described in the "Summary", is not intended to be enumerated in detail or to limit the disclosed implementations to the precise forms disclosed. Although specific implementations and examples are described in this application for illustrative purposes, various modifications that are considered to be within the scope of such implementations and examples are possible, as will be appreciated by those skilled in the relevant art.

[0065] In addition, the word "example" or "exemplary" is used in this application to mean "serving as an example, instance, or illustration." Any aspect or design described in this application as "exemplary" is not necessarily to be construed as preferred or advantageous over other aspects or designs. On the contrary, the use of the word "example" or "exemplary" is intended to present concepts in a concrete way.

Claims

1. An order flow playback method, characterized in that: Backing up the order adding log online in advance, and replaying the backed up order adding log during testing, the method includes: Parsing the order adding log, extracting order content contained in the order adding log, wherein the order content has a historical timestamp and a content validity period, wherein the historical timestamp is the creation time of the order adding log, and the content validity period specifies the start time and end time of the order content; When the current timestamp is within the time range of the content validity period, the current state of the order content is determined to be a valid state; when the current timestamp is outside the time range of the content validity period, the current state of the order content is determined to be an invalid state; wherein the current timestamp is the creation time of the order in the playback order adding process; When it is determined that the current state of the order content is an invalid state, adjusting the current timestamp according to the historical timestamp so that the current state of the order content is updated from the invalid state to the valid state; When determining that the current state of the order content is a valid state, not adjusting the current timestamp; The order adding process is replayed according to the order content after the current timestamp is adjusted, or the order adding process is replayed according to the original order content.

2. The order flow playback method according to claim 1, characterized in that: When it is determined that the current state of the order content is an invalid state, the current timestamp is adjusted according to the historical timestamp, and the specific steps are: The value of the current timestamp is calibrated to the value of the historical timestamp.

3. The order flow playback method according to claim 1, characterized in that: The order content includes multiple sub-order contents, each of which has an independent content validity period; Determine whether the current state of the order content is valid according to the current timestamp and the validity period of the content, specifically the steps of: determine whether the current state of each sub-order content in the order content is valid according to the current timestamp and the validity period of the content; When it is determined according to the current timestamp and the validity period of the content that the current status of each sub-order content in the order content is a valid status, determining that the current status of the order content is a valid status; When it is determined that the current state of at least one sub-order content in the order content is invalid according to the current timestamp and the content validity period, the current state of the order content is determined to be invalid.

4. The order flow playback method according to claim 1, characterized in that: The order content includes at least sub-order content: price and associated activities.

5. An order flow playback device, characterized in that: Back up the order adding log online in advance, and play back the backed up order adding log during the test, the device includes: The add order log parsing unit is used to perform: parsing the add order log, extracting the order content contained in the add order log, the order content has a historical timestamp and a content validity period, wherein the historical timestamp is the creation time of the add order log, and the content validity period specifies the start time and end time of the order content; The order content status determination unit is used to perform: when the current timestamp is within the time range of the content validity period, determine that the current state of the order content is a valid state; when the current timestamp is outside the time range of the content validity period, determine that the current state of the order content is an invalid state; wherein the current timestamp is the creation time of the order in the playback order adding process; A timestamp adjustment unit, configured to: when determining that the current state of the order content is an invalid state, adjust the current timestamp according to the historical timestamp, so that the current state of the order content is updated from the invalid state to the valid state; When determining that the current state of the order content is a valid state, not adjusting the current timestamp; The traffic playback unit is used to execute: playback the order adding process according to the order content after adjusting the current timestamp, or playback the order adding process according to the original order content.

6. The order flow playback device according to claim 5, characterized in that: When it is determined that the current state of the order content is an invalid state, the current timestamp is adjusted according to the historical timestamp, and the specific steps are: The value of the current timestamp is calibrated to the value of the historical timestamp.

7. The order flow playback device according to claim 5, characterized in that: The order content includes multiple sub-order contents, each of which has an independent content validity period; Determine whether the current state of the order content is valid according to the current timestamp and the validity period of the content, specifically the steps of: determine whether the current state of each sub-order content in the order content is valid according to the current timestamp and the validity period of the content; When it is determined according to the current timestamp and the validity period of the content that the current status of each sub-order content in the order content is a valid status, determining that the current status of the order content is a valid status; When it is determined that the current state of at least one sub-order content in the order content is invalid according to the current timestamp and the content validity period, the current state of the order content is determined to be invalid.

8. The order flow playback device according to claim 5, characterized in that: The order content includes at least sub-order content: price and associated activities.