Application test method and device, electronic device, and storage medium

CN117520140BActive Publication Date: 2026-08-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210918905.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-29
Publication Date
2026-08-18
Estimated Expiration
2042-07-29

AI Technical Summary

Technical Problem

[0003]相关技术中,通常通过无障碍服务(Accessibility Service)获取待测试应用的显示窗口中显示的内容,但是无障碍服务主要是为特定人士提供交互反馈服务,其获取到的内容中会缺失部分信息(例如,颜色、字体等),使得获取到的内容与显示窗口中实际显示的内容不一致,降低了测试全面性和测试效果

Benefits of technology

[0059]In the technical solution provided by the embodiments of this application: First, based on the rendering data corresponding to the target page of the application under test, multiple elements to be displayed and their attribute information are determined in the target page. Then, non-visual elements and non-visual attribute information are filtered from the multiple elements to be displayed and their attribute information to obtain multiple visual elements and their visual attribute information in the target page, thereby reducing the amount of data processing. Next, based on the content presented by the target page in the display window of the application under test, the target visual element displayed in the display window is selected from the multiple visual elements. Based on the target visual element and its attribute information, the test result corresponding to the application under test is determined. Since the rendering data of the target page contains the data to be displayed in the target page, and the content presented by the target page in the display window is based on the rendering data of the target page, the visual elements and their visual attribute information presented by the target page in the display window can be obtained based on the rendering data, avoiding information loss, ensuring test comprehensiveness, and improving test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117520140B_ABST
    Figure CN117520140B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an application testing method and device, equipment and a medium. The method comprises: determining a plurality of to-be-displayed elements contained in a target page and attribute information of the plurality of to-be-displayed elements based on rendering data corresponding to the target page of a to-be-tested application; then filtering out non-visualization elements and non-visualization attribute information from the plurality of to-be-displayed elements and the attribute information of the plurality of to-be-displayed elements to obtain a plurality of visualization elements contained in the target page and visualization attribute information of the plurality of visualization elements; and then selecting target visualization elements displayed in a display window of the to-be-tested application from the plurality of visualization elements according to content presented by the target page in the display window, and determining a test result corresponding to the to-be-tested application according to the target visualization elements and the attribute information of the target visualization elements. The technical solution of the present application can guarantee comprehensive testing and improve the testing effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to an application testing method, an application testing apparatus, an electronic device, and a computer-readable medium. Background Technology

[0002] To determine whether the developed application meets expectations, it needs to be tested. During testing, it is necessary to capture the content displayed in the application's window and determine the test results based on this content.

[0003] In related technologies, the content displayed in the display window of the application under test is usually obtained through the Accessibility Service. However, the Accessibility Service mainly provides interactive feedback services for specific users, and the content it obtains may be missing some information (such as color, font, etc.), making the obtained content inconsistent with the content actually displayed in the display window, which reduces the comprehensiveness and effectiveness of the test. Summary of the Invention

[0004] To address the aforementioned technical problems, embodiments of this application provide an application testing method, apparatus, equipment, and medium, thereby ensuring the comprehensiveness of testing to at least a certain extent and improving testing effectiveness.

[0005] According to one aspect of the embodiments of this application, an application testing method is provided, the method comprising:

[0006] Based on the rendering data corresponding to the target page of the application to be tested, determine the multiple elements to be displayed contained in the target page and the attribute information of the multiple elements to be displayed;

[0007] Non-visual elements and non-visual attribute information are filtered from the plurality of elements to be displayed and the attribute information of the plurality of elements to be displayed to obtain a plurality of visual elements contained in the target page and the visual attribute information of the plurality of visual elements;

[0008] Based on the content presented by the target page in the display window of the application under test, the target visual element displayed in the display window is selected from the plurality of visual elements;

[0009] Based on the target visualization element and its visualization attribute information, the test result corresponding to the application to be tested is determined.

[0010] According to one aspect of the embodiments of this application, an application testing apparatus is provided, the apparatus comprising:

[0011] The determination module is configured to determine multiple elements to be displayed and their attribute information contained in the target page of the application to be tested, based on the rendering data corresponding to the target page of the application to be tested.

[0012] The filtering module is configured to filter out non-visual elements and non-visual attribute information from the plurality of elements to be displayed and the attribute information of the plurality of elements to be displayed, so as to obtain a plurality of visual elements contained in the target page and the visual attribute information of the plurality of visual elements;

[0013] The filtering module is configured to filter out the target visual element displayed in the display window from the plurality of visual elements based on the content presented by the target page in the display window of the application to be tested;

[0014] The testing module is configured to determine the test result corresponding to the application under test based on the target visualization element and the visualization attribute information of the target visualization element.

[0015] In one embodiment of this application, based on the foregoing scheme, the filtering module includes:

[0016] The element filtering module is configured to filter out non-visual elements and their attribute information from the plurality of elements to be displayed and their attribute information, thereby obtaining a plurality of visual elements and their attribute information.

[0017] The attribute filtering module is configured to filter out non-visual attribute information from the attribute information of the plurality of visual elements to obtain the visual attribute information of the plurality of visual elements.

[0018] In one embodiment of this application, based on the foregoing scheme, the element filtering module is specifically configured as follows:

[0019] The stacking order and display boundary information of the multiple elements to be displayed are determined based on their attribute information.

[0020] Based on the determined stacking order and display boundary information, the covered elements to be displayed are selected from the plurality of elements to be displayed;

[0021] The covered elements and their attribute information are filtered out from the plurality of elements to be displayed and their attribute information to obtain the plurality of visual elements and their attribute information.

[0022] In one embodiment of this application, based on the foregoing scheme, the screening module includes:

[0023] The size acquisition module is configured to acquire the size of the display window and determine the size of the target page based on the rendering data;

[0024] The scaling module is configured to calculate the scaling ratio of the target page based on the size of the display window and the size of the target page.

[0025] The filtering submodule is configured to filter out the target visual element to be displayed in the display window from the plurality of visual elements according to the scaling ratio.

[0026] In one embodiment of this application, based on the foregoing scheme, under the condition that the visualization attribute information of the plurality of visualization elements includes the position information of the plurality of visualization elements, the filtering submodule includes:

[0027] The scaling module is configured to scale the target page according to the scaling ratio and update the position information of the plurality of visual elements based on the scaled target page;

[0028] The region determination module is configured to determine a target region to be displayed in the display window from the region contained in the scaled target page if the size of the scaled target page is larger than the size of the display window; wherein the size of the target region matches the size of the display window.

[0029] The element determination module is configured to use the updated position information of the plurality of visual elements as the target visual element to determine the visual element located in the target area.

[0030] In one embodiment of this application, based on the foregoing scheme, given that the target page contains multiple views and the display window contains sub-windows corresponding to each of the multiple views, the region determination module is specifically configured as follows:

[0031] From the scaled target page, select candidate views whose size is larger than the corresponding sub-window size, and target views whose size is smaller than or equal to the corresponding sub-window size;

[0032] A candidate region to be displayed in the corresponding sub-window is determined from the region contained in the candidate view; wherein the size of the candidate region matches the size of the corresponding sub-window;

[0033] The candidate region and the region contained in the target view are used as the target region.

[0034] In one embodiment of this application, based on the foregoing scheme, the region determination module is specifically configured as follows:

[0035] Obtain a viewing instruction, and determine the viewing location from the scaled target page according to the viewing instruction;

[0036] Based on the viewing location, the target area to be displayed in the display window is determined from the area contained in the scaled target page.

[0037] In one embodiment of this application, based on the foregoing scheme, under the condition that the target page includes a first view and a second view, the size determination module is specifically configured as follows:

[0038] Calculate the scaling ratio of the first view based on the size of the first view and the size of the display window;

[0039] The sub-window corresponding to the first view is determined from the display window according to the scaling ratio of the first view; wherein the size of the sub-window corresponding to the first view matches the size of the scaled first view;

[0040] Select an area outside the child window corresponding to the first view from the display window, and determine the child window corresponding to the second view from the selected area;

[0041] The scaling factor of the second view is calculated based on the size of the child window corresponding to the second view and the size of the second view.

[0042] In one embodiment of this application, based on the foregoing scheme, when the target page is a webpage, the determining module is specifically configured as follows:

[0043] During the process of rendering the target page through a browser component, the rendering data of the target page is obtained from the browser component;

[0044] The rendered data is parsed to obtain multiple elements to be displayed in the target page and the attribute information of the multiple elements to be displayed.

[0045] In one embodiment of this application, based on the foregoing scheme, the determining module is specifically configured as follows:

[0046] Based on the rendering data corresponding to the target page of the application to be tested, construct the document object model tree corresponding to the target page;

[0047] The document object model tree is split to obtain multiple elements to be displayed contained in the target page and the attribute information of the multiple elements to be displayed.

[0048] In one embodiment of this application, based on the foregoing scheme, the testing module is specifically configured as follows:

[0049] Filter out visual attribute information of a specified type from the visual attribute information of the target visual element; the specified type of visual attribute information includes at least one of font information, color information, and display boundary information;

[0050] Based on the specified type of visual attribute information and the target visual element, determine the test result corresponding to the application to be tested.

[0051] In one embodiment of this application, based on the foregoing scheme, the testing module is specifically configured as follows:

[0052] The set visualization element is compared with the target visualization element, and the attribute information of the set visualization element is compared with the visualization attribute information of the target visualization element.

[0053] The test results for the application under test are determined based on the comparison results.

[0054] According to one aspect of the embodiments of this application, an electronic device is provided, including:

[0055] One or more processors;

[0056] A storage device for storing one or more computer programs, which, when executed by one or more processors, cause the electronic device to perform the application testing method as described above.

[0057] According to one aspect of the embodiments of this application, the embodiments of this application provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor of an electronic device, causes the electronic device to implement the application testing method as described above.

[0058] According to one aspect of the embodiments of this application, the embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the application testing method as described above.

[0059] In the technical solution provided by the embodiments of this application: First, based on the rendering data corresponding to the target page of the application under test, multiple elements to be displayed and their attribute information are determined in the target page. Then, non-visual elements and non-visual attribute information are filtered from the multiple elements to be displayed and their attribute information to obtain multiple visual elements and their visual attribute information in the target page, thereby reducing the amount of data processing. Next, based on the content presented by the target page in the display window of the application under test, the target visual element displayed in the display window is selected from the multiple visual elements. Based on the target visual element and its attribute information, the test result corresponding to the application under test is determined. Since the rendering data of the target page contains the data to be displayed in the target page, and the content presented by the target page in the display window is based on the rendering data of the target page, the visual elements and their visual attribute information presented by the target page in the display window can be obtained based on the rendering data, avoiding information loss, ensuring test comprehensiveness, and improving test results.

[0060] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0061] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0062] Figure 1 This is a schematic diagram illustrating an exemplary implementation environment of the technical solutions in the embodiments of this application;

[0063] Figure 2 This is a flowchart illustrating an exemplary embodiment of the application testing method of this application;

[0064] Figure 3 This is a schematic diagram of a target page shown in an exemplary embodiment of this application;

[0065] Figure 4 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0066] Figure 5 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0067] Figure 6This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0068] Figure 7 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0069] Figure 8 This is a schematic diagram illustrating different stacking types of elements in an exemplary embodiment of this application;

[0070] Figure 9 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0071] Figure 10 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0072] Figure 11 This is a schematic diagram illustrating a display page and display window in an exemplary embodiment of this application;

[0073] Figure 12 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0074] Figure 13 This is a schematic view illustrating an exemplary embodiment of this application;

[0075] Figure 14 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0076] Figure 15 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0077] Figure 16 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0078] Figure 17 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0079] Figure 18 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application;

[0080] Figure 19 This is a schematic diagram illustrating component invocation in an exemplary embodiment of this application;

[0081] Figure 20 This is a block diagram of an application testing apparatus according to an embodiment of this application;

[0082] Figure 21This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the present application embodiments. Detailed Implementation

[0083] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments identical to those of this application. Rather, they are merely examples of apparatuses and methods identical to some aspects of this application as detailed in the appended claims.

[0084] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0085] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0086] It should be noted that "multiple" as mentioned in this application refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0087] To determine whether a developed application meets expectations, it needs to be tested. The application's display window, as the interaction feedback channel between the application and its service objects, is a crucial test object. Therefore, during testing, the content displayed in the application's display window is acquired, and the test results are determined based on this acquired content. In related technologies, accessibility services are typically used to acquire the content displayed in the application's display window during testing. However, accessibility services primarily provide interaction feedback for specific users, and the acquired content may lack certain information (e.g., colors, fonts, etc.), resulting in inconsistencies between the acquired content and the actual content displayed in the window, reducing the comprehensiveness and effectiveness of the test. Therefore, embodiments of this application provide an application testing method, application testing apparatus, electronic device, and computer-readable medium to ensure comprehensive testing and improve test effectiveness.

[0088] Please see Figure 1 , Figure 1 This is a schematic diagram of an implementation environment related to this application. The implementation environment includes a terminal device 110 and a server 120. The terminal device 110 and the server 120 communicate via a wired or wireless network. The terminal device 110 can upload its own data to the server 120 and can also retrieve data from the server 120.

[0089] Among them, terminal equipment 110 may include, but is not limited to, smartphones, tablets, laptops, computers, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc.

[0090] Server 120 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. This document does not impose any restrictions on this.

[0091] It should be noted that, Figure 1 The number of terminal devices 110 and servers 120 is merely illustrative; any number of terminal devices 110 and servers 120 can be used as needed.

[0092] In an exemplary embodiment, the application testing method provided in the embodiments of this application can be executed by a terminal device 110.

[0093] For example, terminal device 110 can be used to install the application to be tested. Terminal device 110 can first obtain the rendering data corresponding to the target page of the application to be tested, and obtain multiple elements to be displayed and their attribute information contained in the target page based on the rendering data. Then, it filters out non-visual elements and non-visual attribute information from the multiple elements to be displayed and their attribute information to obtain multiple visual elements contained in the target page and their visual attribute information. Then, based on the content presented by the target page in the display window of the application to be tested, it selects the target visual element to be displayed in the display window from the multiple visual elements, and determines the target visual element to be displayed in the display window based on the target visual element and its visual attribute information. By extracting the visual attribute information of elements, the test results for the application under test can be determined. Since the rendering data of the target page contains the data that needs to be displayed on the target page, and the content presented in the display window of the target page is based on the rendered data of the target page, it is possible to obtain the visual elements and visual attribute information of the visual elements presented in the display window of the target page based on the rendering data. This avoids information loss, ensures the comprehensiveness of the test, and improves the test effect. Furthermore, after obtaining the multiple elements to be displayed and their attribute information contained in the target page based on the rendering data, non-visual elements and non-visual attribute information are filtered out first. This reduces the amount of data processing and improves the test efficiency while ensuring the test effect.

[0094] In another exemplary embodiment, server 120 may have functions similar to terminal device 110 to execute the application testing method provided in this application embodiment. For example, server 120 may determine multiple elements to be displayed and their attribute information contained in the target page based on the rendering data corresponding to the target page of the application under test. Then, it may filter out non-visual elements and non-visual attribute information from the multiple elements to be displayed and their attribute information to obtain multiple visual elements contained in the target page and their visual attribute information. Next, based on the content presented by the target page in the display window of the application under test, it may select the target visual element displayed in the display window from the multiple visual elements, and determine the test result corresponding to the application under test based on the target visual element and its attribute information.

[0095] In another exemplary embodiment, the terminal device 110 and the server 120 can also jointly execute the application testing method provided in the embodiments of this application. For example, the terminal device 110 can be used to install the application to be tested and obtain the rendering data of the application to be tested, and send the rendering data to the server 120; the server 120 obtains multiple elements to be displayed and their attribute information contained in the target page based on the rendering data, then filters out non-visual elements and non-visual attribute information from the multiple elements to be displayed and their attribute information to obtain multiple visual elements contained in the target page and their visual attribute information, then, based on the content presented by the target page in the display window of the application to be tested, selects the target visual element displayed in the display window from the multiple visual elements, and determines the test result corresponding to the application to be tested based on the target visual element and its visual attribute information, and sends the test result to the terminal device 110; the terminal device 110 displays the test result.

[0096] It should be noted that the application testing method provided in the embodiments of this application can be applied to different application scenarios, such as automated testing scenarios.

[0097] It should be noted that in this application, when the application testing method of this application is applied to specific products or technologies, the permission or consent of the object is obtained, and the extraction, use and processing of the relevant data comply with local security standards and local laws and regulations.

[0098] The following details the various implementation details of the technical solutions in the embodiments of this application:

[0099] Please see Figure 2 , Figure 2 This is a flowchart illustrating an embodiment of the application testing method of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0100] like Figure 2 As shown, this application testing method includes at least steps S210 to S240, which are described in detail below:

[0101] Step S210: Based on the rendering data corresponding to the target page of the application to be tested, determine the multiple elements to be displayed and the attribute information of the multiple elements to be displayed contained in the target page.

[0102] It should be noted that the application to be tested refers to any application that needs to be tested, including but not limited to web apps, native apps, mini-programs, and hybrid apps. Native apps are applications that can run directly on a specific operating system (e.g., Android, iOS); web apps are web applications that need to run within a browser component, such as HTML5 (Hypertext Markup Language, a language for describing web content); mini-programs are applications that can be used without downloading or installing; and hybrid apps are applications developed using a combination of web and native technologies. Based on the services they provide, applications to be tested include, but are not limited to, video applications, audio applications, social applications, and e-commerce applications.

[0103] The target page refers to the pages contained in the application under test. All pages contained in the application under test can be used as target pages to improve the comprehensiveness of the test; alternatively, specific pages can be used as target pages to improve testing efficiency. Target pages can be of various types, including but not limited to web pages and native pages. Web pages are those that need to be displayed using browser components, such as H5 pages; native pages are those that can be directly displayed on a specific operating system.

[0104] The rendering data corresponding to the target page refers to the data obtained by rendering the target page. It should be understood that in order to display the content contained in the target page in the display window, the target page needs to be rendered to obtain rendering data.

[0105] The elements to be displayed are those contained in the target page, including both visual and non-visual elements. Visual elements are those that can be displayed to the human eye and used to convey information. Visual elements include, but are not limited to, one or more combinations of characters, images, videos, and borders. Characters refer to glyphs or symbols, including letters, numbers, operators, punctuation marks, and other symbols, as well as some functional symbols. Images can include static and animated images. Static images can be in JPEG (Joint Photographic Experts Group), PNG (Portable Network Graphic Format), or other image formats. Animated images can be in GIF (Graphics Interchange Format) or other image formats. Videos include, but are not limited to, movies, TV series, and variety shows. Borders include, but are not limited to, element borders (e.g., character borders, image borders, etc.) and page borders. Border shapes can be regular shapes (e.g., rectangles, triangles, circles, etc.) or irregular shapes. See one example. Figure 3 As shown, Figure 3 This is a schematic diagram of a payment success page for an application. The payment success page contains the following visual elements: the application's logo (310), the words "Payment Successful" (320), the payment amount "¥2.00" (330), the text "Recommended Mini Program" (340), and the "Return to Merchant" button (350).

[0106] Non-visual elements are elements that are not visible to the human eye.

[0107] The attribute information of an element to be displayed refers to information describing the element's own properties. For example, for characters, the attribute information includes, but is not limited to, font information, color information, character spacing information, font size information, alignment information, and display boundary information (information used to describe the element's display position and display area). For images, the attribute information includes, but is not limited to, image size, image display boundary information, image pixel information, and image data volume. For borders, the attribute information includes, but is not limited to, border color, border size, border display boundary information, and border transparency information. For videos, the attribute information includes, but is not limited to, video duration, video display boundary information, and video data volume. Furthermore, based on whether it is visual, the attribute information of an element to be displayed can be divided into visual attribute information and non-visual attribute information. Visual attribute information refers to attributes that are visible to the human eye, such as font information, color information, and display boundary information. Non-visual attribute information refers to attributes that are not visible to the human eye, such as the data volume of an image or video, attribute information with a size of 0, and attribute information with a transparency of 0.

[0108] In order to obtain the content displayed in the display window of the application under test, in the embodiments of this application, the rendering data corresponding to the target page of the application under test can be obtained first, and the rendering data can be parsed to obtain multiple elements to be displayed and attribute information of the multiple elements to be displayed contained in the target page.

[0109] The specific method for obtaining rendering data can be flexibly configured according to actual needs. Optionally, rendering data of the target page can be obtained from the rendering component. It should be noted that the rendering component refers to the component used to render the page, including but not limited to browser components, React, etc.

[0110] Step S220: Filter out non-visual elements and non-visual attribute information from multiple elements to be displayed and their attribute information to obtain multiple visual elements contained in the target page and their visual attribute information.

[0111] Since the target page may contain both visual and non-visual elements, and the attribute information of these elements may include both visual and non-visual attributes, and since non-visual elements and non-visual attributes are invisible to the human eye, their impact on the page testing effect is relatively small, in order to reduce the amount of data processing, after identifying the multiple elements to be displayed and their attribute information contained in the target page, we can filter out the non-visual elements and their attribute information, and the remaining data will be the visual elements and their visual attribute information.

[0112] Step S230: Based on the content presented by the target page in the display window of the application to be tested, select the target visual element displayed in the display window from multiple visual elements.

[0113] Target visual elements refer to the visual elements contained in the target page and displayed in the display window of the application to be tested.

[0114] It should be understood that the size of the target page may be smaller than or equal to the size of the display window of the application under test, and correspondingly, all the content contained in the target page can be displayed in the display window of the application under test; conversely, the size of the target page may be larger than the size of the display window of the application under test, and correspondingly, only a portion of the content contained in the target page will be displayed in the display window of the application under test. To determine the visual elements displayed in the display window, in the embodiments of this application, after obtaining multiple visual elements contained in the target page and their attribute information, the target visual element to be displayed in the display window can be selected from the multiple visual elements based on the content presented by the target page in the display window of the application under test.

[0115] The specific method for filtering out target visual elements can be flexibly set according to actual needs.

[0116] Step S240: Determine the test result corresponding to the application to be tested based on the target visualization element and the visualization attribute information of the target visualization element.

[0117] After identifying the target visualization elements, the test results for the application under test can be determined based on the target visualization elements and their visualization attribute information, thereby determining whether the application under test meets expectations.

[0118] exist Figure 2In the illustrated embodiment, firstly, based on the rendering data corresponding to the target page of the application under test, multiple elements to be displayed and their attribute information are determined within the target page. Then, non-visual elements and non-visual attribute information are filtered from the multiple elements to be displayed and their attribute information to obtain multiple visual elements and their visual attribute information within the target page. Next, based on the content presented by the target page in the display window of the application under test, the target visual element to be displayed in the display window is selected from the multiple visual elements. Finally, based on the target visual element and its visual attribute information, the elements to be displayed in the application under test are determined. Applying the corresponding test results, since the rendering data of the target page contains the data that needs to be displayed on the target page, and the content presented in the display window of the target page is based on the rendering data of the target page, it is possible to obtain the visual elements and visual attribute information of the visual elements presented in the display window of the target page based on the rendering data, avoiding information loss, ensuring test comprehensiveness, and improving test results. Furthermore, after obtaining the multiple elements to be displayed and their attribute information contained in the target page based on the rendering data, non-visual elements and non-visual attribute information are filtered out first, thereby reducing the amount of data processing and improving test efficiency while ensuring test results.

[0119] In one exemplary embodiment, see Figure 4 , Figure 4 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0120] like Figure 4 As shown, with the target page being a webpage, the application testing method includes steps S410-S420 and steps S220-S240. The detailed descriptions of steps S410-S420 are as follows:

[0121] Step S410: During the process of rendering the target page through the browser component, obtain the rendering data of the target page from the browser component.

[0122] If the target page is a webpage, it is rendered using a browser component. This browser component can be a browser application or a browser module embedded in the application being tested, such as the WebView component. The WebView component is a control used to display a webpage.

[0123] During the rendering of a target page through a browser component, the rendering data of the target page can be obtained from the browser component.

[0124] Optionally, the rendering data acquisition code can be embedded in the browser component beforehand, so that the rendering data acquisition code runs during the browser component's rendering of the target page to obtain the rendering data of the target page from the browser component. The rendering data acquisition code is used to obtain the rendering data of the target page.

[0125] Optionally, the application testing method provided in this application embodiment can be applied to an automated testing framework. The rendering data acquisition code can be pre-embedded in the automated testing framework. During the automated testing process, the rendering data acquisition code is inserted into the browser component through the automated testing framework, so that during the rendering of the target page by the browser component, the rendering data acquisition code is called to obtain the rendering data of the target page from the browser component.

[0126] Step S420: Parse the rendering data to obtain multiple elements to be displayed in the target page and the attribute information of the multiple elements to be displayed.

[0127] After obtaining the rendering data corresponding to the target page, it is parsed to obtain the multiple elements to be displayed and their attribute information contained in the target page.

[0128] It should be noted that, Figure 4 The specific implementation details of steps S220-S240 shown can be found in [reference]. Figure 2 Steps S220-S240 shown are not repeated here.

[0129] exist Figure 4 In the illustrated embodiment, when the target page is a webpage, the rendering data of the target page is obtained from the browser component during the rendering process of the target page through the browser component, thereby improving the efficiency of obtaining the rendering data.

[0130] In one exemplary embodiment, see Figure 5 , Figure 5 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0131] like Figure 5 As shown, the application testing method includes steps S510-S520 and steps S220-S240. The detailed descriptions of steps S510-S520 are as follows:

[0132] Step S510: Based on the rendering data corresponding to the target page of the application to be tested, construct the document object model tree corresponding to the target page.

[0133] The Document Object Model (DOM) tree, or simply DOM tree, is a tree composed of DOM elements and attribute information.

[0134] In the embodiments of this application, a document object model tree corresponding to the target page can be constructed based on the rendering data.

[0135] Step S520: Split the document object model tree to obtain multiple elements to be displayed in the target page and the attribute information of the multiple elements to be displayed.

[0136] After constructing the target document model tree, the document object model tree can be split to obtain the multiple elements to be displayed contained in the target page and the attribute information of the multiple elements to be displayed.

[0137] Optionally, based on the Document Object Model (DOM) tree, the process of the rendering component rendering the DOM tree of the target page can be simulated, splitting the DOM tree to obtain multiple elements to be displayed and their attribute information. For example, the process of the WebView component rendering the DOM tree of the target page can be simulated to obtain multiple visual elements and their attribute information.

[0138] It should be noted that, Figure 5 The specific implementation details of steps S220-S240 shown can be found in [reference]. Figure 2 Steps S220-S240 shown are not repeated here.

[0139] exist Figure 5 In the illustrated embodiment, based on the rendering data corresponding to the target page of the application under test, a document object model tree corresponding to the target page is constructed. The document object model tree is then split to obtain multiple elements to be displayed and their attribute information contained in the target page, thereby improving the accuracy of the elements to be displayed and their attribute information.

[0140] In one exemplary embodiment, see Figure 6 , Figure 6 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0141] like Figure 6 As shown, the application testing method includes steps S210, S610-S620, and S230-S240. The detailed descriptions of steps S610-S620 are as follows:

[0142] Step S610: From the multiple elements to be displayed and their attribute information, filter out the non-visual elements and their attribute information to obtain the multiple visual elements and their attribute information.

[0143] After identifying the multiple elements to be displayed and their attribute information contained in the target page, in order to reduce the amount of data processing, non-visual elements and their attribute information can be filtered out. The remaining elements to be displayed are the visual elements, and the remaining attribute information is the attribute information of the visual elements.

[0144] Step S620: Filter out non-visual attribute information from the attribute information of multiple visual elements to obtain the visual attribute information of multiple visual elements.

[0145] Visual elements have a lot of attribute information, which can be divided into non-visual attribute information and visual attribute information based on whether they are visualized. Since non-visual attribute information is not visible to the human eye, in order to reduce the amount of data processing, non-visual attribute information can be filtered from the attribute information of multiple visual elements to obtain the visual attribute information of multiple visual elements. For example, filtering out size information with a width and height of 0, filtering out transparency information with an opacity of 0, etc.

[0146] It should be noted that, Figure 6 The specific implementation details of steps S210 and S230-S240 shown can be found in [reference]. Figure 2 Steps S210 and S230-S240 shown will not be repeated here.

[0147] exist Figure 6In the illustrated embodiment, non-visual elements and their attribute information are first filtered from multiple elements to be displayed and their attribute information to obtain multiple visual elements and their attribute information; then, non-visual attribute information is filtered from the attribute information of the multiple visual elements to obtain the visual attribute information of the multiple visual elements, thereby improving the filtering efficiency and thus improving the testing efficiency.

[0148] In one exemplary embodiment, see Figure 7 , Figure 7 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0149] like Figure 7 As shown, the application testing method includes steps S210, S710-S730, S620, and S230-S240. The detailed descriptions of steps S710-S730 are as follows:

[0150] Step S710: Determine the stacking order and display boundary information of the multiple elements to be displayed based on their attribute information.

[0151] On the target page, elements are displayed in three dimensions: the Z-axis representing layering, and the X and Y axes on the flat canvas. The Z-axis is the vertical line between the observer and the screen, representing the distance between elements and the observer. Normally, elements tile along the X and Y axes on the page, and the observer cannot perceive the layering relationship along the Z-axis. If elements overlap, the observer can see that one element may cover another or be covered by another element. See an example. Figure 8 As shown, Figure 8 This is a diagram illustrating a stacking order, containing seven stacking types of elements, arranged from farthest to closest to the observer: background and border elements, negative z-index elements (i.e., elements with a negative position on the z-axis), block elements, floating box elements, inline box elements, z-index: 0 elements (i.e., elements with a position of 0 on the z-axis), and positive z-index elements (i.e., elements with a positive position on the z-axis).

[0152] Data describing the stacking order of elements to be displayed can be obtained from the rendering data of the target page, such as Cascading Style Sheets (CSS). Based on the obtained data, attribute information representing the stacking order of elements to be displayed can be parsed. CSS is a computer language used to represent the styles of documents such as HTML (an application of Standard Generalized Markup Language) or XML (a subset of Standard Generalized Markup Language). Attribute information representing the stacking order of elements to be displayed includes, but is not limited to, stacking context information, stacking level information, and stacking order. Stacking context represents the priority of an element on the Z-axis. If an element contains a stacking context, that is, it is a stacking context element, it means that the element is closer to the observer than non-stacking context elements. Stacking level represents the vertical order of elements on the Z-axis.

[0153] If an element is covered by other elements, the observer cannot see the covered element. Therefore, in order to find the visual element, the stacking order and display boundary information of multiple elements to be displayed can be determined based on the attribute information of multiple elements to be displayed.

[0154] Step S720: Based on the determined stacking order and display boundary information, select the covered elements to be displayed from multiple elements to be displayed.

[0155] Based on the attribute information and display boundary information of multiple elements to be displayed, the covered elements can be selected from the multiple elements to be displayed and treated as non-visual elements.

[0156] In this context, an element to be displayed that is covered is one whose display boundary coincides with the display boundary of other elements to be displayed, and whose stacking priority is lower than that of other elements to be displayed. The higher the priority, the closer it is to the observer.

[0157] Optionally, to ensure that the covered element is not visible, the covered element can be a non-transparent element that is completely covered by other elements to be displayed.

[0158] Step S730: Filter out the covered elements and their attribute information from the multiple elements to be displayed and their attribute information to obtain multiple visual elements and their attribute information.

[0159] After identifying the covered element from multiple elements to be displayed, the covered element can be filtered out from the multiple elements to be displayed, and the attribute information of the covered element can be filtered out from the attribute information of the multiple elements to be displayed, thereby obtaining multiple visual elements and their attribute information.

[0160] It should be noted that, Figure 7 The specific implementation details of steps S210 and S230-S240 shown can be found in [reference]. Figure 2 The steps S210 and S230-S240 shown are as follows: Figure 7 For detailed implementation of step S620 shown, please refer to [link / reference]. Figure 6 Step S620 shown will not be described again here.

[0161] exist Figure 7 In the illustrated embodiment, the stacking order and display boundary information of multiple elements to be displayed are determined based on the attribute information of multiple elements to be displayed. Based on the determined stacking order and display boundary information, covered elements to be displayed are selected from the multiple elements to be displayed. The covered elements to be displayed and their attribute information are then filtered out from the multiple elements to be displayed and their attribute information to obtain multiple visual elements and their attribute information. This process filters out elements that are invisible due to being covered, reducing the amount of data processing.

[0162] In one exemplary embodiment, see Figure 9 , Figure 9 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0163] like Figure 9 As shown, the application testing method includes steps S210-S220, steps S910-S930, and step S240. The detailed descriptions of steps S910-S930 are as follows:

[0164] Step S910: Obtain the size of the display window and determine the size of the target page based on the rendering data.

[0165] During the rendering process, the target page is sized to its original size, which is set by the developer. To determine whether the target page size matches the size of the display window of the application under test, the size of the display window can be obtained, and the target page size can be obtained based on the rendering data of the display page.

[0166] Step S920: Calculate the scaling ratio of the target page based on the size of the display window and the size of the target page.

[0167] After obtaining the size of the display window and the size of the target page, in order to adapt the target page to the display window, the scaling ratio of the target page can be calculated based on the size of the display window and the size of the target page.

[0168] The specific method for calculating the scaling ratio can be flexibly set according to actual needs. In one optional example, multiple scaling ratios can be preset, and the scaling ratio of the target page can be determined from these ratios based on the size of the display window and the size of the target page. Alternatively, in another optional example, the scaling ratio of the target page can be calculated based on the size of the display window and the size of the target page, ensuring that the size of the scaled target page matches the size of the display window. Or, in yet another optional example, the aspect ratio of the target page can be determined based on its size, the width of the display window can be used as the width of the scaled target page, and the length of the scaled target page can be determined based on its width and aspect ratio. Finally, the scaling ratio of the target page can be determined based on its width and length, thus ensuring that the aspect ratio of the target page before and after scaling is the same, thereby ensuring the consistency of page display.

[0169] Step S930: Select the target visual element to be displayed in the display window from multiple visual elements according to the scaling ratio.

[0170] After determining the scaling factor of the target page, you can filter out the target visual elements to be displayed in the display window from among the multiple visual elements contained on the target page, based on the scaling factor. The specific filtering method can be flexibly set according to actual needs.

[0171] It should be noted that, Figure 9 The specific implementation details of steps S210-S220 and step S240 shown can be found in [reference]. Figure 2 Steps S210-S220 and S240 shown will not be repeated here.

[0172] exist Figure 9In the illustrated embodiment, considering that the size of the target page to be rendered may not match the size of the display window, and the target page may be scaled during the display process, the size of the display window is first obtained, and the size of the target page is determined based on the rendering data. The scaling ratio of the target page is calculated based on the size of the display window and the size of the target page. Then, the target visual element to be displayed in the display window is selected from multiple visual elements according to the scaling ratio, thereby improving the accuracy of the target visual element.

[0173] In one exemplary embodiment, see Figure 10 , Figure 10 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0174] like Figure 10 As shown, under the condition that the visualization attribute information of multiple visualization elements includes the position information of multiple visualization elements, the application testing method includes steps S210-S220, S910-S920, S1010-S1030, and step S240. Among them, the detailed description of steps S1010-S1030 is as follows:

[0175] Step S1010: Scale the target page according to the scaling ratio, and update the position information of multiple visual elements based on the scaled target page.

[0176] After determining the scaling ratio of the target page, the target page can be scaled according to the scaling ratio, and the position information of multiple visual elements can be updated based on the scaled target page.

[0177] Step S1020: If the size of the scaled target page is larger than the size of the display window, then determine the target area to be displayed in the display window from the area contained in the scaled target page; wherein the size of the target area matches the size of the display window.

[0178] If the scaled target page is larger than the display window, it means that only a portion of the content within the target page is displayed in the application's window. Therefore, we can determine the area within the scaled target page that matches the display window size and use that area as the target area. In other words, the content within the target area of ​​the target page is the content displayed in the display window. For example, see... Figure 11 As shown, in the target page 1110, a target area 1130 that matches the size of the display window 1120 is determined. The content contained in the target area 1130 is the content displayed in the display window 1120 of the target page 1110.

[0179] Step S1030: Based on the updated position information of multiple visualization elements, the visualization element located in the target area is taken as the target visualization element.

[0180] Because the target page has been scaled, the position information of multiple visual elements contained in the target page has also changed. Therefore, based on the updated position information of multiple visual elements, the visual element located within the target area of ​​the target page can be determined from among the multiple visual elements, and the determined visual element can be used as the target visual element.

[0181] It should be noted that, Figure 10 The specific implementation details of steps S210-S220 and step S240 shown can be found in [reference]. Figure 2 Steps S210-S220 and step S240 are shown. Figure 10 The specific implementation details of steps S910-S920 shown can be found in [reference]. Figure 9 Steps S910-S920 shown are not repeated here.

[0182] exist Figure 10 In the illustrated embodiment, given that the visualization attribute information of multiple visualization elements includes the position information of multiple visualization elements, the target page is first scaled according to the scaling ratio, and the position information of multiple visualization elements is updated based on the scaled target page. If the size of the scaled target page is larger than the size of the display window, the target area to be displayed in the display window is determined from the area contained in the scaled target page. The size of the target area matches the size of the display window. Based on the updated position information of multiple visualization elements, the visualization elements located in the target area are taken as target visualization elements, so that the determined target visualization elements match the visualization elements actually displayed in the display window, thereby improving the accuracy of the target visualization elements.

[0183] In one exemplary embodiment, see Figure 12 , Figure 12 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0184] like Figure 12 As shown, under the condition that the target page contains multiple views and the display window of the application under test contains child windows corresponding to each of the multiple views, the application testing method includes steps S210-S220, S910-S920, S1010, S1210-S1230, S1030, and S240. Among them, the detailed description of steps S1210-S1230 is as follows:

[0185] Step S1210: From the scaled target page, select candidate views whose size is larger than the corresponding child window size, and target views whose size is smaller than or equal to the corresponding child window size.

[0186] It should be noted that a page typically includes multiple views, such as a top navigation bar, sidebar, content section, and bottom information bar. See one example. Figure 13 As shown, the page includes views 1310 and 1320; correspondingly, the window of the application to be tested may include a child window for each view, wherein the child window is used to display the content contained in its corresponding view.

[0187] After scaling the target page, candidate views and the target view can be determined from the multiple views contained in the scaled target page. Candidate views are views whose size is larger than the size of the corresponding child window, and target views are views whose size is smaller than or equal to the size of the corresponding child window.

[0188] Step S1220: Determine the candidate region to be displayed in the corresponding sub-window from the region contained in the candidate view; wherein the size of the candidate region matches the size of the corresponding sub-window.

[0189] Since the size of the candidate view is larger than the size of the corresponding child window, it means that only part of the content in the area contained in the candidate view is displayed in the child window corresponding to the candidate view. Therefore, an area that matches the size of the display window can be determined from the area contained in the candidate view, and this area can be used as the candidate area. That is, the content contained in the candidate area of ​​the candidate view is the content displayed by the candidate view in the corresponding child window.

[0190] Step S1230: Select the candidate region and the region contained in the target view as the target region.

[0191] Since the size of the target view is less than or equal to the size of the corresponding child window, all the content contained in the target view is displayed in the corresponding child window. Therefore, the candidate area of ​​the candidate view and the area contained in the target view are used as the target area.

[0192] It should be noted that, Figure 12 The specific implementation details of steps S210-S220 and step S240 shown can be found in [reference]. Figure 2 Steps S210-S220 and step S240 are shown. Figure 12 The specific implementation details of steps S910-S920 shown can be found in [reference]. Figure 9 Steps S910-S920 are shown. Figure 12 For detailed implementation of steps S1010 and S1030, please refer to [link / reference]. Figure 10 Steps S1010 and S1030 shown will not be repeated here.

[0193] exist Figure 12 In the illustrated embodiment, candidate views with a size larger than the corresponding sub-window size and target views with a size smaller than or equal to the corresponding sub-window size are selected from the scaled target page; candidate regions to be displayed in the corresponding sub-window are determined from the regions contained in the candidate views; wherein the size of the candidate regions matches the size of the corresponding sub-window; the candidate regions and the regions contained in the target views are used as target regions, thereby referencing the display of different views in the process of determining target visual elements, thus improving the accuracy of target visual elements.

[0194] In one exemplary embodiment, see Figure 14 , Figure 14 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0195] like Figure 14 As shown, the application testing method includes steps S210-S220, S910-S920, S1010, S1410-S1420, S1030, and S240. The detailed descriptions of steps S1410-S1420 are as follows:

[0196] Step S1410: If the size of the scaled target page is larger than the size of the display window, obtain the viewing instruction and determine the viewing position from the scaled target page according to the viewing instruction.

[0197] If the size of the scaled target page is larger than the size of the display window, it indicates that only a portion of the content within the target page is displayed in the display window of the application under test. The object or automated testing framework can issue viewing commands to control the content displayed on the target page in the display window, for example, by using a slider control in the display window to control the content displayed on the target page.

[0198] To determine which area of ​​the target page's content is displayed in the display window, a viewing command can be obtained, and the viewing location can be determined from the scaled target page based on the viewing command.

[0199] Step S1420: Based on the viewing location, determine the target area to be displayed in the display window from the area contained in the scaled target page.

[0200] After determining the viewing position from the scaled target page, the target area can be determined from the area contained in the scaled target page based on the viewing position. The content contained in the target area is the content displayed in the display window of the target page.

[0201] The size of the target area can be matched with the size of the display window.

[0202] It should be noted that, Figure 14 The specific implementation details of steps S210-S220 and step S240 shown can be found in [reference]. Figure 2 Steps S210-S220 and step S240 are shown. Figure 14 The specific implementation details of steps S910-S920 shown can be found in [reference]. Figure 9 Steps S910-S920 are shown. Figure 14 For detailed implementation of steps S1010 and S1030, please refer to [link / reference]. Figure 10Steps S1010 and S1030 shown will not be repeated here.

[0203] exist Figure 14 In the illustrated embodiment, if the size of the scaled target page is larger than the size of the display window, a viewing instruction is obtained, and the viewing position is determined from the scaled target page according to the viewing instruction. Based on the viewing position, the target area to be displayed in the display window is determined from the area contained in the scaled target page. Thus, in the process of determining the target visual element, the viewing situation of the target page is taken into account, thereby improving the accuracy of the target visual element.

[0204] In one exemplary embodiment, see Figure 15 , Figure 15 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0205] like Figure 15 As shown, under the condition that the target page contains a first view and a second view, the application testing method includes steps S210-S220, step S910, steps S1510-S1540, step S930, and step S240. The detailed description of steps S1510-S1540 is as follows:

[0206] Step S1510: Calculate the scaling ratio of the first view based on the size of the first view and the size of the display window.

[0207] The target page may include a first view and a second view. The first view may be a view in which all of the contained content needs to be displayed in the display window, while the second view may be a view in which some or all of the contained content can be displayed in the display window. For example, the first view may be a top navigation bar, sidebar, etc., and the second view may be the content portion. It should be noted that "first" and "second" are only used to distinguish the types of views and are not used to limit the number of views.

[0208] To make the first view fit the display window, the scaling ratio of the first view can be calculated based on the size of the first view and the size of the display window.

[0209] Step S1520: Determine the sub-window corresponding to the first view from the display window according to the scaling ratio of the first view; wherein the size of the sub-window corresponding to the first view matches the size of the scaled first view.

[0210] The display window of the application to be tested includes a sub-window corresponding to the first view and a sub-window corresponding to the second view. In order to ensure that all the content contained in the scaled first view is displayed in the display window, the size of the sub-window corresponding to the first view is matched with the size of the scaled first view. That is, after scaling the first view based on the scaling ratio of the first view, the size of the scaled first view is smaller or larger than the size of the sub-window corresponding to the first view.

[0211] Step S1530: Select an area from the display window other than the child window corresponding to the first view, and determine the child window corresponding to the second view from the selected area.

[0212] After determining the child window corresponding to the first view, the child window corresponding to the second view can be determined from the area contained in the display window other than the child window corresponding to the first view.

[0213] Optionally, all areas of the display window except for the child windows corresponding to the first view can be used as child windows corresponding to the second view.

[0214] Step S1540: Calculate the scaling ratio of the second view based on the size of the sub-window corresponding to the second view and the size of the second view.

[0215] After determining the child window corresponding to the second view, the scaling ratio of the second view can be calculated based on the size of the child window and the size of the second view.

[0216] It should be noted that, Figure 15 The specific implementation details of steps S210-S220 and step S240 shown can be found in [reference]. Figure 2 Steps S210-S220 and step S240 are shown. Figure 15 The specific implementation details of steps S910 and S930 shown can be found in [reference]. Figure 9 Steps S910 and S930 shown will not be repeated here.

[0217] exist Figure 15In the illustrated embodiment, the scaling ratio of the first view is calculated based on the size of the first view and the size of the display window. The corresponding sub-window is then determined from the display window based on the scaling ratio of the first view. The size of the sub-window corresponding to the first view matches the size of the scaled first view. An area other than the sub-window corresponding to the first view is selected from the display window, and the corresponding sub-window for the second view is determined from the selected area. The scaling ratio of the second view is calculated based on the size of the sub-window corresponding to the second view and the size of the second view itself. This process considers the scaling of different types of views during the determination of the target visual element, thus improving the accuracy of the target visual element.

[0218] In one exemplary embodiment, see Figure 16 , Figure 16 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0219] like Figure 16 As shown, the application testing method includes steps S210-S230 and steps S1610-S1620, wherein the detailed description of steps S1610-S1620 is as follows:

[0220] Step S1610: Filter out visual attribute information of a specified type from the visual attribute information of the target visual element; the specified type of visual attribute information includes at least one of font information, color information, and display boundary information.

[0221] Visual elements have a lot of visual attribute information; for example, a single element may have more than 200 style attributes, resulting in a lot of redundant information. Therefore, in order to reduce the amount of data processing and improve testing efficiency, in the embodiments of this application, a specified type of visual attribute information is filtered from the visual attribute information of the target visual element.

[0222] The specified type of attribute information can be flexibly set according to actual needs. The specified type of attribute information can be visual attribute information, such as at least one of font information, color information, display boundary information, etc.

[0223] Step S1620: Determine the test result corresponding to the application to be tested based on the specified type of visual attribute information and the target visual element.

[0224] It should be noted that, Figure 16 The specific implementation details of steps S210-S230 shown can be found in [reference]. Figure 2 Steps S210-S230 shown will not be repeated here.

[0225] exist Figure 16 In the illustrated embodiment, a specified type of visual attribute information is filtered from the visual attribute information of the target visual element. The specified type of visual attribute information includes at least one of font information, color information, and display boundary information. Based on the specified type of visual attribute information and the target visual element, the test result corresponding to the application under test is determined. This not only obtains important attribute information, ensures test effectiveness, and reduces data processing volume, but also allows testers to set the specified type of attribute information themselves, thereby improving the controllability of the test.

[0226] In one exemplary embodiment, see Figure 17 , Figure 17 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0227] like Figure 17 As shown, the application testing method includes steps S210-S230 and steps S1710-S1720. The detailed descriptions of steps S1710-S1720 are as follows:

[0228] Step S1710: Compare the set visualization element with the target visualization element, and compare the attribute information of the set visualization element with the visualization attribute information of the target visualization element.

[0229] The visual elements and their attribute information can be the content expected to be displayed in the display window of the application under test, and their specific data can be flexibly set according to actual needs.

[0230] After selecting the target visual element to be displayed in the display window from the multiple visual elements contained in the target page, the target visual element can be compared with the set visual element, and the visual attribute information of the target visual element can be compared with the attribute information of the set visual element.

[0231] Optionally, to improve comparison speed, the visual attribute information of the target visual element can be concatenated according to a set first sorting method to obtain first concatenated information, which is then encoded to obtain a first encoded value. Then, the attribute information of the set visual element is concatenated according to the same sorting method to obtain second concatenated information, which is then encoded to obtain a second encoded value. The first and second encoded values ​​are then compared. Correspondingly, the target visual element and the set visual element can be encoded separately, and the resulting encoded values ​​are compared. The encoding method includes, but is not limited to, hash encoding, where the obtained encoded value is a hash value, thereby improving comparison accuracy.

[0232] Optionally, a target comparison method can be determined from multiple comparison methods based on the data volume of the target visual element and its visual attribute information. The set visual element is then compared with the target visual element according to the target comparison method, and the attribute information of the set visual element is compared with the visual attribute information of the target visual element. For example, if the data volume of the target visual element and its visual attribute information is greater than a set threshold, the set visual element, the target visual element, the attribute information of the set visual element, and the visual attribute information of the target visual element can be encoded separately as described above, and then the comparison can be performed based on the obtained encoded values. If the data volume of the target visual element and its visual attribute information is less than or equal to the set threshold, the set visual element and the target visual element can be directly compared, and the attribute information of the set visual element is directly compared with the visual attribute information of the target visual element.

[0233] Step S1720: Determine the test result corresponding to the application to be tested based on the comparison result.

[0234] Based on the comparison results between the target visualization element and the set visualization element, and the comparison results between the attribute information of the target visualization element and the attribute information of the set visualization element, the test results corresponding to the application to be tested are determined.

[0235] Optionally, if the target visualization element matches the set visualization element, and the attribute information of the target visualization element matches the attribute information of the set visualization element, it indicates that the application under test meets expectations, and therefore the test passes; if the target visualization element does not match the set visualization element, and / or the attribute information of the target visualization element does not match the attribute information of the set visualization element, it indicates that the application under test does not meet expectations, and therefore the test fails.

[0236] Optionally, to improve testing accuracy, a screenshot of the display window of the application under test can be obtained, and the obtained screenshot can be compared with a set image. The test results obtained based on the target visual elements can be updated according to the comparison results, thereby combining multiple testing methods to determine the test results and improve testing accuracy.

[0237] In an optional embodiment, after determining the test results corresponding to the application to be tested, a test report can be generated based on the test results. The test report may include at least one of the following: test results, comparison results between the target visual element and the set visual element, and comparison results between the attribute information of the target visual element and the attribute information of the set visual element. This allows the tester to locate the reason for the test failure based on the test report and optimize the application to be tested.

[0238] It should be noted that, Figure 17 The specific implementation details of steps S210-S230 shown can be found in [reference]. Figure 2 Steps S210-S230 shown will not be repeated here.

[0239] exist Figure 17 In the illustrated embodiment, the set visualization element is compared with the target visualization element, and the attribute information of the set visualization element is compared with the visualization attribute information of the target visualization element. Based on the comparison results, the test result corresponding to the application to be tested is determined, thereby realizing automated testing.

[0240] In one exemplary embodiment, the application testing method is applied to User Acceptance Test (UAT), where the application under test is an application developed based on the Android system, and the target page is an H5 page contained within the application under test. See also Figure 18 , Figure 18 This is a flowchart illustrating an application testing method as shown in another exemplary embodiment of this application. Figure 18 As shown, the application testing method includes steps S1810-S1890, which are described in detail below:

[0241] Step S1810: Start the automated testing framework of the Android system, and call the accessibility service through the automated testing framework to obtain the visual elements displayed in the display window of the H5 page of the application under test and the attribute information of the visual elements.

[0242] Open the H5 page of the application to be tested in the Android client, so that part or all of the content of the H5 page is displayed in the display window of the application to be tested; then, call the accessibility service through the automated testing framework to obtain the target visual elements displayed in the display window of the application to be tested from the H5 page of the application to be tested.

[0243] Optional, see Figure 19 As shown, the automated testing framework of the Android system includes uiautomator (a tool for automated testing of Android application interfaces). After the automated testing framework starts, it calls uiautomator to perform automated testing of the application interface. uiautomator obtains the visual elements displayed in the display window of the H5 page of the application under test and the attribute information of the visual elements by calling the accessibility service.

[0244] Optionally, an automated testing framework can be implemented using the at library (a type of instruction library).

[0245] Step S1820: Start the rendering data acquisition code and run the entry function in the data acquisition code.

[0246] Step S1830: Obtain the tree structure data of the H5 page during the rendering process through the entry function.

[0247] Since the visualization elements and attribute information of the visualization elements obtained by the accessibility service may be missing aria elements, font information, color information, etc., in the embodiments of this application, the rendering data acquisition code can be determined first, and the entry function can be called through the rendering data acquisition code to obtain the tree structure data of the H5 page during the rendering process, that is, the rendering tree of the H5 page.

[0248] Optionally, the root node of the rendering tree (usually document.body) can be found through the entry function, and the tree structure data of the H5 page can be obtained by traversing it using a breadth-first search (BFS) algorithm, thus obtaining the rendering tree. See also... Figure 19As shown, tree structure data can be obtained from the WebView component. Optionally, the rendering data acquisition code can be pre-embedded in the Android system's automated testing framework. After the automated testing framework runs, it can create a corresponding instance in the WebView component based on the rendering data acquisition code, and then obtain the tree structure data of the H5 page from the WebView component through the instance. Optionally, the automated testing framework can embed the rendering data acquisition code into the WebView component via the CDPP protocol, allowing the rendering data acquisition code to run within the WebView component, thereby obtaining the rendering data obtained by the WebView component after rendering the H5 page.

[0249] Step S1840: Store the obtained tree structure data.

[0250] To prevent data loss, the acquired tree structure data can be stored. Alternatively, the acquired tree structure data can be stored using the Android Debug Bridge (ADB).

[0251] Step S1850 is to request the driver for automated testing.

[0252] You can request a Java driver from the Android client to perform automated tests, and then use the Java driver to complete the subsequent automated tests.

[0253] Step S1860: Obtain the multiple elements contained in the H5 page and the attribute information of the multiple elements based on the tree structure data.

[0254] Optionally, the process of obtaining multiple elements and their attribute information contained in an H5 page based on tree structure data may include steps S1861-S1866, which are detailed below:

[0255] Step S1861: Obtain the document object model tree of the H5 page based on the tree structure data.

[0256] Step S1862: Call the html2canvas function to process the document object model tree.

[0257] Step S1863: Call the renderElement function for processing.

[0258] Step S1864: Call the render.render function to obtain the attribute information of the element from the document object model tree.

[0259] The process of calling the render.render function to obtain the attribute information of the element to be displayed may include steps S18641-S18643, which are described in detail below:

[0260] Step S18641: Generate a canvasRenderer instance.

[0261] In step S18642, the documentCloner function is called to retrieve elements from the document object model tree and clone the elements to obtain cloned elements.

[0262] The document object model (DOM) tree can be recursively searched for elements, and the found elements can be cloned. Each node in the DOM tree corresponds to one element.

[0263] Step S18643: Call the parseTree function to obtain the attribute information of the cloned element.

[0264] Optionally, in step S18653, the relevant data of the cloned element can be obtained through the parseTree function, and the relevant data of the cloned element can be converted into a data type that html2canvas can recognize. For example, see [link to relevant documentation]. Figure 18 As shown, the relevant data of cloned elements can be converted into Elementcontainer, which includes bounds, elements, flags, styles, and text nodes.

[0265] Step S1865: Determine the stacking order of the elements to be displayed through the layered rendering management plugin.

[0266] Optionally, the layered rendering management plugin can be the renderStack function.

[0267] The process of determining the stacking order of elements to be displayed through the layered rendering management plugin may include step S18651, which is described in detail below:

[0268] Step S18651: Parse the stacking information of the cloned elements to obtain the stacking order of the cloned elements.

[0269] Cascading information includes, but is not limited to, CSS cascading context.

[0270] Optional, see Figure 18As shown, the element and its stacking type can be determined based on the attribute information of the cloned element. In order of distance from the observer, the stacking types include background and border elements, negative z-index elements, block elements, non-positioned float elements, non-positioned inline-level elements, inline-level elements, elements with z-index of 0, and elements with positive z-index.

[0271] Step S1866: Call renderStackContent to render elements in stacking order.

[0272] Optional, see Figure 18 As shown, the renderNodeContent function can be called to render element content, such as rendering text elements, rendering replacement elements, and rendering text; the applyEffects function can be called to render special effects; the renderNodeBackgroundAndBorders function can be called to render the background and borders; and the renderNode function can be called to render element content, where the renderNode function can call the renderNodeContent and renderNodeBackgroundAndBorders functions for rendering.

[0273] Optionally, call renderStackContent to render the elements in stacking order and obtain multiple elements and their attribute information.

[0274] Step S1870: Filter multiple elements and their attribute information to obtain an H5 page containing multiple visual elements and their visual attribute information.

[0275] Optionally, filtering multiple elements and their attribute information to obtain an H5 page containing multiple visual elements and their visual attribute information may include steps S1871-S1872, detailed below:

[0276] Step S1871: Filter out non-visual elements from the multiple elements to be displayed.

[0277] For example, filtering out elements that are not NAF, and filtering out covered elements.

[0278] Step S1872: Filter out non-visual attribute information.

[0279] For example, filtering out size information with a width and height of 0, filtering out attribute information with an opacity of 0, etc.

[0280] Optionally, after obtaining the visualization element and its visualization attribute information, an XML file can be generated based on the visualization element and its visualization attribute information.

[0281] Step S1880: Obtain the target visual element displayed in the display window from the multiple visual elements contained in the H5 page.

[0282] Optionally, the process of retrieving the target visual element displayed in the display window from multiple visual elements contained in the H5 page includes steps S1881-S1884, which are detailed below:

[0283] Step S1881: Obtain the size of the display window of the application to be tested. The size of the display window includes the length and height of the display window.

[0284] Step S1882: Determine the scaling ratio of the H5 page based on the size of the display window and the size of the H5 page.

[0285] Step S1883: Scale the H5 page based on the determined scaling ratio, and update the position information of the visual elements based on the scaled H5 page.

[0286] Step S1884: Determine the target area from the scaled H5 page, and use the visual elements within the target area as the target visual elements.

[0287] Optionally, the target visual element and its visual attributes can be retrieved from an XML file containing the visual element and its visual attributes, and then converted into JavaScript Object Notation (JSON) format for easier comparison later.

[0288] Step S1890: Update the visualization elements and their attribute information obtained by the accessibility service to the target visualization elements and their attribute information, and determine the test results of the application to be tested based on the target visualization elements and their attribute information.

[0289] Understandable, Figure 18 The specific implementation details of each step in the illustrated embodiment have been described in detail in the foregoing embodiments and will not be repeated here.

[0290] Figure 20 This is a block diagram illustrating an application testing apparatus according to an embodiment of this application. Figure 20 As shown, the device includes:

[0291] The determination module 2001 is configured to determine the multiple elements to be displayed and their attribute information contained in the target page based on the rendering data corresponding to the target page of the application to be tested.

[0292] The filtering module 2002 is configured to filter out non-visual elements and non-visual attribute information from multiple elements to be displayed and the attribute information of multiple elements to be displayed, so as to obtain multiple visual elements contained in the target page and the visual attribute information of multiple visual elements.

[0293] The filtering module 2003 is configured to filter out the target visual elements displayed in the display window from multiple visual elements based on the content presented by the target page in the display window of the application to be tested.

[0294] Test module 2004 is configured to determine the test results for the application under test based on the target visualization elements and their visualization attribute information.

[0295] In one embodiment of this application, the filtering module 2002 includes:

[0296] The element filtering module is configured to filter out non-visual elements and their attribute information from multiple elements to be displayed and their attribute information, so as to obtain multiple visual elements and their attribute information.

[0297] The attribute filtering module is configured to filter out non-visual attribute information from the attribute information of multiple visual elements, and obtain the visual attribute information of multiple visual elements.

[0298] In one embodiment of this application, the element filtering module is specifically configured as follows:

[0299] The stacking order and display boundary information of multiple elements to be displayed are determined based on their attribute information.

[0300] Based on the determined stacking order and display boundary information, select the covered elements to be displayed from multiple elements to be displayed;

[0301] Filter out the covered elements and their attribute information from multiple elements to be displayed, and obtain multiple visual elements and their attribute information.

[0302] In one embodiment of this application, the screening module 2003 includes:

[0303] The size acquisition module is configured to acquire the size of the display window and determine the size of the target page based on the rendering data;

[0304] The scaling module is configured to calculate the scaling ratio of the target page based on the size of the display window and the size of the target page.

[0305] The filtering submodule is configured to filter out the target visualization element to be displayed in the display window from multiple visualization elements based on the zoom level.

[0306] In one embodiment of this application, given that the visualization attribute information of multiple visualization elements includes the position information of the multiple visualization elements, the filtering submodule includes:

[0307] The scaling module is configured to scale the target page according to the scaling ratio and update the position information of multiple visual elements based on the scaled target page;

[0308] The region determination module is configured to determine the target region to be displayed in the display window from the region contained in the scaled target page if the size of the scaled target page is larger than the size of the display window; wherein the size of the target region matches the size of the display window.

[0309] The element determination module is configured to use the updated position information of multiple visualization elements as the target visualization element.

[0310] In one embodiment of this application, based on the foregoing solution, given that the target page contains multiple views and the display window contains sub-windows corresponding to each of the multiple views, the region determination module is specifically configured as follows:

[0311] From the scaled target page, select candidate views whose size is larger than the corresponding child window size, and target views whose size is smaller than or equal to the corresponding child window size;

[0312] The candidate region to be displayed in the corresponding child window is determined from the region contained in the candidate view; wherein the size of the candidate region matches the size of the corresponding child window;

[0313] The candidate region and the region contained in the target view are used as the target region.

[0314] In one embodiment of this application, the region determination module is specifically configured as follows:

[0315] Obtain the viewing instruction and determine the viewing location from the scaled target page according to the viewing instruction;

[0316] Based on the viewing location, determine the target area to be displayed in the display window from the area contained in the scaled target page.

[0317] In one embodiment of this application, given that the target page includes a first view and a second view, the size determination module is specifically configured as follows:

[0318] Calculate the scaling ratio of the first view based on the size of the first view and the size of the display window;

[0319] The child window corresponding to the first view is determined from the display window according to the scaling ratio of the first view; wherein the size of the child window corresponding to the first view matches the size of the scaled first view;

[0320] Select the area outside the child window corresponding to the first view from the display window, and determine the child window corresponding to the second view from the selected area;

[0321] Calculate the scaling ratio of the second view based on the size of the child window corresponding to the second view and the size of the second view itself.

[0322] In one embodiment of this application, based on the aforementioned scheme, under the condition that the target page is a webpage, the determination module 2001 is specifically configured as follows:

[0323] During the rendering of the target page through browser components, the rendering data of the target page is obtained from the browser components;

[0324] The rendered data is parsed to obtain multiple elements to be displayed on the target page, as well as the attribute information of these elements.

[0325] In one embodiment of this application, the determining module 2001 is specifically configured as follows:

[0326] Based on the rendering data corresponding to the target page of the application under test, construct the document object model tree corresponding to the target page;

[0327] The document object model tree is split to obtain multiple elements to be displayed on the target page, as well as the attribute information of these elements.

[0328] In one embodiment of this application, the test module 2004 is specifically configured as follows:

[0329] Filter out visual attribute information of a specified type from the visual attribute information of the target visual element; the specified type of visual attribute information includes at least one of font information, color information, and display boundary information;

[0330] Based on the specified type of visual attribute information and the target visual elements, determine the test results for the application under test.

[0331] In one embodiment of this application, the test module 2004 is specifically configured as follows:

[0332] The set visualization element is compared with the target visualization element, and the attribute information of the set visualization element is compared with the visualization attribute information of the target visualization element.

[0333] The test results for the application to be tested are determined based on the comparison results.

[0334] It should be noted that the apparatus provided in the foregoing embodiments and the method provided in the foregoing embodiments belong to the same concept, and the specific way in which each module and unit performs operations has been described in detail in the method embodiments.

[0335] Embodiments of this application also provide an electronic device, including: one or more processors; and a storage device for storing one or more computer programs, which, when executed by one or more processors, cause the electronic device to perform the application testing method as described above.

[0336] Figure 21 This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the present application embodiments.

[0337] It should be noted that, Figure 21 The computer system 2100 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0338] like Figure 21 As shown, the computer system 2100 includes a Central Processing Unit (CPU) 2101, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on programs stored in Read-Only Memory (ROM) 2102 or programs loaded from storage portion 2108 into Random Access Memory (RAM) 2103. The RAM 2103 also stores various programs and data required for system operation. The CPU 2101, ROM 2102, and RAM 2103 are interconnected via a bus 2104. An Input / Output (I / O) interface 2105 is also connected to the bus 2104.

[0339] The following components are connected to I / O interface 2105: an input section 2106 including a keyboard, mouse, etc.; an output section 2107 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 2108 including a hard disk, etc.; and a communication section 2109 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 2109 performs communication processing via a network such as the Internet. A drive 2110 is also connected to I / O interface 2105 as needed. Removable media 2111, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 2110 as needed so that computer programs read from them can be installed into storage section 2108 as needed.

[0340] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 2109, and / or installed from removable medium 2111. When the computer program is executed by central processing unit (CPU) 2101, it performs various functions defined in the system of this application.

[0341] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. For example, a computer-readable medium can be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable medium can be any tangible medium that includes or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program included on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0342] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which includes one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0343] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0344] Another aspect of this application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the application testing method as described above. This computer-readable medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.

[0345] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable medium. A processor of a computer device reads the computer instructions from the computer-readable medium and executes the computer instructions, causing the computer device to perform the application testing methods provided in the various embodiments described above.

[0346] The above description is merely a preferred exemplary embodiment of this application and is not intended to limit the implementation of this application. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of this application. Therefore, the scope of protection of this application should be determined by the scope of protection claimed in the claims.

Claims

1. An application testing method, characterized in that, The method includes: Based on the rendering data corresponding to the target page of the application to be tested, determine the multiple elements to be displayed contained in the target page and the attribute information of the multiple elements to be displayed; Non-visual elements and non-visual attribute information are filtered from the plurality of elements to be displayed and the attribute information of the plurality of elements to be displayed to obtain a plurality of visual elements contained in the target page and the visual attribute information of the plurality of visual elements; Obtain the size of the display window of the application to be tested, and determine the size of the target page based on the rendering data; Calculate the scaling ratio of the target page based on the size of the display window of the application under test and the size of the target page; The target visual element to be displayed in the display window is selected from the plurality of visual elements according to the scaling ratio; Based on the target visualization element and the visualization attribute information of the target visualization element, determine the test result corresponding to the application to be tested; The target page includes a first view and a second view; the scaling ratio of the target page includes the scaling ratio of the first view and the scaling ratio of the second view; calculating the scaling ratio of the target page based on the size of the display window of the application under test and the size of the target page includes: Calculate the scaling ratio of the first view based on the size of the first view and the size of the display window; The sub-window corresponding to the first view is determined from the display window according to the scaling ratio of the first view; wherein the size of the sub-window corresponding to the first view matches the size of the scaled first view; Select an area outside the child window corresponding to the first view from the display window, and determine the child window corresponding to the second view from the selected area; The scaling factor of the second view is calculated based on the size of the child window corresponding to the second view and the size of the second view.

2. The method as described in claim 1, characterized in that, The step of filtering non-visual elements and non-visual attribute information from the plurality of elements to be displayed and their attribute information to obtain the plurality of visual elements contained in the target page and the visual attribute information of the plurality of visual elements includes: From the plurality of elements to be displayed and their attribute information, filter out the non-visual elements and their attribute information to obtain a plurality of visual elements and their attribute information. Non-visual attribute information is filtered out from the attribute information of the plurality of visual elements to obtain the visual attribute information of the plurality of visual elements.

3. The method as described in claim 2, characterized in that, The step of filtering out non-visual elements and their attribute information from the plurality of elements to be displayed and their attribute information to obtain a plurality of visual elements and their attribute information includes: The stacking order and display boundary information of the multiple elements to be displayed are determined based on their attribute information. Based on the determined stacking order and display boundary information, the covered elements to be displayed are selected from the plurality of elements to be displayed; The covered elements and their attribute information are filtered out from the plurality of elements to be displayed and their attribute information to obtain the plurality of visual elements and their attribute information.

4. The method as described in claim 1, characterized in that, The visualization attribute information of the plurality of visualization elements includes the position information of the plurality of visualization elements; The step of filtering the target visual element to be displayed in the display window from the plurality of visual elements according to the scaling ratio includes: The corresponding view in the target page is scaled according to the scaling ratio, and the position information of the plurality of visual elements is updated based on the scaled target page; If the size of the scaled target page is larger than the size of the display window, then the target area to be displayed in the display window is determined from the area contained in the scaled target page; wherein the size of the target area matches the size of the display window. Based on the updated position information of the multiple visualization elements, the visualization element located in the target area is taken as the target visualization element.

5. The method as described in claim 4, characterized in that, The target page contains multiple views, and the display window contains a sub-window corresponding to each of the multiple views; Determining the target area to be displayed in the display window from the area contained in the scaled target page includes: From the scaled target page, select candidate views whose size is larger than the corresponding sub-window size, and target views whose size is smaller than or equal to the corresponding sub-window size; A candidate region to be displayed in the corresponding sub-window is determined from the region contained in the candidate view; wherein the size of the candidate region matches the size of the corresponding sub-window; The candidate region and the region contained in the target view are used as the target region.

6. The method as described in claim 4, characterized in that, Determining the target area to be displayed in the display window from the area contained in the scaled target page includes: Obtain a viewing instruction, and determine the viewing location from the scaled target page according to the viewing instruction; Based on the viewing location, the target area to be displayed in the display window is determined from the area contained in the scaled target page.

7. The method according to any one of claims 1-6, characterized in that, The target page is a webpage; the determination of multiple elements to be displayed and their attribute information based on the rendering data corresponding to the target page of the application under test includes: During the rendering of the target page through a browser component, the rendering data of the target page is obtained from the browser component; The rendered data is parsed to obtain multiple elements to be displayed in the target page and the attribute information of the multiple elements to be displayed.

8. The method according to any one of claims 1-6, characterized in that, The determination of multiple elements to be displayed and their attribute information based on the rendering data corresponding to the target page of the application under test includes: Based on the rendering data corresponding to the target page of the application to be tested, construct the document object model tree corresponding to the target page; The document object model tree is split to obtain multiple elements to be displayed contained in the target page and the attribute information of the multiple elements to be displayed.

9. The method according to any one of claims 1-6, characterized in that, The step of determining the test result corresponding to the application under test based on the target visualization element and the visualization attribute information of the target visualization element includes: Filter out visual attribute information of a specified type from the visual attribute information of the target visual element; the specified type of visual attribute information includes at least one of font information, color information, and display boundary information; Based on the specified type of visual attribute information and the target visual element, determine the test result corresponding to the application to be tested.

10. The method according to any one of claims 1-6, characterized in that, The step of determining the test result corresponding to the application under test based on the target visualization element and the visualization attribute information of the target visualization element includes: The set visualization element is compared with the target visualization element, and the attribute information of the set visualization element is compared with the visualization attribute information of the target visualization element. The test results for the application under test are determined based on the comparison results.

11. An application testing device, characterized in that, The device includes: The determination module is configured to determine multiple elements to be displayed and their attribute information contained in the target page of the application to be tested, based on the rendering data corresponding to the target page of the application to be tested. The filtering module is configured to filter out non-visual elements and non-visual attribute information from the plurality of elements to be displayed and the attribute information of the plurality of elements to be displayed, so as to obtain a plurality of visual elements contained in the target page and the visual attribute information of the plurality of visual elements; The filtering module is configured to filter out the target visual element displayed in the display window from the plurality of visual elements based on the content presented by the target page in the display window of the application to be tested; The testing module is configured to determine the test result corresponding to the application under test based on the target visualization element and the visualization attribute information of the target visualization element; The filtering module includes: The size acquisition module is configured to acquire the size of the display window of the application to be tested, and determine the size of the target page based on the rendering data; The scaling module is configured to calculate the scaling ratio of the target page based on the size of the display window and the size of the target page. The filtering submodule is configured to filter out the target visual element to be displayed in the display window from the plurality of visual elements according to the scaling ratio; The target page includes a first view and a second view, and the scaling ratio of the target page includes the scaling ratio of the first view and the scaling ratio of the second view. The scaling module is specifically configured as follows: calculating the scaling ratio of the first view based on the size of the first view and the size of the display window; determining the sub-window corresponding to the first view from the display window according to the scaling ratio of the first view; wherein the size of the sub-window corresponding to the first view matches the size of the scaled first view; selecting an area from the display window other than the sub-window corresponding to the first view, and determining the sub-window corresponding to the second view from the selected area; calculating the scaling ratio of the second view based on the size of the sub-window corresponding to the second view and the size of the second view.

12. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the application testing method according to any one of claims 1-10.

13. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by the processor of the electronic device, causes the electronic device to implement the application testing method according to any one of claims 1-10.

14. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the application testing method according to any one of claims 1-10.

Citation Information

Patent Citations

  • Compatibility testing method and system

    CN104424093A

  • Page testing method and device, storage medium and electronic equipment

    CN113094286A