Software testing method, device, equipment and medium based on traffic playback

Through the software testing method based on traffic playback, the playback peak detection method is used to automatically match high-concurrent and peak traffic data, which solves the shortcomings of manually constructing traffic in traditional testing methods and improves the accuracy and efficiency of the test.

CN114328268BActive Publication Date: 2025-01-07CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210043412.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-14
Publication Date
2025-01-07
Estimated Expiration
2042-01-14

AI Technical Summary

Technical Problem

Traditional software testing methods rely on manual construction of online traffic, which consumes a lot of human resources, makes mistakes prone to missed business scenarios, and is unable to construct real scenarios with high concurrency and peak periods, affecting the accuracy and efficiency of test results.

Method used

Using a software test method based on traffic playback, the high-concurrency and peak traffic playback data to be tested is matched from the real-time playback system through the playback peak detection method, and the service system is automatically restored to the reference state, and the test results are compared to reduce manual intervention.

Benefits of technology

It improves the authenticity and business integrity of traffic data, improves the accuracy and efficiency of software testing, and reduces the workload of manual testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328268B_ABST
    Figure CN114328268B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of automated testing technology, and the present invention discloses a software testing method, device, equipment and medium based on traffic playback, the method comprising: receiving a playback test request including a version to be tested and a playback configuration file; using a playback peak detection method, identifying and extracting matching traffic playback data to be tested from a real-time playback system, obtaining associated traffic playback start snapshot data and traffic playback end snapshot data; backing up business data to obtain a benchmark system, and restoring the traffic playback end snapshot data to obtain a benchmark playback result; based on the traffic playback start snapshot data, restoring the business system, and decompressing and configuring the version software corresponding to the version to be tested into the business system, replaying the traffic playback data to be tested, and executing to obtain an upgraded version execution result; comparing the benchmark playback result with the upgraded version execution result to obtain a software test result. Therefore, the present invention improves the accuracy and correctness of the software test result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automated testing technology, and in particular to a software testing method, device, equipment and medium based on traffic playback. Background Art

[0002] At present, after Internet companies have implemented microservices, more and more business services have been generated. With the increase in business needs, the update frequency of business services has continued to accelerate. Business services running online are also more prone to instability. Testing updated business services is a must before going online. The traditional testing method is to manually build online traffic and generate test cases to test updated business services. This consumes a lot of human resources and is prone to errors or omissions in business scenarios. It is even impossible to construct scenarios with high and low peaks and high concurrency of online traffic data, so that it is impossible to achieve problems such as authenticity and business process integrity. Summary of the invention

[0003] The present invention provides a software testing method, device, equipment and medium based on traffic playback, which realizes the use of a playback peak detection method to automatically match the playback data of the traffic to be tested with high concurrency and peak from a real-time playback system, thereby improving the authenticity and business integrity of the traffic data, improving the accuracy and correctness of the software testing results, and improving the efficiency of software testing.

[0004] A software testing method based on traffic playback, comprising:

[0005] Receive a playback test request, wherein the playback test request includes a version to be tested and a playback configuration file;

[0006] Using a playback peak detection method, identifying and extracting the flow playback data to be tested that matches the playback configuration file from the real-time playback system, and obtaining flow playback start snapshot data and flow playback end snapshot data associated with the flow playback data to be tested;

[0007] Decompress and configure the version software corresponding to the version to be tested into the business system, and back up the business system to obtain a benchmark system;

[0008] Restoring the traffic playback start snapshot data and the traffic playback end snapshot data based on the reference system to obtain source data and a first playback result;

[0009] Based on the source data and the business system, replay the flow replay data to be tested, and execute to obtain a second replay result;

[0010] The first playback result and the second playback result are compared to obtain a software test result.

[0011] A software testing device based on traffic playback, comprising:

[0012] A receiving module, used to receive a playback test request, wherein the playback test request includes a version to be tested and a playback configuration file;

[0013] An extraction module is used to identify and extract the flow replay data to be tested that matches the replay configuration file from the real-time replay system by using a replay peak detection method, and to obtain flow replay start snapshot data and flow replay end snapshot data associated with the flow replay data to be tested;

[0014] A configuration module, used to decompress and configure the version software corresponding to the version to be tested into the business system, and back up the business system to obtain a reference system;

[0015] A recovery module, used to recover the traffic playback start snapshot data and the traffic playback end snapshot data based on the reference system to obtain source data and a first playback result;

[0016] An execution module, used for replaying the flow replay data to be tested based on the source data and the business system, and executing to obtain a second replay result;

[0017] The comparison module is used to compare the first playback result and the second playback result to obtain a software test result.

[0018] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the software testing method based on traffic playback when executing the computer program.

[0019] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the software testing method based on traffic playback.

[0020] The data + display method, device, equipment and medium based on ciphertext transmission provided by the present invention, the method receives a playback test request, the playback test request includes a version to be tested and a playback configuration file; uses a playback peak detection method to identify and extract the test flow playback data matching the playback configuration file from a real-time playback system, and obtains flow playback start snapshot data and flow playback end snapshot data associated with the test flow playback data; backs up the business system associated with the test version to obtain a benchmark system, and restores the flow playback end snapshot data based on the benchmark system to obtain a benchmark playback result; restores the business system based on the flow playback start snapshot data, and restores the flow playback end snapshot data corresponding to the test version. The version software is unzipped and configured into the restored business system, and the playback data of the flow to be tested is played back, and the upgraded version execution result is obtained by executing it; the benchmark playback result and the upgraded version execution result are compared to obtain the software test result. Therefore, the playback peak detection method is used to automatically match the playback data of the flow to be tested with high concurrency and peak from the real-time playback system, without the need to manually write and generate the flow data of the complete business, thereby improving the authenticity of the flow data and the business integrity, and automatically installing the version software corresponding to the version to be tested, and restoring the corresponding snapshot data, automatically comparing the test, and obtaining the software test result, thereby reducing the workload of manual testing, improving the accuracy and correctness of the software test results, and improving the efficiency of software testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0022] Figure 1 It is a schematic diagram of an application environment of a software testing method based on traffic playback in one embodiment of the present invention;

[0023] Figure 2 is a flow chart of a software testing method based on traffic playback in one embodiment of the present invention;

[0024] Figure 3 is a flow chart of step S20 of a software testing method based on traffic playback in one embodiment of the present invention;

[0025] Figure 4 is a flow chart of step S20 of a software testing method based on traffic playback in another embodiment of the present invention;

[0026] Figure 5is a flow chart of step S22 of a software testing method based on traffic playback in one embodiment of the present invention;

[0027] Figure 6 is a flow chart of step S203 of a software testing method based on traffic playback in one embodiment of the present invention;

[0028] Figure 7 It is a principle block diagram of a software testing device based on traffic playback in one embodiment of the present invention;

[0029] Figure 8 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0030] 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 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.

[0031] The software testing method based on traffic playback provided by the present invention can be applied in Figure 1 In an application environment, a client (computer device or terminal) communicates with a server through a network. The client (computer device or terminal) includes, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0032] In one embodiment, if Figure 2 As shown, a software testing method based on traffic playback is provided, and its technical solution mainly includes the following steps S10-S50:

[0033] S10, receiving a playback test request, where the playback test request includes a version to be tested and a playback configuration file.

[0034] It is understandable that before the development of the version to be tested is completed and released, it is necessary to perform functional testing on the version to be tested. In order to quickly obtain test results, a playback test is introduced to trigger the playback test request to perform functional testing on the version to be tested. The playback test request is a request for triggering a playback test for the version to be tested. The playback configuration file is a file that configures playback-related properties. The playback configuration file includes the business category involved in the version to be tested. The version to be tested is a unique identifier of a software version. One version to be tested corresponds to a software version. The version to be tested is associated with relevant business categories, indicating that the execution operation of the version to be tested involves associated business categories.

[0035] S20, using the playback peak detection method, identifying and extracting the flow playback data to be tested that matches the playback configuration file from the real-time playback system, and obtaining the flow playback start snapshot data and the flow playback end snapshot data associated with the flow playback data to be tested.

[0036] It can be understood that the real-time playback system is a system that captures effective traffic in network traffic in real time, classifies the captured traffic and generates traffic files, and is capable of storing traffic files in real time. The real-time playback system stores traffic playback data of various business categories, and the traffic playback data is a collection of traffic files available for playback. The playback peak detection method is to identify the traffic playback data related to the business category of the playback configuration file from the real-time playback system, and identify the time period of high concurrency peak period for the traffic playback data, identify the peak time period of each business category and the corresponding starting snapshot data and ending snapshot data, and merge and compress each peak time period into a collection of all related business A peak period of a category and a set of flow files, and a method for determining snapshot data at the beginning and end of the period, querying flow playback data consistent with the business category in the playback configuration file from the real-time playback system, and obtaining the flow playback data to be tested containing the flow file set after applying the playback peak detection method, and the flow playback start snapshot data and the flow playback end snapshot data associated therewith, the flow playback start snapshot data being the snapshot data at the starting moment of the flow playback data to be tested, and the flow playback end snapshot data being the snapshot data at the ending moment of the flow playback data to be tested, that is, the snapshot data corresponding to the moment after all the flow playback data to be tested are executed.

[0037] In one embodiment, if Figure 3As shown, in step S20, i.e., using the playback peak detection method, identifying and extracting the flow playback data to be tested that matches the playback configuration file from the real-time playback system, and obtaining the flow playback start snapshot data and flow playback end snapshot data associated with the flow playback data to be tested, including:

[0038] S201, obtaining at least one flow playback data matching the service category in the playback configuration file from a real-time playback system.

[0039] It can be understood that the real-time playback system is a system that captures effective traffic in network traffic in real time, classifies the captured traffic and generates traffic files, and can store traffic files in real time. The real-time playback system stores traffic playback data of various business categories, and the traffic playback data is a collection of traffic files available for playback. The real-time playback system searches for a business category that matches the business category in the playback configuration file, and obtains the traffic playback data associated with the business category.

[0040] In one embodiment, if Figure 4 As shown, before step S201, that is, before obtaining at least one flow playback data matching the service category in the playback configuration file from the real-time playback system, the following steps are included:

[0041] S21,captures network traffic in real time through edge nodes.

[0042] It can be understood that the edge node is a node in the gateway of the business system, which is mainly used to capture network traffic and generate traffic files and real-time snapshots of network traffic. The capture process is the process of copying the received message from the gateway of the business system.

[0043] S22, performing data cleaning on the network traffic based on distributed flow data through the edge node to obtain multiple queued traffic files.

[0044] It can be understood that the data cleaning based on distributed streaming data is to use the Flink mechanism to perform distributed diversion processing, and then perform deduplication, invalid removal and traffic file generation processing of each distributed node. The Flink mechanism is a streaming data flow execution engine, which provides functions such as data distribution, data communication and fault tolerance mechanism for distributed computing of data flow.

[0045] In one embodiment, in step S22, that is, performing data cleaning based on distributed flow data on the network traffic through the edge node to obtain multiple queued traffic files, includes:

[0046] S221, performing distributed diversion processing on the network traffic through the edge node, diverting the traffic to multiple distributed nodes, and sending multiple diversion data to the distributed nodes.

[0047] It can be understood that the distributed diversion processing is: first, each message is classified into a business category, wherein the business classification is the process of classification through the identification bit of the business type in the message; secondly, according to the Flink mechanism, each message is node-diverted, and the diverted data corresponding to each business category is diverted; finally, each diverted data is sent to the distributed node corresponding to the business category of each diverted data.

[0048] In one embodiment, the step S221, that is, performing distributed diversion processing on the network traffic by the edge node, diverting the traffic to multiple distributed nodes, and sending multiple diversion data to the distributed nodes, includes:

[0049] Performing service classification on each message in the network traffic to obtain a service category of each message.

[0050] Understandably, each of the messages in the network traffic is classified according to the identification bit of the service type in the message, the messages of the same service category are aggregated, and the service category of each of the messages is obtained.

[0051] According to the Flink mechanism, each of the messages is node-divided to divert the diverted data corresponding to each of the service categories.

[0052] It can be understood that the Flink mechanism is a mechanism that links messages of the same business category to form a task chain, and then diverts the task chains of different business categories to corresponding nodes in different Flink clusters. The node diversion is the process of using the Flink mechanism to divert task chains of different business categories to corresponding nodes, and encapsulates the message links of the same business category into one diversion data, and one business category corresponds to one diversion data.

[0053] The process of forming a task chain is to connect the messages with a directional link relationship, so that the sequence can be connected in order.

[0054] Distribute each of the diverted data to the distributed nodes corresponding to the business category of each of the diverted data.

[0055] It can be understood that the distributed nodes are nodes in the Flink cluster, different business categories are assigned different nodes, and each of the diverted data is distributed to the corresponding distributed node.

[0056] The present invention achieves the goal of obtaining the business category of each message by performing business classification on each message in the network traffic; performing node diversion on each message according to the Flink mechanism, and diverting the diverted data corresponding to each business category; distributing each diverted data to the distributed node corresponding to the business category of each diverted data. In this way, the Flink mechanism can be used to divert the data to the distributed nodes of different business categories, so that each distributed node can perform its function and improve the efficiency of data processing.

[0057] S222: Performing tree-structure-based deduplication processing on the diverted data corresponding to each distributed node through each distributed node to obtain deduplication data.

[0058] It can be understood that when each of the distributed nodes performs deduplication processing on the received diverted data, a corresponding session parameter prefix tree is constructed. The session parameter prefix tree is a tree that uses the prefix of the message (source IP, target IP, protocol, service ID, session ID, and URL parameters) as the branch basis of each level. The parent node of the session parameter prefix tree is the distributed node, indicating that the diverted data received by the distributed node is deduplicated. The deduplication processing based on the tree structure is based on the source IP, target IP, protocol, service ID, session ID, and URL of the message in the diverted data. L's parameters are used as parameters for constructing a session parameter prefix tree, and each of the messages is queried. If the same branch node is found, the message is recorded as duplicate data; if not found, a new branch node matching the prefix of the message is inserted at the next level of the corresponding branch node of the query path, so that the message can be queried in the session parameter prefix tree after insertion. By continuously inserting new branch nodes, the session parameter prefix tree can be improved, so that a complete session parameter prefix tree with source IP, target IP, protocol, service ID, session ID and URL as branch nodes at each level can be constructed.

[0059] In one embodiment, if Figure 5 As shown, in step S222, that is, by each of the distributed nodes, the diverted data corresponding to each of the distributed nodes is subjected to tree-structure-based deduplication processing to obtain deduplication data, including:

[0060] Based on the constructed session parameter prefix tree corresponding to the distributed node, each of the messages in the diverted data is queried.

[0061] It can be understood that the parent node of the session parameter prefix tree is constructed, and the constructed session parameter prefix tree is in the format of a six-tuple based on the parameters of the source IP, target IP, protocol, service ID, session ID and URL, and each tree node construction process is constructed in a tree structure in the order of the six-tuple, that is, the session parameter prefix tree is constructed in the order of the source IP, target IP, protocol, service ID, session ID and URL parameters as the order of each layer of tree nodes, and each time the message in the diverted data is received, the tree node of each layer corresponding to it is queried in the order of the source IP, target IP, protocol, service ID, session ID and URL parameters of one of the messages in the diverted data.

[0062] If a branch node of the session parameter prefix tree that is the same as the prefix of the message in the diverted data is found, the message is recorded as duplicate data.

[0063] It can be understood that according to the tree structure query method, if a branch node of the session parameter prefix tree that is the same as the prefix of the message (source IP, target IP, protocol, service ID, session ID and URL parameters) is queried, it means that the message is a duplicate message and it is recorded as the duplicate data.

[0064] The tree structure query method is a recursive query method that searches for all bottom-level child nodes from a parent node and records the search path.

[0065] If a branch node of the session parameter prefix tree that is the same as the prefix of the message in the offload data cannot be found, it is inserted into the session parameter prefix tree to obtain a new branch node in the session parameter prefix tree.

[0066] It can be understood that according to the tree structure query method, if the branch node of the session parameter prefix tree that is the same as the prefix of the message (source IP, target IP, protocol, service ID, session ID and URL parameters) cannot be queried, a new branch node that matches the prefix of the message is inserted at the next level of the corresponding branch node of the query path, so that the message can be queried in the session parameter prefix tree after the insertion.

[0067] After all the messages are queried, all the duplicate data are discarded to obtain the deduplicated data corresponding to the diverted data.

[0068] The present invention realizes querying each message in the diverted data based on a session parameter prefix tree constructed corresponding to the distributed node; if a branch node of the session parameter prefix tree with the same prefix as the message in the diverted data is queried, the message is recorded as duplicate data; if a branch node of the session parameter prefix tree with the same prefix as the message in the diverted data cannot be queried, it is inserted into the session parameter prefix tree to obtain a new branch node in the session parameter prefix tree; after all the messages are queried, all the duplicate data are discarded to obtain the deduplicated data corresponding to the diverted data, so that the diverted data can be quickly deduplicated through the constructed session parameter prefix tree and the query process of the tree structure, thereby accelerating the efficiency of data cleaning.

[0069] S223, through each of the distributed nodes, invalidate the deduplication data corresponding to each of the distributed nodes to obtain valid data.

[0070] It can be understood that the received deduplicated data is invalidated by the distributed nodes, and the invalid removal is a process of filtering and deleting invalid data such as empty data or garbled characters in the deduplicated data, and the filtered deduplicated data is recorded as valid data.

[0071] S224, generating a flow file for the valid data corresponding to each distributed node through each distributed node, and generating a plurality of generated data.

[0072] It can be understood that the process of generating the traffic file is to convert the input valid data into the traffic file format through the distributed nodes, that is, to encapsulate each of the valid data in the traffic file template format to obtain the traffic file for access, thereby generating the generated data corresponding to each message.

[0073] S225, performing time series aggregation on all the generated data through the edge node to obtain a plurality of queued traffic files.

[0074] It can be understood that the timing aggregation is to aggregate all the generated data output by each distributed node in the order of timing, that is, to aggregate all the generated data of the same timing or time point together to obtain the enqueuing traffic file of the timing or time point, thereby obtaining multiple enqueuing traffic files.

[0075] The present invention realizes distributed diversion processing of the network traffic through the edge node, diversion to multiple distributed nodes, and multiple diversion data sent to the distributed nodes; through each of the distributed nodes, the diversion data corresponding to each of the distributed nodes is deduplicated based on a tree structure to obtain each deduplicated data; through each of the distributed nodes, invalid removal of the deduplicated data corresponding to each of the distributed nodes is performed to obtain each valid data; through each of the distributed nodes, flow file generation is performed for the valid data corresponding to each of the distributed nodes to generate multiple generated data; through the edge node, all the generated data are summarized in time series to obtain multiple queued flow files. In this way, distributed diversion processing can be used to execute multiple nodes in parallel, ensure real-time and timely processing, speed up the generation efficiency of flow playback files, and use deduplication processing, invalid removal, and flow file generation based on a tree structure to automatically generate valid generated data, and output the queued flow file in time series summary, providing an accurate and useful data basis for the subsequent generation of flow playback data.

[0076] S23, flowing all the queued traffic files into the message queue in the edge node.

[0077] Understandably, all the queued traffic files are sent to the message queue in the edge node, and the message queue is a queue for storing files to be sent.

[0078] S24, perform peak shaving and current limiting processing on the message queue, and add the queued flow file sub-table in the message queue after peak shaving and current limiting to the flow playback data corresponding to each of the queued flow files, and at the same time, perform snapshot storage on the system database at the time of adding to obtain the snapshot data corresponding to the time of adding.

[0079] It can be understood that the peak shaving and current limiting processing is a process of batch transmission to match the performance of the downstream gateway. After the peak shaving and current limiting processing, all the queued traffic files can be divided into several forms of database structure, and the divided forms of the database structure are added to the traffic playback data. At the same time, at the time of adding, the system database (column storage database) is snapshot stored to obtain the snapshot data corresponding to the time of adding. The snapshot storage is stored using the snapshot method, and the snapshot method is a method of directly cloning the data form without copying the data.

[0080] The present invention realizes real-time capture of network traffic through edge nodes; data cleaning based on distributed flow data is performed on the network traffic through the edge nodes to obtain multiple queued traffic files; all the queued traffic files flow into the message queue in the edge node; peak shaving and current limiting processing is performed on the message queue, and the queued traffic file sub-tables in the message queue after peak shaving and current limiting are added to the traffic playback data corresponding to each queued traffic file, and at the same time, a system database is snapshot stored at the time of adding to obtain the snapshot data corresponding to the time of adding, so that the network traffic can be captured in real time, the traffic playback data is provided for playback in approximately real time, and the data is automatically cleaned, and effective traffic files and snapshot data are automatically generated, so as to provide a data benchmark for subsequent playback and software testing.

[0081] S202, performing peak identification and complete identification on each of the traffic playback data to obtain each peak traffic file and start snapshot data and end snapshot data corresponding to the peak traffic file.

[0082] It can be understood that the peak identification is the process of extracting the time period with high concurrency characteristics in the traffic playback data, and the complete identification is to identify the process characteristics of the complete steps of the business process in the time period identified by the peak, and expand or shrink the area around the identified time period to ensure the integrity of the business process. At the two moments (start moment and end moment) of the time period obtained after the peak identification and complete identification, corresponding snapshot data are obtained respectively, thereby obtaining the starting snapshot data and the ending snapshot data. In the real-time playback system, a real-time snapshot database will be generated to obtain snapshot data at each moment.

[0083] S203, merging and compressing the peak traffic files in time periods to obtain the traffic playback data to be tested, and identifying the beginning and the end of all the starting snapshot data and the ending snapshot data to obtain the traffic playback starting snapshot data and the traffic playback ending snapshot data.

[0084] It can be understood that the time period merging is to arrange the peak traffic files in time sequence to obtain a time sequence arrangement time period; the traffic files are shifted and merged in the time sequence arrangement time period, and each traffic file is shifted according to the same starting point, which is the earliest moment among the moments with traffic files. After the shift, all traffic files are merged and superimposed to increase the number of traffic files to reach a peak state or a high concurrency situation. The time period compression is to compress the data flow of the steps of the same business process, and compress the time period.

[0085] Among them, after obtaining the time series arrangement period, all the starting snapshot data and all the ending snapshot data corresponding to the time series arrangement period are identified from the beginning to the end. The process of the beginning and the end identification is the process of identifying the snapshot data corresponding to the earliest moment among the starting moments of all traffic files, and the snapshot data corresponding to the latest moment among the ending moments of all traffic files, so that the starting snapshot data of the traffic playback and the ending snapshot data of the traffic playback can be identified.

[0086] The present invention achieves this by acquiring at least one flow playback data matching the business category in the playback configuration file from a real-time playback system; performing peak identification and complete identification on each of the flow playback data to obtain each peak flow file and the start snapshot data and the end snapshot data corresponding to the peak flow file; performing time period merging and time period compression on each of the peak flow files to obtain the flow playback data to be tested, and performing head and tail identification on all of the start snapshot data and the end snapshot data to obtain the flow playback start snapshot data and the flow playback end snapshot data. In this way, the flow playback data to be tested during the peak period can be automatically obtained, the software testing requirements under high concurrency conditions are met, the authenticity of the software testing is achieved, and the integrity of the flow playback data to be tested is guaranteed, the business process is avoided from being missing and the test is omitted, and the accuracy and correctness of subsequent software testing is improved.

[0087] In one embodiment, if Figure 6 As shown, in step S203, that is, the time period merging and time period compression of each peak flow file to obtain the flow playback data to be tested, and the head and tail identification of all the starting snapshot data and the ending snapshot data to obtain the flow playback starting snapshot data and the flow playback ending snapshot data, including:

[0088] S2031, arranging each of the peak flow files in time sequence to obtain a time sequence arrangement period.

[0089] It can be understood that the process of arranging in time sequence is to sort in chronological order, that is, to arrange according to the time position on the time axis on the same time axis, to arrange all the peak traffic files on the time axis, and to record the time range of the time position involved as the time sequence arrangement period.

[0090] S2032, shifting and merging the flow files of the time series arrangement period to obtain a merged period, and compressing the merged period to obtain the playback data of the flow to be measured.

[0091] It can be understood that the shifting is a process of removing blank time periods in the time series arrangement period, and shifting the peak flow files adjacent to the blank time period to the time position of the blank time period. The continuous and cyclical shifting can obtain a time series arrangement period without blank time periods, and then the time positions corresponding to each flow file can be merged through the shifting to obtain the merged time period. The time period compression is to shift all the flow files in the merged time period to the time position at the beginning of the merged time period, and superimpose all the flow files, so as to compress the time range of the merged time period, thereby obtaining the playback data of the flow to be measured.

[0092] S2033: Sort the moments of all the starting snapshot data in the measured traffic playback data in ascending order, and record the starting snapshot data corresponding to the first moment in the sorting sequence as the traffic playback starting snapshot data.

[0093] It can be understood that one of the traffic replay data to be tested includes multiple traffic files, and one of the traffic files includes a starting snapshot data and an ending snapshot data, the starting snapshot data includes a starting time for snapshot storage of the column storage database, and the ending snapshot data includes an ending time for snapshot storage of the column storage database, and the identification process of the traffic replay starting snapshot data in the first identification is to sort all the starting times in ascending order, so that the earliest time can be put first, and the starting snapshot data corresponding to the earliest starting time is recorded as the traffic replay starting snapshot data.

[0094] S2034, sorting the moments of all the end snapshot data in the traffic playback data to be tested in descending order, and recording the end snapshot data corresponding to the first moment in the sorting sequence as the traffic playback end snapshot data.

[0095] It can be understood that the identification process of the traffic replay end snapshot data in the first identification is to sort all the end times in descending order, so that the latest time can be placed first, and the end snapshot data corresponding to the latest start and end time is recorded as the traffic replay end snapshot data.

[0096] The present invention achieves the following: arranging each of the peak flow files in time sequence to obtain a time sequence arrangement period; performing flow file translation and merging in the time sequence arrangement period to obtain a merged period, and performing time period compression on the merged period to obtain the flow playback data to be tested; sorting the moments of all the starting snapshot data in the flow playback data to be tested in ascending order, and recording the starting snapshot data corresponding to the first moment in the sorting sequence as the flow playback starting snapshot data; sorting the moments of all the ending snapshot data in the flow playback data to be tested in descending order, and recording the ending snapshot data corresponding to the first moment in the sorting sequence as the flow playback ending snapshot data. In this way, the flow playback data to be tested can be automatically generated by using time sequence arrangement, translation and merging, and time period compression, without the need for manual synthesis, thus reducing costs, and accurately obtaining the flow playback starting snapshot data and the flow playback ending snapshot data through head and tail recognition.

[0097] S30, backing up the business system associated with the version to be tested to obtain a reference system, and restoring the traffic replay end snapshot data based on the reference system to obtain a reference replay result.

[0098] It can be understood that a version to be tested is associated with a business system, and the business system is a currently running system involved in which the version software corresponding to the version to be tested is not installed. It can also be understood that the business system is a running system involved in the current need to test the version to be tested. The mirror backup method is used to perform a full backup of the business system to obtain the benchmark system. The benchmark system is obtained by building a blank system with the same architecture as the business system (including a column storage database such as HBase or Clickhouse associated with the business system), and using the mirror backup method to back up the full data of the business system. The benchmark system includes the version software before the version to be tested is installed. In the benchmark system, the full snapshot recovery technology is used to restore the traffic replay end snapshot data, and all data in the column storage database in the benchmark system is restored to data consistent with the traffic replay end snapshot data, so that all parameters of the benchmark system at this time and all data contained in the column database are recorded as the benchmark playback result.

[0099] Among them, the full snapshot recovery technology is a technology for restoring the data structure and data at the time of the previous snapshot. The snapshot method is a method of directly cloning the data form without copying the data. The snapshot method has the least impact on the domain server and will not directly affect other clusters or cause any server to stagnate or get stuck.

[0100] S40, based on the traffic playback starting snapshot data, the business system is restored, and the version software corresponding to the version to be tested is decompressed and configured into the restored business system, and the traffic playback data to be tested is played back, and the upgrade execution result is obtained.

[0101] Understandably, the full snapshot recovery technology is used to restore the business system according to the traffic playback starting snapshot data, and the column storage database in the business system is restored to data consistent with the traffic playback starting snapshot data. After the business data is restored to the traffic playback starting snapshot data, the version software corresponding to the version to be tested is obtained on the software publishing platform, and the obtained version software is installed to the business system, that is, the version software is decompressed, and the version software in the compressed package format is decompressed into a folder in a format that can be directly read, and the decompressed version software is configured according to the installation path of each file in the folder, that is, each file is installed according to The corresponding paths are migrated, and each file is executed to configure the corresponding parameters in each file into the configuration parameters of the corresponding files of the business system, so as to install the version software for the business system. After the version software is installed, the data to be replayed is played back in the business system, that is, the business system executes each data or instruction in the data to be replayed according to the received data to be replayed, and updates the relevant data in the column storage database. When the business system finishes playing back or executing the data to be replayed, all parameters of the business system and all data contained in the column database are recorded as the upgrade execution result.

[0102] S50, comparing the benchmark playback result with the upgrade execution result to obtain a software test result.

[0103] Understandably, a string difference comparison algorithm is used to compare the baseline playback result and the upgraded version execution result, and the difference result between the baseline playback result and the upgraded version execution result is verified. The verification process is as follows: first, the difference result is subjected to blacklist filtering, that is, the content related to the list listed in the blacklist is filtered out of the difference result, and the blacklist is a list of parameters or data that will inevitably change during the software testing process being compared. Second, the difference result after the blacklist filtering is subjected to whitelist filtering, that is, the content related to the list listed in the whitelist is filtered out, and the whitelist is a list of parameters or data involved in the version to be tested, to obtain the filtering result. Finally, the filtering result is checked for nullity, that is, when it is detected that the filtering result is null, it is determined that the software test result is passed, and when it is detected that the filtering result is not null, it is determined that the software test result is failed, so that the software test result can be displayed on a display interface or a visualization interface.

[0104] The string difference comparison algorithm is an algorithm for comparing differences between file names in the same folder or string data in a table in a database.

[0105] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0106] In one embodiment, a software testing device based on traffic playback is provided, and the software testing device based on traffic playback corresponds to the software testing method based on traffic playback in the above embodiment. Figure 7 As shown, the software testing device based on traffic playback includes a receiving module 11, an extraction module 12, a recovery module 13, a playback module 14 and a comparison module 15. The functional modules are described in detail as follows:

[0107] The receiving module 11 is used to receive a playback test request, wherein the playback test request includes a version to be tested and a playback configuration file;

[0108] The extraction module 12 is used to identify and extract the flow replay data to be tested that matches the replay configuration file from the real-time replay system by using the replay peak detection method, and obtain the flow replay start snapshot data and the flow replay end snapshot data associated with the flow replay data to be tested;

[0109] The recovery module 13 is used to back up the business system associated with the version to be tested to obtain a reference system, and restore the traffic playback end snapshot data based on the reference system to obtain a reference playback result;

[0110] The playback module 14 is used to restore the business system based on the traffic playback start snapshot data, decompress and configure the version software corresponding to the version to be tested into the restored business system, and replay the traffic playback data to be tested, and execute to obtain the version upgrade execution result;

[0111] The comparison module 15 is used to compare the benchmark playback result with the upgrade execution result to obtain the software test result.

[0112] For the specific definition of the software testing device based on traffic playback, please refer to the definition of the software testing method based on traffic playback above, which will not be repeated here. Each module in the above-mentioned software testing device based on traffic playback can be implemented in whole or in part through software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0113] In one embodiment, a computer device is provided. The computer device may be a client or a server. The internal structure diagram thereof may be as follows: Figure 8 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium and an internal memory. The readable storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the readable storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a software testing method based on traffic playback is implemented.

[0114] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the software testing method based on traffic playback in the above embodiment is implemented.

[0115] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the software testing method based on traffic playback in the above embodiment is implemented.

[0116] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0117] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0118] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A software testing method based on traffic playback, characterized in that: include: Receive a playback test request, wherein the playback test request includes a version to be tested and a playback configuration file; Using a playback peak detection method, identifying and extracting the flow playback data to be tested that matches the playback configuration file from the real-time playback system, and obtaining flow playback start snapshot data and flow playback end snapshot data associated with the flow playback data to be tested; Backing up the business system associated with the version to be tested to obtain a reference system, and restoring the traffic playback end snapshot data based on the reference system to obtain a reference playback result; Based on the traffic playback start snapshot data, the business system is restored, and the version software corresponding to the version to be tested is decompressed and configured into the restored business system, and the traffic playback data to be tested is replayed, and the upgrade execution result is obtained; Comparing the benchmark playback result with the upgrade execution result to obtain a software test result; The method of using the playback peak detection method to identify and extract the flow playback data to be tested that matches the playback configuration file from the real-time playback system, and to obtain the flow playback start snapshot data and flow playback end snapshot data associated with the flow playback data to be tested, includes: Acquire at least one flow playback data matching the service category in the playback configuration file from the real-time playback system; Perform peak identification and complete identification on each of the traffic playback data to obtain each peak traffic file and the starting snapshot data and the ending snapshot data corresponding to the peak traffic file; Merging and compressing the peak traffic files in different time periods to obtain the traffic playback data to be tested, and identifying the beginning and the end of all the starting snapshot data and the ending snapshot data to obtain the traffic playback starting snapshot data and the traffic playback ending snapshot data; The step of merging and compressing the peak traffic files in time periods to obtain the traffic playback data to be tested, and identifying the beginning and the end of all the start snapshot data and the end snapshot data to obtain the traffic playback start snapshot data and the traffic playback end snapshot data includes: Arranging the peak flow files in time sequence to obtain a time sequence arrangement period; Shifting and merging the flow files of the time sequence arrangement period to obtain a merged period, and compressing the merged period to obtain playback data of the flow to be measured; Sorting the moments of all the starting snapshot data in the measured traffic playback data in ascending order, and recording the starting snapshot data corresponding to the first moment in the sorting sequence as the traffic playback starting snapshot data; The moments of all the end snapshot data in the measured traffic playback data are sorted in descending order, and the end snapshot data corresponding to the first moment in the sorting sequence is recorded as the traffic playback end snapshot data.

2. The software testing method based on traffic playback according to claim 1, characterized in that: Before acquiring at least one flow playback data matching the service category in the playback configuration file from the real-time playback system, the method includes: Capture network traffic in real time through edge nodes; Performing data cleaning based on distributed flow data on the network traffic through the edge node to obtain multiple queued traffic files; Flow all the queued traffic files into the message queue in the edge node; The message queue is subjected to peak shaving and current limiting processing, and the queued flow file sub-table in the message queue after peak shaving and current limiting is added to the flow playback data corresponding to each queued flow file. At the same time, at the time of adding, the system database is snapshot stored to obtain the snapshot data corresponding to the time of adding.

3. The software testing method based on traffic playback as described in claim 2 is characterized in that: The network traffic is cleaned based on distributed flow data by the edge node to obtain multiple queued flow files, including: Performing distributed diversion processing on the network traffic through the edge node, diverting the traffic to multiple distributed nodes, and sending multiple diversion data to the distributed nodes; By means of each of the distributed nodes, deduplication processing is performed on the diverted data corresponding to each of the distributed nodes based on a tree structure to obtain deduplication data; Through each of the distributed nodes, invalid removal of the deduplication data corresponding to each of the distributed nodes is performed to obtain each valid data; By means of each of the distributed nodes, a flow file is generated for the valid data corresponding to each of the distributed nodes to generate a plurality of generated data; All the generated data are summarized in time series through the edge node to obtain multiple queue-entry flow files.

4. The software testing method based on traffic playback as claimed in claim 3, characterized in that: The distributed diversion processing of the network traffic by the edge node to the plurality of distributed nodes and the plurality of diversion data sent to the distributed nodes include: Performing business classification on each message in the network traffic to obtain a business category of each message; According to the Flink mechanism, each of the messages is node-divided to generate the diverted data corresponding to each of the service categories; Distribute each of the diverted data to the distributed nodes corresponding to the business category of each of the diverted data.

5. The software testing method based on traffic playback as claimed in claim 4, characterized in that: The step of performing tree-structure-based deduplication processing on the shunt data corresponding to each distributed node to obtain deduplication data includes: Based on the constructed session parameter prefix tree corresponding to the distributed node, query each of the messages in the diverted data; If a branch node of the session parameter prefix tree having the same prefix as the message in the diverted data is found, the message is recorded as duplicate data; If a branch node of the session parameter prefix tree that is the same as the prefix of the message in the diverted data cannot be found, inserting it into the session parameter prefix tree to obtain a new branch node in the session parameter prefix tree; After all the messages are queried, all the duplicate data are discarded to obtain the deduplicated data corresponding to the diverted data.

6. A software testing device based on traffic playback, characterized in that: include: A receiving module, used to receive a playback test request, wherein the playback test request includes a version to be tested and a playback configuration file; An extraction module is used to identify and extract the flow replay data to be tested that matches the replay configuration file from the real-time replay system by using a replay peak detection method, and to obtain flow replay start snapshot data and flow replay end snapshot data associated with the flow replay data to be tested; A recovery module, used to back up the business system associated with the version to be tested to obtain a reference system, and restore the traffic playback end snapshot data based on the reference system to obtain a reference playback result; A playback module is used to restore the business system based on the traffic playback start snapshot data, decompress and configure the version software corresponding to the version to be tested into the restored business system, and replay the playback data of the traffic to be tested, and execute to obtain the version upgrade execution result; A comparison module, used for comparing the benchmark playback result with the upgrade execution result to obtain a software test result; The method of using the playback peak detection method to identify and extract the flow playback data to be tested that matches the playback configuration file from the real-time playback system, and to obtain the flow playback start snapshot data and flow playback end snapshot data associated with the flow playback data to be tested, includes: Acquire at least one flow playback data matching the service category in the playback configuration file from the real-time playback system; Perform peak identification and complete identification on each of the traffic playback data to obtain each peak traffic file and the starting snapshot data and the ending snapshot data corresponding to the peak traffic file; Merging and compressing the peak traffic files in different time periods to obtain the traffic playback data to be tested, and identifying the beginning and the end of all the starting snapshot data and the ending snapshot data to obtain the traffic playback starting snapshot data and the traffic playback ending snapshot data; The step of merging and compressing the peak traffic files in time periods to obtain the traffic playback data to be tested, and identifying the beginning and the end of all the start snapshot data and the end snapshot data to obtain the traffic playback start snapshot data and the traffic playback end snapshot data includes: Arranging the peak flow files in time sequence to obtain a time sequence arrangement period; Shifting and merging the flow files of the time sequence arrangement period to obtain a merged period, and compressing the merged period to obtain playback data of the flow to be measured; Sorting the moments of all the starting snapshot data in the measured traffic playback data in ascending order, and recording the starting snapshot data corresponding to the first moment in the sorting sequence as the traffic playback starting snapshot data; The moments of all the end snapshot data in the measured traffic playback data are sorted in descending order, and the end snapshot data corresponding to the first moment in the sorting sequence is recorded as the traffic playback end snapshot data.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the software testing method based on traffic playback as described in any one of claims 1 to 5 is implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the software testing method based on traffic playback as described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Data traffic test method and device, electronic equipment and storage medium

    CN112527568A

  • System for generating test scenarios and test conditions and expected results

    US20130185056A1