CN114238048B - Automatic testing method and system for Web front-end performance - Google Patents
Automatic testing method and system for Web front-end performance Download PDFInfo
- Publication number
- CN114238048B CN114238048B CN202111410813.4A CN202111410813A CN114238048B CN 114238048 B CN114238048 B CN 114238048B CN 202111410813 A CN202111410813 A CN 202111410813A CN 114238048 B CN114238048 B CN 114238048B
- Authority
- CN
- China
- Prior art keywords
- page
- test
- scene
- data
- time
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 176
- 238000000034 method Methods 0.000 claims abstract description 66
- VYZAMTAEIAYCRO-UHFFFAOYSA-N Chromium Chemical compound [Cr] VYZAMTAEIAYCRO-UHFFFAOYSA-N 0.000 claims abstract description 21
- 238000004891 communication Methods 0.000 claims abstract description 21
- 238000009877 rendering Methods 0.000 claims description 27
- 238000012544 monitoring process Methods 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 10
- BUGBHKTXTAQXES-UHFFFAOYSA-N Selenium Chemical compound [Se] BUGBHKTXTAQXES-UHFFFAOYSA-N 0.000 claims description 8
- 229910052711 selenium Inorganic materials 0.000 claims description 8
- 239000011669 selenium Substances 0.000 claims description 8
- 238000012545 processing Methods 0.000 claims description 7
- 238000004458 analytical method Methods 0.000 claims description 3
- 238000004364 calculation method Methods 0.000 abstract description 7
- 238000011056 performance test Methods 0.000 description 7
- 238000004088 simulation Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 235000019800 disodium phosphate Nutrition 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 239000003973 paint Substances 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 238000004064 recycling Methods 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3409—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
- G06F11/3414—Workload generation, e.g. scripts, playback
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3409—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
- G06F11/3419—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment by assessing time
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3466—Performance evaluation by tracing or monitoring
- G06F11/3476—Data logging
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention provides a method and a system for automatically testing the performance of a Web front end, wherein the method comprises the following steps: acquiring and analyzing test data; after the communication session link to be tested is established, testing the Web end through a test instruction generated by the test data; respectively accessing a URL scene and a menu scene according to a tested page path, and receiving access performance data of the URL scene and access performance data of the menu scene; and writing the access performance data of the URL scene and the access performance data of the menu scene into a test report by a rewriting method, and automatically sending the test report to related personnel after the test is finished. In the testing process, the Chrome console is operated to monitor various testing data, so that the error rate of manual acquisition and calculation is reduced, and the workload is reduced.
Description
Technical Field
The invention relates to the technical field of data processing, in particular to a method and a system for automatically testing the performance of a Web front end.
Background
In the front-end performance test of the existing application, a tester needs to collect performance indexes such as white screen time, first screen time, rendering time, heap memory consumption and recovery of each page. In the implementation project or the main line product, the performance test of the main line product depends on that testers manually request each page, collect various performance index data, manually record each item of data by using Excel, and finally process and generate a performance test report so as to determine whether the performance of the front-end page meets the requirements. However, the prior art has the following disadvantages:
1. when the product version is released frequently, the method is limited by limited testing resources, and the testing is performed purely by hand, so that the method cannot cover all product versions and all contents. In addition, the page configurations and page-related service functions of different projects are different, and if the page performance of a project is judged only according to the product performance of a certain version inherited by the project, the page performance is obviously unreliable. Therefore, some projects need to do performance tests of the changed pages separately.
2. In the testing process, for the front-end test of the menu access mode, event logs need to be recorded manually through a developer tool in a browser, and event node time corresponding to each index needs to be screened and counted manually to obtain performance data, so that the manual operation steps are complicated.
3. For a menu access mode, time of various front-end events cannot be acquired through a Chrome interface, time consumption of white screen, first screen, rendering and the like cannot be directly calculated, manual recording is needed, various events are screened from recording results, test time consumption is longer, and efficiency is lower.
4. When the heap memory is collected, the initial value, the peak value and the stable value of the memory also need to be observed by naked eyes, so that the error is large, and the error is easy to occur when the numerical value is obtained.
5. When the number of pages for manually recording the test result is large, there may be input error data, which affects the correctness of the test result.
6. The front-end performance test has two modes of direct access through a URL (uniform resource locator) and click access through a system menu, because the two modes need to be respectively tested to collect and calculate time indexes such as front-end rendering and the like so as to ensure the comprehensiveness of data and scenes, more data needs to be recorded manually, and the time consumption is longer.
Disclosure of Invention
In order to solve the above prior art problems, the present invention provides a method and a system for automatically testing the performance of a Web front end, so as to realize the automatic testing of the performance of the Web application front end.
The first aspect of the present invention provides a method for automatically testing the performance of a Web front end, including:
acquiring and analyzing test data;
after the communication session link to be tested is established, testing the Web end through a test instruction generated by the test data;
respectively accessing a URL scene and a menu scene according to a tested page path, and receiving access performance data of the URL scene and the menu scene;
and writing the access performance data of the URL scene and the access performance data of the menu scene into a test report by a rewriting method, and automatically sending the test report to related personnel after the test is finished.
Further, the respectively accessing the URL scene and the menu scene includes: accessing a URL scene, specifically:
after the page is stable and the resource loading is finished, acquiring a currently used js heap memory from a developer console, and monitoring the js heap memory in real time;
and re-requesting the page by the automatic test framework until the request and the resource loading are finished, stopping real-time monitoring, and storing the js heap memory peak value identified by the real-time monitoring and the memory value after the page is stabilized.
Further, the accessing the URL scene and the menu scene respectively includes: accessing a menu scene, specifically:
accessing a default page and recording a heap memory when the page is stable, after clearing a cache, accessing a tested page and starting to record a page loading event log;
acquiring real-time data of a js heap memory, stopping recording a page loading event log after the detected page is stable, and storing the page loading event log to the local; wherein the page load event log comprises: page access time and page rendering time;
and calculating an access time difference and a rendering time difference according to the page access time and the page rendering time.
Further, after the obtaining and analyzing the test data, the method includes:
establishing a test communication session link; specifically, the method comprises the following steps:
calling Webdriver through the Selenium, driving a Chrome browser by using the Webdriver, and starting the Web application to be tested to establish a test communication session link.
The second aspect of the present invention provides an automated testing system for Web front-end performance, comprising:
the data processing module is used for acquiring and analyzing the test data;
the testing module is used for testing the Web end through a testing instruction generated by the testing data after the communication session link to be tested is established;
the scene access module is used for respectively accessing the URL scene and the menu scene according to the tested page path and receiving the access performance data of the URL scene and the access performance data of the menu scene;
and the test report generating module is used for writing the access performance data of the URL scene and the access performance data of the menu scene into a test report through a rewriting method, and automatically sending the test report to related personnel after the test is finished.
Further, the scene access module is further configured to:
after the page is stable and the resource loading is finished, acquiring a currently used js heap memory from a developer console, and monitoring the js heap memory in real time;
and re-requesting the page by the automatic test framework until the request and the resource loading are finished, stopping real-time monitoring, and storing the js heap memory peak value identified by the real-time monitoring and the memory value after the page is stabilized.
Further, the scene access module is further configured to:
accessing a default page and recording a heap memory when the page is stable, after clearing cache, accessing a tested page and starting to record a page loading event log;
acquiring real-time data of a js heap memory, stopping recording a page loading event log after the detected page is stable, and storing the page loading event log to the local; wherein the page load event log comprises: page access time and page rendering time;
and calculating an access time difference and a rendering time difference according to the page access time and the page rendering time.
Further, the data processing module is further configured to:
establishing a test communication session link; specifically, the method comprises the following steps:
calling the Webdriver through the Selenium, driving the Chrome browser by using the Webdriver, and starting the Web application to be tested so as to establish a test communication session link.
A third aspect of the present invention provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the method for automatically testing the performance of the Web front end according to any one of the first aspects.
A fourth aspect of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, a device in which the computer-readable storage medium is located is controlled to execute the method for automatically testing the performance of the Web front end according to any one of the first aspect.
Compared with the prior art, the embodiment of the invention has the beneficial effects that:
the invention provides a method and a system for automatically testing the performance of a Web front end, wherein the method comprises the following steps: acquiring and analyzing test data; after the communication session link to be tested is established, testing the Web end through a test instruction generated by the test data; respectively accessing a URL scene and a menu scene according to a tested page path, and receiving access performance data of the URL scene and access performance data of the menu scene; and writing the access performance data of the URL scene and the access performance data of the menu scene into a test report by a rewriting method, and automatically sending the test report to related personnel after the test is finished. In the testing process, the Chrome console is operated to monitor various testing data, so that the error rate of manual acquisition and calculation is reduced, and the workload is reduced.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for automatically testing performance of a Web front end according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for automatically testing the performance of a Web front end according to another embodiment of the present invention;
fig. 3 is a flowchart of a method for automatically testing the performance of a Web front end according to another embodiment of the present invention;
fig. 4 is a flowchart of a method for automatically testing the performance of a Web front end according to another embodiment of the present invention;
fig. 5 is a flowchart of a method for automatically testing the performance of a Web front end according to another embodiment of the present invention;
fig. 6 is a flowchart of a method for automatically testing performance of a Web front end according to another embodiment of the present invention;
fig. 7 is a device diagram of an automated testing system for Web front-end performance according to an embodiment of the present invention;
fig. 8 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be understood that the step numbers used herein are for convenience of description only and are not intended as limitations on the order in which the steps are performed.
It is to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
The terms "comprises" and "comprising" indicate the presence of the described features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The term "and/or" refers to any and all possible combinations of one or more of the associated listed items and includes such combinations.
A first aspect.
Referring to fig. 1, an embodiment of the present invention provides an automated testing method for Web front-end performance, including:
and S10, acquiring and analyzing the test data.
And S20, after the communication session link to be tested is established, testing the Web end through the test instruction generated by the test data.
And S30, respectively accessing the URL scene and the menu scene according to the tested page path, and receiving the access performance data of the URL scene and the menu scene.
And S40, writing the access performance data of the URL scene and the access performance data of the menu scene into a test report by a rewriting method, and automatically sending the test report to related personnel after the test is finished.
In a specific implementation manner of the embodiment of the present invention, the accessing the URL scene and the menu scene respectively includes: accessing a URL scene, specifically:
after the page is stable and the resource loading is finished, acquiring a currently used js heap memory from a developer console, and monitoring the js heap memory in real time;
and re-requesting the page by the automatic test framework, stopping real-time monitoring until the request and the resource loading are finished, and storing the js heap memory peak value identified by real-time monitoring and the memory value after the page is stable.
The accessing the URL scene and the menu scene respectively further includes: accessing a menu scene, specifically:
accessing a default page and recording a heap memory when the page is stable, after clearing cache, accessing a tested page and starting to record a page loading event log;
acquiring real-time data of a js heap memory, stopping recording a page loading event log after the detected page is stable, and storing the page loading event log to the local; wherein the page load event log comprises: page access time and page rendering time;
and calculating an access time difference and a rendering time difference according to the page access time and the page rendering time.
In another specific implementation manner of the embodiment of the present invention, after the obtaining and analyzing the test data, the method includes:
establishing a test communication session link; specifically, the method comprises the following steps:
calling Webdriver through the Selenium, driving a Chrome browser by using the Webdriver, and starting the Web application to be tested to establish a test communication session link.
In the testing process, the Chrome console is operated to monitor various testing data, the error rate of manual acquisition and calculation is reduced, and the workload is reduced.
In another embodiment of the present invention, the present invention provides an automated testing method for Web front-end performance, including:
1. a tester inputs a page of a related scene through an Excel design, and each row of data in an Excel document maintains a single Web page, including whether the page is tested or not and a page access path. And maintaining information such as documents, accounts and the like through a Web end of the automatic test platform, uploading the information to a test server, and automatically reading the Excel file after clicking to start testing. When the Excel file is analyzed, traversal is started from a first row of data, all pages needing to be tested are extracted through an identification column whether the Excel file is tested or not, corresponding access paths such as a primary menu, a secondary menu and the like are sequentially decomposed, row positions of the pages and the decomposed paths are stored in a specified global variable, a tested system is accessed through input system addresses, account numbers, passwords and account number posts, and performance testing is started to be executed (the flow is shown in figure 2).
Based on the test case generation process, the following purposes are mainly achieved:
1) each Excel file can be read for 1 time to store all test cases to be executed, and the file reading and writing expenses are reduced.
2) And rapidly generating a test case in real time according to Excel data in each test. Therefore, only the correctness of Excel data needs to be ensured, the test case script is maintained in zero, and the workload is reduced.
3) When tests are required to be performed on different environments and different account numbers, the environment and account number information only needs to be filled in the automatic test platform to restart the tests, and labor cost is reduced.
4) When the test platform does not fill any information and directly initiates a test, the system automatically tracks the address of the client, acquires the latest test application information of the client and directly executes a performance test task, namely, the test task is finished by one key.
2. As shown in fig. 3, when the test script is executed, the Webdriver is called through the Selenium, the Webdriver is used to drive the Chrome browser, and the Web application to be tested is started, so that a complete communication session link is established. After the connection is successful, in the tested Web application on the Chrome, a test instruction is executed through a Python script, each page is accessed (two scenes of URL access and menu access) according to the tested page path, and different monitoring acquisition methods are adopted to respectively collect performance data corresponding to the two access modes:
note: when URL accesses, the resource of the current tab page of the browser can be requested to be loaded, and when the menu accesses, only the resource of the access page is requested to be loaded
2.1 As shown in FIG. 4, URL visits: and after the page is accessed according to the page path, refreshing the page, and after the page is stabilized and the resource loading is finished, acquiring the currently used js heap memory from the console of the developer by using an AI image identification method and character analysis, and starting real-time monitoring. And re-requesting the page by the automatic test framework until the request and the resource loading are finished, stopping AI monitoring, and storing the js heap memory peak value identified by AI monitoring and the memory value after the page is stable. And synchronously acquiring time points corresponding to events such as firstscreen time, navigationttart, loadEventEnd, domContentLoadEventEnd and the like provided by the Chrome interface, and calculating front-end performance indexes such as white screen time, first screen time, rendering time and the like.
2.2 as shown in FIG. 5, menu access: firstly, accessing a default page and recording a heap memory when the page is stable, and accessing a tested page after clearing the cache. And recording the stabilized heap memory under the monitoring tool interface of the developer through AI image recognition, re-accessing the page to be tested, simultaneously controlling a Chrome console to record the page loading process through mouse key simulation, and storing the recorded data. And acquiring real-time data (before page access, a page access peak value and after page access is stable) of a js heap memory in an AI identification mode, stopping recording a page loading event log and storing the log to the local after the tested page is stable, wherein Tracing StartdInbrowser and paint in the log respectively represent page access and page rendering time. The recorded data is parsed and the time difference (rendering time) of each event (e.g., rendering event) is calculated.
Based on the process, the following aims are achieved:
1) two access scenes (URL access and menu access) existing when a user accesses the system are integrated, resources of a whole browser tab page are loaded during the URL access, only resource files of the accessed page are loaded during the menu access, and menu and avatar information resource data are not loaded, namely files of other non-access pages such as menu.
2) The image identification method can effectively monitor the change of the heap memory, record the heap memory when the page is loaded and the heap memory after the page is loaded in real time, output the heap memory recycling and consumption conditions of two access modes by matching with a relevant algorithm in a test frame, and better monitor whether the system has the problem of memory overflow.
3) The method combines mouse key simulation and Chrome open correlation methods, can freely control the operation of a developer console in the test process, is convenient for quickly opening a heap memory test tool, a page loading monitoring tool and the like, assists in acquiring test data, and replaces manual operation.
4) For performance indexes such as white screen, first screen and rendering time, log file analysis and js interface request modes are adopted for collection, and compared with manual calculation and manual execution, the method is more accurate and rapid.
3. As shown in fig. 6, when each use case is executed, no matter in a url access mode or a menu access mode, the system collects and analyzes the change values of the heap memory before and after and the time consumption of various events according to the index sequence on the use case document, writes back the performance data to the test report by calling the openpyxl rewriting method of the third-party module, and after the use case is executed, the system reads the mail address newly submitted by the IP of the submitter in the database, calls the mail sending method packaged in the test frame, and automatically sends the test report to the relevant personnel.
The method provided by the invention realizes the automatic performance test of the Web application front end by using a technical means based on Python + Selenium + Chrome, and collects performance data by combining image recognition, mouse key simulation operation, file data reading, event node time consumption calculation and other modes.
1. And maintaining a test page through Excel, automatically generating a test case according to a preset template based on Excel data, and driving the test through a script. The test data is separated from the test script, and the maintenance cost is reduced.
2. A tester does not need a large amount of codes, only needs to maintain a page to be tested by means of Excel, and drives a Chrome browser to complete various testing operations, so that the testing threshold is greatly reduced.
3. In the testing process, the Chrome console is operated to monitor various testing data, the data are acquired through methods such as file reading, data screening, AI image recognition, mouse key simulation and the like, the error rate of manual acquisition and calculation is reduced, and the workload is reduced.
4. By means of the Python technology, data collected from the Chrome browser are directly written into a test report, manual intervention is reduced, and cost is reduced.
5. The same test case and system information do not need to be uploaded repeatedly by the same submitter at the front end, when zero-input direct submission is carried out, the system can automatically extract the recently submitted test case and system information by capturing the IP of the submitter to carry out test, the complexity of operation is reduced, and the operation is more convenient.
A second aspect.
Referring to fig. 7, an embodiment of the present invention provides an automated testing system for Web front-end performance, including:
the data processing module 10 is used for acquiring and analyzing the test data;
the testing module 20 is configured to test the Web end through a testing instruction generated by the testing data after the communication session link to be tested is established;
the scene access module 30 is configured to respectively access the URL scene and the menu scene according to the tested page path, and receive access performance data of the URL scene and access performance data of the menu scene;
and the test report generating module 40 is configured to write the access performance data of the URL scene and the access performance data of the menu scene into a test report by a rewriting method, and automatically send the test report to relevant people after the test is completed.
In a specific implementation manner of the embodiment of the present invention, the scene access module 30 is further configured to:
after the page is stable and the resource loading is finished, acquiring a currently used js heap memory from a developer console, and monitoring the js heap memory in real time;
and re-requesting the page by the automatic test framework until the request and the resource loading are finished, stopping real-time monitoring, and storing the js heap memory peak value identified by the real-time monitoring and the memory value after the page is stabilized.
In another specific implementation manner of the embodiment of the present invention, the scene access module 30 is further configured to:
accessing a default page and recording a heap memory when the page is stable, after clearing cache, accessing a tested page and starting to record a page loading event log;
acquiring real-time data of a js heap memory, stopping recording a page loading event log after the detected page is stable, and storing the page loading event log to the local; wherein the page load event log comprises: page access time and page rendering time;
and calculating an access time difference and a rendering time difference according to the page access time and the page rendering time.
In another specific implementation manner of the embodiment of the present invention, the data processing module 10 is further configured to:
establishing a test communication session link; specifically, the method comprises the following steps:
calling Webdriver through the Selenium, driving a Chrome browser by using the Webdriver, and starting the Web application to be tested to establish a test communication session link.
In the testing process, the Chrome console is operated to monitor various testing data, so that the error rate of manual acquisition and calculation is reduced, and the workload is reduced.
In a third aspect.
The present invention provides an electronic device, including:
a processor, a memory, and a bus;
the bus is used for connecting the processor and the memory;
the memory is used for storing operation instructions;
the processor is configured to invoke the operation instruction, and the executable instruction enables the processor to execute an operation corresponding to the method for automatically testing the performance of the front end of the Web as shown in the first aspect of the present application.
In an alternative embodiment, an electronic device is provided, as shown in fig. 8, the electronic device 5000 shown in fig. 8 includes: a processor 5001 and a memory 5003. The processor 5001 and the memory 5003 are coupled, such as via a bus 5002. Optionally, the electronic device 5000 may also include a transceiver 5004. It should be noted that the transceiver 5004 is not limited to one in practical application, and the structure of the electronic device 5000 is not limited to the embodiment of the present application.
The processor 5001 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 5001 may also be a combination of processors implementing computing functionality, e.g., a combination comprising one or more microprocessors, a combination of DSPs and microprocessors, or the like.
The memory 5003 is used for storing application code that implements aspects of the present application and is controlled in execution by the processor 5001. The processor 5001 is configured to execute application program code stored in the memory 5003 to implement the teachings of any of the foregoing method embodiments.
Wherein, the electronic device includes but is not limited to: mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like.
And (iv) a fourth aspect.
The invention provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements a method for automated testing of Web front-end performance as presented in the first aspect of the present application.
Yet another embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, which, when run on a computer, enables the computer to perform the corresponding content of the foregoing method embodiments.
Claims (8)
1. An automated testing method for Web front-end performance is characterized by comprising the following steps:
acquiring and analyzing test data, which specifically comprises the following steps: maintaining an Excel document and account information which are designed and input into a test scene page in advance through an automatic test platform web terminal, automatically reading the Excel file after a click is started to test, and analyzing the Excel file according to the following processes to obtain test data:
traversing from the first row of data, extracting all pages to be tested according to the identification columns whether to be tested, and sequentially decomposing corresponding access paths;
storing the row positions of all pages to be tested and the decomposed paths to a specified global variable;
after the communication session link to be tested is established, testing the Web end through a test instruction generated by the test data;
respectively accessing a URL scene and a menu scene according to the tested page path, and receiving access performance data of the URL scene and the menu scene; wherein, visiting the URL scene, specifically:
after the page is stabilized and the resource loading is finished, identifying images and character analysis by using AI, obtaining a currently used js heap memory from a developer console, and monitoring the js heap memory in real time;
requesting the page again by the automated testing frame until the request and the resource loading are finished, stopping real-time monitoring, storing the js heap memory peak value identified by the real-time monitoring and the memory value after the page is stabilized, synchronously acquiring time points corresponding to a plurality of events provided by the Chrome interface, and calculating the performance index of the front end; the time points corresponding to the events comprise firstPaint Time, navigationStart, loadEventEnd and domContentLoadedEventEnd; the front-end performance index comprises white screen time, first screen time and rendering time;
writing the access performance data of the URL scene and the access performance data of the menu scene into a test report through a rewriting method, and automatically sending the test report to related personnel after the test is finished, wherein the method specifically comprises the following steps:
writing the access performance data back to the test report by calling a third-party module openpyxl rewriting method;
after the case execution is finished, the system reads the mail address newly submitted by the IP of the submitter in the database, calls the mail sending method packaged in the test frame and automatically sends the test report to the related personnel.
2. The method for automatically testing the performance of the Web front end according to claim 1, wherein the accessing the URL scene and the menu scene respectively comprises: accessing a menu scene, specifically:
accessing a default page and recording a heap memory when the page is stable, after clearing cache, accessing a tested page and starting to record a page loading event log;
acquiring real-time data of a js heap memory, stopping recording a page loading event log after the detected page is stable, and storing the page loading event log to the local; wherein the page load event log comprises: page access time and page rendering time;
and calculating an access time difference and a rendering time difference according to the page access time and the page rendering time.
3. The method for automatically testing the performance of the Web front end according to claim 1, wherein after the obtaining and analyzing the test data, the method comprises:
establishing a test communication session link; specifically, the method comprises the following steps:
calling Webdriver through the Selenium, driving a Chrome browser by using the Webdriver, and starting the Web application to be tested to establish a test communication session link.
4. An automated Web front-end performance testing system capable of performing the automated Web front-end performance testing method of claim 1, comprising:
the data processing module is used for acquiring and analyzing the test data;
the testing module is used for testing the Web end through a testing instruction generated by the testing data after the communication session link to be tested is established;
the scene access module is used for respectively accessing the URL scene and the menu scene according to the tested page path and receiving the access performance data of the URL scene and the access performance data of the menu scene; and is also used for:
after the page is stable and the resource loading is finished, acquiring a currently used js heap memory from a developer console, and monitoring the js heap memory in real time;
requesting the page again by the automatic test framework until the request and the resource loading are finished, stopping real-time monitoring, and storing the js heap memory peak value identified by real-time monitoring and the memory value after the page is stable;
and the test report generating module is used for writing the access performance data of the URL scene and the access performance data of the menu scene into a test report through a rewriting method, and automatically sending the test report to related personnel after the test is finished.
5. The automated Web front-end performance testing system of claim 4, wherein the scenario access module is further configured to:
accessing a default page and recording a heap memory when the page is stable, after clearing cache, accessing a tested page and starting to record a page loading event log;
acquiring real-time data of a js heap memory, stopping recording a page loading event log after the detected page is stable, and storing the page loading event log to the local; wherein the page load event log comprises: page access time and page rendering time;
and calculating an access time difference and a rendering time difference according to the page access time and the page rendering time.
6. The automated Web front-end performance testing system of claim 4, wherein the data processing module is further configured to:
establishing a test communication session link; specifically, the method comprises the following steps:
calling the Webdriver through the Selenium, driving the Chrome browser by using the Webdriver, and starting the Web application to be tested so as to establish a test communication session link.
7. An electronic device comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the automated Web front end performance testing method of any one of claims 1 to 3 when executing the computer program.
8. A computer-readable storage medium, comprising a stored computer program, wherein the computer program, when executed, controls an apparatus in which the computer-readable storage medium is located to perform the method for automated testing of Web front-end performance according to any one of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111410813.4A CN114238048B (en) | 2021-11-25 | 2021-11-25 | Automatic testing method and system for Web front-end performance |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111410813.4A CN114238048B (en) | 2021-11-25 | 2021-11-25 | Automatic testing method and system for Web front-end performance |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114238048A CN114238048A (en) | 2022-03-25 |
CN114238048B true CN114238048B (en) | 2022-08-23 |
Family
ID=80751114
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111410813.4A Active CN114238048B (en) | 2021-11-25 | 2021-11-25 | Automatic testing method and system for Web front-end performance |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114238048B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115827480B (en) * | 2022-12-20 | 2023-05-12 | 中船重工奥蓝托无锡软件技术有限公司 | Automatic test method, device and system for ship performance prediction APP |
CN119201648A (en) * | 2024-09-25 | 2024-12-27 | 上海数禾信息科技有限公司 | System page monitoring method, device, computer equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101017457A (en) * | 2007-02-09 | 2007-08-15 | 山东浪潮齐鲁软件产业股份有限公司 | Automatically testing method of computer software |
CN106874207A (en) * | 2017-02-27 | 2017-06-20 | 税友软件集团股份有限公司 | The automated testing method and device of a kind of web page |
CN111400149A (en) * | 2020-01-19 | 2020-07-10 | 上海趣蕴网络科技有限公司 | Application performance data monitoring system, client and method |
CN112231213A (en) * | 2020-10-16 | 2021-01-15 | 广州助蜂网络科技有限公司 | Web automated testing method, system, storage medium and terminal equipment |
CN112965914A (en) * | 2021-03-30 | 2021-06-15 | 携程旅游网络技术(上海)有限公司 | Application page testing method, system, device and medium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101482815B (en) * | 2008-01-10 | 2013-08-07 | 国际商业机器公司 | Method and equipment for generating test case of software system |
US10983898B2 (en) * | 2019-03-29 | 2021-04-20 | Usablenet, Inc. | Methods for improved web application testing using remote headless browsers and devices thereof |
-
2021
- 2021-11-25 CN CN202111410813.4A patent/CN114238048B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101017457A (en) * | 2007-02-09 | 2007-08-15 | 山东浪潮齐鲁软件产业股份有限公司 | Automatically testing method of computer software |
CN106874207A (en) * | 2017-02-27 | 2017-06-20 | 税友软件集团股份有限公司 | The automated testing method and device of a kind of web page |
CN111400149A (en) * | 2020-01-19 | 2020-07-10 | 上海趣蕴网络科技有限公司 | Application performance data monitoring system, client and method |
CN112231213A (en) * | 2020-10-16 | 2021-01-15 | 广州助蜂网络科技有限公司 | Web automated testing method, system, storage medium and terminal equipment |
CN112965914A (en) * | 2021-03-30 | 2021-06-15 | 携程旅游网络技术(上海)有限公司 | Application page testing method, system, device and medium |
Also Published As
Publication number | Publication date |
---|---|
CN114238048A (en) | 2022-03-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110825618B (en) | Method and related device for generating test case | |
CN110597704B (en) | Pressure test method, device, server and medium for application program | |
CN106550038B (en) | Data configuration diagnosis system and method of digital control system | |
CN114238048B (en) | Automatic testing method and system for Web front-end performance | |
CN110990053A (en) | Method for creating and using machine learning scheme template and device | |
CN101183332A (en) | Method and device for automatically generating testing datasets by program content | |
CN109308254A (en) | A kind of test method, device and test equipment | |
CN113704590A (en) | Webpage data acquisition method and device, electronic equipment and storage medium | |
Tuovenen et al. | MAuto: Automatic mobile game testing tool using image-matching based approach | |
CN114357057A (en) | Log analysis method and device, electronic equipment and computer readable storage medium | |
CN116841543A (en) | Development method for dynamically generating cross-platform multi-terminal application based on Flutter | |
CN109582578A (en) | System, method, computer-readable medium and the electronic equipment of software test case | |
CN109840212A (en) | Function test method, device, equipment and the readable storage medium storing program for executing of application program | |
CN110232018A (en) | Interface test method, device, computer equipment | |
CN112966263A (en) | Target information acquisition method and device and computer readable storage medium | |
CN112506783A (en) | Test method, test device and storage medium | |
CN115022201B (en) | Data processing function test method, device, equipment and storage medium | |
CN111127223A (en) | Insurance product testing method and device and storage medium | |
CN113901773B (en) | Data accounting method, device, electronic equipment and storage medium | |
CN113901365B (en) | Performance stress testing platform and method, electronic device and readable medium | |
CN111737090B (en) | Log simulation method and device, computer equipment and storage medium | |
CN115481025A (en) | Script recording method and device for automatic test, computer equipment and medium | |
CN115048302A (en) | Front-end compatibility testing method and device, storage medium and electronic equipment | |
CN114546850A (en) | Automatic testing method, system and device for embedded point and storage medium | |
CN113360397A (en) | Regression testing method, device, equipment and storage medium of system function |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |