[go: up one dir, main page]

CN117667716A - Page testing method and device and electronic equipment - Google Patents

Page testing method and device and electronic equipment Download PDF

Info

Publication number
CN117667716A
CN117667716A CN202311679358.7A CN202311679358A CN117667716A CN 117667716 A CN117667716 A CN 117667716A CN 202311679358 A CN202311679358 A CN 202311679358A CN 117667716 A CN117667716 A CN 117667716A
Authority
CN
China
Prior art keywords
page
real native
interface
browser
test
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.)
Pending
Application number
CN202311679358.7A
Other languages
Chinese (zh)
Inventor
丁海盛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202311679358.7A priority Critical patent/CN117667716A/en
Publication of CN117667716A publication Critical patent/CN117667716A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/362Debugging of software
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a page detection method, a page detection device and electronic equipment, and relates to the technical field of software testing, wherein the method comprises the following steps: receiving a test request; acquiring a corresponding real Native page code according to the test request; establishing communication with the interface-free browser, controlling the interface-free browser to execute a real Native page code, and starting a corresponding real Native page; performing performance test operation on the real Native page through the interface-free browser; receiving a page detection result sent by the interface-free browser, and storing the page detection result into a performance log file; and analyzing the performance log file and generating a test report. In the design, the method can realize automatic performance detection of real Native, actively find problems, and perform corresponding performance optimization and improvement in the process of service development according to a test report, thereby improving the problem analysis efficiency.

Description

Page testing method and device and electronic equipment
Technical Field
The application relates to the technical field of software testing, in particular to a page testing method and device and electronic equipment.
Background
At present, the real Native cross-platform technology is widely applied to various application programs, but some problems still exist in the development process, mainly including the situations that performance analysis needs to be manually performed and the performance analysis threshold is high.
First, the real Native cannot actively analyze problems, but requires manual performance analysis. In general, when serious page performance problems are found, manual analysis is performed, all performance problems cannot be found, some performance problems which are not found and solved in time may exist, and manual analysis efficiency is low.
Second, performance analysis has a relatively high threshold in real Native. This requires additional learning and practice of the performance tuning tool by the developer to perform performance analysis.
Disclosure of Invention
In order to at least overcome the above-mentioned shortcomings in the prior art, an object of the present application is to provide a method and apparatus for testing a page, and an electronic device.
In a first aspect, an embodiment of the present application provides a page testing method, where the page testing method includes:
receiving a test request;
acquiring a corresponding real Native page code according to the test request;
establishing communication with an interface-free browser, controlling the interface-free browser to execute the real Native page code, and starting a corresponding real Native page;
performing performance test operation on the real Native page through the interface-free browser;
receiving a page detection result sent by the interface-free browser, and storing the page detection result into a performance log file;
and analyzing the performance log file and generating a test report.
In one possible implementation manner, the step of receiving the page detection result sent by the interface-free browser and storing the page detection result in the performance log file includes:
receiving a test stopping instruction sent by an automatic test platform, and sending the test stopping instruction to the interface-free browser, so that the interface-free browser stops detecting the real Native page;
and receiving a page detection result sent by the interface-free browser, and storing the page detection result into the performance log file.
In one possible implementation manner, the step of establishing communication with an interface-free browser, controlling the interface-free browser to execute the real Native page code, and starting a corresponding real Native page includes:
establishing communication with the interface-free browser to obtain routing URL information;
and starting a corresponding real Native page according to the routing URL information, so that the real Native page is connected to a remote debugging service through the routing URL information.
In one possible implementation, the step of establishing communication with the interface-free browser includes:
communication is established with the Headless Chromium browser through Chrome DevTools Protocol.
In one possible implementation manner, the step of receiving the test request includes:
and receiving an HTTP request, wherein the HTTP request comprises the real Native service information.
In a possible implementation manner, after the step of receiving an HTTP request, the HTTP request includes real Native service information, the method further includes:
and acquiring a real Native service code according to the real Native service information, performing repeated rendering inspection on the real Native service code, and storing the repeated rendering information into a performance log file.
In one possible implementation manner, the step of obtaining a real Native service code according to the real Native service information, performing repeated rendering inspection on the real Native service code, and storing repeated rendering information in a performance log file includes:
generating an abstract syntax tree of the real Native service code by a code compiler;
adding a detection code into the real Native service code according to the abstract syntax tree to perform repeated rendering inspection to obtain repeated rendering information;
and storing the repeated rendering information to a performance log file.
In a second aspect, an embodiment of the present application further provides a page testing apparatus, including:
the first receiving module is used for receiving the test request;
the second receiving module is used for acquiring a corresponding real Native page code according to the test request;
the control module is used for establishing communication with the interface-free browser, controlling the interface-free browser to execute the real Native page code and starting a corresponding real Native page;
the testing module is used for executing performance testing operation on the real Native page through the interface-free browser;
the storage module is used for receiving the page detection result sent by the interface-free browser and storing the page detection result into a performance log file;
and the analysis module is used for analyzing the performance log file and generating a test report.
In a third aspect, embodiments of the present application further provide an electronic device, including:
a memory for storing one or more programs;
and a processor, when the one or more programs are executed by the processor, implementing the page test method provided in the first aspect.
In a fourth aspect, embodiments of the present application further provide a computer readable storage medium having a computer program stored thereon, where the computer program, when executed by a processor, implements the page test method provided in the first aspect.
Based on any one of the above aspects, the method, the device and the electronic equipment for testing a page provided by the embodiments of the present application may obtain a real Native page code through a test request, and after establishing communication with an interface-free browser, control the interface-free browser to execute the real page code, start the real page, execute a performance test operation on the real page through the interface-free browser, and store a page detection result in a performance log file, thereby generating a test report. Therefore, the method can realize automatic performance detection of the real Native, actively find problems, and perform corresponding performance optimization and improvement in the process of service development according to the test report, thereby improving the problem analysis efficiency.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following description will briefly explain the drawings required for the embodiments, it being understood that the following drawings illustrate only some embodiments of the present application and are therefore not to be considered limiting of the scope, and that other related drawings may be obtained according to these drawings without the inventive effort of a person skilled in the art.
Fig. 1 is a schematic application scenario diagram of the page detection method provided in the present embodiment;
FIG. 2 is one of the schematic flowcharts of the page detection method provided in the present embodiment;
fig. 3 is a schematic diagram of the substeps of step S500 provided in the present embodiment;
fig. 4 is a schematic diagram of the substeps of step S300 according to the present embodiment;
FIG. 5 is a second schematic flow chart of a page detection method according to the present embodiment;
fig. 6 is a schematic block diagram of an electronic device according to the present embodiment;
fig. 7 is a schematic diagram of a functional module of the page detection device provided in this embodiment.
Icon: 100-an automated test platform; 200-automated performance analysis service; 300-no interface browser; 700-an electronic device; 710-a processor; 720-a computer-readable storage medium; 730-application program interface color adjustment means; 731-a first receiving module; 732-a second receiving module; 733-a control module; 734-test module; 735—a storage module; 736-analysis module.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
In the description of the present application, it should be noted that, the azimuth or positional relationship indicated by the terms "upper", "lower", etc. are based on the azimuth or positional relationship shown in the drawings, or the azimuth or positional relationship that is commonly put when the product of the application is used, are merely for convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element to be referred to must have a specific azimuth, be configured and operated in a specific azimuth, and therefore should not be construed as limiting the present application. Furthermore, the terms "first," "second," and the like, are used merely to distinguish between descriptions and should not be construed as indicating or implying relative importance.
It should be noted that, in the case of no conflict, different features in the embodiments of the present application may be combined with each other.
The present embodiment provides a solution to the above problem, and a detailed description of a specific embodiment of the present application will be given below with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 illustrates a page detection system provided in this embodiment, where the page detection system includes an automated test platform 100, an automated performance analysis service 200, and an interface-free browser 300. The automated test platform 100 and the automated performance analysis service 200 may communicate with each other via hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP). The automated performance analysis service 200 and the interfacial less browser 300 may communicate with each other through CDP (Chrome DevTools Protocol).
Referring to fig. 2, fig. 2 illustrates a flow chart of a page testing method provided in this embodiment, where the page testing method may be applied to the automated performance testing service shown in fig. 1, and the method may include the following steps.
Step S100, a test request is received.
In this embodiment, the test request sent by the automatic test platform or the real Native CLI tool may be received, and a performance test operation, such as repeated rendering detection, may be performed according to the test request.
Step S200, acquiring corresponding real Native page codes according to the test request.
In this embodiment, the test request obtained in step S100 may be parsed, so as to determine relevant information of the real Native page to be tested, and pull the corresponding real Native page code according to the obtained relevant information.
The Real Native (RN) is a cross-platform mobile application development framework, and currently supports two large platforms, i.e. iOS and Android. The RN develops mobile applications using JavaScript language, JSX like HTML, and CSS.
Step S300, establishing communication with the interface-free browser 300, controlling the interface-free browser 300 to execute the real Native page code, and starting the corresponding real Native page.
In this embodiment, communication may be established with the interface-free browser 300, so as to control the interface-free browser 300 to execute the real Native page code obtained in step S200, and enable the automated test platform 100 to start a corresponding real Native page.
Specifically, in the process of establishing communication with the interface-free browser 300, the real Native debugging service may be started at the server first, and then the interface-free browser 300 is started at the server, so as to implement communication with the interface-free browser 300.
Step S400, executing, by the interface-free browser 300, performance test operation on the real Native page.
In this embodiment, the performance test operation may be performed by the interface-free browser 300 for the real Native page opened in step S300. For example, the operation behavior of the user on the real Native page, such as clicking a button, inputting text, scrolling a page, etc., may be simulated, and may be implemented by executing JavaScript code. In the process of simulating user interaction behavior, breakpoints can be set at specific code positions so as to carry out breakpoint debugging and performance analysis.
In the performance test process, performance data, such as page loading time, rendering performance, interaction response time and other indexes, can be collected and recorded, and page detection results can be generated according to the collected performance data.
Step S500, receiving a page detection result sent by the interface-free browser 300, and storing the page detection result in a performance log file.
In this embodiment, according to the performance test operation performed on the real Native page in step S400, for example, the operation behavior of the user on the real Native page is simulated, the page detection result sent by the interface-free browser 300 is obtained, and the page detection result is stored in the performance log (Profile) file. The page detection result may include indexes such as loading time, rendering performance, resource loading condition, interaction response time and the like of the real Native page.
And step S600, analyzing the performance log file and generating a test report.
In this embodiment, the performance log (Profile) file obtained in step S500 may be analyzed, and the test report may be generated according to the analysis result, where the test report may include a JS thread time-consuming distribution, a JS memory distribution, a component rendering number, a repeated rendering number of component rendering numbers, and so on. The JS memory distribution refers to the distribution condition of the JS threads under different operation or event triggering, including the memory occupation condition, the memory leakage condition and the like, the component rendering times refer to the rendering times of each component, including the rendering times of each component under different scenes, and the repeated rendering times refer to the repeated rendering times of the components under the same property and State conditions.
After the test report is generated, the test report may be sent to the automated test platform 100, and the automated performance test platform sends a performance test mail, where the performance test mail may include content such as a summary, a key index, a problem point, and a suggestion of the test report, so as to perform corresponding performance optimization and improvement in a process of service development.
It can be seen that, based on the above design, the page testing method provided in the embodiments of the present application may obtain the real Native page code through the test request, and after establishing communication with the interface-free browser 300, control the interface-free browser 300 to execute the real Native page code, start the real Native page, execute a performance testing operation on the real Native page through the interface-free browser 300, and store the page detection result in the performance log (Profile) file, thereby generating the test report. Therefore, the method can realize automatic performance detection of the real Native, actively find problems, and perform corresponding performance optimization and improvement in the process of service development according to the test report, thereby improving the problem analysis efficiency.
In one possible implementation, referring to fig. 3, step S500 may include the following sub-steps.
Step S510, receiving a test stopping instruction sent by the automated test platform 100, and sending the test stopping instruction to the interface-free browser 300, so that the interface-free browser 300 stops detecting the real Native page.
In this embodiment, when the automatic test platform 100 opens the real Native page, the automatic test platform 100 may operate the real Native page, for example, click a button, scroll a page, and when the number of times the automatic test platform 100 operates the real Native page (such as clicking a page, scroll a page) reaches a preset threshold, the automatic test platform 100 may send the stop test instruction to the automatic performance analysis service 200, at this time, the automatic performance analysis service 200 may receive the stop test instruction sent by the automatic test platform 100 and send the stop test instruction to the non-interface browser 300, so that the non-interface browser 300 stops performing performance test on the real Native page.
Illustratively, when the automated test platform 100 scrolls the real Native page back and forth 5 times, the automated test platform 100 may send the stop test instruction to the automated performance analysis service 200.
In particular, the automated test platform 100 and the automated performance analysis service 200 may communicate via hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP).
Step S520, receiving the page detection result sent by the interface-free browser 300, and storing the page detection result in the performance log file.
In this embodiment, when the interface-free browser 300 stops detecting the real Native page, the page detection result sent by the interface-free browser 300 may be received, and the page detection result may be stored in the performance log (Profile) file. At this time, a real Native debug service (wrapper server) may be stopped, and after the real Native debug service (wrapper server) is stopped, the performance log (Profile) file may be analyzed, thereby generating the test report. After the test report is generated, the test report may be sent to the automated test platform 100, and the automated performance test platform sends a performance test mail, where the performance test mail may include content such as a summary, a key index, a problem point, and a suggestion of the test report, so as to perform corresponding performance optimization and improvement in a process of service development.
In one possible implementation, referring to fig. 4, step S300 may include the following sub-steps.
In step S310, communication is established with the interface-free browser 300 to obtain the route URL information.
In this embodiment, when establishing communication with the interface-free browser 300, a real Native debug service (wrapper server) may be started at a server to obtain an address and a port number of the real Native debug service (wrapper server), and then the interface-free browser 300 is started at a server to implement communication with the interface-free browser 300. After establishing communication with the interfacial-less browser 300, the routing URL information may be generated according to an address and port number of a real Native debug service (package server).
The real Native debug service (wrapper server) may communicate with the interfacial-less browser 300 through WebSocket.
Step S320, starting a corresponding real Native page according to the routing URL information, and enabling the real Native page to be connected to a remote debugging service through the routing URL information.
In this embodiment, the routing URL information generated in step S310 may be sent to the automated test platform 100, so that the automated test platform 100 may open a corresponding real Native page according to the routing URL information, so that the real Native page may be connected to a remote debug service through the routing URL information, so as to facilitate remote debugging, performance analysis, and error checking.
In step S510, when the number of times the automatic test platform 100 operates (for example, clicks on a page, scrolls the page) on the real Native page reaches a preset threshold, the automatic test platform 100 may send the stop test instruction to the automatic performance analysis service 200 through the route URL information generated in step S310, at this time, the automatic performance analysis service 200 may receive the stop test instruction sent by the automatic test platform 100 through the route URL information and send the stop test instruction to the no-interface browser 300, so that the no-interface browser 300 may stop performing performance test on the real Native page according to the stop test instruction and send the page detection result to the automatic performance analysis service 200.
In one possible implementation, when establishing communication with the interfacial-less browser 300, communication may be established with the Headless Chromium browser through Chrome DevTools Protocol.
In this embodiment, the Headless Chromium browser may be started by CDP (Chrome DevTools Protocol) to establish communication with the Headless Chromium browser, and execution of JavaScript code in automated testing may be implemented, so as to implement interaction with the real Native application.
Specifically, CDP (Chrome DevTools Protocol) is a communication protocol for remote control of Chrome/Chrome behavior, and may be used for operations such as opening a browser/opening a page/intercepting a request/extracting page content. The interface-free browser 300 may be a Headless Chromium browser, and the Headless Chromium browser is a chrome browser that does not display an interface.
In step S510, when the automated performance analysis service 200 sends the stop test instruction to the non-interface browser 300, and the non-interface browser 300 stops detecting the real Native page, the automated performance analysis service 200 may send the stop test instruction to the Headless Chromium browser through CDP (Chrome DevTools Protocol), so that the Headless Chromium browser stops performance testing of the real Native page according to the stop test instruction.
In one possible implementation, upon receiving the test request, an HTTP request may be received, the HTTP request including real Native service information.
In this embodiment, the test request may be an HTTP request, and the HTTP request sent by the automatic test platform or the real Native CLI tool may be received, and a performance test operation, such as repeated rendering detection, is performed according to the HTTP request. The HTTP request may include real Native service information, such as page name, version number, etc.
The automated test platform 100 and automated performance analysis service 200 may communicate via hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP).
In one possible implementation manner, after receiving the HTTP request, the real Native service code may be further obtained according to the real Native service information, and the real Native service code is repeatedly rendered and checked, and the repeated rendering information is stored in a performance log file.
The inventor researches that component repeated rendering is one of the most common problems in real Native, and component repeated rendering is usually caused by the change of tips or states of components. When the tips or states of the components change, the act re-renders the components to reflect these changes. This can result in components being rendered unnecessarily repeatedly in some cases, affecting the performance and user experience of the application. Therefore, repeated rendering inspection of the real Native service code is required.
In this embodiment, the real Native service code may be obtained according to the real Native service information included in the HTTP request, and a repeated rendering check may be performed on the real Native service code, and when repeated rendering is detected, the repeated rendering information may be stored in the performance log (Profile) file, so as to generate the test report. The re-rendering information may include a component name and a reason for the re-rendering.
In a possible implementation manner, referring to fig. 5, when the real Native service code is obtained according to the real Native service information, and the real Native service code is repeatedly rendered and checked, and the repeated rendering information is stored in the performance log file, the method may further include the following steps.
Step S710, generating an abstract syntax tree of the real Native service code through a code compiler.
In this embodiment, the abstract syntax tree (Abstract Syntax Tree, AST) may be obtained by performing syntax analysis on the real Native service code by the code compiler. Wherein the abstract syntax tree (Abstract Syntax Tree, AST) is a tree representation of the abstract syntax structure of the real Native service code, each node on the tree representing a structure in the real Native service code.
Specifically, the code compiler may be a compiler of JavaScript code, for example, a Babel compiler. When the abstract syntax tree of the real Native service code is obtained by the code compiler, the real Native service code may be statically analyzed (the code is analyzed without executing the code) using a Babel compiler, thereby generating the abstract syntax tree (Abstract Syntax Tree, AST). Wherein the Babe l compiler provides AP I for parsing of the exact nature I ve business code and construction of the abstract syntax tree (Abstract Syntax Tree, AST).
When the abstract syntax tree (Abstract Syntax Tree, AST) is generated by a Babe l compiler, the character stream in the real nature business code needs to be read first, then the lexical unit token is generated by lexical analysis, and then the lexical unit token generated by lexical analysis is converted into the abstract syntax tree (Abstract Syntax Tree, AST) with a grammatical meaning by syntax analysis. The lexical analysis refers to dividing the whole code character string into a minimum grammar unit array; whereas parsing refers to building relationships between parsing syntax elements on a word segmentation basis.
And step S720, adding the detection code into the real Native service code for repeated rendering inspection according to the abstract syntax tree to obtain repeated rendering information.
In this embodiment, the detection code may be executed while executing the real Native service code by traversing the abstract syntax tree (Abstract Syntax Tree, AST) generated in step S710 to locate the relevant code for component rendering, thereby adding the detection code to the real Native service code at an appropriate location. In this way, by executing the detection code, it is possible to perform a repeated rendering check on the real Native service code, and record the repeated rendering information, for example, a component name, a reason for repeated rendering, when repeated rendering is detected.
Specifically, the detection code may be used to detect whether there is a repeated rendering in the reactive service code. When the detection code is added to the real Native service code, the detection code can be added to the real Native service code through a run time line framework, so that repeated rendering inspection is performed on the real Native service code. The run time line framework can dynamically monitor and analyze the execution of the real Native business code as the application runs, and provide real-time feedback and warnings.
The detection code may be Stub code (Stub). The real Native service code may be JavaScript code.
Step S730, storing the repeated rendering information in a performance log file.
In this embodiment, when the detection code detects repeated rendering, the repeated rendering information may be obtained and stored in the performance log (Profile) file.
When analyzing the performance log (Profile) file and generating a test report, the repeated rendering information may also be analyzed and displayed in the test report. The test report may count the number of times each component is rendered, including the number of times each component is rendered in different scenes, so that components that are frequently rendered may be found, thereby finding out possible performance problems. The test report can also count the rendering times of the repeated rendering components, namely the repeated rendering times of the components under the same propes and State conditions, so that the components with repeated rendering problems can be conveniently found, and the optimization and improvement are performed.
In the design, the abstract syntax tree (Abstract Syntax Tree, AST) generated by the code compiler is used for injecting the detection code into the real Native service code for repeated rendering inspection, so that the repeated rendering problem can be actively found, and the performance optimization is facilitated in the process of service development.
Based on the same inventive concept, the present embodiment further provides an electronic device 700, please refer to fig. 6, and fig. 6 illustrates a block schematic diagram of the electronic device 700. The electronic device 700 includes a page testing apparatus 730, a computer readable storage medium 720, and a processor 710.
The computer readable storage medium 720 and the processor 710 are directly or indirectly electrically connected to each other to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The page test device 730 includes a plurality of software functional modules that may be stored in the computer readable storage medium 720 in the form of software or firmware (firmware) or cured in an Operating System (OS) of the page test device 730. The processor 710 is configured to execute executable modules stored in the computer readable storage medium 720, such as software functional modules and computer programs included in the page test device 730.
The computer readable storage medium 720 may be, but is not limited to, a random access Memory (Random Access Memory, RAM), a Read Only Memory (ROM), a programmable Read Only Memory (Programmable Read-Only Memory, PROM), an erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc. Wherein the computer readable storage medium 720 is used for storing a program, and the processor 710 executes the program after receiving an execution instruction.
The processor 710 may be an integrated circuit chip with signal processing capabilities. The processor 710 may be a general-purpose processor 710, including a central processor 710 (Central Processing Unit, CPU for short), a network processor 710 (Network Processor, NP for short), etc.; but may also be a digital signal processor 710 (DSP), application Specific Integrated Circuit (ASIC), field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. The general purpose processor 710 may be a microprocessor 710 or the processor 710 may be any conventional processor 710 or the like.
Referring to fig. 7, the embodiment of the present application further provides a page testing apparatus 730. The page test apparatus 730 includes a plurality of functional modules that may be stored in the form of software in the computer readable storage medium 720. Functionally divided, the page testing apparatus 730 may include a first receiving module 731, a second receiving module 732, a control module 733, a testing module 734, a storage module 735, and an analyzing module 736. Wherein:
the first receiving module 731 may be configured to receive a test request.
In this embodiment, the first receiving module 731 may be used to perform step S100 shown in fig. 2, and a specific description of the first receiving module 731 may refer to a description of the step S100.
The second receiving module 732 may be configured to obtain a corresponding real Native page code according to the test request.
In this embodiment, the second receiving 732 module may be configured to perform step S200 shown in fig. 2, and for a specific description of the second receiving module 732, reference may be made to the description of step S200.
The control module 733 may be configured to establish communication with the non-interface browser 300, control the non-interface browser 300 to execute the real Native page code, and start a corresponding real Native page.
In this embodiment, the control module 733 may be used to perform step S300 shown in fig. 2, and for a specific description of the control module 733, reference may be made to the description of step S300.
The test module 734 may be configured to perform performance testing operations on the real Native page via the interfacial-less browser 300.
In this embodiment, the test module 734 may be configured to perform the step S400 shown in fig. 2, and for a specific description of the test module 734, reference may be made to the description of the step S400.
The storage module 735 may be configured to receive a page detection result sent by the non-interface browser 300, and store the page detection result in a performance log file.
In this embodiment, the storage module 735 may be used to perform step S500 shown in fig. 2, and for a specific description of the storage module 735, reference may be made to a description of the step S500.
The analysis module 736 can be used to analyze the performance log file and generate a test report.
In this embodiment, the analysis module 736 may be used to perform the step S600 shown in fig. 2, and for a specific description of the analysis module 736, reference may be made to the description of the step S600.
In summary, according to the page testing method, the device and the electronic equipment provided by the embodiment of the application, the real Native page code can be obtained through the testing request, after communication is established with the interface-free browser, the interface-free browser is controlled to execute the real Native page code, the real Native page is started, performance testing operation is executed on the real page through the interface-free browser, and the page detection result is stored in the performance log file, so that a testing report is generated. Therefore, the method can realize automatic performance detection of the real Native, actively find problems, and perform corresponding performance optimization and improvement in the process of service development according to the test report, thereby improving the problem analysis efficiency.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the same, but rather, various modifications and variations may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.

Claims (10)

1. A method of page detection, the method comprising:
receiving a test request;
acquiring a corresponding real Native page code according to the test request;
establishing communication with an interface-free browser, controlling the interface-free browser to execute the real Native page code, and starting a corresponding real Native page;
performing performance test operation on the real Native page through the interface-free browser;
receiving a page detection result sent by the interface-free browser, and storing the page detection result into a performance log file;
and analyzing the performance log file and generating a test report.
2. The method for detecting a page according to claim 1, wherein the step of receiving the page detection result sent by the interface-free browser and storing the page detection result in the performance log file comprises:
receiving a test stopping instruction sent by an automatic test platform, and sending the test stopping instruction to the interface-free browser, so that the interface-free browser stops detecting the real Native page;
and receiving a page detection result sent by the interface-free browser, and storing the page detection result into the performance log file.
3. The method for detecting a page according to claim 1, wherein the step of establishing communication with an interface-free browser, controlling the interface-free browser to execute the real Native page code, and starting a corresponding real Native page, includes:
establishing communication with the interface-free browser to obtain routing URL information;
and starting a corresponding real Native page according to the routing URL information, so that the real Native page is connected to a remote debugging service through the routing URL information.
4. The page detection method as recited in claim 1, wherein the step of establishing communication with an interface-less browser comprises:
communication is established with the Headless Chromium browser through Chrome DevTools Protocol.
5. The page detection method as recited in claim 1, wherein the step of receiving a test request comprises:
and receiving an HTTP request, wherein the HTTP request comprises the real Native service information.
6. The page detection method as recited in claim 5, wherein after the step of receiving an HTTP request, the HTTP request including real Native service information, the method further comprises:
and acquiring a real Native service code according to the real Native service information, performing repeated rendering inspection on the real Native service code, and storing the repeated rendering information into a performance log file.
7. The page detection method as claimed in claim 6, wherein the steps of acquiring the real Native service code according to the real Native service information, performing repeated rendering inspection on the real Native service code, and storing the repeated rendering information in a performance log file include:
generating an abstract syntax tree of the real Native service code by a code compiler;
adding a detection code into the real Native service code according to the abstract syntax tree to perform repeated rendering inspection to obtain repeated rendering information;
and storing the repeated rendering information to a performance log file.
8. A page detection apparatus, characterized by comprising:
the first receiving module is used for receiving the test request;
the second receiving module is used for acquiring a corresponding real Native page code according to the test request;
the control module is used for establishing communication with the interface-free browser, controlling the interface-free browser to execute the real Native page code and starting a corresponding real Native page;
the testing module is used for executing performance testing operation on the real Native page through the interface-free browser;
the storage module is used for receiving the page detection result sent by the interface-free browser and storing the page detection result into a performance log file;
and the analysis module is used for analyzing the performance log file and generating a test report.
9. An electronic device, comprising:
a memory for storing one or more programs;
a processor, which when executed by the processor, implements the method of any of claims 1-7.
10. A computer readable storage medium, having stored thereon a computer program, characterized in that the computer program, when executed by a processor, implements the method according to any of claims 1-7.
CN202311679358.7A 2023-12-07 2023-12-07 Page testing method and device and electronic equipment Pending CN117667716A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311679358.7A CN117667716A (en) 2023-12-07 2023-12-07 Page testing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311679358.7A CN117667716A (en) 2023-12-07 2023-12-07 Page testing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117667716A true CN117667716A (en) 2024-03-08

Family

ID=90074846

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311679358.7A Pending CN117667716A (en) 2023-12-07 2023-12-07 Page testing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117667716A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118885396A (en) * 2024-07-31 2024-11-01 广东保伦电子股份有限公司 A Web project inspection method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118885396A (en) * 2024-07-31 2024-11-01 广东保伦电子股份有限公司 A Web project inspection method and system

Similar Documents

Publication Publication Date Title
CN110688307B (en) JavaScript code detection method, device, equipment and storage medium
US8943423B2 (en) User interface indicators for changed user interface elements
US9535821B1 (en) Displaying violated coding rules in source code
US11074162B2 (en) System and a method for automated script generation for application testing
CN109710508A (en) Test method, test device, test equipment and computer readable storage medium
US12079298B2 (en) Methods and systems for browser extension used to generate relative XPath, absolute XPath and/or CSS selectors
CN108804305A (en) A kind of method and device of automatic test
CN113238940A (en) Interface test result comparison method, device, equipment and storage medium
Walsh et al. Automatically identifying potential regressions in the layout of responsive web pages
CN110955409B (en) Method and device for creating resources on cloud platform
CN112231213A (en) Web automated testing method, system, storage medium and terminal equipment
CN116991736A (en) Static code analysis method, device, system and storage medium
CN112817853A (en) Automatic test method, system and electronic equipment
CN114185791A (en) Method, device and equipment for testing data mapping file and storage medium
CN112732589A (en) Control testing method, device, equipment and storage medium
CN119847845A (en) Test method, device and storage medium for automatically checking BMC information
CN113419738A (en) Interface document generation method and device and interface management equipment
US20160292067A1 (en) System and method for keyword based testing of custom components
CN117667716A (en) Page testing method and device and electronic equipment
CN113760721A (en) Page testing method and device
CN111258562A (en) Java code quality inspection method, device, equipment and storage medium
CN111209210A (en) Method and device for generating test case, electronic equipment and storage medium
CN113377377A (en) Static code analysis method, analysis device, electronic device and readable storage medium
CN114490337A (en) Commissioning method, commissioning platform, equipment and storage medium
CN115795488B (en) Code detection system and code detection method

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