Automatic testing method and device, electronic equipment and storage medium

By creating a transparent layer on the application device to be tested and utilizing the cross-end features of the browser kernel, the problems of low log review efficiency and cross-end applicability in automated testing are solved, and efficient test log display and rapid error location are achieved. Suitable for a variety of device-side applications.

CN118535446APending Publication Date: 2024-08-23TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310204460.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In the existing technology, during the automated testing process, it is necessary to frequently jump between different devices or interfaces to check logs, resulting in low testing efficiency. Moreover, it is difficult to obtain and apply the code of third-party applications to different platforms, making it difficult to implement cross-end testing.

Method used

By creating a transparent layer on the application device to be tested, the test log information is displayed in real time, and the cross-end feature of the browser kernel is used to obtain the injected code to display the test log in the web view, which is suitable for testing of different device-side applications.

Benefits of technology

It improves the debugging efficiency and applicability of automated testing, can quickly find the cause of test errors, reduces costs, and is suitable for the testing process of different device-side applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535446A
    Figure CN118535446A
Patent Text Reader

Abstract

The invention discloses an automatic testing method and device, electronic equipment and a storage medium, and the method comprises the steps: in a process of testing a to-be-tested application based on a test program, obtaining an injection code based on a preset connection channel, the preset connection channel being a connection channel between a local browser kernel and the test program; and injecting the injection code into the target webpage view and running the injection code, creating a transparent layer in the target webpage view, and displaying test log information based on the transparent layer. By utilizing the technical scheme provided by the invention, the test log information can be displayed in real time on the equipment where the to-be-tested application is located through the transparent image layer in the test process, debugging in the automatic test development process is facilitated, and under the condition of test report errors, the test log can be quickly checked to search for reasons, so that the test efficiency is improved; and meanwhile, based on the cross-end characteristic of the browser, the method can be suitable for the testing process of different equipment end applications, and has relatively high applicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an automated testing method, device, electronic device and storage medium. Background Art

[0002] Application testing is the process of operating a program under specified conditions to discover program errors, measure application quality, and evaluate whether the tested application meets design requirements. Therefore, the application needs to be actually tested on the running platform or client. In the process of automated testing of the application, it is usually necessary to rely on test logs to analyze the operations of the test process.

[0003] In the prior art, when testing applications in some electronic devices, it is usually necessary to export log files to a fixed computer in order to view the log files generated during the operation of the application. During the test, it is necessary to repeatedly jump between different devices or different interfaces to view the actual test process and test logs, which brings inconvenience to the automated testing process and affects the overall efficiency of the test. In addition, if an information display interface is to be injected into the interface of a third-party application, the usual solution is to modify the code of the third-party application, but the third-party application code is difficult to obtain, and the development language of the third-party application is also various, which is difficult to be used for different platforms and clients. Summary of the invention

[0004] The present application provides an automated testing method, apparatus, electronic device, storage medium and computer program product, which can display test log information in real time on the device where the application to be tested is located through a transparent layer during the test process, thereby facilitating debugging during the automated test development process, and in the event of a test error, can quickly view the test log to find the cause, thereby improving test efficiency; at the same time, based on the cross-end characteristics of the browser, it can be applied to the testing process of applications on different device ends, and has strong applicability.

[0005] In one aspect, the present application provides an automated testing method, the method comprising:

[0006] In the process of testing the application to be tested based on the test program corresponding to the application to be tested, a first injection code and a second injection code are obtained based on a preset connection channel, the preset connection channel is a connection channel between a local browser kernel and the test program, the first injection code is used to construct a transparent layer, and the second injection code is used to indicate that the test log information corresponding to the application to be tested is the display information corresponding to the transparent layer;

[0007] Injecting the first injection code and the second injection code into a target web page view;

[0008] During the process of the target web page view running the first injection code and the second injection code, the transparent layer is created in the target web page view, and the test log information is displayed based on the transparent layer.

[0009] Optionally, when the application to be tested is a mobile application, the target web page view includes a first web page view, and in the process of testing the application to be tested based on a test program corresponding to the application to be tested, before acquiring the first injection code and the second injection code, the method further includes:

[0010] Overlaying a preset application in a transparent floating manner on the upper layer of the application to be tested, wherein the preset application includes the first web page view;

[0011] Correspondingly, the creating the transparent layer in the target webpage view and displaying the test log information based on the transparent layer includes:

[0012] Launching the preset application to display the first web page view;

[0013] Based on the first preset style information, the transparent layer is rendered on the first webpage view, and the test log information is displayed based on the transparent layer.

[0014] Optionally, after the upper layer of the application to be tested covers the preset application in a transparent floating manner, the method further includes:

[0015] The event detection function of the preset application is turned off, so that the application to be tested detects the test event during the test of the application to be tested.

[0016] Optionally, the method further includes:

[0017] Turning on the web page debugging switch, wherein turning on the web page debugging switch indicates that the mobile terminal allows web page debugging;

[0018] Correspondingly, rendering the transparent layer on the first webpage view based on the first preset style information, and displaying the test log information based on the transparent layer includes:

[0019] When the web page debugging switch is turned on, the transparent layer is rendered on the first web page view based on the first preset style information, and the test log information is displayed based on the transparent layer.

[0020] Optionally, when the application to be tested is a web application, the target web view includes a second web view in a test page of the application to be tested, and creating the transparent layer in the target web view and displaying the test log information based on the transparent layer includes:

[0021] Based on the second preset style information, the transparent layer is rendered on the second webpage view, and the test log information is displayed based on the transparent layer.

[0022] Optionally, the method further includes:

[0023] Obtaining a preset connection address corresponding to the browser kernel;

[0024] Based on the preset connection address, the preset connection channel is established.

[0025] Optionally, in the process of testing the application to be tested based on the test program corresponding to the application to be tested, acquiring the first injection code and the second injection code based on the preset connection channel includes:

[0026] In a process of testing the application to be tested based on a test program corresponding to the application to be tested, the first injection code and the second injection code are obtained from the test program based on the preset connection channel.

[0027] Optionally, the method further includes:

[0028] Based on the preset connection channel, the test log information corresponding to the application to be tested is obtained.

[0029] Another aspect provides an automated testing device, the device comprising:

[0030] A first acquisition module is used to acquire a first injection code and a second injection code based on a preset connection channel during a process of testing the application to be tested based on a test program corresponding to the application to be tested, wherein the preset connection channel is a connection channel between a local browser kernel and the test program, the first injection code is used to construct a transparent layer, and the second injection code is used to indicate that the test log information corresponding to the application to be tested is the display information corresponding to the transparent layer;

[0031] An injection module, used for injecting the first injection code and the second injection code into a target web page view;

[0032] A creation module is used to create the transparent layer in the target web page view and display the test log information based on the transparent layer during the process of the target web page view running the first injection code and the second injection code.

[0033] Another aspect provides an electronic device, including: a processor;

[0034] a memory for storing instructions executable by the processor;

[0035] The processor is configured to execute the instructions to implement any of the above-mentioned automated testing methods.

[0036] On the other hand, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute any of the above-mentioned automated testing methods.

[0037] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the automated testing method provided in the above-mentioned various optional implementations.

[0038] The automated testing method, device, equipment, storage medium, and computer program product provided by this application have the following technical effects:

[0039] In the process of testing the application to be tested based on the test program corresponding to the application to be tested, the present application obtains the injection code based on the connection channel between the local browser kernel and the test program. Based on the cross-end characteristics of the browser kernel, it can be applicable to the testing process of applications on different device ends, and at the same time, it has low cost and strong applicability. The above injection code is injected into the web page view, and then the injection code is run to create a transparent layer in the web page view. During the test, the test log information is displayed in real time on the device where the application to be tested is located through the transparent layer, which is convenient for debugging in the process of automated test development. In the case of a test error, the test log can be quickly viewed to find the cause, thereby improving the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0041] Figure 1 It is a schematic diagram of an application environment of an automated testing method provided in an embodiment of the present application;

[0042] Figure 2 It is a flowchart of an automated testing method provided in an embodiment of the present application;

[0043] Figure 3This is a schematic diagram of a mobile application test log display provided by an embodiment of the present application;

[0044] Figure 4 This is a schematic diagram of a web application test log display provided by an embodiment of the present application;

[0045] Figure 5 It is a flowchart of a mobile terminal application automation testing method provided in an embodiment of the present application;

[0046] Figure 6 It is a flowchart of another mobile terminal application automation testing method provided in an embodiment of the present application;

[0047] Figure 7 It is a flowchart of a method for automated testing of web applications provided in an embodiment of the present application;

[0048] Figure 8 It is a structural schematic diagram of an automated testing device provided in an embodiment of the present application;

[0049] Fig. 9 It is a structural diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0051] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0052] See also Figure 1 , Figure 1It is a schematic diagram of an application environment of an automated testing method provided in an embodiment of the present application, and the application environment may at least include a server 100, a first terminal 200, and a second terminal 300.

[0053] Among them, the server 100 can be used to provide background services for the first terminal 200. The server 100 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0054] The first terminal 200 may be a terminal installed with the application to be tested, and may include but is not limited to smart phones, desktop computers, tablet computers, laptop computers, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, vehicle terminals, smart TVs and other types of electronic devices; it may also be software running on the above electronic devices, such as applications, applets, etc. The operating system running on the electronic device in the embodiment of the present application may include but is not limited to Android system, iOS system, Linux, Windows, etc.

[0055] The second terminal 300 can be used to run the test program. The second terminal 300 can include but is not limited to smart phones, desktop computers, tablet computers, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, vehicle terminals, smart TVs and other types of electronic devices; it can also be software running on the above electronic devices, such as applications, applets, etc. The operating system running on the electronic device in the embodiment of the present application can include but is not limited to Android system, iOS system, Linux, Windows, etc.

[0056] In addition, it should be noted that Figure 1 What is shown is merely an application environment of an automated testing method, and the embodiments of this specification are not limited to the above. For example, when the application to be tested is a web application, the first terminal 200 and the second terminal 300 may be the same terminal.

[0057] In the embodiments of this specification, the server 100 and the first terminal 200 and the first terminal 200 and the second terminal 300 may be directly or indirectly connected via wired or wireless communication, and this application does not impose any limitation thereto.

[0058] In the design and development process of Internet products, a Develop / Debug mode is often provided for developers to use when debugging products. At the same time, testers also use the Develop / Debug mode to develop and verify the automated testing of software products. For example, the development and debugging of the web page relies on the browser as a carrier. The kernel varies depending on the browser, but no matter which kernel is used, a development tool protocol is provided to enable developers to debug each process of web page parsing; mobile development and debugging can be based on hybrid development web page debugging, and the mobile application can be debugged through the browser development tool protocol and the developer mode provided by the system.

[0059] The following introduces an automated testing method of this application. Figure 2 It is a flowchart of an automated testing method provided in an embodiment of the present application. This specification provides method operation steps such as the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only execution order. When the actual system or terminal product is executed, it can be executed in the order shown in the embodiment or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment). Specifically, Figure 2 As shown, the above method may include:

[0060] S201: In a process of testing an application to be tested based on a test program corresponding to the application to be tested, a first injection code and a second injection code are acquired based on a preset connection channel.

[0061] In a specific embodiment, the application to be tested may be an application that needs to be tested and evaluated. Specifically, the application to be tested may include a variety of device-side applications such as mobile terminals and web terminals. The test program may be a program that tests the application to be tested in combination with actual test requirements; the preset connection channel may be a connection channel between a local browser kernel and the test program. Specifically, the connection channel may be a Socket connection channel. Socket connection may support different communication protocols. Specifically, both parties of the Socket connection may communicate based on the browser development tool protocol.

[0062] In a specific embodiment, the first injection code can be used to construct a transparent layer, and the second injection code can be used to indicate that the test log information corresponding to the application to be tested is the display information corresponding to the transparent layer. Specifically, the first injection code and the second injection code can be codes written based on JavaScript.

[0063] In an optional embodiment, in the process of testing the application to be tested based on the test program corresponding to the application to be tested, obtaining the first injection code and the second injection code based on the preset connection channel may include:

[0064] In a process of testing the application to be tested based on a test program corresponding to the application to be tested, a first injection code and a second injection code are obtained from the test program based on a preset connection channel.

[0065] In a specific embodiment, the first injection code and the second injection code may be written into a test program corresponding to the application to be tested, and the first injection code and the second injection code may be obtained from the test program based on a connection channel between a local browser kernel and the test program.

[0066] In the above embodiment, the above connection channel is used as an operation bridge between the local browser kernel and the test program, and the injection code can be directly obtained from the test program, eliminating the limitations of the prior art that relies on the USB interface for connection and test operations, and improving the convenience of testing.

[0067] In an optional embodiment, the above method may further include:

[0068] Get the preset connection address corresponding to the browser kernel;

[0069] Based on the preset connection address, a preset connection channel is established.

[0070] In a specific embodiment, the preset connection address may include a communication address and debugging port information corresponding to the browser kernel. Specifically, the communication address may be an IP address, and the debugging port information may be a debugging port number.

[0071] In actual applications, the test program may include a parameter statement for establishing a connection channel, and the above-mentioned communication address and debugging port information are written as parameters into the parameter statement. When the parameter statement is run, the above-mentioned preset connection channel is established, so that the web page view can be controlled based on the connection channel, for example, the event information of the web page view is obtained and the layout of the web page view is changed. Specifically, the layout of the web page view can be changed by injecting code into the page or sending a protocol message.

[0072] In a specific embodiment, when the application to be tested is a mobile application, the above-mentioned obtaining the preset connection address corresponding to the browser kernel may include: obtaining the debugging port information and communication address corresponding to the browser kernel based on the debugging instruction corresponding to the preset debugging tool; and using the debugging port and communication address as the preset connection address. Specifically, the above-mentioned preset debugging tool can be used to operate the mobile device where the application to be tested is located, for example, to obtain application information in the mobile device, obtain debugging information, and view test log information.

[0073] In a specific embodiment, when the application to be tested is a web application, the above-mentioned obtaining of the preset connection address corresponding to the browser kernel may include: in the process of starting the local browser, obtaining the debugging port information and communication address corresponding to the browser kernel; and using the debugging port and communication address as the preset connection address.

[0074] In actual applications, when the application to be tested is a web application, you can start the local browser through the CMD command line, and add preset startup parameters to the startup command to obtain the above-mentioned debugging port information and communication address. Specifically, the above-mentioned preset startup parameters can be remote-debuging-port (remote debugging port).

[0075] In the above embodiment, a connection channel between the browser kernel and the test program is established based on the connection address corresponding to the browser kernel, so that the injection code and test log information can be obtained through the connection channel later, thereby realizing the display of the test log information.

[0076] S203: Inject the first injection code and the second injection code into the target web page view.

[0077] In a specific embodiment, the target web page view may be a web page view in the device where the application to be tested is located. The target web page view may be used to carry a transparent layer to display test log information. Specifically, the transparent layer may be a container in the target web page view for displaying content information. When the application to be tested is a mobile application, the target web page view may be the first web page view in a preset application. Specifically, the preset application may be an application that is transparently suspended and covers the upper layer of the application to be tested. When the application to be tested is a web application, the target web page view may be the second web page view in the test page of the application to be tested.

[0078] In actual applications, the first injection code and the second injection code can be directly injected into the target web page view through the preset injection interface corresponding to the target web page view; the first injection code and the second injection code can be directly written in the corresponding positions of the preset injection instruction, and the preset injection instruction can be executed to inject the first injection code and the second injection code into the target web page view; the storage paths corresponding to the first injection code and the second injection code can also be written in the preset injection function, and the preset injection function can be executed to inject the first injection code and the second injection code into the target web page view.

[0079] S205: In the process of the target web page view running the first injection code and the second injection code, a transparent layer is created in the target web page view, and the test log information is displayed based on the transparent layer.

[0080] In a specific embodiment, the layout of the web page view may be adjusted by setting the style of the transparent layer, such as the position, border and background of the transparent layer.

[0081] In the above embodiment, during the test process, the test log information is displayed in real time on the device side where the application to be tested is located based on a transparent layer, which is convenient for debugging during the automated test development process. In the event of a test error, the test log can be quickly viewed to find the cause, thereby improving the test efficiency. At the same time, based on the cross-end characteristics of the browser kernel, it can be applicable to the test process of applications on different device sides, and has low cost and strong applicability.

[0082] In an optional embodiment, when the application to be tested is a mobile application, the target web page view includes a first web page view, and in the process of testing the application to be tested based on the test program corresponding to the application to be tested, before obtaining the first injection code and the second injection code, the above method may further include:

[0083] Overlay the preset application in a transparent floating manner on the top of the application to be tested;

[0084] Accordingly, the above-mentioned step of creating a transparent layer in the target webpage view and displaying the test log information based on the transparent layer may include:

[0085] Launching a preset application to display a first web page view;

[0086] Based on the first preset style information, a transparent layer is rendered on the first webpage view, and the test log information is displayed based on the transparent layer.

[0087] In a specific embodiment, the style of the preset application can be set through the interface configuration component in the preset application development tool, such as setting the preset application to a transparent style, setting the size of the preset application startup interface, etc. Specifically, the preset application development tool can be used to develop mobile applications; the preset application can include the above-mentioned first web page view, and the background of the web page view can be set to transparent.

[0088] In a specific embodiment, the first preset style information may be style information corresponding to a transparent layer on a web page view in a preset application when the application to be tested is a mobile application. Specifically, the style information may include position information, background information, and border information of the transparent layer.

[0089] For details, see Figure 3 , Figure 3 This is a schematic diagram of a mobile application test log display provided by an embodiment of the present application, wherein 301 is a mobile terminal, 302 is a screen display interface of the mobile terminal 301, 303 is the above-mentioned transparent layer, that is, the area in the dotted box, and 304 is the test log information displayed on the transparent layer. The application interface to be tested and the transparent interface of the preset application can be displayed on the screen display interface 302, and the transparent interface of the preset application is located on the upper layer of the application interface to be tested. The preset application includes a transparent-style web page view. When the preset application is started to display the transparent interface, the web page view is displayed at the same time. The transparent layer 303 is located on the web page view, and the test log information is displayed based on the transparent layer 303, so that the test log information can be displayed in real time in the upper layer of the mobile application to be tested during the test.

[0090] In the above embodiment, when the application to be tested is a mobile application, an application is created that covers the upper layer of the application to be tested in a transparent floating manner, a transparent layer is rendered in the web view of the upper application, and the test log information is displayed based on the transparent layer. The test log can be displayed in real time in the upper layer of the application interface to be tested, avoiding repeated jumping between different devices or different pages to view the test process and test log, facilitating debugging during automated testing, and in the event of a test error, being able to quickly find the cause and improve test efficiency.

[0091] In a specific embodiment, in the process of rendering a transparent layer on the first web page view based on the first preset style information, rendering processing can be performed in conjunction with a preset rendering engine. Specifically, the preset rendering engine can be an engine provided by a local browser kernel for web page view typesetting and layout.

[0092] In an optional embodiment, after the upper layer of the application to be tested covers the preset application in a transparent floating manner, the above method may further include:

[0093] The event detection function of the preset application is turned off, so that the application to be tested detects the test events during the testing process of the application to be tested.

[0094] In actual applications, the consumption of interface operation events, such as clicks, slides, etc., by the Android system and the iOS system follows the basic mechanism of layer-by-layer transmission and layer-by-layer consumption. If the top-level element consumes the detection event, the event will not be transmitted downward. If it is not consumed, it will be passed to the event bound to the lower-level element for the lower-level element to determine whether to consume it. In the embodiment of this specification, by turning off the event detection function of the preset application at the upper level, the interface operation event can be passed to the application to be tested at the lower level, so that after covering the preset application, it will not affect the operation of the application to be tested during the test process.

[0095] In the above embodiment, the event transparent consumption mechanism enables the application to be tested at the lower layer to still receive interface operation events, so that while the test log is displayed on the transparent interface of the upper preset application, the operation of the application to be tested at the lower layer during the test will not be affected.

[0096] In an optional embodiment, the above method may further include:

[0097] Turn on the web page debugging switch;

[0098] Accordingly, the above-mentioned rendering of a transparent layer on the first webpage view based on the first preset style information, and displaying the test log information based on the transparent layer may include:

[0099] When the web page debugging switch is turned on, a transparent layer is rendered on the first web page view based on the first preset style information, and the test log information is displayed based on the transparent layer.

[0100] In a specific embodiment, turning on the web page debugging switch indicates that the mobile terminal allows web page debugging.

[0101] In a specific embodiment, turning on the web page debugging switch may include: when the mobile application is an Android mobile application, authorizing web page debugging through ADB (Android Debug Bridge); when the mobile application is an iOS mobile application, enabling the Web inspector.

[0102] In the above embodiment, only when the mobile terminal allows web page debugging, can the operations of rendering and displaying information be performed in the web page view, thereby ensuring the security during the test process.

[0103] In an optional embodiment, when the application to be tested is a web application, the target web view may include a second web view in the test page of the application to be tested, and the above-mentioned creating a transparent layer in the target web view and displaying the test log information based on the transparent layer may include:

[0104] Based on the second preset style information, a transparent layer is rendered on the second webpage view, and the test log information is displayed based on the transparent layer.

[0105] In a specific embodiment, the second preset style information may be style information corresponding to a transparent layer on a web page view in a test web page when the application to be tested is a web application.

[0106] Specifically, the detailed steps of rendering the transparent layer on the second webpage view based on the second preset style information can refer to the above rendering steps when the application to be tested is a mobile application, which will not be repeated here.

[0107] For details, see Figure 4 , Figure 4 This is a schematic diagram of a web application test log display provided by an embodiment of the present application, wherein 401 is a web page interface to be tested, 402 is web page information on the web page interface 401 to be tested, 403 is the above-mentioned transparent layer, that is, the area in the dotted box, 404 is the test log information displayed on the transparent layer, and the transparent layer 403 is located on the web page view of the web page interface 401 to be tested. The test log information is displayed based on the transparent layer 403, so that the test log information can be displayed in real time in a suspended manner on the upper layer of the web page to be tested during the test process.

[0108] In the above embodiment, when the application to be tested is a web application, a transparent layer is rendered in the web view of the web page to be tested, and the test log information is displayed based on the transparent layer. The test log can be displayed in real time on the upper layer of the web page to be tested, avoiding repeated jumping between different pages to view the test process and test log, facilitating debugging during automated testing, and in the event of a test error, being able to quickly find the cause and improve test efficiency.

[0109] In an optional embodiment, the above method may further include:

[0110] Based on the preset connection channel, obtain the test log information corresponding to the application to be tested.

[0111] In actual applications, the test program end can filter the process information (PID) of the application to be tested based on the package name information of the application to be tested and the correspondence between the package name information and the process information, and then obtain the test log information of the application, and pass it to the local browser end through the above-mentioned preset connection channel.

[0112] In the above embodiment, based on the connection channel between the local browser kernel and the test program, the test log information can be obtained from the test program end, eliminating the limitation of the prior art of relying on the USB interface to obtain information and improving the test efficiency.

[0113] It can be seen from the technical solutions provided by the above embodiments of this specification that in this specification, in the process of testing the application to be tested based on the test program corresponding to the application to be tested, the injection code is obtained based on the connection channel between the local browser kernel and the test program. Based on the cross-end characteristics of the browser kernel, it can be applicable to the testing process of applications on different device ends, and at the same time, the cost is low and it has strong applicability; the above injection code is injected into the web page view, and then the injection code is run to create a transparent layer in the web page view. During the test process, the test log information is displayed in real time on the device end where the application to be tested is located based on the transparent layer, which is convenient for debugging in the automated test development process, and in the case of a test error, the test log can be quickly viewed to find the cause, thereby improving the test efficiency. In addition, only when the mobile terminal allows web debugging can the rendering and display information be performed in the web page view to ensure the security of the test process.

[0114] In an alternative embodiment, Figure 5 is a flow chart of a mobile terminal application automation testing method provided in an embodiment of the present application, such as Figure 5 As shown, when the application to be tested is an Android mobile application, the above method may include:

[0115] S501: The browser end authorizes the test program end to debug the web page;

[0116] S502: The test program terminal establishes a connection channel between the browser terminal and the test program terminal according to the debugging port and communication address corresponding to the browser kernel, where the debugging port information and the communication address are obtained based on the debugging instructions corresponding to the preset debugging tool;

[0117] S503: The test program terminal runs the test program to test the application to be tested;

[0118] S504: In the process of running the test program on the test program side to test the application to be tested, the test program side sends the first injection code, the second injection code and the test log information to the browser side based on the connection channel;

[0119] S505: The browser injects the first injection code and the second injection code into the first web page view;

[0120] S506: During the process of running the first injection code and the second injection code in the first web page view, the browser creates a transparent layer on the first web page view based on the first preset style information and displays the test log information in the transparent layer; the first web page view is a web page view displayed by starting a preset application, the preset application is an application that covers the upper layer of the application to be tested in a transparent floating manner, and the event detection function of the preset application is in a closed state, so that the application to be tested can detect test events during the test process.

[0121] The specific manner of each step in the above embodiment has been described in detail in the relevant method embodiment and will not be elaborated here.

[0122] In an alternative embodiment, Figure 6 is a flow chart of another mobile terminal application automation testing method provided by an embodiment of the present application, such as Figure 6 As shown, when the application to be tested is an iOS mobile application, the above method may include:

[0123] S601: Open the web inspector on the browser side;

[0124] S602: The test program terminal establishes a connection channel between the browser terminal and the test program terminal according to the debugging port and communication address corresponding to the browser kernel, where the debugging port information and the communication address are obtained based on the debugging instructions corresponding to the preset debugging tool;

[0125] S603: The test program terminal runs the test program to test the application to be tested;

[0126] S604: In the process of running the test program on the test program side to test the application to be tested, the test program side sends the first injection code, the second injection code and the test log information to the browser side based on the connection channel;

[0127] S605: The browser injects the first injection code and the second injection code into the first web page view;

[0128] S606: During the process of running the first injection code and the second injection code in the first web page view, the browser creates a transparent layer on the first web page view based on the first preset style information and displays the test log information in the transparent layer; the first web page view is a web page view displayed by starting a preset application, the preset application is an application that covers the upper layer of the application to be tested in a transparent floating manner, and the event detection function of the preset application is in a closed state, so that the application to be tested can detect test events during the test process.

[0129] The specific manner of each step in the above embodiment has been described in detail in the relevant method embodiment and will not be elaborated here.

[0130] In an alternative embodiment, Figure 7 is a flow chart of a method for automated testing of web applications provided in an embodiment of the present application, such as Figure 7 As shown, when the application to be tested is a web application, the above method may include:

[0131] S701: The test program terminal establishes a connection channel between the browser terminal and the test program terminal according to the debugging port and communication address corresponding to the browser kernel, wherein the debugging port information and the communication address are obtained through preset startup parameters during the process of starting the browser;

[0132] S702: The test program terminal runs the test program to test the application (webpage) to be tested;

[0133] S703: In the process of running the test program on the test application (webpage) at the test program end, the test program end sends the first injection code, the second injection code and the test log information to the browser end based on the connection channel;

[0134] S704: The browser injects a first code and a second code into a second web page view in the application (web page) to be tested;

[0135] S705: During the process of running the first injection code and the second injection code in the second web page view, the browser creates a transparent layer on the second web page view based on the second preset style information and displays the test log information in the transparent layer.

[0136] The specific manner of each step in the above embodiment has been described in detail in the relevant method embodiment and will not be elaborated here.

[0137] The present application also provides an automated testing device. Figure 8 As shown, the above device may include:

[0138] The first acquisition module 810 is used to acquire the first injection code and the second injection code based on a preset connection channel during the process of testing the application to be tested based on the test program corresponding to the application to be tested, the preset connection channel being the connection channel between the local browser kernel and the test program, the first injection code being used to construct a transparent layer, and the second injection code being used to indicate that the test log information corresponding to the application to be tested is the display information corresponding to the transparent layer;

[0139] An injection module 820 is used to inject a first injection code and a second injection code into a target web page view;

[0140] The creation module 830 is used to create a transparent layer in the target web page view when the target web page view runs the first injection code and the second injection code, and display the test log information based on the transparent layer.

[0141] Optionally, when the application to be tested is a mobile application, the target web page view includes a first web page view, and before the acquisition module, the apparatus may further include:

[0142] A preset application overlay module, used to overlay a preset application in a transparent floating manner on the upper layer of the application to be tested, wherein the preset application includes a first web page view;

[0143] Accordingly, the creation module 830 may include:

[0144] A starting unit, used to start a preset application to display a first web page view;

[0145] The first rendering unit is used to render a transparent layer on the first webpage view based on the first preset style information, and display the test log information based on the transparent layer.

[0146] Optionally, after the preset application overlay module, the above device may further include:

[0147] The event detection function closing module is used to close the event detection function of the preset application so that the application to be tested can detect the test events in the test process of the application to be tested.

[0148] Optionally, the above device may further include:

[0149] A web page debugging switch enabling module is used to enable the web page debugging switch. The web page debugging switch being enabled indicates that the mobile terminal allows web page debugging;

[0150] Accordingly, the first rendering unit may include:

[0151] The first rendering subunit is used to render a transparent layer on the first web page view based on the first preset style information when the web page debugging switch is turned on, and to display the test log information based on the transparent layer.

[0152] Optionally, when the application to be tested is a web application, the target web view includes a second web view in a test page of the application to be tested, and the creation module 830 may include:

[0153] The second rendering unit is used to render a transparent layer on the second web page view based on the second preset style information, and display the test log information based on the transparent layer.

[0154] Optionally, the above device may further include:

[0155] The second acquisition module is used to acquire the preset connection address corresponding to the browser kernel;

[0156] The connection channel establishing module is used to establish a preset connection channel based on a preset connection address.

[0157] Optionally, the first acquisition module 810 may include:

[0158] The first acquisition unit is used to acquire the first injection code and the second injection code from the test program based on a preset connection channel during a process of testing the application to be tested based on the test program corresponding to the application to be tested.

[0159] Optionally, the above device may further include:

[0160] The third acquisition module is used to acquire the test log information corresponding to the application to be tested based on the preset connection channel.

[0161] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0162] The method embodiments provided in the embodiments of the present application can be executed in a terminal (mobile terminal, computer terminal), a server or a similar computing device. Taking running on a terminal as an example, Fig. 9 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application, such as Fig. 9 As shown, the terminal can be used to implement the automated testing method provided in the above embodiment. Specifically:

[0163] The terminal may include components such as an RF (Radio Frequency) circuit 910, a memory 920 including one or more computer-readable storage media, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a WiFi (wireless fidelity) module 970, a processor 980 including one or more processing cores, and a power supply 990. Those skilled in the art will appreciate that Fig. 9 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0164] The RF circuit 910 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 980 for processing; in addition, the data related to the uplink is sent to the base station. Generally, the RF circuit 910 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a user identity module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, etc. In addition, the RF circuit 910 can also communicate with the network and other terminals through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), etc.

[0165] The memory 920 can be used to store software programs and modules, and the processor 980 executes various functional applications and data processing by running the software programs and modules stored in the memory 920. The memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, application programs required for functions, etc.; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 920 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 920 may also include a memory controller to provide the processor 980 and the input unit 930 with access to the memory 920.

[0166] The input unit 930 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit 930 may include a touch-sensitive surface 931 and other input devices 932. The touch-sensitive surface 931, also known as a touch display screen or a touchpad, can collect user touch operations on or near it (such as operations performed by users using fingers, styluses, or any other suitable objects or accessories on or near the touch-sensitive surface 931), and drive corresponding connection devices according to a pre-set program. Optionally, the touch-sensitive surface 931 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 980, and can receive and execute commands sent by the processor 980. In addition, the touch-sensitive surface 931 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 931, the input unit 930 may further include other input devices 932. Specifically, the other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.

[0167] The display unit 940 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the terminal, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 940 may include a display panel 941, and optionally, the display panel 941 may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, the touch-sensitive surface 931 may cover the display panel 941, and when the touch-sensitive surface 931 detects a touch operation on or near it, it is transmitted to the processor 980 to determine the type of the touch event, and then the processor 980 provides corresponding visual output on the display panel 941 according to the type of the touch event. Among them, the touch-sensitive surface 931 and the display panel 941 can be two independent components to realize the input and output functions, but in some embodiments, the touch-sensitive surface 931 and the display panel 941 can also be integrated to realize the input and output functions.

[0168] The terminal may also include at least one sensor 950, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 941 and / or the backlight when the terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the terminal posture (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can be configured in the terminal, they will not be repeated here.

[0169] The audio circuit 960, the speaker 961, and the microphone 962 can provide an audio interface between the user and the terminal. The audio circuit 960 can transmit the received audio data to the speaker 961 after converting the electrical signal, which is converted into a sound signal for output by the speaker 961; on the other hand, the microphone 962 converts the collected sound signal into an electrical signal, which is received by the audio circuit 960 and converted into audio data, and then the audio data is output to the processor 980 for processing, and then sent to another terminal through the RF circuit 910, or the audio data is output to the memory 920 for further processing. The audio circuit 960 may also include an earplug jack to provide communication between an external headset and the terminal.

[0170] WiFi is a short-range wireless transmission technology. The terminal can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 970, which provides users with wireless broadband Internet access. Fig. 9 A WiFi module 970 is shown, but it is understandable that it is not an essential component of the terminal and can be omitted as needed without changing the essence of the invention.

[0171] The processor 980 is the control center of the terminal, and uses various interfaces and lines to connect various parts of the entire terminal. By running or executing software programs and / or modules stored in the memory 920, and calling data stored in the memory 920, the processor 980 performs various functions of the terminal and processes data, thereby performing overall detection of the terminal. Optionally, the processor 980 may include one or more processing cores; preferably, the processor 980 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 980.

[0172] The terminal also includes a power supply 990 (such as a battery) for supplying power to each component. Preferably, the power supply can be logically connected to the processor 980 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 990 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0173] Although not shown, the terminal may also include a camera, a Bluetooth module, etc., which will not be described in detail herein. Specifically in this embodiment, the display unit of the terminal is a touch screen display, and the terminal further includes a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute instructions in the method embodiment of the present invention.

[0174] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the automated testing method as in the embodiment of the present disclosure.

[0175] In an exemplary embodiment, a computer-readable storage medium is also provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the automated testing method in the embodiment of the present disclosure.

[0176] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the automated testing method provided in the above-mentioned various optional implementations.

[0177] It is understandable that in the specific implementation of this application, user-related data is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0178] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0179] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0180] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An automated testing method, characterized in that: The method comprises: In the process of testing the application to be tested based on the test program corresponding to the application to be tested, a first injection code and a second injection code are obtained based on a preset connection channel, the preset connection channel is a connection channel between a local browser kernel and the test program, the first injection code is used to construct a transparent layer, and the second injection code is used to indicate that the test log information corresponding to the application to be tested is the display information corresponding to the transparent layer; Injecting the first injection code and the second injection code into a target web page view; During the process of the target web page view running the first injection code and the second injection code, the transparent layer is created in the target web page view, and the test log information is displayed based on the transparent layer.

2. The automated testing method according to claim 1, characterized in that: In the case where the application to be tested is a mobile application, the target web page view includes a first web page view, and in the process of testing the application to be tested based on a test program corresponding to the application to be tested, before obtaining the first injection code and the second injection code, the method further includes: Overlaying a preset application in a transparent floating manner on the upper layer of the application to be tested, wherein the preset application includes the first web page view; The step of creating the transparent layer in the target webpage view and displaying the test log information based on the transparent layer includes: Launching the preset application to display the first web page view; Based on the first preset style information, the transparent layer is rendered on the first webpage view, and the test log information is displayed based on the transparent layer.

3. The automated testing method according to claim 2, characterized in that: After the upper layer of the application to be tested covers the preset application in a transparent floating manner, the method further includes: The event detection function of the preset application is turned off, so that the application to be tested detects the test event during the test of the application to be tested.

4. The automated testing method according to claim 2, characterized in that: The method further comprises: Turning on the web page debugging switch, wherein turning on the web page debugging switch indicates that the mobile terminal allows web page debugging; The rendering of the transparent layer on the first webpage view based on the first preset style information, and displaying the test log information based on the transparent layer includes: When the web page debugging switch is turned on, the transparent layer is rendered on the first web page view based on the first preset style information, and the test log information is displayed based on the transparent layer.

5. The automated testing method according to claim 1, characterized in that: In the case where the application to be tested is a web application, the target web view includes a second web view in a test page of the application to be tested, and the step of creating the transparent layer in the target web view and displaying the test log information based on the transparent layer includes: Based on the second preset style information, the transparent layer is rendered on the second webpage view, and the test log information is displayed based on the transparent layer.

6. The automated testing method according to any one of claims 1 to 5, characterized in that: The method further comprises: Obtaining a preset connection address corresponding to the browser kernel; Based on the preset connection address, the preset connection channel is established.

7. The automated testing method according to any one of claims 1 to 5, characterized in that: In the process of testing the application to be tested based on the test program corresponding to the application to be tested, acquiring the first injection code and the second injection code based on the preset connection channel includes: In a process of testing the application to be tested based on a test program corresponding to the application to be tested, the first injection code and the second injection code are obtained from the test program based on the preset connection channel.

8. The automated testing method according to any one of claims 1 to 5, characterized in that: The method further comprises: Based on the preset connection channel, the test log information corresponding to the application to be tested is obtained.

9. An automated testing device, characterized in that: The device comprises: A first acquisition module is used to acquire a first injection code and a second injection code based on a preset connection channel during a process of testing the application to be tested based on a test program corresponding to the application to be tested, wherein the preset connection channel is a connection channel between a local browser kernel and the test program, the first injection code is used to construct a transparent layer, and the second injection code is used to indicate that the test log information corresponding to the application to be tested is the display information corresponding to the transparent layer; An injection module, used for injecting the first injection code and the second injection code into a target web page view; A creation module is used to create the transparent layer in the target web page view and display the test log information based on the transparent layer during the process of the target web page view running the first injection code and the second injection code.

10. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the automated testing method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the automated testing method as claimed in any one of claims 1 to 8.