Automated testing method, storage medium and program product

CN122526992APending Publication Date: 2026-08-07BEIJING OPTOKO MICROELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING OPTOKO MICROELECTRONICS TECH CO LTD
Filing Date
2026-04-27
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]然而,在实际的UI自动化测试过程中,用户界面的变更多为批量性、关联性的调整

Benefits of technology

[0012]The automated testing method, storage medium, and program product provided in this application embodiment can reflect the relationship between page elements through a hierarchical structure, and correspond page element aliases to page elements through page element identifiers. Since the page element identifier is unique, when the page under test changes, the changed page elements can be found quickly and accurately through the page element identifiers and hierarchical structure, and the positioning strategy of the page elements can be modified to improve the efficiency and accuracy of modifying the positioning method of page elements, thereby improving the maintainability and robustness of automated testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122526992A_ABST
    Figure CN122526992A_ABST
Patent Text Reader

Abstract

The application discloses an automatic test method, a storage medium and a program product, and relates to the technical field of software testing. The method comprises the following steps: acquiring a hierarchical structure of a to-be-tested page and a test script, wherein the hierarchical structure comprises a plurality of first page nodes having a hierarchical relationship, the first page nodes store a first page element identifier and a first page element positioning strategy set of a first page element, and the test script comprises a to-be-tested page element alias and an operation instruction of a to-be-tested page element; determining a to-be-tested page element identifier corresponding to the to-be-tested page element alias; determining a to-be-tested page node corresponding to the to-be-tested page element in the hierarchical structure; acquiring a to-be-tested page element positioning strategy set of the to-be-tested page element from the to-be-tested page node; positioning the to-be-tested page element based on the to-be-tested page element positioning strategy set; and in response to the positioning of the to-be-tested page element, performing an operation corresponding to the operation instruction on the to-be-tested page element. The application can improve the maintainability and robustness of automatic testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of software testing technology, and in particular relates to an automated testing method, storage medium, and program product. Background Technology

[0002] User interface (UI) automated testing is the process of using automated testing tools to simulate user operations and perform functional verification of the software's user interface.

[0003] Currently, UI automation test scripts primarily describe page elements using their business information. During test script execution, the element's location is determined based on this business information, and then the element is positioned accordingly. This way, when the user interface changes, only the element's location information needs to be modified, without needing to alter the business information within the test script.

[0004] However, in actual UI automation testing, user interface changes are often batch and interconnected adjustments. In such cases, modifying element positioning information is still necessary, which is not only inefficient but also prone to omissions or errors, potentially causing test scripts to malfunction or even halting automated testing.

[0005] In summary, current automated testing methods suffer from poor maintainability and robustness. Summary of the Invention

[0006] This application provides an automated testing method, storage medium, and program product that can improve the maintainability and robustness of automated testing.

[0007] A first aspect of this application provides an automated testing method, comprising: Obtain the hierarchical structure and test script of the page to be tested. The hierarchical structure includes multiple first page nodes with hierarchical relationship. The first page node corresponds to the first page element in the page to be tested. The first page node stores the first page element identifier and the first page element positioning strategy set of the first page element. The test script includes the alias of the page element to be tested and operation instructions. From the mapping relationship between multiple first page element aliases and first page element identifiers, determine the test page element identifier corresponding to the test page element alias; Based on the identifier of the page element to be tested, determine the corresponding page node in the hierarchical structure; Obtain the set of location strategies for the page elements under test from the nodes of the page under test; The element to be tested is located based on the set of element location strategies for the page to be tested. In response to locating the page element to be tested, the operation corresponding to the operation instruction is executed on the page element to be tested.

[0008] A second aspect of this application provides an automated testing apparatus, comprising: The first acquisition module is used to acquire the hierarchical structure and test script of the page to be tested. The hierarchical structure includes multiple first page nodes with hierarchical relationship. The first page nodes correspond to the first page elements in the page to be tested. The first page nodes store the first page element identifier and the first page element positioning strategy set of the first page element. The test script includes the alias of the page element to be tested and operation instructions of the page element to be tested. The first determining module is used to determine the page element identifier corresponding to the page element identifier to be tested from a mapping relationship between multiple first page element aliases and first page element identifiers; The second determining module is used to determine the page node to be tested corresponding to the page element to be tested in the hierarchical structure based on the page element identifier to be tested. The second acquisition module acquires the set of page element positioning strategies for the page element under test from the page node under test; The positioning module is used to locate the page element under test based on the positioning strategy set of the page element under test; The execution module, in response to locating the page element to be tested, performs the operation corresponding to the operation instruction on the page element to be tested.

[0009] A third aspect of the embodiments of this application provides an electronic device, including: a memory and a program or instructions stored in the memory and executable on a processor, wherein when the program or instructions are executed by the processor, they implement the automated testing method provided by any aspect of the embodiments of this application described above.

[0010] A fourth aspect of the embodiments of this application provides a computer-readable storage medium on which a program or instructions are stored, and when the program or instructions are executed by a processor, implement the automated testing method provided by any aspect of the embodiments of this application described above.

[0011] A fifth aspect of the embodiments of this application provides a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform an automated testing method as provided in any aspect of the embodiments of this application described above.

[0012] The automated testing method, storage medium, and program product provided in this application embodiment can reflect the relationship between page elements through a hierarchical structure, and correspond page element aliases to page elements through page element identifiers. Since the page element identifier is unique, when the page under test changes, the changed page elements can be found quickly and accurately through the page element identifiers and hierarchical structure, and the positioning strategy of the page elements can be modified to improve the efficiency and accuracy of modifying the positioning method of page elements, thereby improving the maintainability and robustness of automated testing. Attached Figure Description

[0013] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 This is a flowchart illustrating an automated testing method provided in one embodiment of this application; Figure 2 This is a schematic diagram of a hierarchical structure provided in one embodiment of this application; Figure 3 This is a flowchart illustrating an automated testing method provided in one embodiment of this application; Figure 4 This is a data interaction diagram in one embodiment of this application; Figure 5 This is a schematic diagram of the structure of an automated testing device provided in one embodiment of this application; Figure 6 This is a schematic diagram of an electronic device provided in one embodiment of this application. Detailed Implementation

[0015] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0016] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0017] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations. In the embodiments of this application, certain existing industry solutions such as software, components, and models may be mentioned. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solution of this application, and do not imply that the applicant has already used or necessarily used such solutions.

[0018] User interface (UI) automated testing is the process of using automated testing tools to simulate user operations and perform functional verification of the software's user interface.

[0019] In actual UI automation testing, user interface changes are often batch and interconnected adjustments. For example, a single page refactoring might simultaneously change the positioning information of dozens or even hundreds of UI elements. In this case, it's necessary to find and modify the positioning information of each affected element individually. However, because the business information and positioning information of elements lack a clear expression of their interrelationships, it's difficult to intuitively identify which elements are affected by the same batch of UI changes. Therefore, batch modification is not only inefficient but also prone to overlooking locators that should have been modified, leading to invalid locators for page elements. Furthermore, in large-scale testing projects, the business information of elements often has similar semantic characteristics. For instance, confirmation buttons on multiple different pages or in different scenarios might all be named "Confirm Button." When modifying the positioning information of elements, it's highly likely that mapping entries that shouldn't be modified are mistakenly considered necessary, or that positioning information is incorrectly applied to semantically similar but actually unmodifiable elements, rendering previously usable positioning information invalid. Invalid positioning information can cause large-scale errors in test scripts and even interrupt automated testing.

[0020] In view of this, this application provides an automated testing method, storage medium, and program product. The method includes: obtaining the hierarchical structure of the page under test and a test script. The hierarchical structure includes multiple first page nodes with hierarchical relationships. Each first page node corresponds to a first page element in the page under test. Each first page node stores a first page element identifier and a first page element location strategy set. The test script includes a first page element alias and operation instructions for the page element under test. The method further includes: determining the first page element identifier corresponding to the alias of the page element under test from the mapping relationship between multiple first page element aliases and multiple first page element identifiers; determining the page node corresponding to the page element under test in the hierarchical structure based on the first page element identifier; obtaining the first page element location strategy set from the page node; locating the page element under test based on the first page element location strategy set; and, in response to locating the page element under test, performing the operation corresponding to the operation instructions on the page element under test. Since page element aliases are associated with page elements through page element identifiers, and page element identifiers are unique, and the hierarchical structure can reflect the relationships between page elements, when the page under test changes, the changed page elements can be quickly and accurately found through page element identifiers and hierarchical structure, and the page element positioning strategy can be modified, improving the efficiency and accuracy of modifying the positioning method of page elements, thereby improving the maintainability and robustness of automated testing.

[0021] The automated testing method provided in the embodiments of this application is described below. In practical applications, the entity executing the automated testing method in the embodiments of this application can be an electronic device.

[0022] The following describes specific embodiments of the automated testing method, apparatus, device, storage medium, and program product provided in this application. First, the automated testing method will be introduced.

[0023] Figure 1 This is a flowchart illustrating an automated testing method provided in one embodiment of this application. Figure 1 As shown, the method includes steps 101 to 106.

[0024] Step 101: Obtain the hierarchical structure and test script of the page to be tested. The hierarchical structure includes multiple first page nodes with hierarchical relationship. The first page node corresponds to the first page element in the page to be tested. The first page node stores the first page element identifier and the first page element positioning strategy set of the first page element. The test script includes the alias of the page element to be tested and the operation instructions. Step 102: Determine the test page element identifier corresponding to the test page element alias from the mapping relationship between multiple first page element aliases and first page element identifiers; Step 103: Based on the identifier of the page element to be tested, determine the corresponding page node in the hierarchical structure of the page element to be tested; Step 104: Obtain the set of positioning strategies for the elements of the page under test from the nodes of the page under test; Step 105: Locate the elements of the page to be tested based on the set of element location strategies. Step 106: In response to locating the page element to be tested, perform the operation corresponding to the operation instruction on the page element to be tested.

[0025] The page under test is the user interface of the application being tested. In web applications, the page under test is an HTML document; in mobile applications, it is a screen view or active interface; and in desktop applications, it is a window or panel.

[0026] The page to be tested consists of multiple page elements, including structural elements for layout, such as div and section elements, text and media elements that carry content, such as span and img elements, and control elements that allow user interaction, such as button and input elements.

[0027] Different platforms organize page elements using built-in data structures to manage and render them. The World Wide Web platform uses the Document Object Model (DOM) tree, generated by the browser after parsing Hypertext Markup Language (HTML). Nodes correspond to HTML tags, and the parent-child relationships between nodes reflect the structure of the HTML document. The Android operating system uses a View tree, generated by the system during layout rendering. Nodes correspond to various View components, and the parent-child relationships between nodes reflect the nested structure of the layout file. Apple's iOS mobile operating system uses a UIView tree, where nodes correspond to UIView and its subclasses, and the parent-child relationships between nodes reflect the view hierarchy. Any automated operation on a page essentially involves locating nodes in these built-in tree structures and then performing operations on them.

[0028] In step 101, the hierarchical structure of the page under test can be determined based on the data structure of the page under test within the platform. For example, the first page node is selected from the nodes of the data structure according to preset rules, and the hierarchical relationship between the first page nodes is determined based on the parent-child relationship of the first page nodes in the data structure. After determining the first page nodes, a first page element identifier is generated for each first page node corresponding to the first page element in the page under test, and a first page element positioning strategy set is configured. Then, the first page element identifier and the first page element positioning strategy set for each first page element are stored in the corresponding first page node to obtain the hierarchical structure of the page under test. The first page element identifier is a universally unique identifier (uuid) for the first page element.

[0029] Element aliases are semantic names used in test scripts to refer to page elements. Element aliases can be named using business domain language familiar to testers, such as login buttons, shopping cart icons, and username input boxes, enabling test scripts to clearly express business intent.

[0030] In some embodiments, the hierarchical structure of the page under test is pre-built, and after the hierarchical structure of the page under test is built, each first page element has a first page element identifier. Therefore, the mapping relationship between the first page element alias and the first page element identifier can be constructed.

[0031] In one implementation, because test scripts need to serve the expression of business semantics, the same page element may participate in multiple different business processes or test scenarios, and the name of the element differs in each process or scenario. Therefore, the first page element can have multiple aliases, so that testers can use the alias that best fits the current business process in test scripts for different scenarios, maintaining the semantic clarity of the script. Thus, multiple first page element aliases can map to the same first page element identifier. That is, in the mapping relationship between multiple first page element aliases and first page element identifiers, different first page element aliases can map to the same page element identifier, such as page element alias A1 corresponding to page element identifier A, and page element alias A2 also corresponding to page element identifier A.

[0032] In steps 103 and 104, since the first page element identifier is unique and the first page element node in the hierarchical structure stores the first page element identifier of the first page element, after determining the test page element identifier corresponding to the test page element alias, the test page node corresponding to the test page element can be determined from the hierarchical structure based on the test page element identifier, and then the test page element positioning strategy set of the test page element can be obtained from the test page node.

[0033] In steps 105 and 106, the set of strategies for locating elements on the page under test includes at least one pre-built strategy for locating elements on the page under test. Locating the element on the page under test based on this strategy set can be achieved by sequentially executing the strategies in the set until the element is located or all strategies in the set have been executed. If the element is located, in response to this location, the operation corresponding to the operation instruction is performed on the element, such as clicking or inputting.

[0034] The automated testing method provided in this application embodiment can reflect the relationship between page elements through the hierarchical structure, and associate page element aliases with page elements through page element identifiers. Since the page element identifier is unique, when the page under test changes, the changed page elements can be found quickly and accurately through the page element identifiers and hierarchical structure, and the positioning strategy of the page elements can be modified to improve the efficiency and accuracy of modifying the positioning method of page elements, thereby improving the maintainability and robustness of automated testing.

[0035] In some embodiments, in order to quickly and accurately obtain the hierarchical structure of the page to be tested, the processing procedure of step 101 includes: Step 201: Obtain the structural information of the page to be tested. The structural information includes multiple second page nodes with hierarchical relationships. The second page nodes correspond to the second page elements in the page to be tested. The second page nodes store the attribute information and value information of the second page elements. Step 202: The second page node that meets the preset filtering rules is determined as the first page node. The preset filtering rules are determined based on at least one of the following: the attribute information of the second page element, the role of the second page element in the business process, and the user configuration. Step 203: Generate the first page element identifier for each first page element; Step 204: Based on at least one of the attribute information, value information, and hierarchical relationship of the corresponding first page node of each first page element, generate at least one first page element positioning strategy for each first page element, and generate a first page element positioning strategy set based on at least one first page element positioning strategy. Step 205 determines the hierarchical structure based on the hierarchical relationship of each first page node, the first page element identifier, and the first page element positioning strategy set.

[0036] In step 201, the structural information of the page under test can be obtained from the application under test. For example, the structural information can be the DOM tree structure information, View tree structure information, etc., of the page under test. The structural information of the page under test includes all visible or invisible second page elements in the page under test, as well as the hierarchical relationships between these second page elements. Furthermore, each second page element in the structural information corresponds to a second page node, and the second page node stores the attribute information and value information of that second page element.

[0037] The attribute information of a second page element refers to data describing the inherent characteristics of the page element, used to define the static properties of the page element such as type, identifier, and style. For example, in a web platform, attribute information includes the element's tag name, such as div, span, button, and input; standard attributes of the element, such as id, class, name, and type; and custom attributes, such as data-xxx.

[0038] The value information of a second-page element refers to dynamic data describing the current state or content of that element, reflecting the specific content or state presented by the element at runtime. For example, in a web platform, value information includes the element's text content, such as the displayed text within a button tag; the element's input values, such as user input in an input or textarea; the element's style attribute values, such as color, display, and visibility; and the element's runtime state, such as its visible and interactive states.

[0039] Because not all nodes in the built-in tree structure of each platform have testing value. For example, the DOM tree of the page under test in the Web platform contains not only interactive elements such as buttons and input boxes, but also a large number of layout container elements, such as div, span, and section elements used for page layout and style control; as well as non-visual elements such as script, style, and meta. If the hierarchical structure of the page under test includes all page elements, it will result in a bloated and large hierarchical structure, filled with many nodes that the test script will never operate or verify. This is not conducive to quickly determining the corresponding page element positioning strategy set for the page elements during automated testing, nor is it conducive to the maintenance of the hierarchical structure. Therefore, in steps 202 to 205, the second page node that meets the preset filtering rules is determined as the first page node, the first page element identifier and the first page element positioning strategy set for each first page element are generated, and the hierarchical structure is determined based on the hierarchical relationship of each first page node, the first page element identifier, and the first page element positioning strategy set.

[0040] In step 202, the preset filtering rules are a set of predefined judgment conditions used to filter out the first page elements that need to be tested from the second page elements. The filtering rules can be determined based on at least one of the following: the attribute information of the page elements, such as only retaining elements with a specific id, a specific class, or a specific tag name; the role of the page elements in the business process, such as retaining key interactive elements such as login buttons and shopping cart icons; and user configuration, i.e., which elements are customized by the testers according to specific test requirements.

[0041] In step 203, a unique identifier, namely the first page element identifier, is generated for each first page element. The first page element identifier remains unchanged throughout the entire test lifecycle to ensure that the first page element alias can be mapped to the first page element through the first page element identifier.

[0042] In step 204, a positioning strategy based on locators can be generated based on the attribute or value information of the first page element, or a positioning strategy based on hierarchy can be generated based on the hierarchical relationship of the first page nodes corresponding to the first page element. The locator-based positioning strategy directly positions the element based on its attribute or value information. The hierarchy-based positioning strategy indirectly positions the first page element by first locating its parent or ancestor element within the scope of the parent or ancestor element, based on the hierarchical relationship of the first page nodes corresponding to the first page element in the hierarchical structure.

[0043] In one implementation, when generating the positioning strategy, a positioning strategy based on locators for the first page element can be generated based on the attribute information of the first page element. For example, if the first page element has a resource identifier id attribute, and the id attribute is a unique id, the first page element can be located directly through the id attribute; if the first page element has a class attribute, and there exists a set of class names in the Cascading Style Sheets (CSS) class name set that can uniquely and stably identify the first page element, the first page element can be located by combining the class attribute.

[0044] In one implementation, a locator-based positioning strategy for the first page element can be generated based on the value information of the first page element. For example, if the value information of the first page element, such as the display text of a button, the current content of an input box, the anchor text of a link, etc., is unique on the page, the first page element can be located by the text content.

[0045] In one implementation, a positioning strategy for the first page element based on its hierarchical structure can be generated according to the hierarchical relationship of the first page nodes corresponding to the first page element. For example, the path of the first page node in the hierarchical structure is determined based on the hierarchical relationship of the first page nodes, and the ancestor nodes of the first page node are identified. Stable nodes are then selected from the ancestor nodes as the positioning anchor nodes for the first page node. The criteria for determining a stable node may include whether the node has a unique resource locator attribute, whether it belongs to a fixed page structure, or whether it is a user-specified context container. Then, the positioning expression for the positioning anchor element corresponding to the positioning anchor node and the positioning expression for the first page element based on the positioning anchor element are generated. This allows the test script to first locate the positioning anchor element of the first page element during runtime, and then locate the first page element within the range of the positioning anchor element.

[0046] The automated testing method provided in this application can filter out the first page elements from the second page elements through preset filtering rules, simplify the hierarchical structure of the page under test, facilitate the maintenance of the hierarchical structure, and achieve accurate correspondence between business aliases and page elements through the first page element identifier, avoiding incorrect correspondence between semantically similar business aliases and page elements. Through the element location strategy set, page elements can be located in multiple ways, improving the success rate of page element location, thereby improving the robustness of automated testing.

[0047] Figure 2 This is a schematic diagram of a hierarchical structure provided in one embodiment of this application. For example... Figure 2As shown, the hierarchical structure can be a tree structure, including application nodes, browser nodes, and homepage nodes. Under the homepage node, there are nodes for the logged-in user account tab, cookie settings pop-up, menu 1, navigation buttons, menu 2, and selectors. The logged-in user account tab node includes a logout button node, menu 2 includes a product 1 submenu node and a product 1 header node, and the selectors node includes accept and exit buttons.

[0048] In such Figure 2 In the tree-like hierarchical structure shown, the page element corresponding to the application node is the application process or application object, the page element corresponding to the browser node is the browser window object, the homepage node corresponds to the currently loaded HTML page, the menu node corresponds to the navigation menu component in the page under test, and the cookie setting pop-up node corresponds to the cookie confirmation pop-up or modal in the page under test.

[0049] The hierarchical structure stores the identifiers and positioning strategy sets of the page elements corresponding to the nodes. Figure 2 The text shows the identifier of the page element corresponding to the node, such as... Figure 2 As shown, the page element corresponding to the application node is identified as A, the page element corresponding to the browser node is identified as B, the page element corresponding to the homepage node is identified as C, the page element corresponding to the logged-in user account tab node is identified as D, and so on.

[0050] In some embodiments, in order to quickly locate the page element to be tested, the first page node also stores the element type of the first page element. The page element location strategy set includes multiple page element location strategies. The processing procedure of step 105 includes: Step 301: Obtain the element type of the page element from the page node to be tested; Step 302: Determine the execution priority of the positioning strategy for each element on the page to be tested based on the element type of the element on the page to be tested. Step 303: Execute each element location strategy of the page under test in descending order of execution priority, until the element under test is located, or until all element location strategies of the page under test are executed.

[0051] Element type refers to the inherent classification attribute of page elements in the user interface, used to describe the functional characteristics and interaction methods of the elements. For example, in the Web platform, element type is represented by HTML tag names, such as button for button, input for input box, a for link, select for drop-down list, table for table, etc.

[0052] When the set of element location strategies for the page under test includes multiple element location strategies, the execution priority of each element location strategy can be determined according to the element type of the page under test.

[0053] For example, for elements of type table cells, since table rows and columns may be dynamically added or deleted, and their own attributes change frequently, the execution priority of the positioning strategy based on hierarchy is set to the highest, and the execution priority of the positioning strategy based on locators is set to the second highest. For elements of type fixed buttons, since they usually have stable id attributes or text content, the execution priority of the positioning strategy based on locators is set to the highest, and the execution priority of the positioning strategy based on hierarchy is set to the second highest.

[0054] The element location strategies for each page under test are executed sequentially in descending order of priority. After each strategy is executed, it is determined whether the element was successfully located. If the element is successfully located, the process stops; otherwise, the process continues with the next element location strategy in descending order of priority.

[0055] The automated testing method provided in this application determines the execution priority of the positioning strategy for each page element under test based on the element type of the page element under test. This allows for the selection of the most suitable positioning strategy for different types of page elements under test, improving positioning speed and thus increasing the execution efficiency of automated testing. Furthermore, by trying multiple positioning strategies for page elements under test, the method can locate page elements under test in various ways, improving the success rate of positioning page elements under test and thus increasing the success rate of automated testing.

[0056] In some embodiments, in order to improve the positioning efficiency of the page element under test, the processing procedure in step 302 includes: Step 401: In response to the fact that the element type of the page element under test belongs to the preset unstable element type, the execution priority of the positioning strategy based on the hierarchy structure is determined to be higher than that of the positioning strategy based on the locator. Step 402: In response to the fact that the element type of the page element under test belongs to the preset stable element type, the execution priority of the positioning strategy based on the locator is determined to be higher than that of the positioning strategy based on the hierarchy.

[0057] Page elements with pre-defined unstable element types are prone to structural or content changes in the user interface. In one implementation, pre-defined unstable element types can include: table cells, dynamic list items, dynamic content within modals, and user-defined element types that are expected to be modified in subsequent versions based on specific business scenarios. Specifically, the rows and columns of table cells may be dynamically added or deleted due to data loading or user actions; the number and order of dynamic list items may change with changes in the data source; and dynamic content within modals may appear with a delay due to asynchronous loading.

[0058] For pre-defined unstable element types, a positioning strategy based on hierarchical structure is preferred. First, locate the parent or ancestor element of the element to be tested, and then locate the element to be tested within the range of the parent or ancestor element, thereby improving the success rate of locating the element to be tested.

[0059] Preset stable element types are page elements with relatively stable structure and attribute characteristics in the user interface, and are not easily changed due to page reconstruction, data loading, or user interaction. In one implementation, preset stable element types may include: fixed buttons, page header navigation links, and element types that users customize based on specific business scenarios and are expected to not undergo structural changes in subsequent versions. Among them, fixed buttons usually have a unique id attribute or stable text content; page header navigation links are usually located in a fixed position on the page and have stable identifier attributes.

[0060] For preset stable element types, the positioning strategy based on locators is preferred. The element's own attributes, text content, or feature expressions are used as the basis for positioning to directly locate the element and improve the positioning efficiency of the element.

[0061] The automated testing method provided in this application can configure an accurate priority order for multiple page element location strategies for page elements of different element types, ensuring the efficiency of page element location.

[0062] In some embodiments, to efficiently locate the page elements under test, a hierarchical location strategy is implemented, including: Step 501: Determine the parent node of the page to be tested based on the hierarchical relationship of each first page node; Step 502: Locate the page element corresponding to the parent node; Step 503: In response to locating the page element corresponding to the parent node, locate the page element to be tested within the range of the page element corresponding to the parent node.

[0063] A parent node is the node that is directly above the element being tested in the page's hierarchy, having a direct parent-child relationship. The page element corresponding to the parent node is typically a container or area in the user interface that holds the element being tested, such as a dialog box, a form area, a tab panel, or a page module.

[0064] For dynamically generated page elements within single-page applications or asynchronously loaded pages, the attributes of the page elements themselves may be unstable, but the container or area they reside in is relatively stable. That is, the parent element of the page element is usually more stable than its child elements and less prone to change due to adjustments in page details. Therefore, by first locating the stable parent node and then locating the dynamic child elements within its range, the difficulty in locating elements caused by changes in their own attributes can be effectively addressed, improving the success rate of locating the page elements under test.

[0065] In complex user interfaces, there may be multiple elements with the same attributes or text content, such as confirmation buttons on multiple pages. By first locating a stable parent node, and then locating the element on the page under test within the parent node's scope, the search range can be effectively narrowed, eliminating elements with the same name that may exist in other areas, and improving the accuracy of locating the element on the page under test.

[0066] In one implementation, the positioning of the page element corresponding to the parent node can be done using the method described in any of the above embodiments. For example, the page element corresponding to the parent node can be positioned based on the positioning strategy set of the page element corresponding to the parent node. The specific implementation method and principle are similar and will not be elaborated here.

[0067] The automated testing method provided in this application improves the success rate and efficiency of locating the page element under test by first locating the page element corresponding to the parent node, and then locating the page element under test within the range of the page element corresponding to the parent node in response to locating the page element corresponding to the parent node.

[0068] In some embodiments, to further improve the success rate of locating the page element under test, step 502 further includes: Step 601: In response to the inability to locate the page element corresponding to the parent node, locate the ancestor node of the page node to be tested by locating it level by level upwards, and locate the page element of the ancestor node until the target ancestor node that can locate the corresponding page element is determined. Step 602: Locate the page element to be tested within the range of page elements corresponding to the target ancestor node.

[0069] When locating the page element corresponding to the parent node, if it cannot be located, the parent node's grandparent node (i.e., the grandparent node of the page element under test) can be obtained from the hierarchy, and the page element corresponding to that grandparent node can be attempted to be located. If the page element corresponding to the grandparent node is successfully located, that grandparent node can be used as the target ancestor node of the page element under test. Then, within the range of page elements corresponding to the target ancestor node, the page element under test can be located. At this point, although the target ancestor node is a grandparent node rather than a direct parent node, and its range is larger than that of a direct parent node, it is still a limited area compared to the entire page. Therefore, the efficiency of locating the page element under test can still be improved.

[0070] If locating the grandparent node still fails, the process can continue backtracking to obtain the grandparent node's parent node, i.e., the great-grandparent node of the page node under test, and locate the page element corresponding to the great-grandparent node. This process continues until a page element corresponding to an ancestor node is successfully located, and that ancestor node is determined as the target ancestor node, or until the preset number of backtracking attempts is reached.

[0071] The automated testing method provided in this application improves the success rate of locating the page element under test by locating it level by level upwards. Even when the page changes and the direct parent node fails to be located, it can still trace back upwards to find a usable ancestor node, thereby increasing the success rate of locating the page element under test and thus improving the success rate of automated testing.

[0072] In some embodiments, to help analyze the reasons for the failure to locate the element on the page under test, step 503 may further include: Step 701: In response to the inability to locate the page element to be tested within the scope of the page element corresponding to the parent node, the parent node is determined as the missing node of the page element to be tested.

[0073] In the hierarchical location process, if the parent node of the element under test is successfully located, but the element itself cannot be found within the corresponding range of page elements, this parent node can be identified as the missing node of the element under test. This identifies the hierarchical level at which the location failure occurred, i.e., the last successfully located node in the location path. Identifying the missing node helps testers quickly pinpoint the root cause of the problem, clarifying which specific page container or region has undergone structural changes, resulting in its child elements being unfindable.

[0074] In one implementation, the page element identifier corresponding to the missing node can be output to the test report or log to accurately locate the problematic page component and improve the efficiency of troubleshooting. For example, if the missing node is a modal, the problem can be determined to be inside the modal, allowing for an examination of changes in the modal's content or structure; if the missing node is a sidebar, the problem can be determined to be in the sidebar area.

[0075] The automated testing method provided in this application can accurately determine which node the location failure occurred at by identifying the parent node as the missing node of the page element to be tested when the page element to be tested cannot be located within the range of the page element corresponding to the parent node. This narrows down the scope of the location failure problem and improves the efficiency of troubleshooting location failure problems.

[0076] In some embodiments, to adapt to changes in the page under test, the automated testing method further includes: Step 801: In response to a change in the attribute information or value information of the first page element, generate an updated locator for the first page element based on the changed attribute information and value information of the first page element. Step 802: Based on the updated locator of the first page element, generate a positioning strategy for the first page element based on the updated locator. Step 803: Add the positioning strategy based on the updated locator to the first page element positioning strategy set to update the first page element positioning strategy set and hierarchy.

[0077] When an application's user interface is redesigned or adjusted, the attribute and value information of page elements may also change. Changes in attribute information may include: changes to resource identifiers, additions or deletions of class names, and adjustments to accessibility identifiers. Changes in value information may include: modifications to button display text, adjustments to default values ​​of input fields, and updates to link URLs.

[0078] In step 802, the updated locator can be a locator based on the new id attribute, an XPath expression based on the new text content, a CSS selector based on the new class combination, etc. The specific process and principle of generating a positioning strategy based on the updated locator can be found in the description in the above embodiments, and will not be repeated here.

[0079] In step 803, the positioning strategy based on the updated locator is added to the first page element positioning strategy set, thereby updating the first page element positioning strategy set and hierarchical structure. This ensures that when the subsequent test script runs, it can obtain the latest positioning strategy set of the page element under test from the hierarchical structure, thus ensuring the positioning success rate.

[0080] The automated testing method provided in this application improves the maintenance efficiency of test scripts after changes in the attribute or value information of page elements. This is achieved by generating updated locators and positioning strategies based on the updated locators after changes in the attribute or value information of page elements, and updating the page element positioning strategy set and the hierarchical structure of the page under test. Furthermore, since the original strategies in the page element positioning strategy set are still available, adding new strategies will not cause new positioning failures, thereby reducing maintenance risks and improving the robustness of automated testing.

[0081] Figure 3 This is a flowchart illustrating an automated testing method provided in one embodiment of this application, as shown below. Figure 3 As shown, in one embodiment, the automated testing method includes: Step 901: Obtain the hierarchical structure and test script of the page to be tested; Step 902: Obtain multiple mapping relationships; Step 903: Determine whether the alias of the page element under test has a corresponding identifier for the page element under test in multiple mapping relationships. If not, proceed to step 904; if yes, proceed to step 905. Step 904 throws an exception: Alias ​​not found; Step 905: Determine the corresponding page node in the hierarchy of the page element to be tested; Step 906: Obtain the set of element positioning strategies for the page under test from the nodes of the page under test; Step 907: Determine whether the element positioning strategy set of the page to be tested is empty. If yes, proceed to step 908; otherwise, proceed to step 909. Step 908, throw an exception: No location strategy available; Step 909: Execute the element positioning strategies for each page under test in descending order of execution priority; Step 910: Locate the page element to be tested using the current strategy; Step 911: Determine whether the element positioning on the page under test is successful. If not, proceed to step 912; if yes, proceed to step 914. Step 912: Determine if there are any unexecuted positioning strategies. If yes, proceed to step 909; otherwise, proceed to step 913. Step 913, throws an exception: element location failed; Step 914: Execute the operation command when the element is interactive; Step 915: Record a success log.

[0082] The specific implementation process and principle of steps 901 to 915 can be found in the description in the above embodiments, and will not be repeated here.

[0083] Figure 4 This is a data interaction diagram of one embodiment of this application, such as... Figure 4 As shown, during the execution of test script 41, the operation instructions for the page elements under test are sent to the parsing engine 42. The parsing engine 42 queries the mapping relationship 43 between multiple page element aliases and page element identifiers under test to find the page element identifier corresponding to the page element alias. After obtaining the page element identifier, it queries the page node corresponding to the page element identifier in the hierarchical structure 44 of the page under test, and then obtains the page element location strategy set from the page node. The parsing engine 42 attempts to locate the page element under test in the application 45 based on the page element location strategy set. If the page element under test is successfully located in the application 45, the operation instructions corresponding to the page element under test are executed to achieve automated testing of the application 45.

[0084] As can be seen from one or more of the above embodiments, the automated testing method provided in this application only needs to update the positioning strategy in the hierarchical structure of the page under test when page elements change, without modifying the test script, the mapping relationship between page element aliases and page element identifiers, etc., which can reduce the maintenance workload of automated testing. By locating page elements based on a set of page element positioning strategies, page elements can be located using multiple page element positioning strategies. Even if the preferred positioning strategy based on locators fails due to UI changes, a backup plan can be activated to ensure the continuity and stability of the testing process. By replacing the hierarchical structure of the page under test, the same set of test scripts can be adapted to multiple UI platforms such as Web, Android, and iOS, achieving cross-platform reuse. By using a positioning strategy based on the hierarchical structure, complex page elements such as dynamic components and modals in single-page applications (SPAs) can be effectively located, improving the success rate of page element positioning.

[0085] Based on the automated testing method, this application also provides specific embodiments of the automated testing device.

[0086] Figure 5 This is a schematic diagram of the structure of the automated testing device provided in an embodiment of this application. Figure 4 As shown, the automated testing device 50 provided in this embodiment includes: The first acquisition module 51 is used to acquire the hierarchical structure and test script of the page to be tested. The hierarchical structure includes multiple first page nodes with hierarchical relationship. The first page nodes correspond to the first page elements in the page to be tested. The first page nodes store the first page element identifier and the first page element positioning strategy set of the first page element. The test script includes the alias of the page element to be tested and the operation instructions of the page element to be tested. The first determining module 52 is used to determine the page element identifier corresponding to the page element alias to be tested from the mapping relationship between multiple page element aliases and page element identifiers. The second determining module 53 is used to determine the corresponding page node in the hierarchical structure of the page element to be tested based on the page element identifier. The second acquisition module 54 is used to acquire the set of positioning strategies for the elements of the page under test from the nodes of the page under test. The positioning module 55 is used to locate the elements of the page under test based on the positioning strategy set of the elements of the page under test; The execution module 56 is used to perform the operation corresponding to the operation instruction on the page element under test in response to locating the page element under test.

[0087] As an optional embodiment, the first acquisition module 51 is specifically used for: Obtain the structural information of the page to be tested. The structural information includes multiple second page nodes with hierarchical relationships. The second page nodes correspond to the second page elements in the page to be tested. The second page nodes store the attribute information and value information of the second page elements. The second page node that meets the preset filtering rules is determined as the first page node. The preset filtering rules are determined based on at least one of the following: the attribute information of the second page element, the role of the second page element in the business process, and the user configuration. Generate the first page element identifier for each first page element; Based on at least one of the attribute information, value information, and hierarchical relationship of the corresponding first page node of each first page element, generate at least one first page element positioning strategy for each first page element, and generate a first page element positioning strategy set based on at least one first page element positioning strategy. The hierarchical structure is determined based on the hierarchical relationship of each first page node, the first page element identifier, and the first page element positioning strategy set.

[0088] As an optional embodiment, the first page node also stores the element types of the first page elements. The set of page element positioning strategies to be tested includes multiple page element positioning strategies to be tested. The positioning module 55 is specifically used for: Obtain the element type of the element on the page under test from the nodes of the page under test; The execution priority of the positioning strategy for each element on the page under test is determined based on the element type of the element on the page under test. The element location strategies for each page under test are executed sequentially in descending order of execution priority, until the element under test is located, or until all element location strategies for each page under test are executed.

[0089] As an optional embodiment, the positioning strategies for multiple page elements under test include: a positioning strategy based on hierarchy and a positioning strategy based on locators. The positioning module 55 is further specifically used for: If the element type of the page element under test belongs to the preset unstable element type, then the execution priority of the positioning strategy based on the hierarchy structure is determined to be higher than the positioning strategy based on the locator. If the element type of the page element under test belongs to a preset stable element type, then the execution priority of the positioning strategy based on the locator is determined to be higher than that of the positioning strategy based on the hierarchy.

[0090] As an optional embodiment, the positioning module 55 is used to execute a hierarchical positioning strategy, specifically for: Determine the parent node of the page to be tested based on the hierarchical relationship of each first page node; Locate the page element corresponding to the parent node; In response to locating the page element corresponding to the parent node, locate the page element to be tested within the range of the page element corresponding to the parent node.

[0091] As an optional embodiment, the positioning module 55 is further configured to: In response to the inability to locate the page element corresponding to the parent node, the ancestor node of the page node under test is located level by level upwards, and the page element of the ancestor node is located, until the target ancestor node that can locate the corresponding page element is determined. Locate the page element to be tested within the range of page elements corresponding to the target ancestor node.

[0092] As an optional embodiment, the positioning module 55 is further configured to: If the page element to be tested cannot be located within the scope of the page element corresponding to the parent node, the parent node is identified as the missing node of the page element to be tested.

[0093] As an optional embodiment, the automated testing apparatus further includes an update module, which is used for: In response to changes in the attribute or value information of the first page element, an updated locator for the first page element is generated based on the changed attribute and value information. Based on the updated locator of the first page element, generate a positioning strategy for the first page element based on the updated locator; Add the positioning strategy based on the updated locator to the first page element positioning strategy set to update the first page element positioning strategy set and hierarchy.

[0094] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5As shown, the electronic device provided in this application embodiment may include: a processor 501 and a memory 502 storing computer program instructions.

[0095] Specifically, the processor 501 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0096] Memory 502 may include mass storage for data or instructions. For example, and not limitingly, memory 502 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 502 may include removable or non-removable (or fixed) media. Where appropriate, memory 502 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 502 is non-volatile solid-state memory.

[0097] The processor 501 reads and executes computer program instructions stored in the memory 502 to implement any of the automated testing methods in the above embodiments.

[0098] In one example, the electronic device may also include a communication interface 503 and a bus 510. Wherein, as... Figure 5 As shown, the processor 501, memory 502, and communication interface 503 are connected through bus 510 and complete communication with each other.

[0099] The communication interface 503 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0100] Bus 510 includes hardware, software, or both, that couples the components of the electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 510 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.

[0101] Furthermore, in conjunction with the automated testing methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the automated testing methods in the above embodiments.

[0102] In addition, in conjunction with the automated testing methods in the above embodiments, this application embodiment can provide a computer program product for implementation. When the instructions in the computer program product are executed by the processor of an electronic device, the electronic device performs the automated testing method provided by any aspect of the above embodiments of this application.

[0103] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0104] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0105] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0106] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0107] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. An automated testing method, characterized in that, include: Obtain the hierarchical structure and test script of the page to be tested. The hierarchical structure includes multiple first page nodes with hierarchical relationship. The first page node corresponds to the first page element in the page to be tested. The first page node stores the first page element identifier and the first page element positioning strategy set of the first page element. The test script includes the alias of the page element to be tested and operation instructions. From the mapping relationship between multiple first page element aliases and first page element identifiers, determine the test page element identifier corresponding to the test page element alias; Based on the identifier of the page element to be tested, determine the corresponding page node in the hierarchical structure; Obtain the set of location strategies for the page elements under test from the nodes of the page under test; The element to be tested is located based on the set of element location strategies for the page to be tested. In response to locating the page element to be tested, the operation corresponding to the operation instruction is executed on the page element to be tested.

2. The automated testing method according to claim 1, characterized in that, The process of obtaining the hierarchical structure of the page to be tested includes: Obtain the structural information of the page to be tested. The structural information includes multiple second page nodes with a hierarchical relationship. The second page nodes correspond to the second page elements in the page to be tested. The second page nodes store the attribute information and value information of the second page elements. The second page node that meets the preset filtering rules is determined as the first page node. The preset filtering rules are determined based on at least one of the following: the attribute information of the second page element, the role of the second page element in the business process, and the user configuration. Generate the first page element identifier for each of the first page elements; Based on at least one of the attribute information, value information, and hierarchical relationship of the corresponding first page node of each first page element, generate at least one first page element positioning strategy for each first page element, and generate a first page element positioning strategy set based on at least one first page element positioning strategy. The hierarchical structure is determined based on the hierarchical relationship of each first page node, the first page element identifier, and the first page element positioning strategy set.

3. The automated testing method according to claim 1, characterized in that, The first page node also stores the element type of the first page element. The set of strategies for locating the page element to be tested includes multiple strategies for locating the page element to be tested. Locating the page element to be tested based on the set of strategies for locating the page element to be tested includes: Obtain the element type of the page element from the page node to be tested; The execution priority of the positioning strategy for each element on the page under test is determined based on the element type of the element on the page under test. The page element location strategies are executed sequentially in descending order of their execution priority, until the page element is located, or until all page element location strategies have been executed.

4. The automated testing method according to claim 3, characterized in that, The multiple page element location strategies include: a hierarchy-based location strategy and a locator-based location strategy. Determining the execution priority of each page element location strategy based on its element type includes: If the element type of the page element to be tested belongs to a preset unstable element type, then the execution priority of the hierarchical positioning strategy is determined to be higher than that of the locator-based positioning strategy. If the element type of the page element to be tested belongs to a preset stable element type, then the execution priority of the positioning strategy based on the locator is determined to be higher than that of the positioning strategy based on the hierarchy.

5. The automated testing method according to claim 4, characterized in that, Executing the hierarchical positioning strategy includes: Based on the hierarchical relationship of each of the first page nodes, determine the parent node of the page to be tested; Locate the page element corresponding to the parent node; In response to locating the page element corresponding to the parent node, the page element to be tested is located within the range of the page element corresponding to the parent node.

6. The automated testing method according to claim 5, characterized in that, After locating the page element corresponding to the parent node, the process also includes: In response to the inability to locate the page element corresponding to the parent node, the ancestor node of the page node to be tested is located level by level upwards, and the page element of the ancestor node is located, until the target ancestor node to which the corresponding page element can be located is determined. Locate the page element to be tested within the range of the page elements corresponding to the target ancestor node.

7. The automated testing method according to claim 5, characterized in that, After locating the page element to be tested within the range of the page element corresponding to the parent node, the method further includes: If the page element to be tested cannot be located within the range of the page element corresponding to the parent node, the parent node is determined as the missing node of the page element to be tested.

8. The automated testing method according to any one of claims 2-7, characterized in that, Also includes: In response to a change in the attribute information or value information of the first page element, an updated locator of the first page element is generated based on the changed attribute information and value information of the first page element. Based on the updated locator of the first page element, generate a positioning strategy for the first page element based on the updated locator; The positioning strategy based on the updated locator is added to the first page element positioning strategy set to update the first page element positioning strategy set and the hierarchical structure.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the automated testing method as described in any one of claims 1-8.

10. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the automated testing method as described in any one of claims 1-8.