CN107783899B - Method and device for testing H5 page in application program and computer equipment - Google Patents
Method and device for testing H5 page in application program and computer equipment Download PDFInfo
- Publication number
- CN107783899B CN107783899B CN201710744860.XA CN201710744860A CN107783899B CN 107783899 B CN107783899 B CN 107783899B CN 201710744860 A CN201710744860 A CN 201710744860A CN 107783899 B CN107783899 B CN 107783899B
- Authority
- CN
- China
- Prior art keywords
- page
- tested
- test
- mobile terminal
- file
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3696—Methods or tools to render software testable
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application relates to a method for testing an H5 page in an application program, which comprises the following steps: acquiring an H5 page to be tested, and generating a test command corresponding to the H5 page to be tested; generating the test command to the mobile terminal so that an application program operated by the mobile terminal tests the H5 page to be tested according to the test command, and recording corresponding test data through a Webview kernel; receiving test data returned by the mobile terminal; converting the test data to generate a Har file; and analyzing the Har file to generate a test report corresponding to the H5 page to be tested. By adopting the method, the testing accuracy can be effectively improved when the H5 page in the application program is tested. In addition, the application also relates to a testing device and computer equipment for the H5 page in the application program.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for testing an H5 page in an application program, and a computer device.
Background
As the number of applications in mobile terminals increases, the number of H5 pages in the applications also increases. Testing the H5 page in the application before it is released has also become an important task. In a conventional manner, a tester tests an H5 page in a simulation application in a browser of a test terminal. Since the test environment is not tested in the real application program Webview (web view), operations in the H5 page, such as logging in the H5 page, need to be additionally processed, so that data interaction in the H5 page is not complete enough, thereby resulting in inaccurate test data.
Disclosure of Invention
In view of the above, it is necessary to provide a method, an apparatus, a computer device and a storage medium for testing H5 pages in an application program, which are effective in improving the testing accuracy when testing H5 pages in the application program.
A method for testing an H5 page in an application program comprises the following steps:
acquiring an H5 page to be tested, and generating a test command corresponding to the H5 page to be tested;
generating the test command to the mobile terminal so that an application program operated by the mobile terminal tests the H5 page to be tested according to the test command, and recording corresponding test data through a Webview kernel;
receiving test data returned by the mobile terminal;
converting the test data to generate a Har file;
and analyzing the Har file to generate a test report corresponding to the H5 page to be tested.
In one embodiment, the step of converting the test data to generate the Har file includes:
converting the binary test data into a Json file; the Json file comprises a plurality of requests initiated in a H5 page to be tested and a plurality of received responses, and the requests and the responses are arranged out of order;
and analyzing the multiple unordered requests and responses to generate a Har file.
In one embodiment, the step of parsing the out-of-order requests and responses to generate the Har file includes:
acquiring a page identifier corresponding to an H5 page to be tested, and inquiring a plurality of corresponding out-of-order requests and responses in a Json file according to the page identifier;
acquiring a request identifier, and inquiring a corresponding response identifier according to the request identifier;
acquiring one-to-one corresponding request and response by using the request identifier and the corresponding response identifier;
generating an HTTP request according to the one-to-one corresponding request and response;
the Har file is generated using a plurality of HTTP requests.
In one embodiment, the method further comprises:
accessing a mobile terminal management platform in a server;
acquiring a mobile terminal identifier through the mobile terminal management platform;
and carrying out remote test on the H5 page to be tested of the application program in the mobile terminal according to the mobile terminal identification.
In one embodiment, the method further comprises:
according to the test report, marking the H5 page to be tested as a tested H5 page;
acquiring a scoring item and a scoring rule corresponding to a tested H5 page;
and scoring the tested H5 page by using the Har file, the scoring item and the scoring rule.
An apparatus for testing a H5 page in an application, the apparatus comprising:
the test control module is used for acquiring an H5 page to be tested and generating a test command corresponding to the H5 page to be tested; generating the test command to the mobile terminal so that an application program operated by the mobile terminal tests the H5 page to be tested according to the test command, and recording corresponding test data through a Webview kernel; receiving test data returned by the mobile terminal;
the test data conversion module is used for converting the test data to generate a Har file; and analyzing the Har file to generate a test report corresponding to the H5 page to be tested.
In one embodiment, the test data conversion module is further configured to convert binary test data into a Json file; the Json file comprises a plurality of requests initiated in a H5 page to be tested and a plurality of received responses, and the requests and the responses are arranged out of order; and analyzing the multiple unordered requests and responses to generate a Har file.
In one embodiment, the device further comprises a remote connection module for accessing the mobile terminal management platform in the server; acquiring a mobile terminal identifier through the mobile terminal management platform; and carrying out remote test on the H5 page to be tested of the application program in the mobile terminal according to the mobile terminal identification.
A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the above method.
One or more computer-readable non-transitory storage media storing computer-readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the above-described method.
According to the method and the device for testing the H5 page in the application program, the computer equipment and the storage medium, after the application program running in the mobile terminal receives the test command, the H5 page to be tested is tested according to the test command, and test data reflecting the performance of the H5 page to be tested is recorded through the Webview kernel. The test terminal receives the test data returned by the mobile terminal, and converts the test data to generate a Har file, so that a test report corresponding to the H5 page to be tested can be obtained by using the Har file. In the process, the H5 page to be tested is tested in a real Webview environment, and the data interaction between the H5 page to be tested and the server is complete, so that the accuracy of the test data can be effectively improved. In the testing process, a testing environment does not need to be additionally built, the H5 page to be tested can be directly tested, and therefore the testing of the H5 page is easier to operate.
Drawings
FIG. 1 is a diagram illustrating an example of an application scenario for a method for testing H5 pages in an application;
FIG. 2 is a block diagram of the test terminal of FIG. 1;
FIG. 3 is a flow diagram of a method for testing the H5 page in an application program in one embodiment;
FIG. 4 is a block diagram of a device for testing the H5 page in an application in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The method for testing the H5 (HyperText Markup Language (HTML) 5 generation page) in the application provided in the embodiment of the present application may be applied to the application scenario shown in fig. 1. The test terminal 102 and the mobile terminal 104 are connected through a USB (Universal Serial Bus) interface and a data line. An application is installed in the mobile terminal 104, and an H5 page can be run in the application. The test terminal 102 has a test tool installed therein, and after the test terminal 102 establishes a connection with the mobile terminal 104, the test tool and the application program can communicate through a browser remote protocol. The test tool running in the test terminal 102 obtains the H5 page to be tested. The tester may generate a test command for the H5 page under test at the test tool. The test tool generates test commands to applications running in the mobile terminal 104 via the browser remote protocol. And the application program receives the test command, tests the H5 page to be tested according to the test command, and records corresponding test data through a Webview (network view) kernel. The mobile terminal 104 returns the test data to the test terminal 102 through the application. The test terminal 102 converts the received unreadable test data by using a test tool to generate a readable Har file, and generates a test report corresponding to the H5 page to be tested by analyzing the Har file.
FIG. 2 is an internal block diagram of a test terminal in one embodiment. The test terminal comprises a processor, a nonvolatile storage medium, an internal memory, a USB interface, a display screen and an input device which are connected through a system bus. Wherein the processor of the test terminal is used to provide computational and control capabilities. The memory of the test terminal comprises a nonvolatile storage medium and an internal memory. The nonvolatile storage medium of the test terminal stores an operating system and computer readable instructions, and the internal memory of the test terminal provides an environment for the operating system and the computer readable instructions in the nonvolatile storage medium to run. The computer readable instructions, when executed by a processor, implement a method for testing a H5 page in an application. The USB interface is used for being connected with the mobile terminal. The display screen of the test terminal can be a liquid crystal display screen or an electronic ink display screen, and the input device can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on a terminal shell, or an external keyboard, a touch pad or a mouse. The test terminal can be a desktop computer, a notebook computer, a mobile phone or a tablet computer and the like. It will be appreciated by those skilled in the art that the configuration shown in fig. 2 is a block diagram of only a portion of the configuration relevant to the present application, and does not constitute a limitation on the test terminal to which the present application is applied, and that a particular test terminal may include more or less components than those shown in the figures, or combine certain components, or have a different arrangement of components.
In an embodiment, as shown in fig. 3, a method for testing an H5 page in an application program is provided, which is described by taking an example that the method is applied to a test terminal, and specifically includes:
And step 304, generating a test command to the mobile terminal so that an application program operated by the mobile terminal tests the H5 page to be tested according to the test command, and recording corresponding test data through the Webview kernel.
An application program is installed in the mobile terminal, and an H5 page can be run in the application program. The mobile terminal may also be referred to as a terminal under test. The test terminal and the mobile terminal can establish local connection and also can establish remote connection. Specifically, the test terminal may establish a local connection with the mobile terminal through the USB interface and the data line. The test terminal can also establish remote connection with the mobile terminal through a mobile terminal management platform running in the access server.
In one embodiment, the method further comprises: accessing a mobile terminal management platform in a server; acquiring a mobile terminal identifier through a mobile terminal management platform; and carrying out remote test on the H5 page to be tested of the application program in the mobile terminal according to the mobile terminal identification.
The mobile terminal management platform running in the server can be connected with a plurality of mobile terminals to be tested. When the tester does not have a mobile terminal to be tested at the side temporarily and needs to test the H5 page in the application program through the mobile terminal to be tested, the remote test can be considered. A tester can access the mobile terminal management platform through a Web (network) page displayed in the test terminal to obtain a plurality of mobile terminals which are currently connected with the mobile terminal management platform. The tester can select one or more mobile terminals in the Web page by using the test terminal. The tester can operate the selected mobile terminal through the Web page, such as installing an application program.
The testing terminal is provided with a testing tool, and after the testing terminal is connected with the mobile terminal, the testing tool in the testing terminal and the application program in the mobile terminal can communicate through a browser remote protocol.
When the local connection is formed between the test terminal and the mobile terminal, a tester can open a H5 page to be tested of the application program in the mobile terminal. When the test terminal is remotely connected with the mobile terminal, a tester can open a H5 page to be tested of the application program through a Web page. The test tool running in the test terminal obtains the H5 page to be tested. The tester can click the 'start' button in the test interface displayed by the test tool, and the test tool responds to the operation of the tester to generate a test command of the H5 page to be tested. The test tool generates a test command to an application running in the mobile terminal through a browser remote protocol. And the application program receives the test command and tests the H5 page to be tested according to the test command.
Specifically, the application program clears the cache content in the H5 page currently to be tested according to the test command. After the emptying, the H5 page to be tested is refreshed, and a request is sent to the server. And the server responds to the request from the H5 page to be tested and returns corresponding data to the H5 page to be tested. And the application program receives the data returned by the server and loads the received data to the H5 page to be tested.
When the application program tests the H5 page to be tested according to the test command, the application program records corresponding debugging information through the Webview kernel. Debug information, which may also be referred to as test data, includes: total number of requests, request type, request response time, request content length, request content format, page response time, page load time, and request response status, etc. The test data reflects the page performance of the H5 page under test.
Due to the fact that the application program empties the cache content in the H5 page to be tested according to the test command, after the H5 page to be tested is refreshed, the Webview kernel can accurately record page performance data in the H5 page to be tested.
And 308, converting the test data to generate a Har file.
And step 310, analyzing the Har file to generate a test report corresponding to the H5 page to be tested.
After the Webview kernel records the test data corresponding to the H5 page to be tested, the application program sends the test data to a test tool running in the test terminal. Specifically, the application program reads the test data, generates a binary data stream from the test data according to a Websocket protocol (a network protocol), and sends the binary data stream to the test tool through the browser remote protocol. The test tool receives the binary data stream, converts the binary data stream, and generates a Har (a general file format for storing HTTP (HyperText Transfer Protocol) requests and responses) file.
The test terminal analyzes the Har file by using a test tool, reads test data in a Json (JavaScript Object Notification) format, and comprises the following steps: page load time, total number of requests, manner of request, url of request, and response, etc. And the test tool generates a test report corresponding to the H5 page to be tested according to the test data.
In this embodiment, after receiving the test command, the application running in the mobile terminal tests the H5 page to be tested according to the test command, and records test data reflecting the performance of the H5 page to be tested through the Webview kernel. The test terminal receives the test data returned by the mobile terminal, and converts the test data to generate a Har file, so that a test report corresponding to the H5 page to be tested can be obtained by using the Har file. In the process, the H5 page to be tested is tested in a real Webview environment, and the data interaction between the H5 page to be tested and the server is complete, so that the accuracy of the test data can be effectively improved. In the testing process, a testing environment does not need to be additionally built, the H5 page to be tested can be directly tested, and therefore the testing of the H5 page is easier to operate.
In one embodiment, the step of converting the test data to generate the Har file includes: converting the binary test data into a Json file; the Json file comprises a plurality of requests initiated in the H5 page to be tested and a plurality of received responses, and the requests and the responses are arranged out of order; and analyzing the multiple unordered requests and responses to generate a Har file.
In this embodiment, after the application program running in the mobile terminal generates the test data into the binary data stream, the binary data stream becomes unreadable, and therefore, after receiving the binary data stream, the test terminal needs to convert the binary test data. Specifically, the test tool converts the binary test data into a readable text format, i.e., into a readable string. And the test tool converts the test data in the readable text format into a Json format to generate a corresponding Json file.
The H5 page under test may send multiple requests to the server, and the server may return corresponding data in response to the multiple requests. After the binary test data is converted into a Json file, the requests and responses in the Json file are out of order. The test tool needs to align out-of-order requests with responses in order to generate HTTP requests.
If the page jump exists in the H5 page to be tested, the Json file at least comprises the request and the response of two H5 pages. In order to accurately obtain the request and the response of the H5 page to be tested, the test tool needs to extract the corresponding request and response from the Json file according to the page identifier corresponding to the H5 page to be tested.
In one embodiment, the step of parsing the out-of-order requests and responses to generate the Har file includes: acquiring a page identifier corresponding to an H5 page to be tested, and inquiring a plurality of corresponding out-of-order requests and responses in a Json file according to the page identifier; acquiring a request identifier, and inquiring a corresponding response identifier according to the request identifier; acquiring one-to-one corresponding request and response by using the request identifier and the corresponding response identifier; generating an HTTP request according to the one-to-one corresponding request and response; the Har file is generated using a plurality of HTTP requests.
The test tool utilizes the page identification corresponding to the H5 page to be tested to query a plurality of corresponding out-of-order requests and responses in the Json file. For example, the page identifier of the H5 page to be tested is a, the page identifier of the jump page is B, the request identifier in the H5 page to be tested is a10, and the one-to-one corresponding response identifier is a 20. The request in the jumped page is identified as B10, and the one-to-one corresponding response is identified as B20. The test tool queries corresponding requests and responses according to the page identifier of the H5 page to be tested, and generates a complete HTTP request using the one-to-one corresponding requests and responses, for example, a complete HTTP request using the request of a10 and the response of a 20. And the test tool acquires the format of the Har file, reads the data in the plurality of HTTP requests according to the format of the Har file, and generates the Har file. The test data can be recorded in a Json format in the Har file, and the method comprises the following steps: page load time, total number of requests, manner of request, url of request, and response, etc. And analyzing the Har file, and reading the test data in the Json format, so that a test report corresponding to the H5 page to be tested can be quickly generated.
In one embodiment, the method further comprises: according to the test report, marking the H5 page to be tested as a tested H5 page; acquiring a scoring item and a scoring rule corresponding to a tested H5 page; and (4) scoring the tested H5 page by using the Har file, the scoring item and the scoring rule.
In this embodiment, after the test tool generates the test report corresponding to the H5 page to be tested, the H5 page to be tested is marked as the tested H5 page. Thereby prompting the tester that the corresponding test work has been completed on the H5 page. In order to facilitate the testers to have intuitive understanding of the performance of the H5 page, the test tool may also score the tested H5 page using the test data in the test report.
Specifically, the step of obtaining the score item corresponding to the tested H5 page by the test tool includes: page loading time, page request number, page flow, whether a page has HTTP request errors, whether a page has js or css file compression, and the like. Each scoring item is configured with a corresponding scoring rule, and the testing tool can score according to the scoring rule. For example, if the page load time is greater than 5 seconds, the page requests more than 30 books, and the page traffic exceeds 1MB to directly return a fail. The total score was 100, the score of 100 was excellent, the score of 100 to 90 was good, the score of 80 to 70 was general, the score of 70 to 60 was passing, and the score of less than 60 was poor. By scoring the tested H5 page, the tester can intuitively know the performance quality of the H5 page according to the score, and convenience is provided for the tester.
As shown in fig. 4, the present application further provides a device for testing H5 page in an application program, the internal structure of the device may correspond to the structure shown in fig. 2, and each of the following modules may be implemented in whole or in part by software, hardware or a combination thereof. In one embodiment, the apparatus comprises: a test control module 402 and a test data conversion module 404, wherein:
the test control module 402 is configured to obtain an H5 page to be tested, and generate a test command corresponding to the H5 page to be tested; generating a test command to the mobile terminal so that an application program operated by the mobile terminal tests the H5 page to be tested according to the test command, and recording corresponding test data through a Webview kernel; and receiving test data returned by the mobile terminal.
A test data conversion module 404, configured to convert the test data to generate a Har file; and analyzing the Har file to generate a test report corresponding to the H5 page to be tested.
In one embodiment, the test data conversion module 404 is further configured to convert the binary test data into a Json file; the Json file comprises a plurality of requests initiated in the H5 page to be tested and a plurality of received responses, and the requests and the responses are arranged out of order; and analyzing the multiple unordered requests and responses to generate a Har file.
In one embodiment, the test data conversion module 404 is further configured to obtain a page identifier corresponding to the H5 page to be tested, and query a plurality of out-of-order requests and responses corresponding to the page identifier in the Json file; acquiring a request identifier, and inquiring a corresponding response identifier according to the request identifier; acquiring one-to-one corresponding request and response by using the request identifier and the corresponding response identifier; generating an HTTP request according to the one-to-one corresponding request and response; the Har file is generated using a plurality of HTTP requests.
In one embodiment, the apparatus further comprises a remote connection module 406 for accessing a mobile terminal management platform in the server; acquiring a mobile terminal identifier through a mobile terminal management platform; and carrying out remote test on the H5 page to be tested of the application program in the mobile terminal according to the mobile terminal identification.
In one embodiment, the apparatus further comprises a scoring module 408 for marking the H5 page to be tested as the tested H5 page according to the test report; acquiring a scoring item and a scoring rule corresponding to a tested H5 page; and (4) scoring the tested H5 page by using the Har file, the scoring item and the scoring rule.
In one embodiment, the present application further provides a computer device comprising a memory and a processor, the memory having stored therein computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of:
acquiring an H5 page to be tested, and generating a test command corresponding to the H5 page to be tested;
generating a test command to the mobile terminal so that an application program operated by the mobile terminal tests the H5 page to be tested according to the test command, and recording corresponding test data through a Webview kernel;
receiving test data returned by the mobile terminal;
converting the test data to generate a Har file;
and analyzing the Har file to generate a test report corresponding to the H5 page to be tested.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
converting the binary test data into a Json file; the Json file comprises a plurality of requests initiated in the H5 page to be tested and a plurality of received responses, and the requests and the responses are arranged out of order;
and analyzing the multiple unordered requests and responses to generate a Har file.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
acquiring a page identifier corresponding to an H5 page to be tested, and inquiring a plurality of corresponding out-of-order requests and responses in a Json file according to the page identifier;
acquiring a request identifier, and inquiring a corresponding response identifier according to the request identifier;
acquiring one-to-one corresponding request and response by using the request identifier and the corresponding response identifier;
generating an HTTP request according to the one-to-one corresponding request and response;
the Har file is generated using a plurality of HTTP requests.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
accessing a mobile terminal management platform in a server;
acquiring a mobile terminal identifier through a mobile terminal management platform;
and carrying out remote test on the H5 page to be tested of the application program in the mobile terminal according to the mobile terminal identification.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
according to the test report, marking the H5 page to be tested as a tested H5 page;
acquiring a scoring item and a scoring rule corresponding to a tested H5 page;
and (4) scoring the tested H5 page by using the Har file, the scoring item and the scoring rule.
In one embodiment, the present application also provides one or more computer-readable non-transitory storage media storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of:
acquiring an H5 page to be tested, and generating a test command corresponding to the H5 page to be tested;
generating a test command to the mobile terminal so that an application program operated by the mobile terminal tests the H5 page to be tested according to the test command, and recording corresponding test data through a Webview kernel;
receiving test data returned by the mobile terminal;
converting the test data to generate a Har file;
and analyzing the Har file to generate a test report corresponding to the H5 page to be tested.
In one embodiment, the computer readable instructions when executed by the processor further perform the steps of:
converting the binary test data into a Json file; the Json file comprises a plurality of requests initiated in the H5 page to be tested and a plurality of received responses, and the requests and the responses are arranged out of order;
and analyzing the multiple unordered requests and responses to generate a Har file.
In one embodiment, the computer readable instructions when executed by the processor further perform the steps of:
acquiring a page identifier corresponding to an H5 page to be tested, and inquiring a plurality of corresponding out-of-order requests and responses in a Json file according to the page identifier;
acquiring a request identifier, and inquiring a corresponding response identifier according to the request identifier;
acquiring one-to-one corresponding request and response by using the request identifier and the corresponding response identifier;
generating an HTTP request according to the one-to-one corresponding request and response;
the Har file is generated using a plurality of HTTP requests.
In one embodiment, the computer readable instructions when executed by the processor further perform the steps of:
accessing a mobile terminal management platform in a server;
acquiring a mobile terminal identifier through a mobile terminal management platform;
and carrying out remote test on the H5 page to be tested of the application program in the mobile terminal according to the mobile terminal identification.
In one embodiment, the computer readable instructions when executed by the processor further perform the steps of:
according to the test report, marking the H5 page to be tested as a tested H5 page;
acquiring a scoring item and a scoring rule corresponding to a tested H5 page;
and (4) scoring the tested H5 page by using the Har file, the scoring item and the scoring rule.
It will be understood by those of ordinary skill in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a non-volatile computer readable storage medium, and when executed, can include processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A method for testing an H5 page in an application program comprises the following steps:
acquiring an H5 page to be tested, and generating a test command corresponding to the H5 page to be tested, wherein the test command comprises the following steps: when remote connection is established between the application program and the mobile terminal, opening a H5 page to be tested of the application program through a Web page;
sending the test command to the mobile terminal through a browser remote protocol, so that an application program operated by the mobile terminal clears cache content in the current H5 page to be tested according to the test command, tests the H5 page to be tested, and records corresponding test data through a Webview kernel;
receiving test data returned by the mobile terminal through the application program;
converting the test data to generate a Har file; converting the binary test data into a Json file; the Json file comprises a plurality of requests initiated in a H5 page to be tested and a plurality of received responses, and the requests and the responses are arranged out of order; analyzing the multiple unordered requests and responses to generate a Har file; when the page jump exists in the H5 page to be detected, extracting corresponding requests and responses in the Json file according to the page identification corresponding to the H5 page to be detected; the converting the binary test data into the Json file includes: converting the binary test data into a readable text format; converting the test data in the readable text format into a Json format to generate a corresponding Json file;
analyzing the Har file to generate a test report corresponding to the H5 page to be tested;
according to the test report, marking the H5 page to be tested as a tested H5 page; acquiring a scoring item corresponding to a tested H5 page and a pre-configured scoring rule; and scoring the tested H5 page by using the Har file, the scoring item and the scoring rule.
2. The method of claim 1, wherein the step of parsing the out-of-order plurality of requests and responses to generate the Har file comprises:
acquiring a page identifier corresponding to an H5 page to be tested, and inquiring a plurality of corresponding out-of-order requests and responses in a Json file according to the page identifier;
acquiring a request identifier, and inquiring a corresponding response identifier according to the request identifier;
acquiring one-to-one corresponding request and response by using the request identifier and the corresponding response identifier;
generating an HTTP request according to the one-to-one corresponding request and response;
the Har file is generated using a plurality of HTTP requests.
3. The method of claim 2, wherein generating the Har file using the plurality of HTTP requests comprises:
and acquiring the format of the Har file, reading data in the plurality of HTTP requests according to the format of the Har file, and generating the Har file.
4. The method of claim 1, further comprising:
accessing a mobile terminal management platform in a server;
acquiring a mobile terminal identifier through the mobile terminal management platform;
and carrying out remote test on the H5 page to be tested of the application program in the mobile terminal according to the mobile terminal identification.
5. An apparatus for testing H5 page in an application program, the apparatus comprising:
the test control module is used for acquiring an H5 page to be tested and generating a test command corresponding to the H5 page to be tested; sending the test command to the mobile terminal, so that an application program operated by the mobile terminal clears the cache content in the current H5 page to be tested according to the test command, tests the H5 page to be tested, and records corresponding test data through a Webview kernel; receiving test data returned by the mobile terminal through the application program;
the test data conversion module is used for converting the test data to generate a Har file; analyzing the Har file to generate a test report corresponding to the H5 page to be tested; converting the binary test data into a Json file; the Json file comprises a plurality of requests initiated in a H5 page to be tested and a plurality of received responses, and the requests and the responses are arranged out of order; analyzing the multiple unordered requests and responses to generate a Har file; when the page jump exists in the H5 page to be detected, extracting corresponding requests and responses in the Json file according to the page identification corresponding to the H5 page to be detected; converting the binary test data into a readable text format; converting the test data in the readable text format into a Json format to generate a corresponding Json file;
the test control module is also used for opening a H5 page to be tested of the application program through a Web page and sending the test command to the mobile terminal through a browser remote protocol when remote connection is established between the test control module and the mobile terminal;
the scoring module is used for marking the H5 page to be tested as a tested H5 page according to the test report; acquiring a scoring item corresponding to a tested H5 page and a pre-configured scoring rule; and scoring the tested H5 page by using the Har file, the scoring item and the scoring rule.
6. The apparatus of claim 5, further comprising a remote connection module for accessing a mobile terminal management platform in a server; acquiring a mobile terminal identifier through the mobile terminal management platform; and carrying out remote test on the H5 page to be tested of the application program in the mobile terminal according to the mobile terminal identification.
7. The device of claim 5, wherein the test data conversion module is further configured to obtain a page identifier corresponding to the H5 page to be tested, and query a plurality of out-of-order requests and responses corresponding to the page identifier in the Json file; acquiring a request identifier, and inquiring a corresponding response identifier according to the request identifier; acquiring one-to-one corresponding request and response by using the request identifier and the corresponding response identifier; generating an HTTP request according to the one-to-one corresponding request and response; the Har file is generated using a plurality of HTTP requests.
8. The apparatus of claim 7, wherein the test data conversion module is further configured to obtain a format of a Har file, and read data in the multiple HTTP requests according to the format of the Har file to generate the Har file.
9. A computer device comprising a memory and a processor, the memory having stored therein computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of the method of any one of claims 1 to 4.
10. One or more computer-readable non-transitory storage media storing computer-readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the method of any one of claims 1-4.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710744860.XA CN107783899B (en) | 2017-08-25 | 2017-08-25 | Method and device for testing H5 page in application program and computer equipment |
PCT/CN2018/078328 WO2019037406A1 (en) | 2017-08-25 | 2018-03-07 | Test method and apparatus for h5 page in application and computer device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710744860.XA CN107783899B (en) | 2017-08-25 | 2017-08-25 | Method and device for testing H5 page in application program and computer equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107783899A CN107783899A (en) | 2018-03-09 |
CN107783899B true CN107783899B (en) | 2020-11-24 |
Family
ID=61438205
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710744860.XA Active CN107783899B (en) | 2017-08-25 | 2017-08-25 | Method and device for testing H5 page in application program and computer equipment |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN107783899B (en) |
WO (1) | WO2019037406A1 (en) |
Families Citing this family (19)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108874674A (en) * | 2018-06-21 | 2018-11-23 | 北京金山安全软件有限公司 | page debugging method and device |
CN109240912B (en) * | 2018-08-14 | 2024-02-23 | 深圳市兴海物联科技有限公司 | Webpage application performance evaluation method and terminal based on big data analysis |
CN109117379A (en) * | 2018-09-21 | 2019-01-01 | 四川长虹电器股份有限公司 | A kind of WEB terminal performance test data auto-collection system and method |
CN109460264A (en) * | 2018-09-26 | 2019-03-12 | 深圳壹账通智能科技有限公司 | The acquisition methods of the H5 page, device and computer equipment in application program |
CN109766256B (en) * | 2018-12-21 | 2023-02-07 | 中国平安财产保险股份有限公司 | Method and device for testing H5 page performance in application program and computer equipment |
CN109739754B (en) * | 2018-12-25 | 2022-03-11 | 北京仁科互动网络技术有限公司 | Automatic testing method and system for application program based on WeChat development |
CN109815089A (en) * | 2019-01-16 | 2019-05-28 | 中国平安财产保险股份有限公司 | H5 page monitoring method, device, computer equipment and storage medium |
CN109977027A (en) * | 2019-04-04 | 2019-07-05 | 广州市百果园信息技术有限公司 | A kind of method, apparatus of performance test, system, equipment and storage medium |
CN110245068A (en) * | 2019-04-25 | 2019-09-17 | 深圳壹账通智能科技有限公司 | Automated testing method, device and the computer equipment of the H5 page |
CN110232021A (en) * | 2019-05-21 | 2019-09-13 | 深圳壹账通智能科技有限公司 | The method and device of page test |
CN110245078B (en) * | 2019-05-24 | 2020-11-13 | 平安国际智慧城市科技股份有限公司 | Software pressure testing method and device, storage medium and server |
CN110597584A (en) * | 2019-08-15 | 2019-12-20 | 香港乐蜜有限公司 | Page adaptation testing method and device, electronic equipment and storage medium |
CN110727576B (en) * | 2019-08-22 | 2024-04-26 | 中国平安财产保险股份有限公司 | Web page testing method, device, equipment and storage medium |
CN110750463B (en) * | 2019-10-29 | 2023-06-23 | 百度在线网络技术(北京)有限公司 | Method, device, system, equipment and medium for testing small program |
CN113449227B (en) * | 2020-03-24 | 2023-09-19 | 北京新氧科技有限公司 | Page information processing method and terminal equipment |
CN113495838B (en) * | 2020-04-08 | 2024-01-09 | 阿里巴巴集团控股有限公司 | Page testing method and device |
CN112597054B (en) * | 2020-12-30 | 2023-04-11 | 深圳市世强元件网络有限公司 | Mobile terminal H5 page application testing device, testing method and computer terminal |
CN114064513B (en) * | 2022-01-12 | 2022-06-21 | 北京新氧科技有限公司 | Page fluency performance detection method, device, equipment and system |
CN114490378A (en) * | 2022-01-24 | 2022-05-13 | 北京达佳互联信息技术有限公司 | Page debugging method and device, electronic equipment and computer readable storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107040609A (en) * | 2017-05-25 | 2017-08-11 | 腾讯科技(深圳)有限公司 | A kind of network request treating method and apparatus |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101193007A (en) * | 2006-11-28 | 2008-06-04 | 国际商业机器公司 | Testing method, scenario testing method and corresponding device for URL command |
CN104461903B (en) * | 2014-12-26 | 2017-07-28 | 北京奇虎科技有限公司 | The method and apparatus of test client based on browser |
CN104933174B (en) * | 2015-07-01 | 2018-05-22 | 北京博睿宏远数据科技股份有限公司 | The method that traversal solution cell phone application type adaptation issues are automated based on control |
-
2017
- 2017-08-25 CN CN201710744860.XA patent/CN107783899B/en active Active
-
2018
- 2018-03-07 WO PCT/CN2018/078328 patent/WO2019037406A1/en active Application Filing
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107040609A (en) * | 2017-05-25 | 2017-08-11 | 腾讯科技(深圳)有限公司 | A kind of network request treating method and apparatus |
Non-Patent Citations (1)
Title |
---|
从0到1:打造移动端H5性能测试平台;腾讯移动品质中心TMQ;《https://blog.csdn.net/TMQ1225/article/details/53204476》;20161117;第1-9页 * |
Also Published As
Publication number | Publication date |
---|---|
WO2019037406A1 (en) | 2019-02-28 |
CN107783899A (en) | 2018-03-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107783899B (en) | Method and device for testing H5 page in application program and computer equipment | |
US8326922B2 (en) | Method for server-side logging of client browser state through markup language | |
CN107145440B (en) | Application program testing method and device and computer equipment | |
CN107783898B (en) | Test method and test equipment for mobile application | |
US9870279B2 (en) | Analysis apparatus and analysis method | |
US20180131779A1 (en) | Recording And Triggering Web And Native Mobile Application Events With Mapped Data Fields | |
JP4745819B2 (en) | Vulnerability determination system and inspection device | |
WO2021061185A1 (en) | Test automation of application | |
CN107797917B (en) | Performance test script generation method and device | |
CN112965711B (en) | Job testing method and device, electronic equipment and storage medium | |
US9104573B1 (en) | Providing relevant diagnostic information using ontology rules | |
WO2015120787A1 (en) | Webpage detection method and apparatus | |
CN111459802B (en) | Method, device and equipment for testing WebView page of Android application program based on GUI | |
CN113032237A (en) | Data processing method and device, electronic equipment and computer readable storage medium | |
CN110276183B (en) | Reverse Turing verification method and device, storage medium and electronic equipment | |
US8959209B1 (en) | Systems and methods to indicate compatibility | |
CN115514677B (en) | Method and system for server dial testing | |
US7882205B2 (en) | Device setting apparatus, device setting method, information acquiring apparatus, information acquiring method, storage medium, and program | |
JP6798050B1 (en) | Generator, generation method and generation program | |
CN111104328B (en) | Use case generation method and device, computer equipment and readable storage medium | |
CN114064510A (en) | Function testing method and device, electronic equipment and storage medium | |
CN107451047B (en) | Browser function testing method and system and electronic equipment | |
KR20210041269A (en) | Intelligent crawling system and intelligent crawling method | |
CN113703780B (en) | Decompilation detection and webpage resource data sending method, device, equipment and medium | |
KR20140039786A (en) | System and method for debugging message linkage |
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 | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20180530 Address after: 518052 Room 201, building A, 1 front Bay Road, Shenzhen Qianhai cooperation zone, Shenzhen, Guangdong Applicant after: Shenzhen one ledger Intelligent Technology Co., Ltd. Address before: 200000 Xuhui District, Shanghai Kai Bin Road 166, 9, 10 level. Applicant before: Shanghai Financial Technologies Ltd |
|
TA01 | Transfer of patent application right | ||
GR01 | Patent grant | ||
GR01 | Patent grant |