Reduction method and device of front-end performance test environment, medium and equipment
By obtaining the performance and environment data of the user side, and generating a test environment consistent with the user side, the problem of large differences between the test environment and the real user operating environment in the existing technology is solved, and the rapid and accurate positioning of performance problems is achieved.
Patent Information
- Application Number
- CN202510591259.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-08-22
AI Technical Summary
In the prior art, the test environment for the front-end performance problem of the web is very different from the operating environment of the real user and cannot be accurately reproduced, resulting in difficulty in positioning bottlenecks.
By obtaining the performance data and environment data of the user side, identifying the target performance results with processing speeds lower than the preset speed, downloading the target operating system and browser, generating the basic test running environment from the system image library and software library, and simulating network conditions to achieve a test environment consistent with the user side.
It realizes rapid and accurate restoration of the user's real operating environment, improving the positioning efficiency of performance problems and the resource utilization rate of the test environment.
Smart Images

Figure CN120523697A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of front-end performance testing, and in particular to a method for restoring a front-end performance testing environment, a restoration device, a computer-readable storage medium, and an electronic device. Background Art
[0002] Performance issues in web front-end applications can lead to slow page loading, delayed interactions, and failed page resource loading, impacting the user experience and even causing user churn. Performance optimization has therefore become a crucial topic in web development. When front-end performance issues arise, the primary task is to accurately restore the problem site for in-depth analysis and pinpoint the root cause of the problem or bottleneck. However, pinpointing web front-end performance issues is often complex, especially in the user's actual hardware environment. The root cause may involve multiple factors, such as the browser, operating system, hardware configuration, and network bandwidth.
[0003] Current performance problem location methods mainly rely on manual debugging one by one. Due to differences in users' hardware devices, operating systems, browsers, network bandwidth, etc., existing technologies often find it difficult to fully reproduce all user environments. The test environment is very different from the real user's operating environment, and it is impossible to accurately reproduce the real user environment. Summary of the Invention
[0004] The main purpose of this application is to provide a method, a restoration device, a computer-readable storage medium and an electronic device for restoring a front-end performance test environment, so as to at least solve the problem in the prior art that the test environment is very different from the actual user's operating environment and the actual user's operating environment cannot be accurately reproduced.
[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a method for restoring a front-end performance test environment is provided, comprising: obtaining user-side data, the user-side data including at least performance data and environment data, the performance data representing the resource response speed of the user-side page, and the environment data including a unique identifier of the operating system, a unique identifier of the browser, and the network conditions of the user-side; determining a performance result of the user-side data based on the performance data, the performance result representing the processing speed of the user-side; downloading a target operating system and a target browser from a system image library and a software library based on the unique identifier of the operating system and the unique identifier of the browser corresponding to a target performance result representing that the processing speed of the user-side is lower than a preset processing speed, so as to generate a basic test running environment; based on the basic test running environment, simulating the network conditions corresponding to the user-side data whose performance result is the target performance result, so as to restore a test environment consistent with the operating system, the browser, and the network conditions corresponding to the user-side data whose performance result is the target performance result.
[0006] According to another aspect of the present application, a front-end performance test environment restoration device is provided, comprising: an acquisition unit for acquiring user-side data, the user-side data including at least performance data and environment data, the performance data representing the resource response speed of the user-side page, the environment data including a unique identifier of the operating system, a unique identifier of the browser, and the network conditions of the user-side; a determination unit for determining a performance result of the user-side data based on the performance data, the performance result representing the processing speed of the user-side; a downloading unit for downloading a target operating system and a target browser from a system image library and a software library based on the unique identifier of the operating system and the unique identifier of the browser corresponding to a target performance result representing that the processing speed of the user-side is lower than a preset processing speed, so as to generate a basic test running environment; a simulation unit for simulating, based on the basic test running environment, the network conditions corresponding to the user-side data whose performance result is the target performance result, so as to restore a test environment consistent with the operating system, the browser, and the network conditions corresponding to the user-side data whose performance result is the target performance result.
[0007] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described.
[0008] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include methods for executing any one of the methods described.
[0009] Applying the technical solution of the present application, first, obtain user-side data, the user-side data at least including performance data and environmental data, the performance data characterizing the resource response speed of the user-side page, the environmental data including the unique identifier of the operating system, the unique identifier of the browser and the network conditions of the user-side, then, determine the performance result of the user-side data based on the performance data, and then download the target operating system and target browser from the system image library and software library based on the target performance result that characterizes the processing speed of the user-side lower than the preset processing speed, the unique identifier of the operating system and the unique identifier of the browser to generate a basic test running environment, and finally, based on the basic test running environment, simulate the network conditions corresponding to the user-side data whose performance result is the target performance result, so as to restore the test environment consistent with the operating system, the browser and the network conditions corresponding to the user-side data whose performance result is the target performance result. In the present application, by collecting the performance data and environmental data of the user-side, it is determined whether the processing speed of the user-side is lower than the preset processing speed, thereby identifying the performance result with performance problems as the target performance result. According to the operating system unique identifier and browser unique identifier corresponding to the target performance result, the corresponding version is downloaded from the system image library and software library to generate a basic test operating environment consistent with the user-side environment. In the basic operating environment, by simulating the network conditions corresponding to the user-side, its access environment in the actual scenario is further restored, thereby achieving a fast and accurate restoration of the user's real operating environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The drawings that constitute part of this application are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation on this application. In the drawings:
[0011] Figure 1 A schematic diagram of a process for restoring a front-end performance test environment provided in accordance with an embodiment of the present application is shown;
[0012] Figure 2 Another flow chart of a method for restoring a front-end performance test environment provided in accordance with an embodiment of the present application is shown;
[0013] Figure 3 Another schematic diagram of a method for restoring a front-end performance test environment provided in accordance with an embodiment of the present application is shown;
[0014] Figure 4 shows a schematic diagram of an algorithm provided according to an embodiment of the present application;
[0015] Figure 5The figure shows a structural block diagram of a front-end performance test environment restoration device provided according to an embodiment of the present application.
[0016] The above drawings include the following reference numerals:
[0017] 50. System image library; 52. Software library; 54. Network simulation module; 56. On-site sandbox; 58. Automation script; 60. Performance probe; 62. Browser environment; 64. Simulated network environment; 66. Static files; 68. API request. DETAILED DESCRIPTION
[0018] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0019] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0020] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0021] As introduced in the background technology, the test environment in the existing technology is very different from the operating environment of the real user, and it is impossible to accurately reproduce the real user operating environment. In order to solve the above technical problems, the embodiments of the present application provide a front-end performance test environment restoration method, restoration device, computer-readable storage medium and electronic device.
[0022] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.
[0023] In this embodiment, a method for restoring a front-end performance testing environment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0024] Figure 1 FIG. 1 is a flow chart of a method for restoring a front-end performance test environment according to an embodiment of the present application. Figure 1 As shown, the method includes the following steps:
[0025] Step S201: Acquire user-side data, the user-side data including at least performance data and environment data. The performance data represents the resource response speed of the user-side page, and the environment data includes a unique identifier of the operating system, a unique identifier of the browser, and network conditions of the user-side.
[0026] Step S202, determining a performance result of the user terminal data based on the performance data, where the performance result represents a processing speed of the user terminal;
[0027] Step S203: Based on the target performance result indicating that the processing speed of the user terminal is lower than a preset processing speed, a target operating system and a target browser are downloaded from a system image library and a software library corresponding to the unique identifier of the operating system and the unique identifier of the browser to generate a basic test execution environment;
[0028] Step S204, based on the above-mentioned basic test running environment, simulate the above-mentioned network conditions corresponding to the above-mentioned user-end data whose performance results are the above-mentioned target performance results, so as to restore the test environment consistent with the above-mentioned operating system, the above-mentioned browser and the above-mentioned network conditions corresponding to the above-mentioned user-end data whose performance results are the above-mentioned target performance results.
[0029] Specifically, the above performance data is used to characterize the response speed of various resources in the page, such as page loading time, first screen rendering time, application programming interface response time, etc.; the above system image library is used to store different versions of operating systems, and the above software library is used to store different versions of browsers.
[0030] Through the above embodiment, first, the user-side data is obtained, and the above-mentioned user-side data at least includes performance data and environmental data. The above-mentioned performance data characterizes the resource response speed of the user-side page, and the above-mentioned environmental data includes the unique identifier of the operating system, the unique identifier of the browser and the network conditions of the above-mentioned user-side. Then, the performance result of the above-mentioned user-side data is determined according to the above-mentioned performance data. Then, based on the target performance result that characterizes that the above-mentioned processing speed of the above-mentioned user side is lower than the preset processing speed, the above-mentioned unique identifier of the above-mentioned operating system and the above-mentioned unique identifier of the above-mentioned browser are downloaded from the system image library and the software library to generate a basic test running environment. Finally, based on the above-mentioned basic test running environment, the above-mentioned network conditions corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result are simulated to restore the test environment consistent with the above-mentioned operating system, the above-mentioned browser and the above-mentioned network conditions corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result. In this application, by collecting the performance data and environmental data of the user side, it is determined whether the processing speed of the user side is lower than the preset processing speed, thereby identifying the performance result with performance problems as the target performance result. According to the operating system unique identifier and browser unique identifier corresponding to the target performance result, the corresponding version is downloaded from the system image library and software library to generate a basic test operating environment consistent with the user-side environment. In the basic operating environment, by simulating the network conditions corresponding to the user-side, its access environment in the actual scenario is further restored, thereby achieving a fast and accurate restoration of the user's real operating environment.
[0031] In an optional solution, the above-mentioned user-side data also includes user request data. After simulating the above-mentioned network conditions corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result based on the above-mentioned basic test running environment to restore the test environment consistent with the above-mentioned operating system, the above-mentioned browser and the above-mentioned network conditions corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result, the above-mentioned method also includes: running the target script so that the above-mentioned test environment executes the operation corresponding to the above-mentioned target script to restore the actual access behavior corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result, the above-mentioned target script is a script generated according to the above-mentioned request data whose performance result is the above-mentioned target performance result; collecting the target performance data of the above-mentioned test environment, and comparing the above-mentioned target performance data with the above-mentioned performance data in the above-mentioned user-side data, generating analysis results and outputting a performance report, the above-mentioned target performance data represents the above-mentioned resource response speed of the above-mentioned page in the above-mentioned test environment, and the above-mentioned performance report is a report of the difference between the above-mentioned target performance data and the above-mentioned performance data; after outputting the above-mentioned performance report, terminating the operation of the above-mentioned test environment and releasing the computing resources occupied by the above-mentioned test environment.
[0032] In the above embodiment, after constructing a test environment consistent with the user-side data corresponding to the target performance result, the target script generated by the user-side request data is run, causing the test environment to execute a page access process consistent with the actual operation behavior corresponding to the user-side data, reproducing the operation path corresponding to the user-side data. During the script execution process in the test environment, target performance data generated in the test environment is collected. The target performance data collected in the test environment is compared and analyzed with the user-side performance data corresponding to the target performance result, and a performance report is output to identify performance bottlenecks or problem points. After the report is output, the test environment is automatically terminated and computing resources are released, ensuring that the environment is recyclable and the task is controllable, improving system efficiency and completing a complete test task closed loop. In this way, the page operations and request processes experienced by users during actual use can be accurately restored. During the test process, by comparing the target performance data collected in the test environment with the original user-side performance data and outputting a performance analysis report, it helps to quickly identify performance bottlenecks or anomalies, thereby improving the efficiency of problem location. In addition, after the test is completed, the computing resources occupied by the test environment are automatically released, achieving closed-loop management of the test process and improving system resource utilization and task execution efficiency.
[0033] Specifically, target performance data in the test environment is collected in real time through performance probes or front-end monitoring components.
[0034] In another optional solution, according to the method of claim 1, it is characterized in that determining the performance result of the user-side data based on the performance data includes: dividing the resource types of the user-side data according to the file extension of the performance data, and determining the number of the resource types based on the resource types; determining the average response time of the resource types, and the byte size of the resource types corresponding to the resource types, and determining the resource ratio according to the byte size of the resource types, wherein the resource ratio is the ratio of the byte size of the resource type to the byte size of the user-side data; according to Determine the comprehensive performance evaluation value, where r is the above comprehensive performance evaluation value, n is the number of the above resource types, and p i is the proportion of the above resources, t i is the average response time of the above resource type; compare the above comprehensive performance evaluation value with the multi-level threshold set to obtain the corresponding above performance result.
[0035] In the above embodiment, the file extension of performance data is identified, the resource type of the user-side data is classified, and the resource proportion and average response time are combined for calculation. This not only considers the response time of each resource type, but also introduces its byte size ratio within the total resources as a weighting factor. This forms a performance scoring model that better reflects the actual page loading characteristics, effectively reflecting the dominant impact of time-consuming key resource types on overall performance, and making the scoring results more valuable for reference. By generating a comprehensive performance evaluation value and comparing it with preset multi-level thresholds, an accurate judgment of the user-side performance level is achieved.
[0036] In some other exemplary embodiments, before determining the performance results of the above-mentioned user-end data based on the above-mentioned performance data, the above-mentioned method also includes: performing integrity testing on the above-mentioned performance data obtained to delete the above-mentioned performance data whose detection results of the above-mentioned integrity testing are incomplete to obtain the above-mentioned performance data whose detection results of the above-mentioned integrity testing are complete, and determining the above-mentioned performance data whose detection results of the above-mentioned integrity testing are complete as the performance data to be tested; and unifying the units and formats of the above-mentioned performance data to be tested.
[0037] In the above embodiment, integrity checks are performed on the acquired performance data, and invalid records with missing key fields are deleted to prevent incomplete data from interfering with the performance scoring results. The units and formats of the performance data to be tested are standardized to ensure unit consistency for all response times and resource sizes, avoiding problems such as misjudgment and scoring bias caused by mixed unit usage, thereby improving test accuracy.
[0038] Specifically, the above-mentioned integrity check is used to determine whether the performance data contains necessary fields such as page loading time, resource type, response time, resource size, etc.
[0039] According to some further optional schemes of the present application, the above-mentioned multi-level threshold set includes a first threshold and a second threshold, the above-mentioned first threshold is less than the above-mentioned second threshold, and the above-mentioned comprehensive performance evaluation value is compared with the multi-level threshold set to obtain the corresponding above-mentioned performance result, including: when the above-mentioned comprehensive performance evaluation value is less than or equal to the above-mentioned first threshold, determining the above-mentioned performance result as the first performance result; when the above-mentioned comprehensive performance evaluation value is greater than the above-mentioned first threshold, and the above-mentioned comprehensive performance evaluation value is less than or equal to the above-mentioned second threshold, determining the above-mentioned performance result as the second performance result; when the above-mentioned comprehensive performance evaluation value is greater than the above-mentioned second threshold, determining the above-mentioned performance result as the target performance result; the above-mentioned processing speed of the above-mentioned user terminal represented by the above-mentioned first performance result, the above-mentioned second performance result and the above-mentioned target performance result decreases in sequence.
[0040] In the above embodiment, by setting the first threshold and the second threshold for the above multi-level threshold set, the performance results are divided into three levels, which can clearly distinguish user data with different levels of performance, avoid the problem of fuzzy boundaries, and provide a clear and executable decision-making basis for subsequent decisions.
[0041] Specifically, when the comprehensive performance evaluation value is less than or equal to the first threshold, it means that the overall response of the page is the first performance result, and it can be judged that the user experience is good, and the restoration process is skipped; when the evaluation value is between the first and second thresholds, it means that the page performance is the second performance result, and the system can mark it as an observation object; when the evaluation value exceeds the second threshold, the system automatically determines it as the target performance result, that is, the page response is slow, triggering the subsequent test environment restoration and behavior reproduction process.
[0042] This paper provides a specific usage scenario of a front-end performance test environment restoration method. The method introduces the page interaction performance indicators FCP (First Contenful Paint), CLS (Cumulative LayoutShift), and FID (First Input Delay) as the basis for determining the priority of the restored test environment. A script is embedded in the front-end page to automatically collect interaction indicators. After receiving complete performance data including FCP, CLS, and FID, the data is normalized and the user experience score is calculated according to UxScore = α × FCP_norm + β × CLS_norm + γ × FID_norm. Here, α, β, and γ are weights obtained through experience or training. FCP_norm = actual FCP / 1.8; CLS_norm = actual CLS / 0.1; and FID_norm = actual FID / 100. A higher score indicates a worse user experience. If the user experience score exceeds the set threshold, the user data will be marked as a high-priority test object; if the user experience score is less than the set threshold, you can choose to postpone processing or not perform restoration; in the test task queue, sort by score and give priority to scheduling test tasks for high-scoring users.
[0043] In some other exemplary schemes of the present application, the above-mentioned network conditions include network bandwidth and network delay, and the above-mentioned network delay is the total delay experienced from the above-mentioned user terminal sending request data to the above-mentioned user terminal receiving response data. Simulating the above-mentioned network conditions corresponding to the above-mentioned user terminal data whose performance results are the above-mentioned target performance results includes: determining the above-mentioned network bandwidth of the above-mentioned user terminal as the target network bandwidth, and determining the above-mentioned network delay of the above-mentioned user terminal as the target network delay; configuring the above-mentioned network bandwidth of the network simulation module to be equal to the above-mentioned target network bandwidth, and configuring the above-mentioned network delay to be equal to the above-mentioned target network delay.
[0044] In the above embodiment, by determining the network bandwidth of the user end as the target network bandwidth, determining the network delay of the user end as the target network delay, and configuring the network parameters in the test environment of the network simulation module so that the network bandwidth is equal to the target network bandwidth and the network delay is configured as the target network delay, the bandwidth and delay actually used by the user are restored, and the network bottlenecks in the resource loading and interface response processes can be truly reproduced, making performance problems easier to reproduce and locate. By restoring the network parameters, the user operating environment is further restored.
[0045] Specifically, a token bucket algorithm can be used to set bandwidth limits; a uniform delay consistent with the target round-trip delay can be injected at the virtual network interface; and a fixed packet loss probability can be configured to simulate real network instability.
[0046] In an optional solution, before simulating the network conditions corresponding to the user-end data whose performance result is the target performance result based on the basic test running environment to restore the test environment consistent with the operating system, the browser and the network conditions corresponding to the user-end data whose performance result is the target performance result, the method further includes: determining the usage frequency of each of the above browsers based on the number of times each of the above browsers is used in the user-end data whose performance result is the target performance result, the usage frequency being the proportion of the number of times each of the above browsers is used to the number of times all of the above browsers are used; generating a test task queue according to the usage frequency, the test task queue being a queue arranged from high to low according to the usage frequency; and testing the user-end data whose performance result is the target performance result in sequence according to the order of the usage frequencies in the test task queue.
[0047] In the above embodiment, by constructing a test task queue and arranging the test task queue from high to low according to the frequency of use, browsers with high usage frequency are placed at the front of the test task queue, so that test tasks of browser types with high usage frequency are executed first, and limited test resources are used to test browsers with high usage frequency first, which helps to reasonably allocate resources and improves the user experience.
[0048] Specifically, we first extract browser-related fields from all user-side data with target performance results and standardize them into browser names (such as Chrome, Safari, Firefox, Edge, etc.) using regular expressions or parsing tools. Furthermore, browser usage frequency is periodically refreshed based on real-time user behavior data, and the order of the test task queue is adjusted based on the actual frequency of browser usage by users.
[0049] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the front-end performance test environment restoration method of the present application will be described in detail below in combination with specific embodiments.
[0050] This embodiment relates to a specific method for restoring a terminal performance test environment, such as Figure 2 As shown, the following steps are included:
[0051] Step S1: extract client environment data;
[0052] Step S2: Simulate user environment creation;
[0053] Step S3: Create a virtual machine;
[0054] Step S4: Install browser software;
[0055] Step S5: Configure the network environment;
[0056] Step S6: running the automation script;
[0057] Step S7: collecting performance data;
[0058] Step S8: Report data.
[0059] For example, with respect to the core technical aspects of this patent, the front-end performance test environment restoration technology implementation method is as follows. Figure 3 As shown, it mainly consists of 9 parts: front-end performance monitoring system, performance analysis module, system image library 50, software library 52, network simulation module 54, on-site environment management module, performance probe 60, on-site sandbox 56 and report generation module. The workflow is as follows: Data collection and analysis: The front-end performance monitoring system collects data from the user end, including performance data (page loading time, white screen time, application programming interface time, etc.), environmental data (operating system, browser version, network bandwidth, etc.), page information (front-end application domain name, page routing address, API (Application Programming Interface) data, page resource information, etc.). And pass the data to the performance analysis module. The main function of the performance analysis module is to extract abnormal data and data with poor performance from the performance data; Extract data with poor performance: After receiving the performance data, the performance analysis module extracts the data with poor performance through real-time analysis and sends the data to the on-site environment management module; Algorithm: By regularly analyzing the historical performance data of web applications, the proportion of different types of data is counted, such as Figure 4As shown, static files 66 are one category (including HTML, CSS, JS, etc.), and API requests 68 are another category. The proportions of the two are p0 and p1 respectively, p0+p1=1. If the loading time of static file 66 is t0 and the time taken for API request 68 is t1, then the performance evaluation method is p0*t0+p1*t1=r. For example, if the first content drawing is 0-1.8s, it is the first performance result, 1.8-3s is orange medium, and more than 3s is the third performance data. Comprehensive historical data: The total historical time greater than 3 seconds is: r i >3; the total historical time from 1.8 to 3 seconds is: 1.8≤r i ≤3; the total historical time below 1.8 seconds is: r i <1.8; Performance evaluation criteria are: First performance: Second performance: Third performance: If the system response time exceeds 3 seconds for more than 90% of the time, it is classified as the third performance level and requires on-site restoration and performance analysis. Construction of the on-site sandbox 56: The on-site environment management module primarily manages the creation, update, and deletion of environment-related tasks. The on-site environment management module relies on the system image library 50, the software library 52, and the network simulation module 54. After receiving the results of the performance analysis module, the on-site environment management module selects the appropriate operating system version, browser version, and network bandwidth based on environmental data (such as operating system, browser version, and network bandwidth) to jointly build an operating environment that is close to the user's actual usage environment. This environment is called the on-site sandbox 56. Sandbox environment restoration on-site: The on-site sandbox 56 primarily simulates the user's actual operating environment. Operating systems primarily include all released versions of Windows, macOS, and Android. The browser environment 62 can be Internet Explorer, and bandwidth can be adjusted based on user data. After the on-site sandbox 56 is constructed, a simulated network environment 64 is constructed, and the pages under the corresponding routes of the web application are automatically executed by the automation script 58. After the execution is completed, the on-site environment management module destroys the on-site sandbox 56. Automatically obtain and analyze performance data: The performance probe 60 installed in the online sandbox will automatically collect performance data including page screenshots, waterfall data, page loading time, white screen time, CPU, memory, etc., and send all data to the performance analysis module. After receiving the on-site data, the performance analysis module will perform comparative analysis and processing on the user's actual performance data, and send the analysis results to the report generation module. Output performance report: The main function of the report generation module is to output formatted performance reports in formats such as PPT, Word, or PDF. Problem location and resolution: After developers receive the performance report, they will conduct further problem location and resolution.
[0060] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0061] The embodiment of the present application also provides a front-end performance test environment restoration device. It should be noted that the front-end performance test environment restoration device of the embodiment of the present application can be used to execute the front-end performance test environment method provided by the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation methods, and the details that have been explained will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0062] The following introduces the front-end performance test environment restoration device provided in the embodiment of the present application.
[0063] Figure 5 Schematic diagram of a front-end performance test environment restoration device according to an embodiment of the present application. Figure 5 As shown, the device includes:
[0064] An acquisition unit 10 is configured to acquire user-side data, the user-side data including at least performance data and environment data, the performance data representing the resource response speed of the user-side page, and the environment data including a unique identifier of the operating system, a unique identifier of the browser, and network conditions of the user-side;
[0065] A first determining unit 20 is configured to determine a performance result of the user terminal data based on the performance data, wherein the performance result represents a processing speed of the user terminal;
[0066] The downloading unit 30 is configured to download a target operating system and a target browser from a system image library and a software library based on the target performance result indicating that the processing speed of the user terminal is lower than a preset processing speed and the unique identifier of the operating system and the unique identifier of the browser corresponding to the target performance result, so as to generate a basic test execution environment;
[0067] The simulation unit 40 is used to simulate the above-mentioned network conditions corresponding to the above-mentioned user-end data whose performance results are the above-mentioned target performance results based on the above-mentioned basic test running environment, so as to restore the test environment consistent with the above-mentioned operating system, the above-mentioned browser and the above-mentioned network conditions corresponding to the above-mentioned user-end data whose performance results are the above-mentioned target performance results.
[0068] Through the above embodiment, first, through the acquisition unit, the user-side data is acquired, the user-side data at least includes performance data and environment data, the performance data characterizes the resource response speed of the page of the user-side, the environment data includes the unique identifier of the operating system, the unique identifier of the browser and the network conditions of the user-side, then, through the first determination unit, the performance result of the user-side data is determined according to the performance data, and then, through the download unit, based on the target performance result that characterizes the processing speed of the user-side lower than the preset processing speed, the unique identifier of the operating system and the unique identifier of the browser corresponding to the target operating system and the unique identifier of the browser are downloaded from the system image library and the software library to generate a basic test running environment, and finally, through the simulation unit, based on the basic test running environment, the network conditions corresponding to the user-side data with the performance result being the target performance result are simulated to restore the test environment consistent with the operating system, the browser and the network conditions corresponding to the user-side data with the performance result being the target performance result. In this application, by collecting the performance data and environment data of the user-side, it is determined whether the processing speed of the user-side is lower than the preset processing speed, thereby identifying the performance result with performance problems as the target performance result. According to the operating system unique identifier and browser unique identifier corresponding to the target performance result, the corresponding version is downloaded from the system image library and software library to generate a basic test operating environment consistent with the user-side environment. In the basic operating environment, by simulating the network conditions corresponding to the user-side, its access environment in the actual scenario is further restored, thereby achieving a fast and accurate restoration of the user's real operating environment.
[0069] Specifically, the above performance data is used to characterize the response speed of various resources in the page, such as page load time, first screen rendering time, application programming interface response time, etc.; the above system image library is used to store different versions of operating systems, and the above software library is used to store different versions of browsers;
[0070] In an optional solution, the above-mentioned device also includes: an operation unit, which is used to run the target script so that the above-mentioned test environment executes the operation corresponding to the above-mentioned target script to restore the actual access behavior corresponding to the above-mentioned user-end data whose performance result is the above-mentioned target performance result, and the above-mentioned target script is a script generated according to the above-mentioned request data whose performance result is the above-mentioned target performance result; a collection unit, which is used to collect the target performance data of the above-mentioned test environment, and compare the above-mentioned target performance data with the above-mentioned performance data in the above-mentioned user-end data, generate analysis results and output a performance report, the above-mentioned target performance data represents the above-mentioned resource response speed of the above-mentioned page in the above-mentioned test environment, and the above-mentioned performance report is a report on the difference between the above-mentioned target performance data and the above-mentioned performance data; a termination unit, which is used to terminate the operation of the above-mentioned test environment after outputting the above-mentioned performance report, and release the computing resources occupied by the above-mentioned test environment.
[0071] In the above embodiment, after constructing a test environment consistent with the user-side data corresponding to the target performance result, the target script generated by the user-side request data is run, causing the test environment to execute a page access process consistent with the actual operation behavior corresponding to the user-side data, reproducing the operation path corresponding to the user-side data. During the script execution process in the test environment, target performance data generated in the test environment is collected. The target performance data collected in the test environment is compared and analyzed with the user-side performance data corresponding to the target performance result, and a performance report is output to identify performance bottlenecks or problem points. After the report is output, the test environment is automatically terminated and computing resources are released, ensuring that the environment is recyclable and the task is controllable, improving system efficiency and completing a complete test task closed loop. In this way, the page operations and request processes experienced by users during actual use can be accurately restored. During the test process, by comparing the target performance data collected in the test environment with the original user-side performance data and outputting a performance analysis report, it helps to quickly identify performance bottlenecks or anomalies, thereby improving the efficiency of problem location. In addition, after the test is completed, the computing resources occupied by the test environment are automatically released, achieving closed-loop management of the test process and improving system resource utilization and task execution efficiency.
[0072] Specifically, target performance data in the test environment is collected in real time through performance probes or front-end monitoring components.
[0073] In another optional solution, the first determining unit includes: a division module for dividing the resource types of the user-side data according to the file extension of the performance data, and determining the number of the resource types based on the resource types; a first determining module for determining the average response time of the resource types, and the byte size of the resource types corresponding to the resource types, and determining the resource ratio according to the byte size of the resource types, wherein the resource ratio is the ratio of the byte size of the resource type to the byte size of the user-side data; a second determining module for determining the resource type according to the byte size of the resource type; Determine the comprehensive performance evaluation value, where r is the above comprehensive performance evaluation value, n is the number of the above resource types, and p i is the proportion of the above resources, t i is the average response time of the above resource type; a comparison module is used to compare the above comprehensive performance evaluation value with the multi-level threshold set to obtain the corresponding above performance result.
[0074] In the above embodiment, the file extension of performance data is identified, the resource type of the user-side data is classified, and the resource proportion and average response time are combined for calculation. This not only considers the response time of each resource type, but also introduces its byte size ratio within the total resources as a weighting factor. This forms a performance scoring model that better reflects the actual page loading characteristics, effectively reflecting the dominant impact of time-consuming key resource types on overall performance, and making the scoring results more valuable for reference. By generating a comprehensive performance evaluation value and comparing it with preset multi-level thresholds, an accurate judgment of the user-side performance level is achieved.
[0075] In some other exemplary embodiments, the above-mentioned device also includes: a detection unit, which is used to perform integrity detection on the above-mentioned performance data obtained, so as to delete the above-mentioned performance data whose detection results of the above-mentioned integrity detection are incomplete, so as to obtain the above-mentioned performance data whose detection results of the above-mentioned integrity detection are complete, and determine the above-mentioned performance data whose detection results of the above-mentioned integrity detection are complete as the performance data to be tested; and a unification unit, which is used to unify the units and formats of the above-mentioned performance data to be tested.
[0076] In the above embodiment, integrity checks are performed on the acquired performance data, and invalid records with missing key fields are deleted to prevent incomplete data from interfering with the performance scoring results. The units and formats of the performance data to be tested are standardized to ensure unit consistency for all response times and resource sizes, avoiding problems such as misjudgment and scoring bias caused by mixed unit usage, thereby improving test accuracy.
[0077] Specifically, the above-mentioned integrity check is used to determine whether the performance data contains necessary fields such as page loading time, resource type, response time, resource size, etc.
[0078] According to some further optional schemes of the present application, the above-mentioned comparison module includes: a first determination submodule, used to determine that the above-mentioned performance result is a first performance result when the above-mentioned comprehensive performance evaluation value is less than or equal to the above-mentioned first threshold; a second determination submodule, used to determine that the above-mentioned performance result is a second performance result when the above-mentioned comprehensive performance evaluation value is greater than the above-mentioned first threshold and the above-mentioned comprehensive performance evaluation value is less than or equal to the above-mentioned second threshold; a third determination submodule, used to determine that the above-mentioned performance result is a target performance result when the above-mentioned comprehensive performance evaluation value is greater than the above-mentioned second threshold; the above-mentioned processing speed of the above-mentioned user terminal represented by the above-mentioned first performance result, the above-mentioned second performance result and the above-mentioned target performance result decreases in sequence.
[0079] In the above embodiment, by setting the first threshold and the second threshold for the above multi-level threshold set, the performance results are divided into three levels, which can clearly distinguish user data with different levels of performance, avoid the problem of fuzzy boundaries, and provide a clear and executable decision-making basis for subsequent decisions.
[0080] Specifically, when the comprehensive performance evaluation value is less than or equal to the first threshold, it means that the overall response of the page is the first performance result, and it can be judged that the user experience is good, and the restoration process is skipped; when the evaluation value is between the first and second thresholds, it means that the page performance is the second performance result, and the system can mark it as an observation object or selectively restore it; when the evaluation value exceeds the second threshold, the system automatically determines it as the target performance result, that is, the page response is slow, triggering the subsequent test environment restoration and behavior reproduction process.
[0081] In some other exemplary schemes of the present application, the above-mentioned simulation unit includes: a third determination module, used to determine the above-mentioned network bandwidth of the above-mentioned user terminal as the target network bandwidth, and determine the above-mentioned network delay of the above-mentioned user terminal as the target network delay; a configuration module, used to configure the above-mentioned network bandwidth of the network simulation module to be equal to the above-mentioned target network bandwidth, and configure the above-mentioned network delay to be equal to the above-mentioned target network delay.
[0082] In the above embodiment, by determining the network bandwidth of the user end as the target network bandwidth, determining the network delay of the user end as the target network delay, and configuring the network parameters in the test environment of the network simulation module so that the network bandwidth is equal to the target network bandwidth and the network delay is configured as the target network delay, the bandwidth and delay actually used by the user are restored, and the network bottlenecks in the resource loading and interface response processes can be truly reproduced, making performance problems easier to reproduce and locate. By restoring the network parameters, the user operating environment is further restored.
[0083] Specifically, a token bucket algorithm can be used to set bandwidth limits; a uniform delay consistent with the target round-trip delay can be injected at the virtual network interface; and a fixed packet loss probability can be configured to simulate real network instability.
[0084] In an optional solution, the above-mentioned device also includes: a second determination unit, used to determine the usage frequency of each of the above-mentioned browsers based on the number of times each of the above-mentioned browsers is used in the above-mentioned user-side data whose performance result is the above-mentioned target performance result, and the above-mentioned usage frequency is the ratio of the above-mentioned number of times each of the above-mentioned browsers is used to the above-mentioned number of times of use of all the above-mentioned browsers; a generation unit, used to generate a test task queue according to the above-mentioned usage frequency, and the above-mentioned test task queue is a queue arranged from high to low according to the above-mentioned usage frequency; a testing unit, used to test the above-mentioned user-side data whose performance result is the above-mentioned target performance result in sequence according to the order of the above-mentioned usage frequencies in the above-mentioned test task queue.
[0085] In the above embodiment, by constructing a test task queue and arranging the test task queue from high to low according to the frequency of use, browsers with high usage frequency are placed at the front of the test task queue, so that test tasks of browser types with high usage frequency are executed first, and limited test resources are used to test browsers with high usage frequency first, which helps to reasonably allocate resources and improves the user experience.
[0086] Specifically, we first extract browser-related fields from all user-side data with target performance results and standardize them into browser names (such as Chrome, Safari, Firefox, Edge, etc.) using regular expressions or parsing tools. Furthermore, browser usage frequency is periodically refreshed based on real-time user behavior data, and the order of the test task queue is adjusted based on the actual frequency of browser usage by users.
[0087] The front-end performance test environment restoration device includes a processor and memory. The acquisition unit, first determination unit, download unit, and simulation unit are all stored as program units in the memory. The processor executes the program units stored in the memory to implement the corresponding functions. The modules are all located in the same processor; alternatively, the modules can be located in different processors in any combination.
[0088] The processor includes a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and adjusting kernel parameters can at least address the existing issue of the test environment differing significantly from the actual user operating environment, making it difficult to accurately replicate the actual user operating environment.
[0089] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0090] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the method for restoring the front-end performance test environment.
[0091] Specifically, the restoration method of the front-end performance test environment includes:
[0092] Step S201: Acquire user-side data, the user-side data including at least performance data and environment data. The performance data represents the resource response speed of the user-side page, and the environment data includes a unique identifier of the operating system, a unique identifier of the browser, and network conditions of the user-side.
[0093] Step S202, determining a performance result of the user terminal data based on the performance data, where the performance result represents a processing speed of the user terminal;
[0094] Step S203: Based on the target performance result indicating that the processing speed of the user terminal is lower than a preset processing speed, a target operating system and a target browser are downloaded from a system image library and a software library corresponding to the unique identifier of the operating system and the unique identifier of the browser to generate a basic test execution environment;
[0095] Step S204, based on the above-mentioned basic test running environment, simulate the above-mentioned network conditions corresponding to the above-mentioned user-end data whose performance results are the above-mentioned target performance results, so as to restore the test environment consistent with the above-mentioned operating system, the above-mentioned browser and the above-mentioned network conditions corresponding to the above-mentioned user-end data whose performance results are the above-mentioned target performance results.
[0096] Specifically, the above performance data is used to characterize the response speed of various resources in the page, such as page loading time, first screen rendering time, application programming interface response time, etc.; the above system image library is used to store different versions of operating systems, and the above software library is used to store different versions of browsers.
[0097] In one embodiment of the present application, the above-mentioned user-side data also includes user request data. After simulating the above-mentioned network conditions corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result based on the above-mentioned basic test running environment to restore the test environment consistent with the above-mentioned operating system, the above-mentioned browser and the above-mentioned network conditions corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result, the above-mentioned method also includes: running a target script so that the above-mentioned test environment executes the operation corresponding to the above-mentioned target script to restore the actual access behavior corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result, the above-mentioned target script is a script generated according to the above-mentioned request data whose performance result is the above-mentioned target performance result; collecting the target performance data of the above-mentioned test environment, and comparing the above-mentioned target performance data with the above-mentioned performance data in the above-mentioned user-side data, generating analysis results and outputting a performance report, the above-mentioned target performance data representing the above-mentioned resource response speed of the above-mentioned page in the above-mentioned test environment, and the above-mentioned performance report being a report of the difference between the above-mentioned target performance data and the above-mentioned performance data; after outputting the above-mentioned performance report, terminating the operation of the above-mentioned test environment and releasing the computing resources occupied by the above-mentioned test environment.
[0098] In one embodiment of the present application, determining the performance result of the user-side data based on the performance data includes: dividing the resource types of the user-side data according to the file extension of the performance data, and determining the number of the resource types based on the resource types; determining the average response time of the resource types, and the byte size of the resource types corresponding to the resource types, and determining the resource ratio according to the byte size of the resource types, wherein the resource ratio is the ratio of the byte size of the resource type to the byte size of the user-side data; and determining the resource ratio according to the byte size of the resource types. Determine the comprehensive performance evaluation value, where r is the above comprehensive performance evaluation value, n is the number of the above resource types, and p i is the proportion of the above resources, t i is the average response time of the above resource type; compare the above comprehensive performance evaluation value with the multi-level threshold set to obtain the corresponding above performance result.
[0099] In one embodiment of the present application, before determining the performance results of the above-mentioned user-end data based on the above-mentioned performance data, the above-mentioned method also includes: performing integrity testing on the above-mentioned performance data obtained to delete the above-mentioned performance data whose detection results of the above-mentioned integrity testing are incomplete, so as to obtain the above-mentioned performance data whose detection results of the above-mentioned integrity testing are complete, and determining the above-mentioned performance data whose detection results of the above-mentioned integrity testing are complete as the performance data to be tested; and unifying the units and formats of the above-mentioned performance data to be tested.
[0100] In one embodiment of the present application, the multi-level threshold set includes a first threshold and a second threshold, the first threshold is less than the second threshold, and the comprehensive performance evaluation value is compared with the multi-level threshold set to obtain the corresponding performance result, including: when the comprehensive performance evaluation value is less than or equal to the first threshold, determining the performance result as the first performance result; when the comprehensive performance evaluation value is greater than the first threshold and the comprehensive performance evaluation value is less than or equal to the second threshold, determining the performance result as the second performance result; when the comprehensive performance evaluation value is greater than the second threshold, determining the performance result as the target performance result; the processing speed of the user terminal represented by the first performance result, the second performance result and the target performance result decreases in sequence.
[0101] In one embodiment of the present application, the above-mentioned network conditions include network bandwidth and network delay, and the above-mentioned network delay is the total delay experienced from the time the above-mentioned user terminal sends the request data to the time the above-mentioned user terminal receives the response data. Simulating the above-mentioned network conditions corresponding to the above-mentioned user terminal data whose performance result is the above-mentioned target performance result includes: determining the above-mentioned network bandwidth of the above-mentioned user terminal as the target network bandwidth, and determining the above-mentioned network delay of the above-mentioned user terminal as the target network delay; configuring the above-mentioned network bandwidth of the network simulation module to be equal to the above-mentioned target network bandwidth, and configuring the above-mentioned network delay to be equal to the above-mentioned target network delay.
[0102] In one embodiment of the present application, before simulating the network conditions corresponding to the user-end data whose performance result is the target performance result based on the basic test running environment to restore the test environment consistent with the operating system, the browser and the network conditions corresponding to the user-end data whose performance result is the target performance result, the method further includes: determining the usage frequency of each of the above-mentioned browsers based on the number of times each of the above-mentioned browsers in the above-mentioned user-end data whose performance result is the target performance result, the above-mentioned usage frequency being the ratio of the above-mentioned number of times each of the above-mentioned browsers is used to the above-mentioned number of times all of the above-mentioned browsers are used; generating a test task queue according to the above-mentioned usage frequency, the above-mentioned test task queue being a queue arranged from high to low according to the above-mentioned usage frequency; and testing the above-mentioned user-end data whose performance result is the target performance result in sequence according to the order of the above-mentioned usage frequencies in the above-mentioned test task queue.
[0103] An embodiment of the present invention provides a device, comprising a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, at least the following steps are performed:
[0104] Step S201: Acquire user-side data, the user-side data including at least performance data and environment data. The performance data represents the resource response speed of the user-side page, and the environment data includes a unique identifier of the operating system, a unique identifier of the browser, and network conditions of the user-side.
[0105] Step S202, determining a performance result of the user terminal data based on the performance data, where the performance result represents a processing speed of the user terminal;
[0106] Step S203: Based on the target performance result indicating that the processing speed of the user terminal is lower than a preset processing speed, a target operating system and a target browser are downloaded from a system image library and a software library corresponding to the unique identifier of the operating system and the unique identifier of the browser to generate a basic test execution environment;
[0107] Step S204, based on the above-mentioned basic test running environment, simulate the above-mentioned network conditions corresponding to the above-mentioned user-end data whose performance results are the above-mentioned target performance results, so as to restore the test environment consistent with the above-mentioned operating system, the above-mentioned browser and the above-mentioned network conditions corresponding to the above-mentioned user-end data whose performance results are the above-mentioned target performance results.
[0108] Specifically, the above performance data is used to characterize the response speed of various resources in the page, such as page loading time, first screen rendering time, application programming interface response time, etc.; the above system image library is used to store different versions of operating systems, and the above software library is used to store different versions of browsers.
[0109] In one embodiment of the present application, the above-mentioned user-side data also includes user request data. After simulating the above-mentioned network conditions corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result based on the above-mentioned basic test running environment to restore the test environment consistent with the above-mentioned operating system, the above-mentioned browser and the above-mentioned network conditions corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result, the above-mentioned method also includes: running a target script so that the above-mentioned test environment executes the operation corresponding to the above-mentioned target script to restore the actual access behavior corresponding to the above-mentioned user-side data whose performance result is the above-mentioned target performance result, the above-mentioned target script is a script generated according to the above-mentioned request data whose performance result is the above-mentioned target performance result; collecting the target performance data of the above-mentioned test environment, and comparing the above-mentioned target performance data with the above-mentioned performance data in the above-mentioned user-side data, generating analysis results and outputting a performance report, the above-mentioned target performance data representing the above-mentioned resource response speed of the above-mentioned page in the above-mentioned test environment, and the above-mentioned performance report being a report of the difference between the above-mentioned target performance data and the above-mentioned performance data; after outputting the above-mentioned performance report, terminating the operation of the above-mentioned test environment and releasing the computing resources occupied by the above-mentioned test environment.
[0110] In one embodiment of the present application, determining the performance result of the user-side data based on the performance data includes: dividing the resource types of the user-side data according to the file extension of the performance data, and determining the number of the resource types based on the resource types; determining the average response time of the resource types, and the byte size of the resource types corresponding to the resource types, and determining the resource ratio according to the byte size of the resource types, wherein the resource ratio is the ratio of the byte size of the resource type to the byte size of the user-side data; and determining the resource ratio according to the byte size of the resource types. Determine the comprehensive performance evaluation value, where r is the above comprehensive performance evaluation value, n is the number of the above resource types, and p i is the proportion of the above resources, t i is the average response time of the above resource type; compare the above comprehensive performance evaluation value with the multi-level threshold set to obtain the corresponding above performance result.
[0111] In one embodiment of the present application, before determining the performance results of the above-mentioned user-end data based on the above-mentioned performance data, the above-mentioned method also includes: performing integrity testing on the above-mentioned performance data obtained to delete the above-mentioned performance data whose detection results of the above-mentioned integrity testing are incomplete, so as to obtain the above-mentioned performance data whose detection results of the above-mentioned integrity testing are complete, and determining the above-mentioned performance data whose detection results of the above-mentioned integrity testing are complete as the performance data to be tested; and unifying the units and formats of the above-mentioned performance data to be tested.
[0112] In one embodiment of the present application, the multi-level threshold set includes a first threshold and a second threshold, the first threshold is less than the second threshold, and the comprehensive performance evaluation value is compared with the multi-level threshold set to obtain the corresponding performance result, including: when the comprehensive performance evaluation value is less than or equal to the first threshold, determining the performance result as the first performance result; when the comprehensive performance evaluation value is greater than the first threshold and the comprehensive performance evaluation value is less than or equal to the second threshold, determining the performance result as the second performance result; when the comprehensive performance evaluation value is greater than the second threshold, determining the performance result as the target performance result; the processing speed of the user terminal represented by the first performance result, the second performance result and the target performance result decreases in sequence.
[0113] In one embodiment of the present application, the above-mentioned network conditions include network bandwidth and network delay, and the above-mentioned network delay is the total delay experienced from the time the above-mentioned user terminal sends the request data to the time the above-mentioned user terminal receives the response data. Simulating the above-mentioned network conditions corresponding to the above-mentioned user terminal data whose performance result is the above-mentioned target performance result includes: determining the above-mentioned network bandwidth of the above-mentioned user terminal as the target network bandwidth, and determining the above-mentioned network delay of the above-mentioned user terminal as the target network delay; configuring the above-mentioned network bandwidth of the network simulation module to be equal to the above-mentioned target network bandwidth, and configuring the above-mentioned network delay to be equal to the above-mentioned target network delay.
[0114] In one embodiment of the present application, before simulating the network conditions corresponding to the user-end data whose performance result is the target performance result based on the basic test running environment to restore the test environment consistent with the operating system, the browser and the network conditions corresponding to the user-end data whose performance result is the target performance result, the method further includes: determining the usage frequency of each of the above-mentioned browsers based on the number of times each of the above-mentioned browsers in the above-mentioned user-end data whose performance result is the target performance result, the above-mentioned usage frequency being the ratio of the above-mentioned number of times each of the above-mentioned browsers is used to the above-mentioned number of times all of the above-mentioned browsers are used; generating a test task queue according to the above-mentioned usage frequency, the above-mentioned test task queue being a queue arranged from high to low according to the above-mentioned usage frequency; and testing the above-mentioned user-end data whose performance result is the target performance result in sequence according to the order of the above-mentioned usage frequencies in the above-mentioned test task queue.
[0115] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0116] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, can be centralized on a single computing device, or can be distributed across a network of multiple computing devices. They can be implemented using program code executable by the computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described herein can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0117] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0118] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0119] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0120] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0121] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0122] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0123] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0124] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0125] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A method for restoring a front-end performance test environment, characterized in that: include: Acquire user-side data, the user-side data including at least performance data and environment data, the performance data representing a resource response speed of a page on the user-side, the environment data including a unique identifier of an operating system, a unique identifier of a browser, and network conditions of the user-side; Determining a performance result of the user terminal data based on the performance data, wherein the performance result represents a processing speed of the user terminal; Based on the target performance result indicating that the processing speed of the user terminal is lower than a preset processing speed, the target operating system and the target browser are downloaded from a system image library and a software library corresponding to the unique identifier of the operating system and the unique identifier of the browser to generate a basic test execution environment; Based on the basic test running environment, the network conditions corresponding to the user-side data whose performance result is the target performance result are simulated to restore the test environment consistent with the operating system, the browser and the network conditions corresponding to the user-side data whose performance result is the target performance result.
2. The method according to claim 1, characterized in that The user-side data also includes user request data. After simulating the network conditions corresponding to the user-side data whose performance result is the target performance result based on the basic test running environment to restore the test environment consistent with the operating system, the browser, and the network conditions corresponding to the user-side data whose performance result is the target performance result, the method further includes: Running a target script, so that the test environment executes operations corresponding to the target script to restore the actual access behavior corresponding to the user-side data whose performance result is the target performance result, wherein the target script is a script generated based on the request data whose performance result is the target performance result; collecting target performance data of the test environment, comparing the target performance data with the performance data in the user-side data, generating analysis results, and outputting a performance report, wherein the target performance data represents the resource response speed of the page in the test environment, and the performance report is a report of the difference between the target performance data and the performance data; After outputting the performance report, the test environment is terminated and the computing resources occupied by the test environment are released.
3. The method according to claim 1, characterized in that Determining a performance result of the user-end data according to the performance data includes: Classifying the resource types of the user-side data according to the file extensions of the performance data, and determining the number of the resource types based on the resource types; Determine an average response time of the resource type and a byte size of the resource type corresponding to the resource type, and determine a resource ratio according to the byte size of the resource type, where the resource ratio is a ratio of the byte size of the resource type to the byte size of the user-end data; according to Determine the comprehensive performance evaluation value, where r is the comprehensive performance evaluation value, n is the number of resource types, and p i is the resource ratio, t i is the average response time of the resource type; Compare the comprehensive performance evaluation value with a multi-level threshold set to obtain the corresponding performance result.
4. The method according to claim 1, wherein Before determining the performance result of the user-end data based on the performance data, the method further includes: Performing an integrity test on the acquired performance data to delete the performance data for which the integrity test result is incomplete, so as to obtain the performance data for which the integrity test result is complete, and determining the performance data for which the integrity test result is complete as the performance data to be tested; The units and formats of the performance data to be tested are unified.
5. The method according to claim 3, characterized in that The multi-level threshold set includes a first threshold and a second threshold, the first threshold is smaller than the second threshold, and the comprehensive performance evaluation value is compared with the multi-level threshold set to obtain the corresponding performance result, including: If the comprehensive performance evaluation value is less than or equal to the first threshold, determining the performance result as a first performance result; When the comprehensive performance evaluation value is greater than the first threshold and the comprehensive performance evaluation value is less than or equal to the second threshold, determining the performance result as the second performance result; If the comprehensive performance evaluation value is greater than the second threshold, determining the performance result as a target performance result; The processing speed of the user terminal represented by the first performance result, the second performance result, and the target performance result decreases in sequence.
6. The method according to claim 1, characterized in that The network conditions include network bandwidth and network delay, where the network delay is the total delay from the time the user terminal sends request data to the time the user terminal receives response data. Simulating the network conditions corresponding to the user terminal data whose performance result is the target performance result includes: Determine the network bandwidth of the user terminal as a target network bandwidth, and determine the network delay of the user terminal as a target network delay; The network bandwidth of the network simulation module is configured to be equal to the target network bandwidth, and the network delay is configured to be equal to the target network delay.
7. The method according to claim 1, characterized in that Before simulating, based on the basic test running environment, the network conditions corresponding to the user-side data whose performance result is the target performance result, to restore a test environment consistent with the operating system, the browser, and the network conditions corresponding to the user-side data whose performance result is the target performance result, the method further includes: Determining a usage frequency of each browser based on the usage count of each browser in the user-side data whose performance result is the target performance result, where the usage frequency is a ratio of the usage count of each browser to the usage count of all browsers; Generate a test task queue according to the usage frequency, wherein the test task queue is a queue arranged from high to low according to the usage frequency; The user-side data whose performance results are the target performance results are tested in sequence according to the order of the usage frequencies in the test task queue.
8. A front-end performance test environment restoration device, characterized in that: include: an acquisition unit, configured to acquire user-side data, the user-side data including at least performance data and environment data, the performance data representing a resource response speed of a page on the user-side, the environment data including a unique identifier of an operating system, a unique identifier of a browser, and network conditions of the user-side; a determining unit, configured to determine a performance result of the user terminal data based on the performance data, wherein the performance result represents a processing speed of the user terminal; a downloading unit, configured to download a target operating system and a target browser from a system image library and a software library based on the unique identifier of the operating system and the unique identifier of the browser corresponding to the target performance result indicating that the processing speed of the user terminal is lower than a preset processing speed, so as to generate a basic test running environment; A simulation unit is used to simulate the network conditions corresponding to the user-side data whose performance result is the target performance result based on the basic test running environment, so as to restore the test environment consistent with the operating system, the browser and the network conditions corresponding to the user-side data whose performance result is the target performance result.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for executing the method of any one of claims 1 to 7.