Page performance test method and device, equipment and storage medium
By creating a target browser, processing login identification information and encapsulating test scripts in the web page performance test, the problem of low automation and inability to skip the login interface in the existing technology is solved, and efficient page performance testing is achieved.
Patent Information
- Application Number
- CN202411944543.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, the degree of automation of web page performance testing is low and the testing efficiency is low. Especially in page scenarios where login is required to open, it is impossible to skip the login interface for performance testing.
By creating the target browser, determining its port number, adding the login identification information to the browser's cached data, judging the validity of the login identification information, and in effective cases, encapsulating the test script based on the test code package and port number, and calling the script for page performance testing.
It realizes automated page performance testing, which can be batch tested, improves testing efficiency, and skips the login interface in scenarios where login is required and performs performance testing directly.
Smart Images

Figure CN119597675A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a page performance testing method, device, equipment and storage medium. Background Art
[0002] Web page performance testing refers to the process of evaluating and measuring web page performance indicators by simulating the behavior of real users accessing web pages.
[0003] In the related art, the performance test of a single page can only be performed manually by the user, which has a poor degree of automation and low test efficiency. Moreover, when faced with a scenario where a login is required before opening the page to be tested, it is impossible to skip the login interface to open the page to be tested, resulting in the inability to perform the performance test of the page to be tested. Summary of the invention
[0004] In order to solve the above technical problems, the present disclosure provides a page performance testing method, device, equipment and storage medium, which can automatically perform page performance testing and batch testing to improve testing efficiency.
[0005] In a first aspect, an embodiment of the present disclosure provides a page performance testing method, the method comprising:
[0006] Create a target browser and determine the port number of the target browser;
[0007] Adding the login identification information of the target browser to the cache data of the target browser;
[0008] Determining whether the login identification information of the target browser in the cache data is valid;
[0009] If the login identification information is valid, encapsulate the test script based on the target test code package and the port number of the target browser;
[0010] The test script is called to test the page performance of each web page to be tested, and a performance test result of each web page to be tested is obtained.
[0011] In some embodiments, adding the login identification information of the target browser to the cache data of the target browser includes:
[0012] Reading the login identification information of the target browser from the target configuration file;
[0013] The login identification creation code is called to add the login identification information of the target browser to the cache data of the target browser.
[0014] In some embodiments, before reading the login identification information of the target browser from the target configuration file, the method further includes:
[0015] In response to a login operation previously performed by the user on the target browser, sending a login request to the server;
[0016] Receiving login response information returned by the server, wherein the login response information includes login identification information of the target browser;
[0017] The login identification information of the target browser is written into the target configuration file.
[0018] In some embodiments, determining whether the login identification information of the target browser in the cache data is valid includes:
[0019] Sending a connection request to a server based on the login identification information of the target browser;
[0020] Receiving connection status information returned by the server;
[0021] Whether the login identification information of the target browser is valid is determined according to the connection status information.
[0022] In some embodiments, the packaging of the test script based on the target test code package and the port number of the target browser includes:
[0023] Get the target test code package from the test tool;
[0024] Generate page performance test code based on the target test code package and the port number of the target browser;
[0025] The page performance test code is encapsulated into a test script.
[0026] In some embodiments, calling the test script to test the page performance of each web page to be tested to obtain the performance test result of each web page to be tested includes:
[0027] Call the test script to obtain the URL information of each web page to be tested;
[0028] Poll the URL information of each web page to be tested to determine the URL information of the current web page to be tested;
[0029] Opening the current web page to be tested based on the URL information of the current web page to be tested;
[0030] Testing the performance of the current web page to be tested to obtain a performance test result of the current web page to be tested;
[0031] When each web page to be tested is tested, the performance test result of each web page to be tested is obtained.
[0032] In some embodiments, the page performance of each web page to be tested includes at least one of the following:
[0033] Page loading speed, response time, compatibility with target browsers, user concurrency, resource usage.
[0034] In a second aspect, an embodiment of the present disclosure provides a page performance testing device, the device comprising:
[0035] A creation module is used to create a target browser and determine the port number of the target browser;
[0036] An adding module, used for adding the login identification information of the target browser to the cache data of the target browser;
[0037] A judging module, used for judging whether the login identification information of the target browser in the cache data is valid;
[0038] A packaging module, used for packaging a test script based on a target test code package and a port number of the target browser when the login identification information is valid;
[0039] The test module is used to call the test script to test the page performance of each web page to be tested, and obtain the performance test result of each web page to be tested.
[0040] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0041] Memory;
[0042] Processor; and
[0043] Computer programs;
[0044] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.
[0045] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method as described in the first aspect.
[0046] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the method described in the first aspect is implemented.
[0047] The page performance test method, device, equipment and storage medium provided by the embodiments of the present disclosure create a target browser, determine the port number of the target browser, add the login identification information of the target browser to the cache data of the target browser, determine whether the login identification information of the target browser in the cache data is valid, and if the login identification information is valid, encapsulate the test script based on the target test code package and the port number of the target browser, call the test script to test the page performance of each web page to be tested, and obtain the performance test result of each web page to be tested. Compared with the prior art, the embodiments of the present disclosure add the login identification information of the target browser to the cache data of the target browser, can skip the login interface, test the web page to be tested in the scenario that requires login, call the test script to test the page performance of each web page to be tested, and can automatically perform page performance testing or batch testing to improve testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0050] Figure 1 A flow chart of a page performance testing method provided by an embodiment of the present disclosure;
[0051] Figure 2 A flow chart of a page performance testing method provided by another embodiment of the present disclosure;
[0052] Figure 3 A flow chart of a page performance testing method provided by another embodiment of the present disclosure;
[0053] Figure 4 A schematic diagram of the overall process of the page performance testing method provided by the embodiment of the present disclosure;
[0054] Figure 5 A schematic diagram of the structure of a page performance testing device provided by an embodiment of the present disclosure;
[0055] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0056] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0057] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0058] Web page performance testing refers to the process of evaluating and measuring web page performance indicators by simulating the behavior of real users accessing web pages.
[0059] In the related art, the performance test of a single page can only be performed manually by the user, which has a poor degree of automation and low test efficiency. Moreover, when faced with a scenario where a login is required before opening the page to be tested, it is impossible to skip the login interface to open the page to be tested, resulting in the inability to perform the performance test of the page to be tested.
[0060] To address this problem, an embodiment of the present disclosure provides a page performance testing method, which is described below in conjunction with a specific embodiment.
[0061] Figure 1 The flowchart of the page performance testing method provided by the embodiment of the present disclosure. The execution subject of the method is an electronic device, which may be a terminal, and the terminal may specifically be a tablet computer, a notebook computer, a personal computer, etc. The method can be applied to the scenario of testing page performance.
[0062] It is understandable that the page performance testing method provided by the embodiments of the present disclosure can also be applied in other scenarios.
[0063] Below Figure 1 The page performance test method shown in the figure is introduced. The method can be applied to electronic devices. Taking a terminal as an example, the method includes the following specific steps:
[0064] S101, creating a target browser and determining the port number of the target browser.
[0065] In this step, the terminal creates a target browser and determines the port number of the target browser. Figure 4 As shown, the terminal can create a target browser through the open source tool puppeteer. Puppeteer is a Node.js library that provides a set of interface APIs for manipulating browsers and can perform various operations on browsers.
[0066] S102: Add the login identification information of the target browser to the cache data of the target browser.
[0067] In this step, the terminal will add the login identification information of the target browser to the cache data of the target browser, thereby achieving free login. Optionally, the login identification information is cookie data, and the cookie data can be json format data. The format of the login identification information and cookie data is not limited here.
[0068] S103: Determine whether the login identification information of the target browser in the cache data is valid.
[0069] In this step, the terminal determines whether the login identification information of the target browser in the cache data is valid, that is, determines whether the login identification information can pass the identity authentication.
[0070] In some embodiments, S103 may include but is not limited to S1031, S1032, S1033:
[0071] S1031. Send a connection request to a server based on the login identification information of the target browser.
[0072] In this embodiment, the terminal sends a connection request to the server, and the connection request carries the login identification information of the target browser.
[0073] S1032: Receive connection status information returned by the server.
[0074] After receiving the connection request sent by the terminal, the server returns the connection status information to the terminal, and the terminal receives the connection status information returned by the server.
[0075] S1033: Determine whether the login identification information of the target browser is valid according to the connection status information.
[0076] In this embodiment, if the connection status information is a successful connection, the login identification information of the target browser is determined to be valid; if the connection request is sent multiple times in succession and the connection status information returned by the server is always a failed connection, the login identification information of the target browser is determined to be invalid.
[0077] S104: When the login identification information is valid, encapsulate the test script based on the target test code package and the port number of the target browser.
[0078] In this step, if the login identification information of the target browser is determined to be valid, the test script is encapsulated according to the target test code package and the port number of the target browser, and the browser homology operation is implemented through the port number of the target browser. Optionally, the target test code package is a lighthouse module package, which is not specifically limited.
[0079] In some embodiments, if it is determined that the login identification information of the target browser is invalid, the login fails and it is necessary to re-acquire the login identification information of the target browser, add the login identification information of the target browser to the cache data of the target browser, and then determine whether the login identification information of the target browser is valid.
[0080] S105: calling the test script to test the page performance of each web page to be tested, and obtaining the performance test result of each web page to be tested.
[0081] After the test script is packaged, the terminal can further call the test script to test the page performance of each web page to be tested, obtain the performance test results of each web page to be tested, and automatically perform page performance testing, and can perform batch testing to improve test efficiency. Figure 4 As shown, the test script can be called through the computer programming language Python to implement page performance automation testing.
[0082] In some embodiments, the page performance of each web page to be tested includes at least one of the following: page loading speed, response time, compatibility with target browsers, user concurrency, and resource usage. Optionally, the page performance of each web page to be tested may also include other performances, which are not limited here.
[0083] The disclosed embodiment creates a target browser, determines the port number of the target browser, adds the login identification information of the target browser to the cache data of the target browser, determines whether the login identification information of the target browser in the cache data is valid, and if the login identification information is valid, encapsulates a test script based on the target test code package and the port number of the target browser, calls the test script to test the page performance of each web page to be tested, and obtains the performance test result of each web page to be tested. Compared with the prior art, the disclosed embodiment adds the login identification information of the target browser to the cache data of the target browser, can skip the login interface, test the web page to be tested in the scenario that requires login, calls the test script to test the page performance of each web page to be tested, can automatically perform page performance testing, and can also perform batch testing to improve testing efficiency.
[0084] Figure 2A flow chart of a page performance testing method provided by another embodiment of the present disclosure, such as Figure 2 As shown, the method includes the following steps:
[0085] S201, create a target browser, and determine the port number of the target browser.
[0086] Specifically, the implementation process and principle of S201 and S101 are the same, and will not be repeated here.
[0087] S202: Read the login identification information of the target browser from the target configuration file.
[0088] In this step, the terminal may obtain a target configuration file, and read the login identification information of the target browser from the target configuration file.
[0089] In some embodiments, before reading the login identification information of the target browser from the target configuration file in S202, the method further includes:
[0090] S1. In response to a login operation performed in advance by a user on a target browser, a login request is sent to a server;
[0091] S2. Receive the login response information returned by the server, wherein the login response information includes the login identification information of the target browser;
[0092] S3. Writing the login identification information of the target browser into the target configuration file.
[0093] S203: calling the login identification creation code to add the login identification information of the target browser to the cache data of the target browser.
[0094] In this step, if Figure 4 As shown, the terminal will call the login identification creation code, namely setCookie, to add the login identification information of the target browser to the cache data of the target browser to achieve free login.
[0095] S204: Determine whether the login identification information of the target browser in the cache data is valid.
[0096] Specifically, the implementation process and principle of S204 and S103 are the same, and will not be repeated here.
[0097] S205: If the login identification information is valid, obtain a target test code package from the test tool.
[0098] In this step, if it is determined that the login identification information of the target browser is valid, the terminal can obtain the target test code package from the test tool lighthouse.
[0099] S206: Generate page performance test code based on the target test code package and the port number of the target browser.
[0100] In this step, the terminal can generate page performance test code according to the target test code package and the port number of the target browser, and implement browser homology operation through the port number of the target browser. Figure 4 As shown, the terminal uses the target test code package (such as the lighthouse module package) combined with the port number of the target browser to write the lighthouse stress testing method and generate the page performance test code.
[0101] S207: Encapsulate the page performance test code into a test script.
[0102] After the page performance test code is generated, the terminal further encapsulates the page performance test code into a test script. In some embodiments, it can be encapsulated into a js executable test script.
[0103] S208: calling the test script to test the page performance of each web page to be tested, and obtaining the performance test result of each web page to be tested.
[0104] Specifically, the implementation process and principle of S208 and S105 are the same, and will not be repeated here.
[0105] The embodiment of the present disclosure creates a target browser, determines the port number of the target browser, reads the login identification information of the target browser from the target configuration file, and calls the login identification creation code to add the login identification information of the target browser to the cache data of the target browser. Further, a target test code package is obtained from the test tool, and a page performance test code is generated based on the target test code package and the port number of the target browser, and the page performance test code is encapsulated into a test script. Then, the test script is called to test the page performance of each web page to be tested, and the performance test results of each web page to be tested are obtained. Through this method, the embodiment of the present disclosure can skip the login interface, test the web pages to be tested in the scenarios that require login, call the test script to test the page performance of each web page to be tested, and can automatically perform page performance testing, and can perform batch testing to improve testing efficiency.
[0106] Figure 3 A flow chart of a page performance testing method provided by another embodiment of the present disclosure, such as Figure 3 As shown, the method includes the following steps:
[0107] S301, create a target browser, and determine the port number of the target browser.
[0108] Specifically, the implementation process and principle of S301 and S101 are the same, and will not be repeated here.
[0109] S302: Add the login identification information of the target browser to the cache data of the target browser.
[0110] Specifically, the implementation process and principle of S302 and S102 are the same, and will not be repeated here.
[0111] S303: Determine whether the login identification information of the target browser in the cache data is valid.
[0112] Specifically, the implementation process and principle of S303 and S103 are the same, and will not be repeated here.
[0113] S304: When the login identification information is valid, encapsulate the test script based on the target test code package and the port number of the target browser.
[0114] Specifically, the implementation process and principle of S304 and S104 are the same, and will not be repeated here.
[0115] S305: Call the test script to obtain the URL information of each web page to be tested.
[0116] In this step, the user will input the URL information of each web page to be tested in advance, and the terminal calls the test script to obtain the URL information of each web page to be tested.
[0117] S306: Poll the URL information of each web page to be tested to determine the URL information of the current web page to be tested.
[0118] After obtaining the URL information of each web page to be tested, the terminal further polls the URL information of each web page to be tested to determine the URL information of the current web page to be tested.
[0119] S307: Open the current web page to be tested based on the URL information of the current web page to be tested.
[0120] S308: Testing the performance of the current web page to be tested to obtain a performance test result of the current web page to be tested.
[0121] S309: When each web page to be tested is tested, a performance test result of each web page to be tested is obtained.
[0122] In this step, the terminal determines whether each web page to be tested has been tested. If it is determined that each web page to be tested has been tested, the performance test result of each web page to be tested is obtained.
[0123] In some embodiments, after obtaining the performance test result of each web page to be tested, the performance test result of each web page to be tested may be stored in the local memory of the terminal, so that the user can check the performance test result of each web page to be tested.
[0124] The disclosed embodiment creates a target browser, determines the port number of the target browser, and adds the login identification information of the target browser to the cache data of the target browser. Then, it is determined whether the login identification information of the target browser in the cache data is valid. If the login identification information is valid, the test script is encapsulated based on the target test code package and the port number of the target browser. Further, the test script is called to obtain the URL information of each web page to be tested, the URL information of each web page to be tested is polled, the URL information of the current web page to be tested is determined, and the current web page to be tested is opened based on the URL information of the current web page to be tested. Then, the performance of the current web page to be tested is tested to obtain the performance test result of the current web page to be tested. When each web page to be tested is tested, the performance test result of each web page to be tested is obtained. Compared with the prior art, the disclosed embodiment can skip the login interface, test the web page to be tested in the scenario where login is required, call the test script to test the page performance of each web page to be tested, and can automatically perform page performance testing, batch testing, and improve test efficiency.
[0125] Figure 5 The schematic diagram of the structure of the page performance test device provided in the embodiment of the present disclosure. The page performance test device may be the terminal as described in the above embodiment, or the page performance test device may be a component or assembly in the terminal. The page performance test device provided in the embodiment of the present disclosure may execute the processing flow provided in the embodiment of the page performance test method, such as Figure 5 As shown, the page performance testing device 50 includes: a creation module 51, an adding module 52, a judging module 53, an encapsulation module 54, and a testing module 55; wherein the creation module 51 is used to create a target browser and determine the port number of the target browser; the adding module 52 is used to add the login identification information of the target browser to the cache data of the target browser; the judging module 53 is used to judge whether the login identification information of the target browser in the cache data is valid; the encapsulation module 54 is used to encapsulate the test script based on the target test code package and the port number of the target browser when the login identification information is valid; the testing module 55 is used to call the test script to test the page performance of each web page to be tested, and obtain the performance test result of each web page to be tested.
[0126] Optionally, when the adding module 52 adds the login identification information of the target browser to the cache data of the target browser, it is specifically used to: read the login identification information of the target browser from the target configuration file; call the login identification creation code to add the login identification information of the target browser to the cache data of the target browser.
[0127] Optionally, before reading the login identification information of the target browser from the target configuration file, the device 50 also includes: a writing module 56; the writing module 56 is used to send a login request to the server in response to a login operation performed by the user in advance on the target browser; receive login response information returned by the server, the login response information including the login identification information of the target browser; write the login identification information of the target browser into the target configuration file.
[0128] Optionally, when the judgment module 53 judges whether the login identification information of the target browser in the cache data is valid, it is specifically used to: send a connection request to the server based on the login identification information of the target browser; receive connection status information returned by the server; and judge whether the login identification information of the target browser is valid based on the connection status information.
[0129] Optionally, when the encapsulation module 54 encapsulates the test script based on the target test code package and the port number of the target browser, it is specifically used to: obtain the target test code package from the test tool; generate a page performance test code based on the target test code package and the port number of the target browser; and encapsulate the page performance test code into a test script.
[0130] Optionally, the test module 55 calls the test script to test the page performance of each web page to be tested, and when obtaining the performance test result of each web page to be tested, it is specifically used to: call the test script to obtain the URL information of each web page to be tested; poll the URL information of each web page to be tested to determine the URL information of the current web page to be tested; open the current web page to be tested based on the URL information of the current web page to be tested; test the performance of the current web page to be tested to obtain the performance test result of the current web page to be tested; when the test of each web page to be tested is completed, obtain the performance test result of each web page to be tested.
[0131] Optionally, the page performance of each web page to be tested includes at least one of the following: page loading speed, response time, compatibility with a target browser, user concurrency performance, and resource utilization rate.
[0132] Figure 5 The page performance testing device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.
[0133] Figure 6 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 6 , which shows a structural schematic diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0134] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603 to implement the page performance test method of the embodiment described in the present disclosure. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0135] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0136] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the page performance testing method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0137] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0138] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0139] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0140] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0141] Create a target browser and determine the port number of the target browser;
[0142] Adding the login identification information of the target browser to the cache data of the target browser;
[0143] Determining whether the login identification information of the target browser in the cache data is valid;
[0144] If the login identification information is valid, encapsulate the test script based on the target test code package and the port number of the target browser;
[0145] The test script is called to test the page performance of each web page to be tested, and a performance test result of each web page to be tested is obtained.
[0146] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0147] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0148] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0149] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0150] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0151] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0152] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0153] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0154] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A page performance testing method, characterized in that: The method comprises: Create a target browser and determine the port number of the target browser; Adding the login identification information of the target browser to the cache data of the target browser; Determining whether the login identification information of the target browser in the cache data is valid; If the login identification information is valid, encapsulate the test script based on the target test code package and the port number of the target browser; The test script is called to test the page performance of each web page to be tested, and a performance test result of each web page to be tested is obtained.
2. The method according to claim 1, characterized in that The step of adding the login identification information of the target browser to the cache data of the target browser includes: Reading the login identification information of the target browser from the target configuration file; The login identification creation code is called to add the login identification information of the target browser to the cache data of the target browser.
3. The method according to claim 2, characterized in that Before reading the login identification information of the target browser from the target configuration file, the method further includes: In response to a login operation previously performed by the user on the target browser, sending a login request to the server; Receiving login response information returned by the server, wherein the login response information includes login identification information of the target browser; The login identification information of the target browser is written into the target configuration file.
4. The method according to claim 1, characterized in that: The determining whether the login identification information of the target browser in the cache data is valid includes: Sending a connection request to a server based on the login identification information of the target browser; Receiving connection status information returned by the server; Whether the login identification information of the target browser is valid is determined according to the connection status information.
5. The method according to claim 1, characterized in that The test script encapsulation based on the target test code package and the port number of the target browser includes: Get the target test code package from the test tool; Generate page performance test code based on the target test code package and the port number of the target browser; The page performance test code is encapsulated into a test script.
6. The method according to claim 1, characterized in that The calling of the test script to test the page performance of each web page to be tested, and obtaining the performance test result of each web page to be tested, includes: Call the test script to obtain the URL information of each web page to be tested; Poll the URL information of each web page to be tested to determine the URL information of the current web page to be tested; Opening the current web page to be tested based on the URL information of the current web page to be tested; Testing the performance of the current web page to be tested to obtain a performance test result of the current web page to be tested; When each web page to be tested is tested, the performance test result of each web page to be tested is obtained.
7. The method according to claim 1, characterized in that The page performance of each web page to be tested includes at least one of the following: Page loading speed, response time, compatibility with target browsers, user concurrency, resource usage.
8. A page performance testing device, characterized in that: The device comprises: A creation module is used to create a target browser and determine the port number of the target browser; An adding module, used for adding the login identification information of the target browser to the cache data of the target browser; A judging module, used for judging whether the login identification information of the target browser in the cache data is valid; A packaging module, used for packaging a test script based on a target test code package and a port number of the target browser when the login identification information is valid; The test module is used to call the test script to test the page performance of each web page to be tested, and obtain the performance test result of each web page to be tested.
9. An electronic device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.