Test case modification method, device, storage medium and program product

By monitoring and automatically modifying the page element positioning method in test cases, using the information of historical page elements to infer new positioning methods, it solves the problem of test case positioning failure caused by front-end code changes in software maintenance, and improves the efficiency and reduction of test case modification maintenance costs.

CN118503142BActive Publication Date: 2025-01-03ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410976854.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2025-01-03
Estimated Expiration
2044-07-19

AI Technical Summary

Technical Problem

During the maintenance process, the front-end code changes in the software cause the test cases to fail to position the page elements, which requires frequent manual modification, and the maintenance of the test script is large and inefficient.

Method used

By monitoring page element positioning abnormal events, obtaining element positioning information of target elements, using the element positioning information of historical page elements to infer the new element positioning method of target elements, and automatically modifying the element positioning method in the test case.

Benefits of technology

It reduces the need for manual intervention to locate failures caused by front-end page changes, improves the efficiency of test case modification, and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503142B_ABST
    Figure CN118503142B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a test case modification method, device, storage medium and program product. In the embodiment of the present application, based on the characteristic that some elements or element attributes are the same or similar before and after the version of the tested page is updated, for the target element with abnormal positioning in the tested page, the new element positioning mode of the target element, i.e., the target element positioning mode, is inferred based on the element positioning information of the page element on the historical page of the tested page and the element positioning information of the target element, and the element positioning mode of the target element in the test case is modified based on the target element positioning mode, so as to realize the automatic modification of the test case, reduce the need for manual intervention when positioning fails due to changes in the front-end page, and help improve the efficiency of test case modification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a test case modification method, device, storage medium and program product. Background Art

[0002] With the continuous development of Internet technology, various software has been developed and used by users. To ensure that the software meets the requirements when actually used by users, the software needs to pass precise testing before release or delivery. Automated user interface (UI) testing can test whether the functions and performance of the software are in line with expectations by simulating user interaction operations. During the UI test, it is necessary to locate the page elements to be operated first, that is, first find the page elements to be operated, and then simulate the interaction between the user and the page elements.

[0003] Software often needs to be upgraded during maintenance, and the front-end code corresponding to the software interface often changes accordingly. Due to the modification of the front-end code, the positioning of the page elements by the test case may become invalid, and testers are often required to manually modify the code corresponding to the test case. The workload of test script maintenance is large, and the efficiency of test case modification is low. Summary of the invention

[0004] Multiple aspects of the present application provide a test case modification method, device, storage medium and program product to automatically modify test cases and improve the efficiency of test case modification.

[0005] The present application provides a test case modification method, including:

[0006] In the process of testing the page under test by the test case, in response to the page element positioning abnormality event, element positioning information of the target element of the positioning abnormality is obtained;

[0007] Obtaining element location information of a history page element on a history page of the page under test;

[0008] Determining a target element positioning method of the target element according to the element positioning information of the target element and the element positioning information of the historical page element;

[0009] According to the target element positioning method, the element positioning method of the target element in the test case is modified to obtain a target test case.

[0010] The embodiment of the present application further provides an electronic device, comprising: a memory and a processor; wherein the memory is used to store a computer program;

[0011] The processor is coupled to the memory and is used to execute the computer program to perform the steps in the above test case modification method.

[0012] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned test case modification method.

[0013] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by one or more processors, causes the one or more processors to execute the steps in the above-mentioned test case modification method.

[0014] In an embodiment of the present application, based on the characteristic that some elements or element attributes are the same or similar before and after the version of the page under test is updated, for the target element with abnormal positioning in the page under test, a new element positioning method of the target element, i.e., the target element positioning method, is inferred based on the element positioning information of the page elements on the historical pages of the page under test and the element positioning information of the target element. Based on the target element positioning method, the element positioning method of the target element in the test case is modified, thereby realizing automatic modification of the test case and reducing the need for manual intervention when positioning fails due to changes in the front-end page, which helps to improve the efficiency of test case modification. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0016] Figure 1 A flowchart of a test instance modification method provided in an embodiment of the present application;

[0017] Figure 2 A schematic diagram of the structure of a test instance modification system provided in an embodiment of the present application;

[0018] Figure 3 A schematic diagram of the workflow of the reasoning and correction module provided in the embodiment of the present application;

[0019] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0021] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0022] In response to the technical problem of low efficiency in modifying existing test cases, in some embodiments of the present application, based on the characteristic that some elements or element attributes are the same or similar before and after the version of the page under test is updated, for the target element with abnormal positioning in the page under test, the new element positioning method of the target element, i.e., the target element positioning method, is inferred based on the element positioning information of the page elements on the historical pages of the page under test and the element positioning information of the target element. The element positioning method of the target element in the test case is modified based on the target element positioning method, thereby realizing automatic modification of the test case and reducing the need for manual intervention when positioning fails due to changes in the front-end page, which helps to improve the efficiency of test case modification.

[0023] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0024] It should be noted that the same reference numerals denote the same objects in the following drawings and embodiments, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in the subsequent drawings and embodiments.

[0025] Figure 1 The following is a flow chart of a test instance modification method provided in an embodiment of the present application. Figure 1 As shown, the method mainly includes the following steps:

[0026] 101. During the process of testing the page under test by the test case, in response to a page element positioning abnormality event, element positioning information of a target element with positioning abnormality is obtained.

[0027] 102. Obtain element location information of historical page elements of historical versions of the page under test.

[0028] 103. Determine a target element positioning method of the target element according to the element positioning information of the target element and the element positioning information of the historical page elements.

[0029] 104. According to the target element positioning method, modify the element positioning method of the target element in the test case to obtain the target test case.

[0030] In this embodiment, the page under test refers to the user interface (UI) of the software to be tested. The software to be tested can be any software with a user interface, such as a client, an application, a web page, a cloud service, or other forms of products. In some embodiments, the software to be tested can be software in a proprietary cloud. A test case refers to the code for performing UI testing on the user interface, which can simulate the interaction between the user and the user interface and realize automated testing of the user interface.

[0031] The page elements of the page under test refer to the various elements used to construct and present the page under test, including but not limited to: buttons, controls, text boxes, links, etc. When the test case tests the page under test, it is necessary to first find the page elements to be operated on the page under test, that is, to locate the page elements. After that, the user's interaction with the page elements can be simulated to perform UI testing. After the software to be tested is updated, the UI of the software may also be updated accordingly, resulting in the failure of the positioning of the page elements on the UI of the software in the test case, that is, the page elements on the UI of the updated software cannot be located, which requires modification of the test case.

[0032] In actual applications, if a test case fails to locate a certain page element during the test process, an error will be reported or page element location abnormality reminder information will be output. This error or abnormal reminder information of the failure to locate the page element means that a page element location abnormality event occurs in the test case. Based on this, in this embodiment, the page element location abnormality event can be monitored during the test case's test of the page under test. If a page element location abnormality event is monitored, then in step 101, during the test case's test of the page under test, in response to the page element location abnormality event, the element location information of the target element with the abnormal location is obtained.

[0033] In this embodiment, the element location information of the page element refers to the information used to describe the location of the page element during the page test process, which may include: the identification information of the test case for testing the page element, the test path of the page element, the functional information of the page element, the element location method of the page element, and the hierarchical relationship information of the page element. Of course, the element location information of the page element may also include: the identity (Identity, ID) of the page element, the class name (Class), the tag name (Tag Name), the name (Name) of the element, the text (Text Content) of the element, and the location information (Location). Among them, the location information refers to the information describing which page the page element is on.

[0034] In order to indicate the uniqueness of a page element, the identification of the page element may be determined based on the identification information of the test case that tests the page element, the test path of the page element, and the functional information of the page element. For example, the combination of the identification information of the test case that tests the page element, the test path of the page element, and the functional information of the page element may be used as the identification of the page element. A page element may be uniquely locked by the identification information of the test case that tests the page element, the test path of the page element, and the functional information of the page element.

[0035] The functional information of a page element refers to the functions that can be achieved by operating the page element. For example, for a button, various operations are performed through the button, such as submitting a form, downloading a file, and going to the next page. Among them, "submitting a form", "downloading a file", and "going to the next page" are the functional information of the button. For another example, a link is a link between web pages, and through a link, you can jump to other pages, download files, jump to a specific location, etc. Among them, "jump to other pages", "download files" and "jump to a specific location" are the functional information of the button.

[0036] Test case identification information for testing page elements. Test case identification information can uniquely identify a test case, such as the name of the test case, the identity (ID) or number of the test case, etc. The test path of a page element refers to the steps and the order of the steps in which the test case tests the page element.

[0037] The hierarchical relationship of page elements refers to the hierarchical relationship between page elements, which determines the positioning, display and interactive behavior of elements. The hierarchical relationship of page elements may include: parent-child elements, sibling elements (also known as brother elements), ancestor elements and descendant elements, etc. Among them, parent-child elements means that if one element directly contains another element, the former is the parent element of the latter, and the latter is the child element of the former. Ancestor elements and descendant elements mean that if one element indirectly contains another element, the former is the ancestor element of the latter, and the latter is the descendant element of the former. Sibling elements (also known as brother elements) refer to two elements that have a common parent element, and these two elements are called brother elements.

[0038] In order to facilitate the positioning of page elements, the hierarchical relationship information of page elements included in the element positioning information of page elements can be implemented as information of hierarchical relationships that are directly related to page elements, that is, direct hierarchical relationship information of page elements, which can include: Hypertext Markup Language (HTML) information of other elements with which the page element has a direct relationship, that is, HTML information of the parent element, child element, and sibling element of the page element, which can be called minimized HTML information. In this way, element positioning through the direct hierarchical relationship of page elements can simplify positioning reference information and improve element positioning efficiency.

[0039] Among them, the direct hierarchical relationship of page elements can be represented by the Document Object Model (DOM). DOM is a cross-platform, language-independent interface that allows programs and scripts to dynamically access and update the content, structure, and style of documents. The DOM scripting language operates HTML documents and Extensible Markup Language (XML) documents. DOM uses a tree structure as a hierarchical structure to represent various elements or content in the page in the form of tree nodes. In DOM, each element is regarded as a node, and each node is an "object", that is, when the user operates the element, each element node is regarded as an object, and then the properties and methods of this object are used to perform related operations.

[0040] The element positioning method of a page element refers to the method of defining the page element. General element positioning methods may include: identification (ID) positioning, name (Name) positioning, class (Class) positioning, tag name (Tag) positioning, link text positioning, partial link text positioning, Extensible Markup Language (XML) path (Xpath) positioning and Cascading Style Sheets (CSS) selector positioning. Multiple means more than 2.

[0041] Among them, ID positioning refers to positioning using the ID attribute of the page element. Name positioning refers to positioning through the Name attribute of the page element. Class positioning refers to positioning using the class attribute of the page element. Tag name positioning refers to positioning using the tag name of the element. Link text positioning is used to locate link elements on the page, and is positioned by the complete text of the link. Positioning by partial link text is used for fuzzy matching of link text, and is suitable for situations where the link text is long or requires partial matching. XPath positioning refers to the use of XPath expressions for precise element positioning. CSS selector positioning refers to the use of CSS selector expressions for element positioning.

[0042] In this embodiment, the abnormal positioning of the page element will trigger the test case automatic correction mechanism, and start executing step 101. Figure 2 As shown, a test case execution and data collection module 20a can be set to execute the test case and monitor the page element positioning abnormality event during the test case testing of the tested page. The test case execution and data collection module 20a can also execute step 101, that is, in response to the page element positioning abnormality event, obtain the element positioning information of the target element.

[0043] The test case fails to locate the target element, indicating that the element positioning method for the target element in the test case is invalid, so the element positioning method of the target element in the test case needs to be modified. Considering that there will be some elements or element attributes that are the same or similar before and after the version of the tested page is updated, the new element positioning method of the target element can be inferred with the help of the page elements on the historical version of the page corresponding to the tested page. Based on this, in step 102, the element positioning information of the historical page elements on the historical page of the tested page can be obtained. Among them, the historical page of the tested page refers to the page corresponding to the tested page in the software version before the software to which the tested page belongs is updated, that is, the tested page is an updated version of the historical page. The page elements on the historical page are called historical page elements.

[0044] The history page of the page under test can be one or more. Multiple means more than two. Multiple history pages correspond to multiple historical versions of the software to which the page under test belongs, and each historical version corresponds to a history page of the page under test. The type of information contained in the element location information of the historical page element is the same as the element location information of the aforementioned target element, but the specific content may be different, which will not be repeated here.

[0045] In this embodiment, the element location information of the historical page elements can be obtained in real time or collected in advance, and the collected element location information of the historical page elements is stored in the database. Figure 2 As shown, an element location information recording module 20b may be provided, which is used to collect element location information of the page elements of the software, and is responsible for storing the element location information of the page elements of the software, such as storing the element location information of the page elements of the software in a database. The page elements of the software collected by the element location information recording module 20b may include: page elements of each historical version of the software to which the aforementioned tested page belongs (i.e., the aforementioned historical page elements), and may also include page elements of other software. Each software may be software in a proprietary cloud. There are many software in the proprietary cloud, and multiple versions of the same software may coexist, which can provide rich element location information.

[0046] Correspondingly, the element location information recording module 20b can automatically scan the element location information of the page elements of each software, and store the collected element location information of the page elements in the database. Specifically, the identification information, test path, function information and direct hierarchical relationship information of the test case of the page element of the page to be stored can be obtained. Among them, the page to be stored can be the UI interface of each software, including: the historical page of the tested page. Further, the identification of the page element of the page to be stored can be determined according to the identification information, test path and function information of the test case of the page element of the page to be stored; thereafter, the identification of the page element of the page to be stored, the element location method and the direct hierarchical relationship information of the page element of the page to be stored can be used as the element location information of the page element on the page to be stored; and the element location information of the page element of the page to be stored can be stored. For example, the element location information of the page element of the page to be stored can be stored in the database. Of course, the element location information recording module 20b can also support users to update the element location information of the page elements recorded in the database.

[0047] Based on the element positioning information of the page elements pre-stored in the database, step 102 can be implemented as follows: according to the identifier of the tested page to which the target element belongs, determine the historical page of the tested page from the database; and read the element positioning information of the historical page elements on the historical page of the tested page from the database.

[0048] The historical page may be one or more historical pages of adjacent versions of the current version of the page under test. The adjacent versions of the current version refer to one or more versions that are closest to the current version.

[0049] Furthermore, in step 103, a target element positioning method of the target element may be determined according to the element positioning information of the target element and the element positioning information of the historical page elements.

[0050] Specifically, according to the element location information of the target element and the element location information of the historical page element, the historical page element whose function information and identification information of the test case are the same as the target element can be determined from the historical page elements. For the convenience of description and distinction, the historical page element whose function information and identification information of the test case are the same as the target element is defined as the first historical page element. The number of the first historical page elements can be one or more, which is determined by the actual situation.

[0051] Since the function and test case used by the first historical page element are the same as those of the target element, the first historical page element and the target element may be the same page element. Therefore, the element positioning information of the first historical page element has a great reference significance for re-determining the element positioning method of the target element. Therefore, the target element positioning method of the target element can be determined based on the element positioning information of the first historical page element.

[0052] In the embodiments of the present application, the specific implementation method of determining the target element positioning method of the target element according to the element positioning information of the first historical page element is not limited. In some embodiments, the element positioning method of the first historical page element may be used to attempt to locate the target element; if the positioning is successful, the target element positioning method may be determined to be the element positioning method of the first historical page element. Specifically, in combination with Figure 2 and Figure 3 , the element positioning method of the first historical page element can be obtained from the element positioning information of the first historical page element, and the element positioning method of the target element in the test case is replaced with the element positioning method of the first historical page element to obtain the candidate test case (corresponding to Figure 3 In the example above, the element positioning method of the historical page element replaces the element positioning method of the target element. Further, the target element can be positioned using the candidate test case; if the candidate test case locates the target element, the element positioning method of the first historical page element is determined to be the target element positioning method.

[0053] In this embodiment, the tested page may have one or more historical pages. Accordingly, the tested page may also have one or more historical versions. Generally, one historical version corresponds to one historical page. For embodiments in which there are multiple historical versions, the aforementioned first historical page element may also be multiple, and multiple historical versions correspond to multiple first historical page elements.

[0054] For an embodiment in which there are multiple first historical page elements corresponding to multiple historical versions, when attempting to use the element positioning method of the first historical page element to locate the target element, a first historical page element that has not been tried can be randomly selected from the multiple first historical page elements each time; and the element positioning method of the target element in the test case is replaced with the element positioning method of the currently selected first historical page element to obtain a candidate test case, and the current candidate test case can be used to locate the target element; if the current candidate test case locates the target element, the element positioning method of the currently selected first historical page element is determined to be the target element positioning method.

[0055] Since the historical version that is closer to the current version of the page under test has a higher similarity with the page under test, the first historical page element on the historical version has a greater similarity with the target element. Therefore, in order to determine the target element positioning method as soon as possible and improve the test case modification efficiency, the element positioning method of the target element in the test case can be replaced with the element positioning method of the first historical page element corresponding to multiple historical versions in sequence according to the order from new to old, to obtain candidate test cases. That is, each time from the historical version that has not been replaced, the latest historical version is selected as the currently replaced historical version; and the element positioning method of the target element in the test case is replaced with the element positioning method of the first historical page element corresponding to the currently replaced historical version, to obtain candidate test cases. Further, the current candidate test case can be used to locate the target element; if the current candidate test case locates the target element, the element positioning method of the first historical page element corresponding to the currently replaced historical version is determined to be the target element positioning method. If the current candidate test case fails to be located, the latest historical version is selected from the remaining unreplaced historical versions as the current replaced historical version, and the cycle is repeated until the target element is successfully located. The element positioning method of the first historical page element corresponding to the historical version that successfully locates the target element is used as the target element positioning method.

[0056] Among them, combined Figure 2 and Figure 3 , Step 102 and step 103 can be performed by the reasoning and correction module 20c. Figure 2 and Figure 3The "version priority matching" means that the target element is positioned using the element positioning method of the first historical page element; if the positioning is successful, the target positioning method for determining the target element can be the element positioning method of the first historical page element.

[0057] In this implementation, when encountering a scenario where an abnormal element is positioned, the element positioning method is preferentially searched from the historical versions of the tested page, which can improve the efficiency and effect of correcting the element positioning method of the page element.

[0058] Combination Figure 2 and Figure 3 If the target element is still not successfully located after all the first historical page elements are cycled through, other methods can be used to determine the target element location method of the target element, which is described below in conjunction with the following embodiments. Of course, it is also possible to replace the element location method of the target element in the test case without relying on the element location method of the first historical page element, and directly use the method provided in the following embodiments to determine the target element location method of the target element.

[0059] In some embodiments, when determining the target element positioning method of the target element based on the element positioning information of the first historical page element, the element positioning features of the target element can be further mined based on the element positioning information of the first historical page element and the element positioning information of the target element to enrich the element positioning features of the target element. When the target element cannot be directly located, the target element is located using the mined element positioning features. Accordingly, the multi-dimensional element positioning features of the target element can be determined based on the element positioning information of the first historical page element and the element positioning information of the target element.

[0060] Specifically, combined Figure 2 and Figure 3 , taking the first historical page element and the target element as the element set, obtaining the element positioning information of different dimensions corresponding to the element set from the element positioning information of the first historical page element and the element positioning information of the target element; and combining the element positioning information of different dimensions corresponding to the element set to obtain a multi-dimensional element positioning feature (corresponding to Figure 3 "Multi-dimensional element positioning features" in

[0061] Among them, the element positioning information has as many dimensions as the number of types of element positioning information of the page element. One type of element positioning information is one dimension. That is, if there are M types of element positioning information of the page element, then the element positioning information is element positioning information of M dimensions. M is a positive integer, and M≥2, which is specifically determined by the number of types of element positioning information. For example, the element positioning information includes: the identity (Identity, ID) of the page element, the class name (Class), the tag name (Tag Name), the name (Name) of the element, the element text (Text Content), the location information (Location), the identification information of the test case for testing the page element, the test path of the page element, the functional information of the page element, the element positioning method of the page element, and the hierarchical relationship information of the page element, then the element positioning information has 11 dimensions.

[0062] Combining the element location information of different dimensions corresponding to the element set means that the element location information of different page elements or the same page element in different dimensions can be combined into one element location feature, and the element location information of different page elements in the same dimension cannot be combined into one element location feature. For example, the class name of the first historical page element Q1 and the name of the second historical page element Q2 can be combined into one element location feature; of course, the class name of the first historical page element Q1 and the name of the first historical page element Q1 can be combined into one element location feature; but the class name of the first historical page element Q1 and the class name of the second historical page element Q2 cannot be combined into one element location feature, etc.

[0063] It is worth noting that in the embodiment of the present application, combination is a mathematical term, which means taking m (m≤n) elements from n different elements as a group, that is, a combination. Therefore, a positioning feature information of a page element can also be regarded as a feature combination.

[0064] Therefore, the element positioning information of different dimensions corresponding to the element set is combined, and the obtained multi-dimensional element positioning features may include: multiple feature combinations, each feature combination includes the element positioning feature of at least one dimension of at least one page element included in the element set.

[0065] In order to facilitate the use of element positioning features to lock the target element, the tree structure information of the tested page can also be obtained. Accordingly, in the case of monitoring an abnormal event in the positioning of a page element, the tree structure information of the tested page can also be obtained in response to the abnormal event in the positioning of the page element. Among them, the tree structure information of the tested page refers to the description of the tested information in the form of a tree structure, and the tree nodes represent various elements or contents in the tested page. Each page element is regarded as a tree node, and the tree node also describes various element positioning information of the page element. Optionally, the tree information of the tested page can be implemented as a DOM tree structure.

[0066] Based on the tree structure information of the tested page, when the target element is locked by using the multi-dimensional element positioning features of the mined target element, similar elements of the target element can be determined from the tree structure information according to the multi-dimensional element positioning features and the tree structure information.

[0067] Specifically, combined Figure 2 and Figure 3 , the similarity between the page elements contained in the tree structure information and the target elements can be determined based on the multi-dimensional element positioning features and tree structure information (corresponding to Figure 2 and Figure 3 'Similarity Analysis' in .

[0068] Since the element location information of different dimensions has different effects on element location, when determining the similarity between the page elements contained in the tree structure information and the target elements, the element location information of each dimension can be configured with weights according to the influence of the element location information of each dimension on the accuracy of element location. Among them, the greater the influence of the dimension on the accuracy of element location, the greater the corresponding weight. And because the historical pages of the historical versions that are closer to the tested page in time have greater similarity with the tested page, therefore, weights can be configured for multiple historical versions according to the newness of the multiple historical versions and the version to which the tested page belongs. Among them, the newer the historical version, the greater the weight; the weight of the version to which the tested page belongs is greater than the weight of any historical version.

[0069] Based on the weights of the element positioning features of each dimension, the weights of multiple historical versions and the version to which the tested page belongs, the multi-dimensional element positioning features include: an embodiment of multiple feature combinations, for any feature combination, the weights of each dimension corresponding to the element positioning information and the weights of multiple historical versions and the version to which the tested page belongs can be obtained; and according to the weights of each dimension and the weights of multiple historical versions and the version to which the tested page belongs, the weights of each element positioning feature included in the feature combination are determined. For any element positioning feature, the product of the weight of the dimension to which the element positioning feature belongs and the weight of the version corresponding to the element positioning feature can be used as the weight of the element positioning feature. In the same way, the weights of each element positioning feature included in each feature combination can be determined.

[0070] The following takes the example that the element location information of the page element includes: the element location information of three dimensions, such as the page element's identification, function and class name, and the historical versions are version 1 and version 2, and the version of the tested page is version 3, to illustrate the weights of each element location feature included in the above-mentioned determined feature combination. Accordingly, the element location information corresponding to the first historical page element and the target page element is shown in Table 1 below:

[0071] Table 1 Element location information corresponding to the first historical page element and the target page element

[0072]

[0073] Based on the above Table 1, by adopting the method of determining the multi-dimensional element positioning features of the target element provided in the above embodiment, the multi-dimensional element positioning features can be obtained, including the following feature combinations: (identifier 1, Class1), (identifier 1, function 1), (class1, class name 2),... (identifier 1, class1, function 1), (identifier 2, class2, function 2), (identifier 3, Class3, function 3), (identifier 1, class2, function 2), (identifier 1, class2, function 3)... and so on.

[0074] Assuming that the weight of the logo is 0.5, the weight of the class name is 0.3, the weight of the function is 0.2, the weight of version 1 is 0.1, the weight of version 2 is 0.3, and the weight of version 3 is 0.6, the weights of the location information of each element in Table 1 are shown in Table 2:

[0075] Table 2: Weights of element positioning information

[0076]

[0077] The numbers in brackets in Table 2 represent the weights of the corresponding element location information.

[0078] Furthermore, the weights of the element positioning features contained in the feature combination can be determined based on the weights of each dimension and the weights of multiple historical versions and the version to which the tested page belongs. For example, the weights corresponding to (identifier 1, Class 1) are (0.05, 0.03); the weights corresponding to (identifier 1, class 2, function 3) are (0.05, 0.09, 0.12), etc.

[0079] Accordingly, the aforementioned determination of the similarity between the page elements contained in the tree structure information and the target elements based on the multi-dimensional element positioning features and the tree structure information can be implemented as follows: for any feature combination, the feature combination can be matched in the tree structure information; if there is a first element in the tree structure information that matches the feature combination, the similarity between the first element and the target element is determined based on the weights of the element positioning features contained in the feature combination.

[0080] The first element matches the feature combination, which means that the element location information of the first element in the dimension corresponding to the feature combination is the same as the feature combination. For example, if the feature combination is (identifier 1, Class1), the identifier of the first element is also identifier 1, and the class name is also Class1.

[0081] When determining the similarity between the first element and the target element based on the weights of the positioning features of each element contained in the feature combination, the sum of the weights of the positioning features of each element contained in the feature combination can be used as the similarity between the first element and the target element. For example, assuming that the first element matches the feature combination (identity 1, Class1), the similarity between the first element and the target element is the sum of the weights of identity 1 and Class1, which is equal to 0.08.

[0082] After determining the similarity between the page element included in the tree structure information and the target element, similar elements of the target element may be determined from the tree structure information according to the similarity between the page element included in the tree structure information and the target element.

[0083] In some embodiments, the page element with the greatest similarity to the target element may be determined from the page elements included in the tree structure information as a similar element to the target element. Alternatively, a second element with a similarity to the target element greater than or equal to a set similarity threshold may be determined from the page elements included in the tree structure information as a similar element to the target element, etc.

[0084] Since the element positioning features of the similar elements are relatively similar to the target element, after the similar elements of the target element are determined, the target element positioning method of the target element may be determined according to the element positioning information of the similar elements.

[0085] There may be one or more similar elements. Multiple means more than two. For the embodiment with one similar element, the element positioning method of the similar element can be used as the target element positioning method of the target element. For the embodiment with multiple similar elements, since the similar elements are matched in the tree structure information of the tested page with the help of the element positioning features of the historical page elements of the historical version, the element positioning features of the historical page elements of the historical version may be changed and invalid features for the tested page, affecting the subsequent similarity results. Therefore, in the case of multiple similar elements, multiple similar elements can be further screened.

[0086] Specifically, direct hierarchical relationship information of multiple similar elements can be determined from the HTML document of the tested page. Specifically, HTML information of parent elements, child elements and sibling elements with which each similar element has a direct hierarchical relationship can be determined from the HTML document of the tested page as the direct hierarchical relationship information of the similar elements, that is, the minimized HTML information of the similar elements.

[0087] Furthermore, a historical page element (defined as a second historical page element) having the same identifier as the target element can be determined from the historical page elements, and the direct hierarchical relationship information of the second historical page element can be obtained. Specifically, the element location information of the second historical page element can be obtained from a database that pre-stores the element location information of the page elements of the aforementioned page to be stored, and the direct hierarchical relationship information of the second historical page element can be determined from the element location information of the second historical page element.

[0088] Since the direct hierarchical relationship information of the page elements is HTML information, which is text information, the text similarity between the multiple similar elements and the second historical page elements can be determined based on the direct relationship information of the multiple similar elements and the direct relationship information of the second historical page elements. Among them, the similar element with the highest text similarity to the second historical page element (defined as the target similar element) can be determined as the target element. Since the HTML information contains the information required for element positioning, such as the identity (ID), class name (Class), name (Name) and hierarchical relationship information of the page element, the target element positioning method of the target element can be determined based on the HTML information of the target similar element with the highest text similarity.

[0089] The above-mentioned embodiment exemplifies a specific implementation method of determining the target element positioning method of the target element according to the element positioning information of the target element and the element positioning information of the historical page elements, but does not constitute a limitation.

[0090] In the aforementioned embodiment, the element location information of the historical page elements and the page information of the tested page at runtime (i.e., the tree structure information of the tested page) are used in combination with simple heuristic rules to reduce the reliance on complex machine learning models, and can quickly adapt to new UI changes, avoiding the need for large-scale data sets and high-end computing resources to train complex models, simplifying the complexity of test case modifications, and reducing the resource requirements for test case modifications. Among them, the simple heuristic rule refers to the aforementioned combination of the element location information of the historical page elements and the tree structure information of the tested page to determine the similar elements of the target element; and based on the element location information of the similar elements, determine the relevant content of the target element location method of the target element.

[0091] The target element positioning method of the target element of the aforementioned embodiment can significantly improve the accuracy of the determined target element positioning method. Specifically, first, in the case of detecting abnormal positioning of the target element, the element positioning method can be preferentially searched from the historical version of the tested page, which can improve the efficiency and effect of correcting the element positioning method of the page element. Afterwards, in the case that the element positioning method corresponding to the historical version is not effective, the multi-dimensional element positioning features can be determined based on the element positioning information of the target element and the element positioning information of the historical page elements corresponding to the historical version. Through the rich element positioning features, the element positioning method of similar elements with a high similarity to the target element can be inferred as the target element positioning method, which can improve the accuracy of the determined target element positioning method.

[0092] After determining the target element positioning mode of the target element, in step 104, the element positioning mode of the target element in the test case can be modified according to the target element positioning mode to obtain the target test case. Specifically, the element positioning mode of the target element in the test case can be modified to the target element positioning mode to obtain the target test case.

[0093] In the embodiment of the present application, based on the fact that some elements or element attributes are the same or similar before and after the version of the tested page is updated, for the target element with abnormal positioning in the tested page, the new element positioning method of the target element, that is, the target element positioning method, is inferred based on the element positioning information of the page element on the historical page of the tested page and the element positioning information of the target element, and the element positioning method of the target element in the test case is modified based on the target element positioning method, thereby realizing the automatic modification of the test case, reducing the need for manual intervention when positioning fails due to changes in the front-end page, and helping to improve the efficiency of test case modification. On the other hand, the automatic modification of test cases reduces the need for manual intervention and can also reduce maintenance costs.

[0094] In addition, the present application monitors the testing process of the tested page by the test case in real time. Once the abnormal event of page element positioning is detected, the aforementioned steps 102-104 are promptly responded to and automatically corrected immediately without waiting for the test to end. This instant feedback and correction mechanism significantly improves the test efficiency and reduces the number of manual interventions.

[0095] The above embodiment provides an automated modification scheme for test cases when the positioning of page elements is abnormal. If the element positioning still fails after the automated modification scheme is implemented, the embodiment of the present application also provides a supplementary mechanism, namely Figure 2 and Figure 3 The "manual intervention correction" mechanism shown supports testers to intervene and make modifications. For example, a modification interface may be provided, through which testers can modify test cases.

[0096] Specifically, the test unit associated with the target element can be determined from the test case. The test unit is an independent unit with minimal functions. The test unit can be displayed on the modification interface, and the target element and code position where the page element positioning abnormality event occurs are marked. The tester analyzes the HTML information of the tested page and manually modifies the element positioning method of the target element in the test unit on the modification interface (corresponding to Figure 3 ) to obtain the modified test unit; and run the modified test unit for testing. After the test is successful, you can modify the element positioning method of the target element in the test case, and execute the modified test case from the code location where the element positioning exception event occurs to continue testing the page under test. Compared with starting the test case from scratch for a full-process test, this can save testing time and improve testing efficiency. This embodiment takes the automatic correction mechanism as its core, combined with the flexibility of manual correction, so that test cases are easy to expand and maintain, and the updating and management of test cases become more efficient.

[0097] In some embodiments, the manually corrected data can also be fed back to the reasoning and correction module 20c for learning and optimization, forming a closed-loop feedback mechanism of human-machine collaboration, and improving the ability of the reasoning and correction module 20c to handle complex scenarios. Among them, the reasoning and correction module 20c is used to execute the specific implementation of steps 102-step 104 and steps 102-step 104.

[0098] In adopting Figure 2 and Figure 3 After modifying the element location method of the target element in the test case by any of the methods shown, if the target element is successfully located using the modified test case, it means that the target element is successfully located. Accordingly, relevant information of the current modification, such as a modification log, etc., can be recorded, and the modified target test case can continue to be executed.

[0099] In the embodiment of the present application, the target test case can be used to continue testing the page under test. Specifically, the code location where the element positioning abnormal event occurs can be determined from the target test case; the target test case is executed from the code location where the element positioning abnormal event occurs to continue testing the page under test. Compared with starting the test case from scratch to conduct a full-process test, testing time can be saved and testing efficiency can be improved.

[0100] The present application embodiment can also evaluate the test results of the modified test case (i.e., the target test case) of the above embodiment. Figure 2As shown, a result evaluation and feedback module 20d may also be provided to evaluate the test results of the target test case and determine whether the target element can be successfully located and is effective. Specifically, the target test case can obtain the screenshots of the tested page before and after the target element is located and the tested page after the test. The tester can compare the screenshots of the tested page before and after the target element is located and the tested page after the test according to the target test case to check whether the operation effect of the target test case on the target element meets expectations (i.e. Figure 2 If the target test case's operation effect on the target element meets expectations, it means that the target test case has successfully located the target element, that is, the test case modification is effective. Furthermore, the information of the target test case that tests the target element of the tested page, and the element location results before and after the test case modification can be recorded; the target test case can also record the element location of the target element and the screenshots of the tested page before and after the test, so that subsequent staff can check and confirm the correctness of the results after the test case modification, and solidify the target test case (i.e. Figure 2 If the target test case does not meet the expected effect on the target element, it means that the test case modification has failed and is invalid. The tester can manually modify the failed page element according to the error message and record it in the change library of each version of the page element.

[0101] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 101 and 102 can be device A; for another example, the execution subject of step 101 can be device A, and the execution subject of step 102 can be device B; and so on.

[0102] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel, and the serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel.

[0103] Accordingly, an embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned test case modification method.

[0104] The embodiment of the present application also provides a computer program product, including a computer program, when the computer program is executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned test case modification method. In the embodiment of the present application, the computer program product can be implemented as software in various forms, such as an application (Application, APP), a small program, a software development kit (Software Development Kit, SDK), an image file of a CD (such as an ISO file), a plug-in or software as a service (Software as a Service, SaaS) software, etc., but is not limited thereto.

[0105] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown, the electronic device includes: a memory 40a and a processor 40b. The memory 40a is used to store computer programs.

[0106] The processor 40b is coupled to the memory 40a, and is used to execute the computer program to execute the steps in the test case modification method provided in the above embodiments. The specific implementation of each step can be found in the relevant description of the above embodiments, which will not be repeated here.

[0107] In some optional embodiments, such as Figure 4 As shown, the electronic device may also include optional components such as a communication component 40c, a power component 40d, a display component 40e and an audio component 40f. Figure 4 The components are shown schematically only, and do not mean that the electronic device must include Figure 4 The components shown do not necessarily mean that the electronic device can only include Figure 4 Components shown.

[0108] in addition, Figure 4 The components in the dashed box are optional components, not mandatory components, and may depend on the product form of the electronic device. The electronic device of this embodiment may be implemented as a terminal device such as a desktop computer, a laptop computer, a mobile phone, or an IoT device; or it may be various server devices such as a traditional server, a cloud server, or a server cluster.

[0109] In an embodiment of the present application, the memory is used to store a computer program and can be configured to store various other data to support operations on the device where it is located. Among them, the processor can execute the computer program stored in the memory to implement the corresponding control logic. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random-Access Memory, SRAM), electrically erasable programmable read only memory (Electrically Erasable Programmable Read Only Memory, EEPROM), erasable programmable read only memory (Electrical Programmable Read Only Memory, EPROM), programmable read only memory (Programmable Read Only Memory, PROM), read only memory (Read Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0110] In the embodiment of the present application, the processor may be any hardware processing device that can execute the logic of the above method. Optionally, the processor may be a central processing unit (CPU), a graphics processing unit (GPU) or a microcontroller unit (MCU); it may also be a field programmable gate array (FPGA), a programmable array logic device (PAL), a general array logic device (GAL), a complex programmable logic device (CPLD) or other programmable devices; or it may be an advanced reduced instruction set (RISC) processor (Advanced RISC Machines, ARM) or a system on chip (System on Chip, SoC), etc., but not limited thereto.

[0111] In an embodiment of the present application, the communication component is configured to facilitate wired or wireless communication between the device in which it is located and other devices. The device in which the communication component is located can access a wireless network based on a communication standard, such as Wireless Fidelity (WiFi), 2G or 3G, 4G, 5G or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can also be implemented based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology or other technologies.

[0112] In an embodiment of the present application, the display component may include a liquid crystal display (LCD) and a touch panel (TP). If the display component includes a touch panel, the display component may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0113] In an embodiment of the present application, a power supply component is configured to provide power to various components of the device in which it is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component is located.

[0114] In an embodiment of the present application, the audio component may be configured to output and / or input audio signals. For example, the audio component includes a microphone (Microphone, MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal. For example, for a device with a language interaction function, voice interaction with a user may be achieved through an audio component.

[0115] It should be noted that the descriptions such as “first” and “second” in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit “first” and “second” to different types.

[0116] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program codes.

[0117] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, 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, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0118] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0119] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0120] In a typical configuration, a computing device includes one or more processors (CPU, etc.), input / output interfaces, network interfaces, and memory.

[0121] Memory may include non-permanent storage in a computer-readable medium, in the form of random-access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0122] Computer storage media is readable storage media, also known as readable media. Readable storage media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0123] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the above elements.

[0124] The above contents are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A test case modification method, characterized in that: include: In the process of testing the page under test by the test case, in response to the page element positioning abnormality event, the element positioning information of the target element with positioning abnormality and the tree structure information of the page under test are obtained; the element positioning information of the target element includes the element positioning mode of the target element; Obtaining element location information of a historical page element on a historical page of the page under test; According to the element location information of the target element and the element location information of the historical page elements, determine, from the historical page elements, a first historical page element whose function information and identification information of the test case are the same as those of the target element; wherein the element location information of the page element includes: the function information of the page element and the identification information of the test case for testing the page element; the page element includes: the target element and the historical page element; Determining a target element positioning method of the target element according to the element positioning information of the first historical page element; According to the target element positioning method, modify the element positioning method of the target element in the test case to obtain a target test case; The step of determining the target element positioning method of the target element according to the element positioning information of the first historical page element includes: Taking the first historical page element and the target element as an element set, acquiring element location information of different dimensions corresponding to the element set from the element location information of the first historical page element and the element location information of the target element; Combining the element location information of different dimensions corresponding to the element set to obtain a multi-dimensional element location feature of the target element; Determine similar elements of the target element from the tree structure information according to the multi-dimensional element positioning features and the tree structure information; The target element positioning method is determined according to the element positioning information of the similar elements.

2. The method according to claim 1, characterized in that: There are multiple historical pages; the multiple historical pages correspond to multiple historical versions; the first historical page elements are multiple historical page elements corresponding to the multiple historical versions; The determining the target element positioning method of the target element according to the element positioning information of the first historical page element further includes: Acquire the element positioning method of the first historical page element from the element positioning information of the first historical page element; According to the order of the multiple historical versions from new to old, the element positioning mode of the target element in the test case is replaced with the element positioning mode of the first historical page element corresponding to the multiple historical versions in sequence to obtain a candidate test case; Locating the target element using the candidate test case; If the candidate test case locates the target element, the element positioning mode of the first historical page element corresponding to the currently replaced historical version is determined as the target element positioning mode.

3. The method according to claim 1, characterized in that The determining, based on the multi-dimensional element positioning features and the tree structure information, similar elements of the target element from the tree structure information includes: Determine the similarity between the page element included in the tree structure information and the target element according to the multi-dimensional element positioning features and the tree structure information; According to the similarity between the page element contained in the tree structure information and the target element, similar elements of the target element are determined from the tree structure information.

4. The method according to claim 3, characterized in that The multi-dimensional element positioning feature includes: a plurality of feature combinations; each feature combination includes an element positioning feature of at least one dimension of at least one page element included in the element set; and determining the similarity between the element included in the tree structure information and the target element based on the multi-dimensional element positioning feature and the tree structure information includes: For any feature combination, matching the any feature combination in the tree structure information; If there is a first element in the tree structure information that matches any of the feature combinations, the similarity between the first element and the target element is determined according to the weights of the positioning features of each element included in any of the feature combinations.

5. The method according to claim 4, characterized in that There are multiple historical pages; the multiple historical pages correspond to multiple historical versions; before determining the similarity between the first element and the target element according to the weight of each element positioning feature included in any one of the feature combinations, the method further includes: Obtaining the weights of each dimension corresponding to the element location information and the weights of the multiple historical versions and the version to which the tested page belongs; wherein the newer the historical version, the greater its weight, and the weight of the version to which the tested page belongs is greater than the weights of the multiple historical versions; The weight of each element positioning feature included in any feature combination is determined according to the weight of each dimension and the weights of the multiple historical versions and the version to which the tested page belongs.

6. The method according to claim 3, characterized in that The determining, from the tree structure information, similar elements of the target element according to the similarity between the elements included in the tree structure information and the target element, comprises: From the elements included in the tree structure information, a second element whose similarity to the target element is greater than or equal to a set similarity threshold is determined as a similar element to the target element.

7. The method according to claim 1, characterized in that There are multiple similar elements, and determining the target element positioning method according to the element positioning information of the similar elements includes: Determining direct hierarchical relationship information of a plurality of similar elements from the HTML document of the tested page; Determine, from the historical page elements, a second historical page element having the same identifier as the target element; Acquire direct hierarchical relationship information of the second historical page element from the element location information of the second historical page element; Determining text similarities between the plurality of similar elements and the second historical page element respectively according to the direct hierarchical relationship information of the plurality of similar elements and the direct hierarchical relationship information of the second historical page element; The target element positioning method is determined according to the HTML information of the target similar element with the highest text similarity.

8. The method according to any one of claims 1 to 7, characterized in that: Before obtaining the element location information of the historical page element on the historical page of the tested page, the method further includes: Acquire identification information, test paths, function information of the test cases of the page elements of the page to be stored and direct hierarchical relationship information of the page elements of the page to be stored; the page to be stored includes the history page of the page to be tested; Determine the identification of the page element of the page to be stored according to the identification information, test path and function information of the test case of the page element of the page to be stored; Using the identifier of the page element of the page to be stored, the element positioning method and the direct hierarchical relationship information of the page element of the page to be stored as the element positioning information of the page element on the page to be stored; The element location information of the page element of the page to be stored is stored.

9. The method according to any one of claims 1 to 7, characterized in that: After obtaining the target test case, the method further includes: The target test case is used to continue testing the page under test.

10. The method according to claim 9, characterized in that The step of continuing to test the page under test by using the target test case includes: Determine, from the target test case, a code location where the element positioning exception event occurs; The target test case is executed starting from the code position where the element positioning exception event occurs to continue testing the page under test.

11. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store a computer program; The processor is coupled to the memory and configured to execute the computer program to perform the steps of the method according to any one of claims 1 to 10.

12. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the method according to any one of claims 1 to 10.

13. A computer program product, characterized in that The method comprises a computer program, which, when executed by one or more processors, causes the one or more processors to execute the steps of the method according to any one of claims 1 to 10.