Playback data construction method and device, equipment, storage medium and product

By capturing and processing data in the production environment, generating replay test data, and building an execution environment, the shortcomings of existing systems in testing complex scenarios are resolved, enabling more efficient traffic recording and replay testing, and improving system stability and user experience.

CN121880164APending Publication Date: 2026-04-17CHINA MOBILE FINANCIAL TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA MOBILE FINANCIAL TECHNOLOGY CO LTD
Filing Date
2024-10-12
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing traffic recording and playback testing systems cannot effectively handle complex business scenarios, especially in product systems in the business travel sector. They cannot resolve system failures in a timely manner, affecting user experience and operational effectiveness.

Method used

In the production environment, request and response data are captured, and replay test data is generated by filtering, preprocessing, and setting data tags. A replay execution environment is built, and traffic replay tests are performed using the replay engine. System metrics are monitored in real time to adjust strategies.

Benefits of technology

The generated replay test data is more in line with the actual system requirements, and can build tests normally in complex environments, improve test results, discover system defects in a timely manner, and improve system stability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121880164A_ABST
    Figure CN121880164A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of intelligent testing, and discloses a playback data construction method and device, equipment, a storage medium and a product, and the method comprises the steps: capturing request data in a production environment and response data corresponding to the request data, and generating flow data; filtering the traffic data based on a filtering rule to generate filtered traffic data; preprocessing the filtered flow data to generate processed flow data; and setting a corresponding data label for processing the flow data, and generating playback test data. The data is directly captured in the production environment, and the captured data is processed to obtain the playback test data, so that the playback test data can still be normally constructed even in a complex environment, and the playback test data which is finally obtained by directly recording in the test environment better meets the actual system application requirements, and the test efficiency is improved. Therefore, the flow recording playback test is carried out, the test effect is better, and the defects of the system can be explored more easily.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent testing technology, and in particular to methods, apparatus, devices, storage media and products for constructing playback data. Background Technology

[0002] In most enterprises, as business needs continue to evolve, the complexity of Internet technology (IT) system products also increases. The controllability and time costs of IT system architects, developers, product managers, testers, and maintenance personnel also increase. More often than not, conventional development, testing, and maintenance methods are no longer sufficient to fully guarantee the stability of IT systems.

[0003] To address the shortcomings of traditional automated testing systems, technical personnel have proposed traffic recording and playback testing, leading to various related solutions. However, current traffic recording and playback testing systems only provide an overall process description for certain test environment scenarios and business operations. Furthermore, they fail to offer sufficient solutions for complex business scenarios. For example, in the business travel sector, user usage times and frequencies are unpredictable. If a healthy, timely, and accurate production traffic playback strategy cannot be used to routinely verify and test key business processes and core interfaces, system failures will be difficult to resolve quickly and effectively, impacting user experience and significantly diminishing the overall operational effectiveness of the product. Summary of the Invention

[0004] The main purpose of this application is to provide a method, apparatus, device, storage medium and product for constructing playback data, which aims to solve the technical problem that traffic recording and playback testing is only applicable to some test environment scenarios and business processes, and cannot cope with complex business scenarios.

[0005] To achieve the above objectives, this application proposes a method for constructing playback data, the method comprising:

[0006] Capture request data and corresponding response data in the production environment to generate traffic data;

[0007] The traffic data is filtered based on filtering rules to generate filtered traffic data;

[0008] The filtered traffic data is preprocessed to generate processed traffic data. The preprocessing includes data cleaning and / or data desensitization.

[0009] Set corresponding data tags for the processed traffic data and generate playback test data.

[0010] Optionally, the step of filtering the traffic data based on filtering rules to generate filtered traffic data includes:

[0011] Extract the corresponding filter fields, rule matching attributes, and attribute matching methods from the filter rules;

[0012] Extract the corresponding matching attributes from each traffic data based on the filtering fields;

[0013] Based on the attribute matching method, the corresponding matching attributes in the traffic data are compared with the rule matching attributes to determine the data to be filtered out.

[0014] The data to be filtered out is removed from the traffic data to generate filtered traffic data.

[0015] Optionally, the data tags include business model tags;

[0016] The step of setting corresponding data tags for the processed traffic data and generating replay test data includes:

[0017] Feature extraction is performed on each processing traffic data to obtain the data feature vector corresponding to each processing traffic data;

[0018] The processed traffic data is clustered based on the data feature vector to obtain clustering results, which include at least one cluster and the cluster to which each processed traffic data belongs.

[0019] Based on the clustering results, set corresponding business mode labels for each processed traffic data.

[0020] Optionally, the data tag includes a data status tag, which is used to characterize whether the data is abnormal traffic data;

[0021] The step of setting corresponding data tags for the processed traffic data and generating replay test data includes:

[0022] The processed traffic data is analyzed using an anomaly detection algorithm to determine the anomaly score corresponding to each processed traffic data.

[0023] The anomaly score is compared with a preset anomaly threshold, and a corresponding data status label is set for each processed traffic data based on the comparison result.

[0024] Optionally, after setting corresponding data tags for the processed traffic data and generating replay test data, the method further includes:

[0025] Obtain the recording environment information corresponding to the playback test data, and construct a playback execution environment based on the recording environment information;

[0026] The playback engine is configured with parameters based on the playback strategy, which includes playback speed, concurrency and / or number of playbacks;

[0027] Upon completion of configuration, the playback test data is input into the playback engine, enabling the playback engine to perform traffic playback tests on the playback execution environment based on the playback test data.

[0028] Optionally, after the configuration is completed and the replay test data is input into the replay engine so that the replay engine performs traffic replay tests on the replay execution environment based on the replay test data, the method further includes:

[0029] During the traffic replay test, the system metrics data in the replay execution environment are monitored in real time. The system metrics data include response time, error rate, and throughput.

[0030] Calculate the system performance score based on the system indicator data, and determine whether the system in the replay execution environment is abnormal based on the system performance score;

[0031] When a system anomaly is detected in the playback execution environment, the playback strategy is adjusted, and the process returns to the step of configuring the playback engine parameters based on the playback strategy.

[0032] Furthermore, to achieve the above objectives, this application also provides a playback data construction apparatus, the apparatus comprising:

[0033] The capture module is used to capture request data and corresponding response data in the production environment, and generate traffic data.

[0034] The filtering module is used to filter the traffic data based on filtering rules to generate filtered traffic data.

[0035] The processing module is used to preprocess the filtered traffic data to generate processed traffic data. The preprocessing includes data cleaning and / or data desensitization.

[0036] The settings module is used to set corresponding data tags for the processed traffic data and generate playback test data.

[0037] In addition, to achieve the above objectives, this application also provides a playback data construction device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the playback data construction method as described above.

[0038] In addition, to achieve the above objectives, this application also provides a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the playback data construction method as described above.

[0039] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the playback data construction method described above.

[0040] One or more technical solutions proposed in this application have at least the following technical effects:

[0041] Because the data is captured directly in the production environment, and the captured data is processed to obtain replay test data, it ensures that even in complex environments, replay test data can still be built normally. Compared with recording directly in the test environment, the final replay test data obtained is more in line with the actual system application requirements. Therefore, the test results will be better and more conducive to discovering system defects. Attached Figure Description

[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0043] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 A flowchart illustrating the first embodiment of the data reconstruction method for playback in this application;

[0045] Figure 2 This is a flowchart illustrating Embodiment 2 of the data reconstruction method for playback in this application.

[0046] Figure 3 This is a schematic diagram of the module structure of the playback data construction device according to an embodiment of this application;

[0047] Figure 4 This is a schematic diagram of the device structure of the hardware operating environment involved in the playback data construction method in this application embodiment.

[0048] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0049] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0050] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0051] Based on this, the embodiments of this application provide a method for constructing playback data, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the data reconstruction method for playback in this application.

[0052] In this embodiment, the playback data construction method includes steps S10 to S40:

[0053] Step S10: Capture request data and corresponding response data in the production environment to generate traffic data.

[0054] It should be noted that the execution subject of this embodiment can be the playback data construction device, which can be a personal computer, server or other electronic device, or other devices that can achieve the same or similar functions. This embodiment does not limit this. In this embodiment and the following embodiments, the playback data construction device is used as an example to illustrate the playback data construction method of the present invention.

[0055] It should be noted that the production environment can be the environment in which the system that needs to be maintained (hereinafter referred to as the system to be maintained) actually provides services to users. For example, in the business travel field, when developing a business travel system, the code development first needs to be completed in a development environment on the intranet. After that, the system needs to be tested in a test environment on the intranet. When the test is passed, the business travel system can be launched on the public network (i.e., a public network that users can directly access). At this time, the public network environment is the production environment.

[0056] In practical use, the request data can be business request data actively sent by user equipment, other equipment or systems to the system to be maintained, in order to request the system to be maintained to perform a certain system function; the response data corresponding to the request data can be a business request issued by the system to be maintained based on the received request data to reply to the request data.

[0057] Of course, the request data can also be business request data actively sent by the system to be maintained to the user equipment, other equipment, or system. In this case, the response data corresponding to the request data can be a business request issued by the user equipment, other equipment, or system based on the received request data to reply to the request data. A request data and its corresponding response data are combined to construct a traffic data.

[0058] In practical applications, network packet capture tools can be used to capture request data and corresponding response data. The network packet capture data can be the tcpdump tool or other tools with the same or similar functions. This embodiment does not limit this.

[0059] In practical applications, network packet capture tools can also have their parameters adjusted to modify the method and type of captured data. For example, taking the tcpdump tool as an example, the tool can be configured via commands to adjust the method and / or type of captured data. For instance, the "-i any" command means capturing data from all network interfaces, the "-nn" command indicates that hostnames are not resolved during the capture process to speed up the capture and reduce the size of the output file, and the "-w traffic.pcap" command specifies the output file name as traffic.pcap, which stores the captured network traffic data.

[0060] Step S20: Filter the traffic data based on the filtering rules to generate filtered traffic data.

[0061] It should be noted that when capturing data in a production environment, data that is irrelevant to the business or the current test objective may also be captured. In order to ensure the effectiveness of subsequent replay test data and avoid interference from irrelevant data, traffic data can be filtered based on filtering rules to remove irrelevant data and obtain filtered traffic data.

[0062] In practical use, each traffic data can be matched with the filtering rules, the part of the traffic data that does not match the filtering rules can be removed, and the remaining part can be used as the filtered traffic data.

[0063] In a specific implementation, to ensure that multiple different types of filtering rules can be configured, step S20 in this embodiment may include:

[0064] Extract the corresponding filter fields, rule matching attributes, and attribute matching methods from the filter rules;

[0065] Extract the corresponding matching attributes from each traffic data based on the filtering fields;

[0066] Based on the attribute matching method, the corresponding matching attributes in the traffic data are compared with the rule matching attributes to determine the data to be filtered out.

[0067] The data to be filtered out is removed from the traffic data to generate filtered traffic data.

[0068] It should be noted that the filter field is the field used for data filtering. The rule matching attribute is the threshold used to determine whether a rule is met. The attribute matching method is the comparison method used when comparing the data to be judged with the rule matching attribute to determine whether it meets the rule. This can include greater than, equal to, less than, etc. Of course, it can also include more methods, such as modulo, division, addition or subtraction with a specific value, etc. This embodiment does not limit these methods.

[0069] In practical use, the protocol type and / or port number can be used as filtering fields. For example, if the filtering rule is set to TCP port 80 or TCP port 443, then the filtering fields are the protocol type and port number, the rule matching attribute is TCP, and 80 or 443, and the attribute matching method is equal to. In this case, the matching attribute corresponding to each traffic attribute will be "protocol type, port number". At this time, the traffic data with a protocol type other than TCP, and the protocol type of TCP but a port number other than 80 or 443, will be the data to be filtered out.

[0070] Step S30: Preprocess the filtered traffic data to generate processed traffic data.

[0071] It should be noted that preprocessing may include data cleaning and / or data desensitization.

[0072] Understandably, since the data is captured in a production environment, some of it may contain sensitive information related to user privacy. To prevent privacy leaks, it's necessary to anonymize the filtered traffic data to remove sensitive information. Furthermore, because data capture occurs in a production environment, the data volume may be large. When tools capture large datasets, anomalies may cause defects in the captured data. Additionally, errors may occur during system execution, resulting in defective data (such as missing lines, blank lines, or garbled characters). Therefore, data cleaning of the filtered traffic data is necessary to remove defective data and ensure the reliability of subsequent replay test data.

[0073] In practical implementation, existing data cleaning tools can be used for data cleaning. For example, the pandas library in Python can be used to clean filtered traffic data, removing invalid and redundant parts. Data anonymization can be achieved using regular expressions, replacing sensitive information in the filtered traffic data with other data, thereby achieving data anonymization.

[0074] In practical applications, data cleaning and data anonymization can be used simultaneously. For example, the `read_csv` function of the pandas library can be used to read filtered traffic data, then the `dropna` method can be used to remove rows containing null values, and finally the `to_csv` method can be used to save the processed data as a new CSV file. For the data contained in the CSV file, sensitive information can be replaced using regular expressions. For example, the `re.sub` function can be used to replace the phone number with the placeholder `[PHONE_NUMBER]`, thereby achieving phone number anonymization.

[0075] Step S40: Set corresponding data tags for the processed traffic data and generate playback test data.

[0076] It should be noted that the data tags set can include business mode tags and / or data status tags. The business mode tag is used to characterize the business mode type corresponding to the processed traffic data, such as immediate response, delayed response, etc. The data status tag is used to characterize whether the data is abnormal traffic data. Abnormal traffic data refers to request data and / or response data corresponding to request data generated when the system responds abnormally and interacts with user devices, other devices, or the system.

[0077] Understandably, capturing data directly in the production environment and processing it to obtain playback test data is more in line with actual system application needs than recording directly in the test environment. Therefore, using this data for traffic recording and playback testing will yield better test results and be more conducive to discovering system defects.

[0078] In a practical implementation, business model labels can be set in batches through feature clustering. In this case, step S40 in this embodiment may include:

[0079] Feature extraction is performed on each processing traffic data to obtain the data feature vector corresponding to each processing traffic data;

[0080] The processed traffic data is clustered based on the data feature vector to obtain clustering results;

[0081] Based on the clustering results, set corresponding business mode labels for each processed traffic data.

[0082] It should be noted that when extracting features from each processing traffic data separately, existing learning libraries can be used, such as the machine learning library scikit-learn, to extract features such as request type and response time from each processing traffic data, thereby obtaining the data feature vector corresponding to each processing traffic data.

[0083] Of course, feature extraction algorithms or models can also be used for feature extraction, such as convolutional neural networks or recurrent neural networks. This embodiment does not limit this.

[0084] In practical applications, a preset clustering algorithm can be used to cluster the processed traffic data based on the data feature vector to obtain clustering results. The preset clustering algorithm can be the K-means clustering algorithm or other algorithms with the same or similar functions. The clustering results contain at least one cluster and the cluster to which each processed traffic data belongs.

[0085] When setting corresponding business mode labels for each processing traffic data based on clustering results, the cluster center of each cluster can be obtained, and the corresponding business mode labels can be set for the cluster center by manual annotation or model recognition. Then, the business mode labels of each processing traffic data belonging to the cluster are set to be consistent with the cluster center of the cluster.

[0086] For example, the K-means algorithm is used to cluster the processing traffic data based on the data feature vector X corresponding to each processing traffic data, and at least one cluster is determined. The cluster center of the cluster can be represented as C_k. At this time, the corresponding business mode label can be set for the cluster center by manual annotation or model recognition. Then, the business mode label of each processing traffic data belonging to the cluster is set to the business mode label of C_k.

[0087] In a specific implementation, to ensure accurate identification of abnormal data, step S40 in this embodiment may include:

[0088] The processed traffic data is analyzed using an anomaly detection algorithm to determine the anomaly score corresponding to each processed traffic data.

[0089] The anomaly score is compared with a preset anomaly threshold, and a corresponding data status label is set for each processed traffic data based on the comparison result.

[0090] It should be noted that the anomaly detection algorithm can be the Isolation Forest algorithm. When used, the Isolation Forest algorithm extracts subsamples from the processed traffic data (usually sampling without replacement). For each subsample, a tree is recursively built until all samples are isolated or the maximum tree depth is reached. At each split, a feature is randomly selected, and a value on that feature is randomly chosen as the split point. If a sample is quickly isolated, it is likely an anomaly; if many splits are required to isolate it, it is more likely normal. This process is repeated to build multiple trees, forming a forest. Then, for new data points, the Isolation Forest algorithm estimates their path length (i.e., the number of splits required to isolate them) using the already constructed forest. Shorter path lengths mean easier isolation and therefore a higher probability of an anomaly. Finally, the Isolation Forest algorithm assigns a corresponding anomaly score to each processed traffic data point. The higher the anomaly score, the higher the probability that the data is an anomaly. Specifically, the Isolation Forest algorithm's scoring function is defined as follows:

[0091]

[0092] In the formula, s(x,n): the anomaly score of data point x; E(h(x)): the average path length (or average depth) of data point x in all isolated trees (iTrees); when E(h(x)) is close to c(n), s(x,n) is close to 0.5, indicating that the anomaly of data point x is not obvious. When E(h(x)) is close to 0, s(x,n) is close to 1, indicating that data point x is easily isolated and is therefore likely an anomaly. When E(h(x)) is close to n-1, s(x,n) is close to 0, indicating that data point x requires multiple partitions to be isolated and is therefore unlikely to be an anomaly.

[0093] In practical use, the preset anomaly threshold can be set in advance by the administrator of the playback data construction device. If the anomaly score is greater than or equal to the preset anomaly threshold, it indicates that the data is likely to be abnormal, and the data status label corresponding to the data can be set to an anomaly label. Similarly, if the anomaly score is less than the preset anomaly threshold, the data status label corresponding to the data can be set to a normal label.

[0094] This embodiment provides a method for constructing replay data. Since the data is captured directly in the production environment and processed to obtain replay test data, it ensures that even in complex environments, replay test data can still be constructed normally. Compared with recording directly in the test environment, the replay test data obtained is more in line with the actual system application requirements. Using this for traffic recording and replay testing will result in better test effects and is more conducive to discovering system defects.

[0095] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 After step S40, the playback data construction method further includes steps S50 to S70:

[0096] Step S50: Obtain the recording environment information corresponding to the playback test data, and construct a playback execution environment based on the recording environment information.

[0097] It should be noted that the production environment is crucial for the normal operation of the system, and testing cannot be performed there. However, to ensure accurate testing of the system to be maintained, the testing environment should be as consistent as possible with the production environment. Therefore, it is possible to obtain the recording environment information corresponding to the replay test data. This recording environment information can include the configuration standards of the system to be maintained in the production environment at the time the test data was recorded and replayed, including the versions and configuration parameters of all key components.

[0098] In practical use, a playback execution environment can be built based on the recording environment information. That is, in the test environment, a system to be maintained is built based on the recording environment information, and the versions and configuration parameters of the components used are consistent with those in the production environment.

[0099] Specifically, scripts or playbooks can be written using selected configuration management tools to automatically check the configuration in the test environment. These scripts or playbooks will connect to the remote host (test environment) and perform a series of tasks to verify the configuration status. Afterward, these scripts or playbooks are run in the test environment to collect configuration data and compare it with the configuration standards of the production environment. The automation tools will generate reports listing any configuration differences, ultimately ensuring that the environment configuration of the test environment is consistent with that of the production environment.

[0100] Step S60: Configure the parameters of the playback engine based on the playback strategy.

[0101] It should be noted that the replay strategy may include replay speed (i.e., the frequency of using replay test data during replay testing), concurrency (the number of replay test data entries used simultaneously), and / or replay count (the number of times replay tests are performed using the replay test data).

[0102] In practical use, the playback engine can be built based on the playback tool JMter or other similar tools. The playback engine can be configured with parameters based on the playback strategy, setting the playback speed, concurrency, and / or number of playbacks when performing playback tests.

[0103] The replay strategy can be configured by the administrators of the replay data construction equipment according to actual needs. For example, the administrators or testers of the replay data construction equipment can first analyze the test objectives and requirements, determine the test focus, and identify whether the main test objective is performance, stability, or anomaly handling. They should also consider user behavior and network conditions in the actual application scenario. Configure the replay speed by setting the number of requests per second (v). For performance testing, a higher number of requests can be set to simulate high load conditions. For functional testing, a lower number of requests can be set to ensure the correctness of request processing. When configuring concurrency, set the number of concurrent users or connections (c). Set the concurrency based on the application's peak concurrency. For example, if the peak concurrent user count for Business Travel 100 is 1000, then according to the Pareto principle, set the concurrent user count to 800 to observe the system's limits. Configure the replay count, setting the number of repetitions for each request or scenario. For tests that need to verify the stability of repeated operations, set a higher number of replays. For example, for Business Travel 100 users booking flights, hotels, and ride-hailing services. For simple function verification, a lower number of replays can be set, such as submitting business trip application forms, ticket refunds and changes, etc.

[0104] Step S70: Upon completion of configuration, the playback test data is input into the playback engine so that the playback engine performs traffic playback tests on the playback execution environment based on the playback test data.

[0105] Understandably, after the configuration is complete, the replay test data can be input into the replay engine. The replay engine will then extract the data required for the current round of replay test from the replay test data according to the replay strategy, and send a request to the system to be maintained in the replay execution environment (i.e., the test environment whose adjusted configuration is consistent with the production environment) to perform the replay test.

[0106] In a specific implementation, to ensure the test results, after step S70 in this embodiment, the following may also be included:

[0107] During the traffic replay test, system metrics data in the replay execution environment are monitored in real time.

[0108] Calculate the system performance score based on the system indicator data, and determine whether the system in the replay execution environment is abnormal based on the system performance score;

[0109] When a system anomaly is detected in the playback execution environment, the playback strategy is adjusted, and the process returns to the step of configuring the playback engine parameters based on the playback strategy.

[0110] It should be noted that system metrics data may include response time, error rate, and throughput. Response time can be the interval between when the system under maintenance responds to a received request; error rate is the proportion of errors that occur during the system's response process; and throughput can be the amount of data that the system under maintenance can process within a certain time.

[0111] In practical use, the system performance score can be calculated based on system indicator data using a preset scoring formula. The preset scoring formula can be:

[0112]

[0113] In the formula, CPI is the system performance score, throughput is the numerator, representing the system's processing capacity; response time and error rate together form the denominator, representing the system's burden or poor performance; the penalty factor is a coefficient that can be preset by the administrator of the playback data construction device to amplify the impact of the error rate on CPI.

[0114] Using this formula for calculation means that the negative impact of error rate on system performance will be given greater consideration. By calculating CPI, a single index that can comprehensively reflect system performance can be obtained. A higher CPI value indicates that the system has better performance, that is, it can handle a large number of requests in a shorter response time and has a lower error rate. Conversely, a lower CPI value indicates that the system performance is poor and may need optimization or adjustment.

[0115] In practical use, if the system performance score is too low, such as if the system performance score is less than the preset performance threshold, it indicates that the system performance of the system to be maintained is poor. It can be determined that the system in the replay execution environment (i.e. the system to be maintained in the replay execution environment) is abnormal and may need to be optimized or adjusted. In order to continue the replay test, the replay strategy can be dynamically adjusted, such as reducing the replay rate to cope with the system pressure, and return to step S60 to continue the replay test, thereby ensuring the stable operation and optimal performance of the system.

[0116] In practical applications, dashboards can be created using monitoring tools such as Grafana to display CPI and other key performance indicators in real time. This allows testers and system administrators to dynamically adjust replay strategies or set adjustment rules for replay strategies based on real-time data.

[0117] In practical implementation, after the test is completed, result analysis can also be performed, for example:

[0118] A detailed analysis of the playback results is conducted, including key indicators such as response time, success rate, and error rate, as well as verification of the correctness of the business logic.

[0119] Correctness verification can be carried out from the following aspects:

[0120] Requirements Comparison: Compare the business logic during the playback process with the original requirements document to ensure that all business rules and processes are correctly implemented. Check for any missing functionalities or unhandled exceptions.

[0121] Unit testing: Use the JUnit unit testing framework to write test cases for business logic; ensure that test cases cover all possible business scenarios, including normal conditions and boundary conditions; use assertions to verify the consistency between actual output and expected output.

[0122] Integration testing: Focus on whether the interfaces and data interactions between modules conform to the business logic; simulate the collaborative work between different modules to ensure the smooth execution of the overall business process.

[0123] System testing: Testing is conducted at the entire software system level to verify whether the software meets business requirements; simulating real-world business scenarios to test the performance of business logic under various complex environments.

[0124] Code review: Through mutual review among team members, potential problems in the code are discovered, such as logical errors and improper handling of boundary conditions, to ensure the readability, maintainability and scalability of the code.

[0125] Automated testing: Use automated testing tools to improve testing efficiency, reduce human error, configure continuous integration processes, and ensure that every code change is verified by automated testing.

[0126] Exception handling: Verify the business logic's ability to handle exceptional situations, ensure the system can run stably and provide reasonable error messages, use try-catch blocks to catch and handle exceptions, and record detailed exception information for subsequent troubleshooting.

[0127] Data validation: Ensure that the data processed by business logic is logically valid and conforms to business rules and data constraints. Use data validation tools or custom validation logic to check the correctness of input and output data.

[0128] Specifically, data such as the response time T (milliseconds) and success rate R (%) of the system to be maintained can be collected during replay testing. Data analysis tools (such as Excel or Python pandas) are used to perform data analysis and calculate metrics such as average response time T_avg and success rate R_avg. The results data, including response time T and success rate R, are exported from the replay tool. Pandas is then used to perform data analysis to calculate the average response time T_avg = mean(T) and the success rate R_avg = mean(R).

[0129] The formula for calculating the average response time T_avg is:

[0130]

[0131] Where Ti is the response time of the i-th request, and n is the total number of requests.

[0132] During the replay test, each request is marked as successful or failed, and the success rate R can be calculated using the following formula:

[0133]

[0134] Where, N success N is the number of successful requests. total This is the total number of requests.

[0135] In practice, test reports can be automatically generated based on the analysis results, providing intuitive charts and data analysis to help testers and developers quickly locate problems and optimize the system.

[0136] Specifically, the design report should include the test objectives, test environment, test strategy, test results, and problem analysis. Use charts (such as line charts, bar charts, and pie charts) to visually display performance metrics and problem distribution. Specifically, use automated report generation tools (such as JMeter's HTML report generator) to quickly generate test reports. Write custom scripts or use the Jinja2 template engine to generate test reports that meet specific requirements.

[0137] This embodiment provides a method for constructing replay data. Since the replay engine is automatically configured according to the replay strategy, it ensures that testers can reasonably adjust the relevant parameters in the replay test process according to actual needs, and the adjustment can be quickly applied to the replay engine, thus ensuring the testing efficiency of the replay test.

[0138] This application also provides a playback data construction apparatus, please refer to... Figure 3 The playback data construction device includes:

[0139] The capture module 10 is used to capture request data and corresponding response data in the production environment and generate traffic data.

[0140] Filtering module 20 is used to filter the traffic data based on filtering rules to generate filtered traffic data;

[0141] Processing module 30 is used to preprocess the filtered traffic data to generate processed traffic data. The preprocessing includes data cleaning and / or data desensitization.

[0142] The setting module 40 is used to set corresponding data tags for the processed traffic data and generate playback test data.

[0143] The playback data construction apparatus provided in this application, employing the playback data construction method in the above embodiments, can solve the technical problem that traffic recording and playback testing only targets certain test environment scenarios and services as a whole process, and cannot cope with complex business scenarios. Compared with the prior art, the beneficial effects of the playback data construction apparatus provided in this application are the same as those of the playback data construction method provided in the above embodiments, and other technical features in the playback data construction apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0144] This application provides a playback data construction device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the playback data construction method in the first embodiment described above.

[0145] The following is for reference. Figure 4 The diagram illustrates a structural schematic of a playback data construction device suitable for implementing embodiments of this application. The playback data construction device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 4The playback data construction device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0146] like Figure 4 As shown, the playback data construction device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the playback data construction device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. The communication device 1009 allows the playback data construction device to communicate wirelessly or wiredly with other devices to exchange data. Although playback data construction devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0147] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0148] The playback data construction device provided in this application, employing the playback data construction method in the above embodiments, can solve the technical problem that traffic recording and playback testing only targets certain test environment scenarios and services as a whole process, and cannot cope with complex business scenarios. Compared with the prior art, the beneficial effects of the playback data construction device provided in this application are the same as those of the playback data construction method provided in the above embodiments, and other technical features in this playback data construction device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0149] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0150] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0151] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the playback data construction method in the above embodiments.

[0152] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0153] The aforementioned computer-readable storage medium may be included in the playback data construction device; or it may exist independently and not assembled into the playback data construction device.

[0154] The aforementioned computer-readable storage medium carries one or more programs that, when executed by the playback data construction device, cause the playback data construction device to:

[0155] Capture request data and corresponding response data in the production environment to generate traffic data; filter the traffic data based on filtering rules to generate filtered traffic data; preprocess the filtered traffic data to generate processed traffic data, the preprocessing including data cleaning and / or data anonymization; set corresponding data tags for the processed traffic data to generate replay test data.

[0156] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0157] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0158] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0159] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described playback data construction method. This addresses the technical problem that traffic recording and playback testing only applies to certain test environments and business scenarios, and cannot handle complex business scenarios. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the playback data construction method provided in the above embodiments, and will not be elaborated upon here.

[0160] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the playback data construction method described above.

[0161] The computer program product provided in this application can solve the technical problem that traffic recording and playback testing only covers the overall process in some test environments and business scenarios, and cannot cope with complex business scenarios. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the playback data construction method provided in the above embodiments, and will not be repeated here.

[0162] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for constructing playback data, characterized in that, The method includes: Capture request data and corresponding response data in the production environment to generate traffic data; The traffic data is filtered based on filtering rules to generate filtered traffic data; The filtered traffic data is preprocessed to generate processed traffic data. The preprocessing includes data cleaning and / or data desensitization. Set corresponding data tags for the processed traffic data and generate playback test data.

2. The playback data construction method as described in claim 1, characterized in that, The step of filtering the traffic data based on filtering rules to generate filtered traffic data includes: Extract the corresponding filter fields, rule matching attributes, and attribute matching methods from the filter rules; Extract the corresponding matching attributes from each traffic data based on the filtering fields; Based on the attribute matching method, the corresponding matching attributes in the traffic data are compared with the rule matching attributes to determine the data to be filtered out. The data to be filtered out is removed from the traffic data to generate filtered traffic data.

3. The playback data construction method as described in claim 1, characterized in that, The data tags include business model tags; The step of setting corresponding data tags for the processed traffic data and generating replay test data includes: Feature extraction is performed on each processing traffic data to obtain the data feature vector corresponding to each processing traffic data; The processed traffic data is clustered based on the data feature vector to obtain clustering results. The clustering results include at least one cluster and the cluster to which each processed traffic data belongs. Based on the clustering results, set corresponding business mode labels for each processed traffic data.

4. The playback data construction method as described in claim 1, characterized in that, The data tag includes a data status tag, which is used to characterize whether the data is abnormal traffic data; The step of setting corresponding data tags for the processed traffic data and generating replay test data includes: The processed traffic data is analyzed using an anomaly detection algorithm to determine the anomaly score corresponding to each processed traffic data. The anomaly score is compared with a preset anomaly threshold, and a corresponding data status label is set for each processed traffic data based on the comparison result.

5. The playback data construction method according to any one of claims 1-4, characterized in that, After setting corresponding data tags for the processed traffic data and generating replay test data, the process further includes: Obtain the recording environment information corresponding to the playback test data, and construct a playback execution environment based on the recording environment information; The playback engine is configured with parameters based on the playback strategy, which includes playback speed, concurrency and / or number of playbacks; Upon completion of configuration, the playback test data is input into the playback engine, enabling the playback engine to perform traffic playback tests on the playback execution environment based on the playback test data.

6. The playback data construction method as described in claim 5, characterized in that, Upon completion of configuration, the replay test data is input into the replay engine so that the replay engine performs traffic replay tests on the replay execution environment based on the replay test data. This process further includes: During the traffic replay test, the system metrics data in the replay execution environment are monitored in real time. The system metrics data include response time, error rate, and throughput. Calculate the system performance score based on the system indicator data, and determine whether the system in the replay execution environment is abnormal based on the system performance score; When a system anomaly is detected in the playback execution environment, the playback strategy is adjusted, and the process returns to the step of configuring the playback engine parameters based on the playback strategy.

7. A playback data construction apparatus, characterized in that, The device includes: The capture module is used to capture request data and corresponding response data in the production environment, and generate traffic data. The filtering module is used to filter the traffic data based on filtering rules to generate filtered traffic data. The processing module is used to preprocess the filtered traffic data to generate processed traffic data. The preprocessing includes data cleaning and / or data desensitization. The settings module is used to set corresponding data tags for the processed traffic data and generate playback test data.

8. A playback data construction device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the playback data construction method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the playback data construction method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the playback data construction method as described in any one of claims 1 to 6.