Automatic testing method, computer equipment and computer program product
Through the operation trajectory model recording interface operation process, computer equipment can effectively jump to the functional interface to be tested in automated testing, solving the problem of insufficient test coverage and comprehensiveness in the existing technology, and achieving more efficient automated testing.
Patent Information
- Application Number
- CN202411571493.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-11
AI Technical Summary
During the testing process, existing automated testing methods are prone to insufficient testing of some key functions due to randomly generated events, and cannot effectively jump back to the functional interface to be tested, resulting in insufficient test coverage and comprehensiveness.
The operation process in the interface is recorded through the operation track model, including the node information of the interface facing the corresponding node and the edge information of the corresponding behavior of the operation behavior within the interface. The computer device can determine when it recognizes other interfaces other than the target interface corresponding to the function to be tested. Out of the target operation path that jumps to the target interface and automatically jumps to the target interface for testing.
It improves the automated test coverage and comprehensiveness of the functional interface to be tested, ensuring that it can re-jump back to the target interface after leaving the functional interface to be tested, and enhances the accuracy and comprehensiveness of the test.
Smart Images

Figure CN119415435A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of automated testing technology, and in particular to an automated testing method, a computer device, and a computer program product. Background Art
[0002] During the application development process, developers need to use automated testing tools to perform automated testing on the application. Commonly used automated testing tools include Monkey tools.
[0003] During the automated testing process, the automated testing tool will randomly generate operation events (such as clicks, touches, gestures, etc.) and system events, and simulate the user's operation behavior in the application by injecting the operation events and system events into the application. Summary of the invention
[0004] The present application provides an automated testing method, a computer device, and a computer program product. The technical solution is as follows:
[0005] On the one hand, an embodiment of the present application provides an automated testing method, the method comprising:
[0006] Based on a target function to be tested in the application to be tested, determining a target interface in the application to be tested, wherein the target interface refers to an interface for realizing the target function;
[0007] During the automated testing process, when the current interface does not belong to the target interface, the target path information is determined based on the operation trajectory model, the operation trajectory model includes the node information of the node corresponding to the interface in the application to be tested and the edge information of the behavior edge corresponding to the operation behavior in the interface, the target path information is the path information of the target operation path to jump to the target interface, and the target operation path is composed of nodes and behavior edges between nodes;
[0008] Jump to the target interface based on the target path information;
[0009] Perform automated testing in the target interface.
[0010] On the other hand, an embodiment of the present application provides an automated testing device, the device comprising:
[0011] An interface determination module, used to determine a target interface in the application to be tested based on a target function to be tested in the application to be tested, wherein the target interface refers to an interface for realizing the target function;
[0012] A path determination module is used to determine target path information based on an operation trajectory model during an automated test process when the current interface does not belong to the target interface, wherein the operation trajectory model includes node information of nodes corresponding to the interface in the application to be tested and edge information of behavior edges corresponding to operation behaviors in the interface, wherein the target path information is path information of a target operation path for jumping to the target interface, and the target operation path is composed of nodes and behavior edges between nodes;
[0013] A jump module, used for jumping to the target interface based on the target path information;
[0014] A testing module is used to perform automated testing in the target interface.
[0015] On the other hand, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein the memory stores at least one computer instruction, and the at least one computer instruction is loaded and executed by the processor to implement the automated testing method described in the above aspects.
[0016] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores at least one computer instruction, and the at least one computer instruction is used to be executed by a processor to implement the automated testing method as described in the above aspects.
[0017] On the other hand, an embodiment of the present application provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the automated testing method described in the above aspects.
[0018] In the embodiment of the present application, an operation trajectory model is used to record the operation process in the interface, wherein the operation trajectory model includes node information of the corresponding node of the interface and edge information of the corresponding behavior edge of the operation behavior in the interface. With the help of the node information and edge information in the operation trajectory model, the computer device can determine the target operation path to jump to the target interface when identifying other interfaces outside the target interface corresponding to the function to be tested, that is, determine the interface to be passed through when jumping to the target interface and the operation behavior performed in the interface, so as to automatically jump to the target interface based on the target path information corresponding to the target operation path, and then perform automated testing in the target interface. Compared with automated testing based on randomly generated events, which leads to insufficient testing of some key functions, the automated testing scheme provided by the embodiment of the present application can jump back to the interface of the function to be tested when leaving the interface of the function to be tested, improve the automated testing coverage of the interface of the function to be tested, and help improve the comprehensiveness of the test of the function to be tested. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is an architectural diagram of a computer system provided by an exemplary embodiment of the present application;
[0020] Figure 2 is a schematic diagram of an operation trajectory model corresponding to an operation process shown in an exemplary embodiment of the present application;
[0021] Figure 3 A flowchart of an automated testing method provided by an exemplary embodiment of the present application is shown;
[0022] Figure 4 A flowchart of an operation path determination process provided by an exemplary embodiment of the present application is shown;
[0023] Figure 5 is a schematic diagram of a skeletonized interface layout shown in an exemplary embodiment of the present application;
[0024] Figure 6 is a schematic diagram of an interface layout similarity calculation process shown in an exemplary embodiment of the present application;
[0025] Figure 7 is a schematic diagram of an operation path shown in an exemplary embodiment of the present application;
[0026] Figure 8 A flowchart of an operation path determination process provided by another exemplary embodiment of the present application is shown;
[0027] Fig. 9 is a schematic diagram of an operation path shown in another exemplary embodiment of the present application;
[0028] Fig.10is a flow chart of an interface jump process shown in an exemplary embodiment of the present application;
[0029] Fig.11 is a schematic diagram of a function tree shown in an exemplary embodiment of the present application;
[0030] Fig.12 is a schematic diagram of an implementation of a target interface determination process shown in an exemplary embodiment of the present application;
[0031] Fig.13 is a schematic diagram of an implementation of an automated test event determination process shown in an exemplary embodiment of the present application;
[0032] Fig.14 is a schematic diagram of an implementation of an automated testing process shown in an exemplary embodiment of the present application;
[0033] Fig.15 A structural block diagram of an automated testing device provided by another exemplary embodiment of the present application is shown;
[0034] Fig.16 A structural block diagram of a computer device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0035] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0036] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0037] Please refer to Figure 1 , which shows an architecture diagram of a computer system shown in an exemplary embodiment of the present application. The computer system includes a server 110, a computer device 120 and a terminal 130.
[0038] In some embodiments, the server 110 is used to configure the function to be tested in the application to be tested. Optionally, the server 110 provides a web page for configuring the function to be tested, and the developer can configure the function to be tested of the application to be tested on the web page.
[0039] In some embodiments, the server 110 is also configured with an operation trajectory model, which fully records the node information of the corresponding node of the interface in the application to be tested, the side information representing the operation behavior in the interface and the interface changes before and after the operation behavior, and the path information of the operation path composed of continuous operation behaviors. Based on the operation trajectory model, functions such as interface positioning and interface flashback can be realized.
[0040] The computer device 120 may be connected to the server 110 via a wired network or a wireless network.
[0041] In some embodiments, the computer device 120 is an electronic device installed with an automated testing tool, and the electronic device may be a personal computer, a workstation, etc. In some embodiments, the computer device 120 may determine the function to be tested in the application to be tested by accessing the server 110, and obtain the operation trajectory model configured in the server 110, thereby determining the target interface to which the function to be tested belongs based on the operation trajectory model.
[0042] The terminal 130 may be connected to the computer device 120 via a wired connection (such as a USB connection) or a wireless connection (such as a WiFi connection).
[0043] In some embodiments, the terminal 130 is an electronic device installed with an automated testing tool plug-in and an application to be tested, and the electronic device may be a smart phone, a tablet computer, a wearable device, a personal computer, etc. During the automated testing process, the terminal 130 may communicate with the computer device 120 via the automated testing tool plug-in.
[0044] In some embodiments, the computer device 120 sends an automated testing instruction to the terminal 130 , and the automated testing tool plug-in of the terminal 130 simulates user operation behavior in the interface based on the automated testing instruction and feeds back the automated testing result to the computer device 120 .
[0045] In an embodiment of the present application, during the automated testing process, the computer device 120 will monitor in real time whether the current interface of the terminal 130 is the target interface to which the function to be tested belongs, and if the current interface does not belong to the target interface, determine the target operation path to jump to the target interface based on the operation trajectory model, thereby controlling the terminal 130 to jump to the target interface based on the target operation path, so as to continue the automated testing in the target interface.
[0046] In some embodiments, when the automated testing tool generates automated testing events (use cases), in addition to randomly selecting basic events provided by the automated testing tool, it also combines the operation behaviors in the operation trajectory model to improve the comprehensiveness of the automated testing events.
[0047] For ease of understanding, the operation trajectory model involved in the embodiments of the present application is first described below.
[0048] The operation trajectory model (Trajectory Structure) is a model (or data structure) used to record the operation process. Figure 2 As shown, the operation trajectory model 23 corresponding to the operation process is composed of nodes 231, behavior edges 232 and operation paths 233. Among them, the node 231 corresponds to the interface 21 passed during the operation process; the behavior edge 232 corresponds to the operation behavior in the interface, which is used to connect the edges 22 of different nodes (interface switching occurs after the operation) or the same node (no interface switching occurs after the operation); the operation path 233 corresponds to the operation behavior sequence.
[0049] In addition, in order to ensure the accuracy of the operation process record, the node information 241 of the node 231 represents the interface features of the interface from different dimensions to ensure the accuracy of the subsequent interface retrieval and positioning; the edge information 242 of the behavior edge 232 indicates the operation behavior and the node jumps before and after the operation behavior to ensure the accurate restoration of the operation in the subsequent interface; the path information 243 of the operation path 233 represents the execution sequence between different operation behaviors to ensure that complex operations are executed in sequence.
[0050] Compared with screenshots and videos, the operation trajectory model has a lower data volume and can be automatically generated without manual triggering by the user. In addition, it can automatically backtrack and reproduce based on node information, edge information, and path information, improving the efficiency of operation backtracking and reproduction.
[0051] Regarding the method of generating the operation trajectory model, in one possible implementation, a computer device traverses the entire interface of the application and all interface elements in the interface, and performs operations on the interface elements, thereby generating an operation trajectory model that includes node information representing interface features, edge information representing operation behaviors, and path information representing operation paths.
[0052] node
[0053] The interface is a visual user interface, such as a desktop, an application program interface, a system interface, etc. In the embodiment of the present application, different interfaces in the operation process correspond to respective nodes, and different nodes represent the interface features of their respective corresponding interfaces through their respective node information, that is, different nodes can be distinguished based on the node information.
[0054] Optionally, dimensions characterizing interface features may include interface content dimension, interface layout dimension, interface function dimension, interface description dimension, the window to which the interface belongs, etc. The following embodiments will describe in detail the specific content contained in the node information.
[0055] The interface in this embodiment is not limited to the visible range of the screen, but includes the completed interface within and outside the visible range of the screen. Accordingly, before and after the interface content is scrolled, even if the displayed content within the visible range of the screen changes significantly, the interface before and after the scrolling will not be judged as a different interface.
[0056] In the embodiments of the present application, different interfaces refer to interfaces with significant differences in interface layout, content, and style. Usually, when an interface switch occurs, the interfaces before and after the switch are determined to be different interfaces. For example, when text or images in an interface change dynamically, or when list elements in an interface change, they are not determined to be different interfaces; when clicking on a control in an interface to trigger an interface jump, the interfaces before and after the jump are determined to be different interfaces.
[0057] Behavior Edge
[0058] The behavior edge (Edge) corresponding to the operation behavior is a directed edge, and the direction of the behavior edge is the interface jump direction, that is, the behavior edge points from the interface before the jump to the interface after the jump.
[0059] Optionally, the operation behavior refers to a manual operation behavior of the user, such as a trigger operation on a control in the interface; or, the operation behavior refers to a system behavior, such as an automatic interface jump operation after a preset time period has been reached.
[0060] In some embodiments, a plurality of operation behavior types are preset, and the edge information of the behavior edge includes the operation behavior type to which the operation behavior belongs.
[0061] Regarding the recording method of the node jump situation before and after the operation behavior, in a possible implementation, the side information includes information about the corresponding nodes of the interface before and after the operation behavior is performed. For example, the side information includes the node identifier of the node corresponding to the interface before the operation behavior is performed, and the node identifier of the node corresponding to the interface after the operation behavior is performed. Among them, the interface identifiers corresponding to the interfaces before and after the operation behavior can be different interface identifiers (i.e., the interface jump occurs after the operation), or they can be the same interface identifier (i.e., the operation does not cause an interface jump).
[0062] Operation Path
[0063] Since a series of operations may need to be performed during the operation process and multiple interfaces may need to be jumped, the computer device needs to sort the behavior edges corresponding to the operation behaviors according to the execution sequence between the operation behaviors to obtain the operation path (Path). Among them, the operation path is a directed path composed of multiple nodes and behavior edges between nodes.
[0064] Correspondingly, the path information of the operation path is composed of edge information, and can indicate the order relationship between the edge information and the corresponding behavior edge.
[0065] Please refer to Figure 3 , which shows a flowchart of an automated testing method provided by an exemplary embodiment of the present application, and the method may include the following steps.
[0066] Step 301 : determining a target interface in the application to be tested based on a target function to be tested in the application to be tested, where the target interface refers to an interface for realizing the target function.
[0067] In some embodiments, the target function may be manually specified by a developer, and / or determined by an automated testing tool from all functions of the application to be tested based on a testing strategy, which is not limited in this embodiment of the present application.
[0068] In some embodiments, when the target function to be tested is the full function of the application to be tested, the target interface is the full interface of the application to be tested; when the target function to be tested is a partial function of the application to be tested, the target interface is a partial interface of the application to be tested.
[0069] Optionally, when there are multiple target functions to be tested, the target interface is used to implement at least one target function, and the number of determined target interfaces may also be multiple.
[0070] For example, the application to be tested includes a total of 50 interfaces. When the target functions to be tested are functions A, B, C, D, and E, the computer device determines the target interfaces as interface 1, interface 3, interface 5, and interface 9, where interface 1 is used to implement functions A and B, interface 3 is used to implement function C, interface 5 is used to implement function D, and interface 9 is used to implement function E.
[0071] Step 302, during the automated testing process, when the current interface does not belong to the target interface, the target path information is determined based on the operation trajectory model. The operation trajectory model includes the node information of the node corresponding to the interface in the application to be tested and the edge information of the behavior edge corresponding to the operation behavior in the interface. The target path information is the path information of the target operation path that jumps to the target interface. The target operation path is composed of nodes and behavior edges between nodes.
[0072] In order to improve the focus of automated testing, that is, to increase the coverage of key interfaces or functions, during the automated testing process, the computer equipment monitors in real time whether the current interface of the application to be tested belongs to the target interface. If the current interface belongs to the target interface, the automated test is performed in the target interface; if the current interface does not belong to the target interface, it is necessary to jump to the target interface first and then perform the automated test.
[0073] In a possible implementation, the computer device determines whether the current interface belongs to the target interface based on the operation trajectory model.
[0074] In the embodiment of the present application, the computer device determines the target operation path to jump to the target interface based on the node information of the interface corresponding to the node in the operation trajectory model and the edge information of the behavior edge corresponding to the operation behavior, and determines the target path information corresponding to the target operation path. Among them, the target path information includes the edge information of the behavior edge arranged in order. Since the behavior edge connects the interface before and after the operation behavior, the nodes passed on the target operation path can be determined based on the edge information.
[0075] In some embodiments, the target operation path is an operation path for jumping from a current interface to a target interface, or the target operation path is an operation path for jumping from a specified interface to a target interface.
[0076] In some embodiments, when there are multiple target interfaces, if the current interface does not belong to any target interface, the computer device determines the target path information based on the operation trajectory model. In addition, the target operation path is an operation path that jumps to a random target interface among the multiple target interfaces, or a target interface selected according to a preset rule.
[0077] Step 303: Jump to the target interface based on the target path information.
[0078] In a possible implementation, the computer device simulates user operations in the interface of the application to be tested based on the target path information, and finally jumps to the target interface.
[0079] Optionally, the computer device generates an operation instruction based on the target path information, and sends the operation instruction to the terminal, and the terminal simulates the user operation in the interface based on the operation instruction to achieve interface jump.
[0080] It should be noted that during the interface jump process, the computer device needs to detect the current interface in real time to determine whether to jump to the target interface according to the target operation path indicated by the target path information, and whether to jump to the target interface.
[0081] Step 304, performing automated testing in the target interface.
[0082] After completing the interface jump, the computer device performs automated testing in the target interface according to the automated test case. In some embodiments, the computer device is used to send automated testing instructions to the terminal based on automated testing, and the terminal simulates operations in the interface based on the automated testing instructions to implement automated testing.
[0083] In summary, in the embodiment of the present application, the operation trajectory model is used to record the operation process in the interface, wherein the operation trajectory model includes the node information of the corresponding node of the interface and the edge information of the corresponding behavior edge of the operation behavior in the interface. With the help of the node information and edge information in the operation trajectory model, the computer device can determine the target operation path to jump to the target interface when identifying other interfaces outside the target interface corresponding to the function to be tested, that is, determine the interface to be passed through when jumping to the target interface and the operation behavior performed in the interface, so as to automatically jump to the target interface based on the target path information corresponding to the target operation path, and then perform automated testing in the target interface. Compared with automated testing based on randomly generated events, which leads to insufficient testing of some key functions, the automated testing scheme provided by the embodiment of the present application can jump back to the interface of the function to be tested when leaving the interface of the function to be tested, improve the automated testing coverage of the interface of the function to be tested, and help improve the comprehensiveness of the test of the function to be tested.
[0084] In a possible implementation, when the current interface does not belong to the target interface, the target operation path determined by the computer device based on the operation trajectory model is the operation path from the current interface to the target interface, and accordingly, the computer device jumps from the current interface to the target interface based on the target path information of the target operation path. Figure 4 As shown, the above step 202 may include the following sub-steps:
[0085] Step 202A: when the current interface does not belong to the target interface, determine the first node corresponding to the current interface based on the node information in the operation trajectory model.
[0086] Since the nodes in the operation trajectory model correspond to interfaces, before determining the target operation path for jumping from the current interface to the target interface, the computer device first needs to determine the first node corresponding to the current interface in the operation trajectory model.
[0087] Furthermore, since node information is used in the operation trajectory model to represent the interface features of the interface, and interface feature matching is usually used to identify whether two interfaces are the same interface, the computer device determines the first node (belonging to the recorded node) corresponding to the current interface based on the node information of the recorded nodes corresponding to the recorded interfaces in the operation trajectory model.
[0088] In some embodiments, the computer device generates node information corresponding to the current interface in the same manner as the recorded interface, thereby determining the first node corresponding to the current interface by comparing the node information of the recorded node corresponding to the recorded interface and the node information corresponding to the current interface.
[0089] The following first describes the node information:
[0090] Node Information
[0091] In some embodiments, the node information of a node includes at least a node identifier and a node factor of the node.
[0092] The node identifier is a unique identifier assigned to a node (with no actual meaning), which can be represented in the form of a string. Different nodes have different node identifiers, while the same node has the same node identifier.
[0093] Optionally, a node factor is composed of several fields that characterize interface features from different dimensions, wherein the fields that characterize interface features can be referred to as node sub-factors. When determining whether two nodes are the same node, the computer device matches the field contents with the same field name in the two node factors, that is, matches the node sub-factors in different node factors, thereby determining whether the two nodes are the same node based on the matching results of multiple dimensions.
[0094] In some embodiments, the node factor may include at least one of the following node sub-factors:
[0095] First node subfactor (windowName)
[0096] Since the same interface is definitely located in the same window, and interfaces located in different windows are definitely not the same interface, the computer device can determine whether two nodes are the same node based on the dimension of the window to which the interface belongs.
[0097] In a possible implementation, the computer device determines the first node sub-factor based on the window name of the window to which the interface belongs.
[0098] Among them, the window name of the window to which the interface belongs can be extracted from the interface code.
[0099] Furthermore, when identifying whether two nodes are the same node, the computer device can compare whether the first node sub-factors in the node factors of the two nodes are the same. If they are different, the two nodes are determined to be different nodes; if they are the same, since different interfaces may be located in the same window, the computer device cannot directly determine that the two nodes with the same window name belong to the same node, but needs to make further determinations based on other node sub-factors.
[0100] Second node sub-factor (operableElements)
[0101] The interface usually includes a large number of operable elements, such as button controls, expandable list controls, text input box controls, upload controls, etc., and these operable elements can reflect the interface characteristics of the interface to a certain extent.
[0102] Therefore, the computer device can determine whether two nodes are the same node based on the dimension of the operable elements contained in the interface.
[0103] Affected by factors such as version updates or dynamic changes in content, the element content of the operable elements in the same interface may change (for example, the button display text of a button control changes, or the list item content in an expandable list control changes), but the element type of the operable elements in the same interface usually does not change. Therefore, in a possible implementation, the computer device determines the element type of the operable element, and performs information summary processing on the string obtained by splicing the element type, thereby determining the information summary result as the second node sub-factor. Among them, the element type of the operable element can be extracted from the interface code.
[0104] Among them, since the character string after the information digest is of fixed length, it is convenient to directly compare the information digest results later.
[0105] Optionally, the computer device performs MD5 processing on the string obtained by concatenating the element types, and determines the obtained string as the second node sub-factor.
[0106] Illustratively, when the interface includes 2 button controls, 1 text box control, and 3 radio selection controls, the computer device performs MD5 processing on the concatenated string Button_TextBox_RadioButton, and determines the obtained 64-bit string as the second node sub-factor.
[0107] Of course, in addition to being represented by a character string obtained from the information digest, the computer device may also determine an element type list (list) composed of element types as the second node sub-factor, which is not limited in this embodiment.
[0108] Furthermore, when identifying whether two nodes are the same node, the computer device can compare whether the second node sub-factors in the node factors of the two nodes are the same. If they are different, the two nodes are determined to be different nodes; if they are the same, in order to avoid judging two different simple interfaces (i.e., interfaces containing a small number of operable elements) as the same interface, the computer device needs to make further judgments based on other node sub-factors.
[0109] The third node subfactor (layoutVector)
[0110] Affected by factors such as version updates, the interface content of the same interface may change significantly, but the overall layout of the interface usually changes less. Therefore, the computer device can determine whether two nodes are the same node based on the dimension of interface layout.
[0111] In a possible implementation, the computer device determines the third node sub-factor based on the interface layout of the interface.
[0112] Optionally, in order to facilitate the subsequent comparison of interface layouts, the third node sub-factor is represented by a vector, wherein vector elements of different dimensions in the vector are used to represent different interface elements, and the vectors obtained by vectorizing the interface layouts of different interfaces have the same number of dimensions (for example, all are 512-dimensional vectors).
[0113] Regarding the vectorization method of the interface layout, in a possible implementation, the computer device extracts the interface layout information of the interface, performs vectorization processing on the interface layout information, and determines the obtained interface layout vector as the third node sub-factor. The interface layout information of the interface can be extracted from the interface code.
[0114] Optionally, the computer device generates an interface element skeleton based on the interface layout information, and the interface element skeleton is only used to characterize the position and size of different interface elements in the interface, and does not include the specific element content of the interface elements. Further, the computer device vectorizes the interface element skeleton to obtain an interface layout vector.
[0115] Indicative, such as Figure 5 As shown, the computer device performs skeleton processing on the interface layout information of the interface 51 to obtain an interface element skeleton 52.
[0116] Fourth node sub-factor (screenVector)
[0117] In addition to determining different interfaces (nodes) from the dimension of interface layout, different interfaces can also be determined from a more intuitive visual level, that is, a computer device can determine whether two nodes are the same node from the dimension of the interface screen.
[0118] In a possible implementation, the computer device determines the fourth node sub-factor based on an interface screen of the interface.
[0119] In some embodiments, the computer device directly determines the interface screen as a fourth node sub-factor, and the fourth node sub-factor includes a pixel value of each pixel in the interface screen.
[0120] In order to reduce the amount of storage and simplify the amount of calculation in subsequent comparisons, in other embodiments, the computer device performs vector processing on the interface screen of the interface, and determines the obtained interface screen vector as the fourth node sub-factor. The number of dimensions of the interface screen vectors obtained by vector processing of different interface screens is consistent.
[0121] Regarding the method of vectorizing the interface screen, optionally, the computer device extracts image features of the interface screen through a neural network (such as a CNN network, a DNN network, etc.), and uses the extracted image feature vector as the fourth node sub-factor. Alternatively, the computer device can extract color features (such as obtained through a color histogram), texture features (such as obtained through texture analysis), and shape features (such as obtained through edge detection) of the interface screen, and obtain the fourth node sub-factor by vectorizing the color features, texture features, and shape features. The embodiments of the present application do not limit the specific method of screen vectorization.
[0122] Fifth node sub-factor (summaryFunction)
[0123] During the interface development phase, developers usually add interface function description information to the interface code. Even if the interface effect is iteratively updated later, the interface function description information usually does not change. Therefore, the computer device can determine whether two nodes are the same node from the dimension of interface function.
[0124] In a possible implementation, the computer device determines the fifth node sub-factor based on interface function description information of the interface, wherein the interface function description information can be extracted from the interface code.
[0125] It should be noted that, since not all interfaces will add interface function description information, if the interface function description information cannot be obtained, the fifth node sub-factor may be empty.
[0126] Furthermore, when subsequently identifying whether two nodes are the same node, the computer device can compare whether the fifth node sub-factors in the node factors of the two nodes are the same. If they are the same, it is determined that the two nodes are the same node; if they are not the same, the computer device needs to make further determinations based on other node sub-factors.
[0127] In a possible implementation, the computer device may generate a node factor corresponding to the current interface, and compare the node factor with the node factor of the recorded node, thereby determining the first node corresponding to the current interface. This step may include the following sub-steps:
[0128] Step 202A1: Generate a node factor corresponding to the current interface based on interface features of different dimensions of the current interface.
[0129] In a possible implementation, the computer device generates corresponding node sub-factors based on interface features of different dimensions of the current interface, and then determines the node factor corresponding to the current interface.
[0130] In some embodiments, the node factor corresponding to the current interface may include all or part of the above node sub-factors. For example, the computer device determines the first to fifth node sub-factors corresponding to the current interface.
[0131] Step 202A2: Determine a recorded interface that matches the current interface based on the node factors of the recorded nodes corresponding to the recorded interfaces in the operation trajectory model and the node factors corresponding to the current interface.
[0132] In a possible implementation, the computer device matches the node factors of the current interface with the node factors corresponding to the recorded interfaces in the operation trajectory model one by one, thereby determining the recorded interface that matches the current interface.
[0133] Optionally, the computer device may determine a recorded interface that matches the current interface based on a single node sub-factor in the node factor, or in combination with multiple node sub-factors in the node factor.
[0134] In some embodiments, when the node factor includes the first to fifth node sub-factors described above, the computer device may determine whether the current interface matches the recorded interface in the following cases.
[0135] Case 1: When the first node sub-factors corresponding to the current interface and the recorded interface are different, it is determined that the current interface does not match the recorded interface.
[0136] Since the same interface belongs to the same window, by comparing the first node sub-factors of the current interface and the recorded interface, and when the first node sub-factor of the current interface is different from the first node sub-factor of the recorded interface, the computer device determines that the current interface does not match the recorded interface.
[0137] When the first node sub-factor of the current interface is the same as the first node sub-factor of the recorded interface, the computer device needs to combine other node sub-factors to further determine whether the current interface matches the recorded interface.
[0138] Optionally, when making subsequent determinations in combination with other node sub-factors, the computer device only needs to consider recorded interfaces having the same first node sub-factor as the current interface, thereby narrowing the determination scope, reducing the amount of calculation in the determination process, and improving determination efficiency.
[0139] Case 2: When the second node sub-factors corresponding to the current interface and the recorded interface are different, it is determined that the current interface does not match the recorded interface.
[0140] Since the types of operable elements included in different interfaces are generally different, the computer device determines that the current interface does not match the recorded interface by comparing the second node sub-factors of the current interface and the recorded interface, and when the second node sub-factor of the current interface is different from the second node sub-factor of the recorded interface.
[0141] When the second node sub-factor of the current interface is the same as the second node sub-factor of the recorded interface (they may be two different interfaces containing very few operable elements), the computer device needs to combine other node sub-factors to further determine whether the current interface matches the recorded interface.
[0142] Optionally, when making subsequent determinations in combination with other node factors, the computer device only needs to consider recorded interfaces that have the same second node sub-factor as the current interface, thereby narrowing the determination scope, reducing the amount of calculation in the determination process, and improving determination efficiency.
[0143] Case 3: When the fifth node sub-factors corresponding to the current interface and the recorded interface are the same, it is determined that the current interface matches the recorded interface.
[0144] If the functions of the two interfaces are completely the same, then the two interfaces should belong to the same interface. Therefore, in some embodiments, when the fifth node sub-factors of the current interface and the recorded interface are both not empty, the computer device compares whether the fifth node sub-factors of the two are the same, and when the fifth node sub-factors of the two are the same, it determines that the current interface matches the recorded interface.
[0145] Optionally, if at least one of the fifth node sub-factors of the current interface and the recorded interface is empty, or the fifth node sub-factors of the two are different, the computer device needs to combine other node sub-factors to further determine whether the current interface matches the recorded interface.
[0146] Case 4: When the first node sub-factor corresponding to the current interface is the same as that of the recorded interface, and the second node sub-factor corresponding to the current interface is the same as that of the recorded interface, and the fifth node sub-factor corresponding to the current interface is different from that of the recorded interface, and the similarity between the third node sub-factor corresponding to the current interface and the recorded interface is greater than the first similarity threshold, and / or the similarity between the fourth node sub-factor corresponding to the current interface and the recorded interface is greater than the second similarity threshold, it is determined that the current interface matches the recorded interface.
[0147] When it is impossible to determine whether the current interface matches the recorded interface based on the first node sub-factor, the second node sub-factor, and the fifth node sub-factor, since the same interface usually has a very similar interface layout and / or a very similar interface visual representation, the computer device can further combine at least one of the interface layout and the interface visual representation to determine whether the current interface matches the recorded interface.
[0148] Optionally, when the similarity between the interface layout of the current interface and the recorded interface, and / or the similarity between the interface visual presentation of the current interface and the recorded interface is greater than a threshold, the computer device determines that the current interface matches the recorded interface.
[0149] In some embodiments, when the third node sub-factor is represented by an interface layout vector, the computer device determines the vector distance between the current interface and the interface layout vector of the recorded interface as the similarity. The vector distance can be a cosine distance, a Euclidean distance, a Manhattan distance, etc., which is not limited in the embodiments of the present application.
[0150] In some embodiments, when the fourth node sub-factor is represented by an interface screen vector, the computer device determines the vector distance between the current interface and the interface screen vector of the recorded interface as the similarity. The vector distance can be a cosine distance, a Euclidean distance, a Manhattan distance, etc., which is not limited in the embodiment of the present application.
[0151] Indicative, such as Figure 6 As shown, the computer device vectorizes the first interface element skeleton 61 corresponding to the current interface to obtain the first interface layout vector, and vectorizes the second interface element skeleton 62 corresponding to the recorded interface to obtain the second interface layout vector. By calculating the cosine distance between the first interface layout vector and the second interface layout vector, the interface layout similarity between the current interface and the recorded interface is 0.42490305.
[0152] Case 5: When the first node sub-factor corresponding to the current interface is the same as that of the recorded interface, and the second node sub-factor corresponding to the current interface is the same as that of the recorded interface, and the fifth node sub-factor corresponding to the current interface is different from that of the recorded interface, and the similarity between the third node sub-factor corresponding to the current interface and the recorded interface is less than the first similarity threshold, and the similarity between the fourth node sub-factor corresponding to the current interface and the recorded interface is less than the second similarity threshold, it is determined that the current interface does not match the recorded interface.
[0153] Optionally, when the similarity between the interface layout of the current interface and the recorded interface, and the similarity between the interface visual performance of the current interface and the recorded interface are both less than a threshold, the computer device determines that the current interface does not match the recorded interface.
[0154] Step 202A3: determine the recorded node corresponding to the matched recorded interface as the first node corresponding to the current interface.
[0155] In some embodiments, when a single recorded interface is matched, the computer device determines the recorded node corresponding to the recorded interface as the first node corresponding to the current interface; when multiple recorded interfaces are matched, the computer device determines the recorded node corresponding to the recorded interface with the highest matching degree as the first node corresponding to the current interface.
[0156] Step 202B, based on the first node, the second node corresponding to the target interface and the edge information in the operation trajectory model, determine the target path information of the target operation path, where the target operation path is the operation path from the current interface to the target interface.
[0157] After determining the first node, the computer device uses the first node as the starting node and the second node corresponding to the target interface as the ending node to determine a target operation path from the first node to the second node.
[0158] Since the side information in the operation trajectory model can indicate the jump between interfaces after the operation behavior is performed in the interface, the computer device can determine the nodes that need to be passed on the target operation path and the operation behavior in the interface corresponding to the node based on the side information in the operation trajectory model.
[0159] The side information in the operation trajectory model is explained below.
[0160] Side Information
[0161] When reproducing the operation behavior subsequently, it is necessary to know what operation was performed in the interface and the changes in the interface before and after the operation. Therefore, in order to ensure the accuracy of the operation behavior reproduction, the edge information corresponding to the operation behavior at least has the ability to indicate the operation behavior and the interface before and after the operation behavior is executed.
[0162] In some embodiments, the edge information includes at least: behavior information of the operation behavior, a starting node identifier (fromNodeID) of the starting node corresponding to the starting interface before the operation behavior, an ending node identifier (toNodeID) of the ending node corresponding to the ending interface after the operation behavior, and an edge identifier (a unique identifier similar to a node identifier and a node element identifier).
[0163] Among them, when the interface before and after the operation behavior does not switch, the starting node identifier and the ending node identifier in the side information corresponding to the operation behavior are the same; when the interface before and after the operation behavior switches, the starting node identifier and the ending node identifier in the side information corresponding to the operation behavior are different.
[0164] As an important content in the side information, the behavior information needs to be able to clearly indicate the operation behavior. In a possible implementation, the behavior information includes the action type (ActionType) of the operation behavior.
[0165] In some embodiments, a common action class (CommonAction) is defined, which includes all operation actions of users and systems, so as to ensure the accuracy of recorded operation actions. In addition, the behavior type of each operation behavior belongs to the behavior type class. Optionally, the behavior type class is an enumeration class.
[0166] In an illustrative example, taking the commonly used operations in a mobile phone as an example, the behavior type class may include at least one of the following behavior types: GoHome (return to the home page), RecentApps (recent applications), GoBack (return), StartApp (start application), Click (click), DoubleClick (double-click), LongClick (long press), InputText (input text), Scroll (scroll), Concurrent (collaborative operation, that is, operation behaviors that occur at the same time), Continuous (continuous operation, referring to operation behaviors performed in sequence), Stop (terminate), Wait (wait, a scenario in which the interface changes automatically over time), and Unknown (unknown behavior, as a fallback behavior).
[0167] Since some operation behaviors are directed to interface controls within the interface, in order to ensure that the subsequent operation can determine which interface control to operate on based on the behavior information, in some embodiments, when the behavior type of the operation behavior is determined as behavior information, if the operation behavior is related to the interface control within the interface, the computer device also determines the node element identifier of the node element corresponding to the interface control as the behavior information.
[0168] For example, when the operation behavior is a click operation, the behavior information corresponding to the operation behavior includes the operation type "Click" and the node element identifier of the node element corresponding to the clicked button; for another example, when the operation behavior is a text input operation, the behavior information corresponding to the operation behavior includes the operation type "InputText" and the node element identifier of the node element corresponding to the text input box where the text is entered.
[0169] In addition, since the operation process may involve a series of continuous operation behaviors, in order to facilitate the tracing back of the previous operation behavior before the current operation behavior, in a possible implementation, when the operation behavior has a previous operation, the computer device determines the operation information of the previous operation as the edge information of the behavior edge corresponding to the operation behavior, that is, the edge information also includes the previous operation information (preAction).
[0170] Illustratively, for the operation of clicking the login button, the preceding operations may include entering an account number in a first text box and entering a password in a second text box.
[0171] Optionally, the preceding operation information may be identified in the form of a list, where each item in the list corresponds to a preceding operation, and the preceding operation may be represented by a jump between nodes, such as a starting node identifier → an ending node identifier (the starting node identifier and the ending node identifier may be the same).
[0172] In a possible implementation, the computer device determines the target path information of the target operation path based on the first node identifier of the first node, the second node identifier of the second node, the start node identifier and the end node identifier included in the edge information. This step may include the following sub-steps:
[0173] Step 202B1, based on the first node identifier corresponding to the first node, the second node identifier corresponding to the second node, and the starting node identifier and the ending node identifier contained in the edge information in the operation trajectory model, determine a behavior edge list, the behavior edge list contains behavior edges corresponding to the operation behaviors arranged in time sequence, and the behavior edges in the behavior edge list connect the first node and the second node.
[0174] In one possible implementation, the computer device uses the first node identifier as the target starting node identifier and the second node identifier as the target ending node identifier, performs a behavior edge search through a path search algorithm based on the directed connection relationship between different nodes represented by the edge information, and determines the set of behavior edges that are searched (directly or indirectly) connecting the first node and the second node as a behavior edge list, in which the behavior edges in the behavior edge list are arranged in the execution timing of the operation behaviors corresponding to the behavior edges.
[0175] Optionally, the path search algorithm may be a depth-first search algorithm, a breadth-first search algorithm, a Dijkstra algorithm, an A* search or a D* search algorithm, etc., which is not limited in the embodiments of the present application.
[0176] In an illustrative example, Figure 7As shown, when the current interface is the first interface 71 and the target interface is the third interface 73, the computer device uses the current interface as the starting interface, and the behavior edges of the behavior edge list determined by path search are Click (48) and Click (56) in sequence. The operation path indicated by the behavior edge is: when clicking the first interface control 711 (the corresponding node element is identified as 48) in the first interface 71, the second interface 72 is displayed. When clicking the second interface control 721 (the corresponding node element is identified as 56) in the second interface 72, the third interface 73 is displayed.
[0177] It should be noted that the number of the behavior edge lists determined in step 202B1 may be one or more, that is, one or more operation paths for jumping from the current interface to the target interface are determined.
[0178] Step 202B2: Determine target path information of the target operation path based on the behavior edge list.
[0179] Further, the computer device determines target path information of the target operation path based on the edge information of the behavior edge included in the behavior edge list.
[0180] In some embodiments, when there is a single behavior edge list (ie, there is only one operation path for jumping from the current interface to the target interface), the computer device determines the behavior edge list as the target path information of the target operation path.
[0181] In other embodiments, when there are multiple behavior edge lists (ie, there are multiple operation paths from the current interface to the target interface), the computer device can select the behavior edge list according to the rules to determine the target path information of the target operation path.
[0182] Regarding the selection rules, in one possible implementation, a computer device sorts multiple behavior edge lists in ascending order of the path length of the operation path represented by the behavior edge list, and selects the behavior edge list in sequence, that is, selects the behavior edge list in order from short to long path length.
[0183] Furthermore, after a certain behavior edge list is determined as the target path information of the target operation path, the computer device determines whether the target operation path is reachable during the interface jump based on the target path information, and thus determines whether it is necessary to continue selecting subsequent behavior edge lists based on the reachability of the target operation path.
[0184] The reachability of the target operation path refers to whether the operation behavior indicated by the target operation path is simulated in the interface, and whether it can eventually jump to the target interface.
[0185] Optionally, when there are multiple behavior edge lists, the computer device determines the i-th behavior edge list as the target path information of the target operation path; when the target operation path corresponding to the i-th behavior edge list is unreachable, the computer device determines the i+1-th behavior edge list as the target path information of the target operation path; when the target operation path corresponding to the i-th behavior edge list is reachable, the computer device does not need to traverse other behavior edge lists after the i-th behavior edge list.
[0186] In some embodiments, when the target operation path corresponding to the edge list in the i-th line is unreachable, the computer device returns to the first node and then simulates the interface jump based on the re-determined target path information.
[0187] In a possible implementation, in order to improve the efficiency of interface jump, when the target operation path is reachable, the computer device associates and stores the first node, the second node, and the behavior edge list corresponding to the target operation path. The computer device can then preferentially detect whether there is a corresponding behavior edge list based on the first node and the second node. If so, the computer device directly determines the target path information based on the behavior edge list, eliminating the path search process; if not, the computer device executes the above path search process.
[0188] In an embodiment of the present application, node factors that describe interface features in multiple dimensions are generated from the dimensions of the window to which the interface belongs, the dimensions of the operable elements within the interface, the interface layout, the interface screen, and the interface function description, thereby improving the comprehensiveness and accuracy of the description of the interfaces corresponding to different nodes, thereby facilitating the accuracy of subsequent interface retrieval and positioning based on the node factors, and improving the accuracy of interface jumps.
[0189] In this embodiment, the starting node identifier of the starting node before the operation behavior, the ending node identifier of the ending node after the operation behavior, and the behavior information of the operation behavior are used as side information, thereby improving the accuracy of the operation behavior record; and the behavior information includes the behavior type of the operation behavior, and contains the node element identifier of the targeted interface control, thereby ensuring the accuracy of subsequent restoration of the interface control operation.
[0190] In a possible implementation, when the current interface does not belong to the target interface, the target operation path determined by the computer device based on the operation trajectory model is the operation path from the current interface to the target interface, and accordingly, the computer device jumps from the current interface to the target interface based on the target path information of the target operation path. Figure 8 As shown, the above step 202 may include the following sub-steps:
[0191] Step 202C: when the current interface does not belong to the target interface, determine the node corresponding to the start interface as the first node.
[0192] In order to improve the efficiency of selecting other operation paths to try to jump when a certain operation path is unreachable, in a possible implementation, when the current interface does not belong to the target interface, the computer device determines the node corresponding to the launcher interface as the first node, that is, determines the launcher interface as the starting interface for subsequent jumps to the target interface.
[0193] The startup interface is an interface for starting the application to be tested, for example, the startup interface is the main desktop. Moreover, after starting the application to be tested through the startup interface, the interface displayed by the application to be tested is the main interface of the application.
[0194] Step 202D, based on the first node, the second node corresponding to the target interface and the edge information in the operation trajectory model, determine the target path information of the target operation path, where the target operation path is the operation path from the start interface to the target interface.
[0195] The implementation of this step may refer to the above step 202B, and this embodiment will not be described in detail here.
[0196] It should be noted that before the interface jump is performed based on the target path information, the computer device first needs to jump from the current interface to the startup interface. Optionally, a unified operation can be used to jump from different interfaces to the startup interface, such as executing the operation of closing all applications.
[0197] In an illustrative example, Fig. 9 As shown, when the current interface is different from the target interface (third interface 94), the computer device uses the launch interface as the starting interface, and the behavior edges of the behavior edge list determined by path search are startApp, Click (49) and Click (57) in sequence. The operation path indicated by the behavior edge is: click the application icon (startApp) of the application to be tested in the launcher interface 91, and then click (click) the first interface control 921 in the first interface 92 (the corresponding node element is identified as 49), jump to display the second interface 93. Click the second interface control 931 in the second interface 93 (the corresponding node element is identified as 57), jump to display the third interface 94.
[0198] Regarding the method of determining the target interface in the above embodiment, when there are multiple target interfaces, in order to improve the interface test coverage of each target interface, in a possible implementation manner, during the automated testing process, when the current interface does not belong to the target interface, the computer device determines the interface test coverage data of different target interfaces, and based on the interface test coverage data, determines the target jump interface from multiple target interfaces, thereby determining the target path information based on the operation trajectory model and the target jump interface, and the target path information is the path information of the target operation path to jump to the target jump interface.
[0199] Among them, the interface test coverage data is used to characterize the number of times automated tests are performed in a specified interface (interface test coverage times), or the proportion of the total number of automated tests (interface test coverage rate).
[0200] In a possible implementation, the computer device maintains the corresponding relationship between different interfaces and interface test coverage data. Each time an automated test is performed in an interface, the computer device updates the interface test coverage data of the interface.
[0201] In a possible implementation, the computer device determines the target interface with the lowest interface test coverage data as the target jump interface to improve the comprehensiveness of the interface test of the target interface.
[0202] Optionally, the computer device may randomly select a target jump interface in an early stage of the test, and select a target jump interface based on interface test coverage data in a later stage of the test.
[0203] In an embodiment of the present application, the computer device determines the target interface with insufficient coverage by maintaining the interface test coverage data of each target interface. When an interface jump is required, the target interface with insufficient coverage is preferentially determined as the target jump interface, thereby improving the test coverage of the target interface and ensuring the comprehensiveness of the test of the key interfaces.
[0204] The target path information is composed of side information. When jumping to the target interface based on the target path information, the computer device simulates the operation in the interface according to the operation behavior indicated by the side information to trigger the interface jump. Fig.10 As shown, step 203 may include the following sub-steps:
[0205] Step 203A: Determine target edge information corresponding to the target behavior edge between nodes on the target operation path based on the target path information.
[0206] In one possible implementation, in order to ensure the timing accuracy of the operation behavior, the computer device determines the target edge information corresponding to the target behavior edges between nodes on the target operation path in sequence according to the execution timing of the operation behavior indicated by the edge information in the target path information, thereby simulating the operation according to the target operation behavior indicated by the target edge information.
[0207] Step 203B, based on the target behavior information included in the target side information, simulate the target operation behavior indicated by the target behavior information in the interface until jumping to the target interface.
[0208] The operation behavior in the interface can be a manual operation behavior of the user, such as a trigger operation on a control in the interface; or the operation behavior is a system behavior, such as an automatic interface jump operation after reaching a preset time. Accordingly, the target side information includes target behavior information, which is used to indicate the operation behavior in the interface.
[0209] In some embodiments, when the target operation behavior indicated by the target behavior information is related to the target interface control, the target behavior information includes the node element identifier of the target node element corresponding to the target interface control and the target behavior type of the target operation behavior.
[0210] The node element information is described below.
[0211] Node element information
[0212] In some embodiments, the node element information of the node element includes at least a node element identifier and a node element factor of the node element.
[0213] The node element identifier is a unique identifier assigned to the node element (with no actual meaning), which can be expressed in the form of a string. Different node elements have different node element identifiers.
[0214] Optionally, the node element factor (NodeElement Factor) is composed of several fields that characterize the control features of the interface control from different dimensions, wherein the fields that characterize the control features can be called node element sub-factors. Similar to the role of the node factor, the role of the node element factor is to retrieve and locate the interface control of the feature in the interface.
[0215] When determining whether two node elements are the same node element (i.e., determining whether two interface controls are the same interface control), the computer device matches the field contents with the same field name in the two node element factors, that is, matches the node element sub-factors in different node element factors, thereby determining whether the two node elements are the same node element based on the matching results of multiple dimensions.
[0216] In some embodiments, the node element factor may include at least one of the following node element sub-factors:
[0217] First node element subfactor (packageName)
[0218] In a possible implementation, the computer device determines the first node element sub-factor based on the package name of the control class to which the interface control belongs, that is, describes the control feature of the interface control from the control package name dimension.
[0219] Optionally, the computer device obtains the package name of the control package referenced by the interface from the interface code, and thereby determines the package name of the control class to which the interface control belongs based on the package name of the control package.
[0220] In an illustrative example, the computer device determines the package name android.widget of the control class as the first node element sub-factor based on the package name of the widget package referenced by the interface.
[0221] Further, when subsequently identifying whether two interface controls are the same interface control, the computer device can compare whether the first node element sub-factors corresponding to the two interface controls are the same. If they are different, the two interface controls are determined to be different interface controls; if they are the same, since the same interface contains multiple interface controls belonging to the same control package, the computer device cannot directly determine that the two interface controls are the same interface control, but needs to make further determinations based on other node element sub-factors.
[0222] Second node element sub-factor (className)
[0223] In a possible implementation, the computer device determines the second node element sub-factor based on the class name of the control class to which the interface control belongs, that is, describes the control feature of the interface control from the control class name dimension.
[0224] Optionally, the computer device obtains the control code of the interface control and the package name of the control package referenced by the interface from the interface code, thereby determining the package name of the control class to which the interface control belongs based on the control code and the control package name.
[0225] In an illustrative example, the computer device determines that the class name of the control class in which the text box control in the widget is located, android.widget.TextView, is determined as the second node element sub-factor.
[0226] Further, when subsequently identifying whether two interface controls are the same interface control, the computer device can compare whether the second node element sub-factors corresponding to the two interface controls are the same. If they are different, the two interface controls are determined to be different interface controls; if they are the same, since the same interface contains multiple interface controls belonging to the same control class at the same time, the computer device cannot directly determine that the two interface controls are the same interface control, but needs to make further determinations based on other node element sub-factors.
[0227] Third node element sub-factor (ResourceId)
[0228] The resources of the interface control can be layout, string, color, image, etc., and each interface control is assigned a unique ID, namely, resource ID, when it is defined in the layout file. The interface control can be referenced or operated in the code through the resource ID. Since the resource ID of the interface control is unique and generally does not change (it may be updated during the version iteration process), in a possible implementation, the computer device determines the third node element sub-factor based on the resource identifier corresponding to the interface control, that is, describes the control characteristics of the interface control from the resource dimension.
[0229] Optionally, the computer device may start from the interface root node of the interface, traverse each control under each interface root node, and obtain the resource ID of each interface control by means of code printing.
[0230] In an illustrative example, the computer device determines the resource ID "com.phonebrand.someapp:id / tv_name" of the interface control as the third node element sub-factor.
[0231] Fourth node element sub-factor (contentDescription)
[0232] The interface code may include a control description of the interface control (used to describe the control content, usually used for barrier-free functions). For example, for a text box control, the interface code may contain the following control description: text box, text content xxx. Since the control description generally does not change (it may be manually adjusted during version iteration), in a possible implementation, the computer device determines the fourth node element sub-factor based on the control description corresponding to the interface control, that is, describes the control characteristics of the interface control from the control description dimension.
[0233] Optionally, the computer device may extract a control description corresponding to the interface control from the interface code, wherein the control description of the interface control may be empty.
[0234] Fifth node element sub-factor (Text)
[0235] Some interface controls in the interface usually display text so that users can know the purpose of the interface control, such as the word "Upload" displayed on the upload button. Since the text content corresponding to the interface control usually does not change, in a possible implementation, the computer device determines the fifth node element sub-factor based on the text content corresponding to the interface control, that is, describes the control feature of the interface control from the dimension of the control's explicit text content.
[0236] Optionally, the computer device may traverse each control under the root node of the interface, and when the text attribute field of the control is not empty, determine the text content of the text attribute field as the fifth node element sub-factor.
[0237] Optionally, the computer device may also recognize the text displayed by the interface control through OCR, and use the recognized text as the text content corresponding to the interface control, which is not limited in this embodiment.
[0238] Sixth node element subfactor (listOrder)
[0239] For an interface control located in a list, the text content of the same interface control may change dynamically (for example, it may change dynamically with the time period or scene), but its absolute position or relative position in the list will not change. Therefore, in order to improve the comprehensiveness of the node element information and improve the accuracy of the subsequent positioning of the interface control, in a possible implementation, when the interface control is located in a list control, the computer device determines the sixth node element sub-factor based on the position of the interface control in the list control.
[0240] Optionally, the position of the interface control in the list control can be an absolute position, such as being located at the first position in the list, or being located at the last position in the list. The position can be a relative position, such as being located between two interface controls in the list control, or being located after an interface control in the list control.
[0241] Optionally, when a list control is identified in the interface code, the computer device may determine the absolute position or relative position of the interface control based on the arrangement order or rule of each interface control in the list control.
[0242] Seventh node element subfactor (parentChain)
[0243] Each interface control in the interface is in a control chain, where the upper interface control in the control chain is the parent control of the lower interface control, and the top interface control in the control chain is the root control corresponding to the root node of the interface. When the text content, position, size and other parameters of the interface control are fine-tuned, as long as the control function implemented by the interface control remains unchanged, the control chain to which it belongs will usually not change. Therefore, computer devices can describe interface controls from the dimension of the control chain corresponding to the interface control.
[0244] In a possible implementation, the computer device determines the seventh node element sub-factor based on the parent control chain corresponding to the interface control.
[0245] Among them, the parent control chain is composed of the parent controls of the interface controls, and the end point of the parent control chain is the root control corresponding to the interface root node, that is, the first and last controls of the parent control chain of the current interface control are the root control of the interface root node and the current interface control respectively.
[0246] Optionally, the computer device may determine the parent-child relationship between each interface control based on the interface code, and thereby construct a parent control chain corresponding to each interface control based on the parent-child relationship.
[0247] Eighth node element sub-factor (preNodeElementFactor & postNodeElementFactor)
[0248] In order to further improve the comprehensiveness of the control features, the current interface control may be described with the help of other interface controls surrounding the current interface control. In a possible implementation, the computer device determines the eighth node element sub-factor based on the adjacent interface controls of the interface control.
[0249] Optionally, the adjacent interface control may include other interface controls that are adjacent to the current interface control in at least one direction. For example, the adjacent interface control may include a left interface control and a right interface control of the current interface control.
[0250] Optionally, the computer device determines the relative position relationship between the interface controls based on the control layout information corresponding to each interface control in the interface code, or the computer device identifies the interface screen to determine the relative position relationship between the interface controls.
[0251] Optionally, the computer device may determine the node element factor corresponding to the adjacent interface control as the eighth node element sub-factor of the current interface control. For example, the eighth node element sub-factor of the current interface control includes the node tuple factor (preNodeElementFactor) of the left interface control and the node tuple factor (postNodeElementFactor) of the right interface control.
[0252] Regarding the timing of determining the above node element sub-factors, in a possible implementation manner, the above various node element sub-factors are all determined in real time.
[0253] In another possible implementation, the first to fifth node element sub-factors are determined in real time. Since the sixth to eighth node element sub-factors cannot be directly extracted from the interface code but need to be analyzed by certain calculations, the sixth to eighth node element sub-factors are determined by lazy count.
[0254] Among them, lazy calculation means that node element sub-factor calculation is performed only when node element sub-factor comparison is required. For example, when the node element cannot be uniquely located based on the first to fifth node element sub-factors, the computer device calculates the sixth to eighth node element sub-factors.
[0255] Optionally, when the sixth to eighth node element sub-factors adopt lazy calculation, the sixth to eighth node element sub-factors will not participate in serialization, and only the first to fifth node element sub-factors participate in serialization.
[0256] In a possible implementation, when the sixth to eighth node element sub-factors are calculated in a lazy manner, the computer device stores the interface code so as to subsequently calculate the sixth to eighth node element sub-factors based on the interface code analysis.
[0257] In some embodiments, the node element information may further include at least one of the following:
[0258] Control properties
[0259] Optionally, the control attributes include the type, purpose, and coordinates of the interface control.
[0260] In some embodiments, the control properties may include at least one of the following: stateDescription (control state description), isPassword (whether it is a password input control), isHintText (whether it is a hint text), visible (visibility), checkable (whether it can be checked), editable (whether it can be edited), clickable (whether it can be clicked), scrollable (whether it can be scrolled), longClickable (whether it can be long pressed), focusable (whether it can get focus), enabled (whether it is available), focused (whether it is the focus), checked (whether it is checked), selected (whether it is selected) and bounds (coordinate range).
[0261] Of course, the node element information may also include other control attributes other than the above examples, which is not limited in this embodiment.
[0262] Child node element identifier (children)
[0263] In a possible implementation, the computer device determines a sub-control of the current interface control, and determines a sub-node element identifier of a sub-node element corresponding to the sub-control as the node element information of the current interface control.
[0264] Optionally, the computer device uses the child node element identifier of the direct child control of the current interface control as the node element information, wherein the direct child control refers to a lower-level child control directly connected to the current interface control in a parent-child relationship.
[0265] Optionally, the child node element identifiers can be in list form.
[0266] Parent node element identifier (parentNodeElementId)
[0267] In a possible implementation, the computer device determines the parent control of the current interface control, and determines the parent node element identifier of the child node element corresponding to the parent control as the node element information of the current interface control.
[0268] Optionally, the computer device uses the child node element identifier of the direct parent control of the current interface control as the node element information, wherein the direct parent control refers to the upper parent control directly connected to the current interface control in the parent-child relationship.
[0269] Since the interface controls may be fine-tuned during the development of the application, or the interface controls may change slightly in different scenarios, in order to ensure the accuracy of the operation of the interface controls, in one possible implementation, when the computer device simulates the operation behavior of the target interface control in the interface, it is necessary to determine the node element factor of the target node element based on the node element identifier of the target node element, and then locate the target interface control from the interface based on the node element factor and the node element factors corresponding to each actual interface control in the interface. Optionally, this step may include the following sub-steps:
[0270] Step 203B1, based on the node element identifier in the target behavior information, obtain the target node element factor of the target node element, the target node element factor includes node element sub-factors that characterize the control features of the target interface control from different dimensions.
[0271] In some embodiments, the computer device obtains the node element factor of the node element corresponding to the node element identifier from the operation trajectory model based on the node element identifier. Optionally, the node element factor may include one or more of the first to eighth node element sub-factors mentioned above.
[0272] Step 203B2: Determine the target interface control from the interface based on the target node element factor and the node element factors corresponding to each interface control in the interface.
[0273] Before performing node element factor comparison, the computer device needs to generate node element factors corresponding to each interface control in the interface. The generated node element factors may include one or more of the first to eighth node element sub-factors, and different node element sub-factors may be generated synchronously or under the request of comparison requirements.
[0274] The process of generating the node element factor may refer to the above embodiment, which will not be described in detail in this embodiment.
[0275] Optionally, the computer device may locate the target interface control from the interface based on a single node element sub-factor in the node element factor, or a combination of multiple node element sub-factors.
[0276] In some embodiments, the node element sub-factors that characterize the control features from different dimensions can be divided into first precision sub-factors, second precision sub-factors, and third precision sub-factors. In the process of locating the interface control based on the node element factor, the interface control can be located based on all or part of the precision sub-factors in descending order of precision.
[0277] Optionally, the first node element subfactor and the second node element subfactor belong to the first precision subfactor, the third node element subfactor, the fourth node element subfactor and the fifth node element subfactor belong to the second precision subfactor, and the sixth node element subfactor, the seventh node element subfactor and the eighth node element subfactor belong to the third precision subfactor.
[0278] In the process of positioning the interface control based on the node element factor, the priority of the first precision sub-factor is higher than the priority of the second precision sub-factor, and the priority of the second precision sub-factor is higher than the priority of the third precision sub-factor.
[0279] In the process of locating the interface control, if a unique interface control can be located based on the first precision sub-factor, there is no need to perform positioning based on the second precision sub-factor and the third precision sub-factor.
[0280] If the unique interface control cannot be located based on the first precision sub-factor, the interface control location is continued based on the second precision. If the unique interface control can be located based on the second precision sub-factor, there is no need to locate it based on the third precision sub-factor.
[0281] If the only interface control cannot be located based on the second precision sub-factor, the interface control is located based on the third precision.
[0282] Optionally, the first precision subfactors of two identical interface controls must be exactly the same. In other words, if the first precision subfactors of two interface controls are different, the two interface controls must not be the same interface control.
[0283] Optionally, when the first precision subfactors of the two interface controls are completely identical, the computer device further determines whether the two interface controls are identical based on the second precision subfactors of the two interface controls.
[0284] Optionally, if the second precision subfactors of the two interface controls are exactly the same, then the two interface controls are determined to be the same interface control. If the second precision subfactors of the two interface controls are completely different, then the two interface controls are determined to be different interface controls. If the second precision subfactors of the two interface controls are partially the same and partially different, the computer device further determines whether the two interface controls are the same based on the third precision subfactors of the two interface controls.
[0285] Optionally, if the third precision subfactors of the two interface controls are exactly the same, the two interface controls are determined to be the same interface control; if the third precision subfactors of the two interface controls are different, the two interface controls are determined to be different interface controls. Alternatively, if the matching degree of the third precision subfactors of the two interface controls is higher than a matching degree threshold, the two interface controls are determined to be the same interface control; if the matching degree of the third precision subfactors of the two interface controls is lower than the matching degree threshold, the two interface controls are determined to be different interface controls.
[0286] Step 203B3: simulating the target operation behavior on the target interface control in the interface based on the target behavior type included in the target behavior information.
[0287] After locating the target interface control in the interface, the computer device generates an operation behavior event for the target interface control based on the target behavior type in the target behavior information, thereby simulating the target operation behavior for the target interface control in the interface based on the operation behavior event.
[0288] In this embodiment, node element factors that describe the characteristics of the interface control in multiple dimensions are generated from dimensions such as the package name of the control class to which the interface control belongs, the type, the resource identifier corresponding to the interface control, the control description of the interface control, the text content displayed by the interface control, the position of the interface control in the list, the control chain in which the interface control is located, and the positional relationship between the interface control and other interface controls. This improves the comprehensiveness and accuracy of the description of the interface control, and is conducive to improving the accuracy of subsequent retrieval and positioning of the interface control based on the node element sub-factors.
[0289] In the above-mentioned embodiments, the accuracy of the target interface determined based on the target function to be tested will directly affect the accuracy of the subsequent automated test. In order to improve the accuracy of the determined target interface, in a possible implementation, the computer device can determine the target interface in the application to be tested based on the target function to be tested in the application to be tested and the node information of the node in the operation trajectory model.
[0290] In order to facilitate subsequent interface retrieval based on functions, such as being able to retrieve the hotspot settings subpage under the settings page based on the "hotspot settings" function indicated by "I want to set up a mobile phone hotspot", in a possible implementation, the node information of the node may also include atomic capabilities information (atomicCapabilities). The atomic capabilities information is used to indicate the atomic capabilities of the interface, which are the smallest units of functions, such as turning on A, turning off A, viewing B, adding C, uploading D, and so on.
[0291] Regarding the method of generating atomic function information, in some embodiments, the computer device generates atomic function information of the interface through a large language model, and determines the atomic function information as node information of the node.
[0292] Optionally, the computer device inputs a screenshot of the interface and prompt information (prompt) into the large language model, instructing the large language model to extract atomic function information of the interface. The atomic function information can be in the form of a list.
[0293] It should be noted that the atomic function information can be generated synchronously with other node information, or it can be generated uniformly when the computer device is idle, or when the number of interfaces for which atomic function information has not been generated reaches a threshold value. This embodiment does not limit this.
[0294] In other possible implementations, in order to further improve the efficiency of subsequent interface retrieval, in addition to using the atomic function information as part of the node information, the computer device may use at least one of the following methods to mine more node information:
[0295] 1. Perform OCR recognition on the images in the interface and extract the text information contained in the images as node information.
[0296] 2. Generate the image description corresponding to the image in the interface as node information. For example, you can use the Image2Text model to generate the image description corresponding to the image.
[0297] 3. Use the TAG system to generate image classification tags as node information.
[0298] 4. Use the large language model to generate an interface information summary and / or an interface summary description as node information.
[0299] 5. Get the interface text information from all text type controls in the interface and use it as node information.
[0300] As an important part of the interface, interface controls are responsible for receiving user operations and triggering interface content updates or interface jumps. During the operation process, most operations are performed on interface controls.
[0301] In addition to the atomic function information, the fifth node sub-factor determined based on the interface function description information in the node information can also characterize the interface function. Therefore, the computer device can determine whether the interface is used to achieve the target function based on the target function and at least one of the atomic function information and / or the fifth node sub-factor in the node information.
[0302] In a possible implementation, when the atomic function information and / or the fifth node sub-factor in the node information of the node matches the target function, the computer device determines the interface corresponding to the node as the target interface in the application to be tested.
[0303] In some embodiments, when the target function, atomic function information and fifth node sub-factor are all in text form, the computer device can determine whether the target function matches the atomic function information and whether the target function matches the fifth node sub-factor by calculating the text semantic similarity.
[0304] Optionally, the text semantic similarity may be represented by a vector distance of text vectors, which is not limited in this embodiment.
[0305] Regarding the method of determining the target function to be tested, in a possible implementation, the computer device displays a function tree corresponding to the application to be tested, the function tree is used to represent the hierarchical structure of the functions in the function to be tested. Based on the function selection operation in the function tree, the computer device determines the target function to be tested in the application to be tested.
[0306] The function selection operation may be a selection operation on a leaf function, or a selection operation on a parent function corresponding to the leaf function, wherein when the parent function is selected, the leaf function under the parent function is also selected.
[0307] In an illustrative example, Fig.11 As shown, the computer device displays a function tree 1101 corresponding to the album application. When receiving a trigger operation on the function selection control 1102, the terminal determines that the target functions to be tested include rotation, cropping, adjustment, marking, sharing, editing and more functions.
[0308] Indicative, such as Fig.12 As shown, the computer device displays a function tree 1204 of the application to be tested, and determines a function set 1205 consisting of at least one target function from the function tree 1204 based on user selection and a test strategy.
[0309] The computer device obtains the atomic function information 1202 and the interface function description information 1203 corresponding to each interface from the operation trajectory model 1201, and matches the target function in the function set 1205 with the atomic function information 1202 and / or the interface function description information 1203 based on the matching strategy 1206, thereby determining the target interface 1207 based on the matching result.
[0310] In this embodiment, based on the node information related to the interface function in the operation trajectory model, the target interface matching the target function to be tested is determined, which simplifies the process of indicating the scope of automated testing and improves the comprehensiveness of automated testing interface coverage.
[0311] In one possible implementation, in order to further improve the effect of automated testing, a computer device combines automated testing basic events to obtain automated testing combined events, and generates automated testing supplementary events based on the operation behaviors in the target interface in the operation trajectory model, thereby performing automated testing in the target interface based on the automated testing basic events, automated testing combined events, and automated testing supplementary events.
[0312] Optionally, the automated test basic event is a primitive automated test event in the automated test tool, such as a touch event, a zoom event, a rotation event, a track event, a system case event, a keyboard event, etc. in the Monkey test tool.
[0313] Optionally, the computer device combines the automated test basic events based on the combination rules to obtain the automated test combination events. The combination rules may include concurrent combination rules and sequential combination rules. The automated test combination events obtained based on the combination rules that are not combined are composed of multiple concurrently executed automated test basic events; the automated test combination events obtained based on the sequential combination rules are composed of multiple sequentially executed automated test basic events.
[0314] Optionally, after the computer device determines the target interface, based on the target node identifier of the target node corresponding to the target interface, searches for a behavior edge with the target node identifier as the starting node identifier from the operation trajectory model, and generates an automated test supplementary event based on the operation behavior corresponding to the behavior edge.
[0315] Indicative, such as Fig.13 As shown, the automated testing basic event 1302 provided by the computer equipment automated testing tool 1301, the automated testing combined event 1303 obtained by combining the automated testing basic event 1302, and the automated testing supplementary event 1305 provided by the operation trajectory model 1304 are all determined as automated testing events for performing automated testing on the target interface.
[0316] In this embodiment, by combining basic automated test events and introducing the operation trajectory model as a supplement to automated test events, automated testing can cover test boundaries that automated test events cannot cover, thereby improving the comprehensiveness and coverage of automated testing.
[0317] In combination with the above embodiments, Fig.14 As shown, the computer device determines the target interface to be tested based on the interface atomic capabilities and interface functions provided by the operation trajectory model, and the function set selected from the function tree based on the test strategy. And on the basis of the automated test basic events provided by the automated test function, the automated test combination events composed of the automated test basic events and the automated test supplementary events provided by the operation trajectory model are added to enrich the comprehensiveness of the interface test. In addition, based on the functions selected by the user, the automated test of different ranges of interfaces (corresponding to activities) in the application to be tested can be realized, which not only ensures the comprehensiveness of the test, but also ensures the test effect of the key interfaces.
[0318] Please refer to Fig.15 , which shows a structural block diagram of an automated testing device provided by an exemplary embodiment of the present application. The device includes:
[0319] An interface determination module 1501 is used to determine a target interface in the application to be tested based on a target function to be tested in the application to be tested, where the target interface refers to an interface for realizing the target function;
[0320] A path determination module 1502 is used to determine target path information based on an operation trajectory model during an automated test process when the current interface does not belong to the target interface, wherein the operation trajectory model includes node information of nodes corresponding to the interface in the application to be tested and edge information of behavior edges corresponding to operation behaviors in the interface, wherein the target path information is path information of a target operation path for jumping to the target interface, and the target operation path is composed of nodes and behavior edges between nodes;
[0321] A jump module 1503, configured to jump to the target interface based on the target path information;
[0322] The testing module 1504 is used to perform automated testing in the target interface.
[0323] Optionally, the path determination module 1502 is used to:
[0324] In a case where the current interface does not belong to the target interface, determining a first node corresponding to the current interface based on the node information in the operation trajectory model;
[0325] The target path information of the target operation path is determined based on the first node, the second node corresponding to the target interface, and the edge information in the operation trajectory model, where the target operation path is an operation path from the current interface to the target interface.
[0326] Optionally, the node information includes a node factor of the node, and the node factor includes node sub-factors that characterize interface features of the interface from different dimensions;
[0327] The path determination module 1502 is used to:
[0328] Based on interface features of different dimensions of the current interface, generating the node factor corresponding to the current interface;
[0329] Determining the recorded interface that matches the current interface based on the node factor of the recorded node corresponding to the recorded interface in the operation trajectory model and the node factor corresponding to the current interface;
[0330] The recorded node corresponding to the matched recorded interface is determined as the first node corresponding to the current interface.
[0331] Optionally, the node factor includes a first node sub-factor, a second node sub-factor, a third node sub-factor, a fourth node sub-factor and a fifth node sub-factor;
[0332] The path determination module 1502 is used to:
[0333] When the first node sub-factors corresponding to the current interface and the recorded interface are different, determining that the current interface does not match the recorded interface;
[0334] In a case where the second node sub-factors corresponding to the current interface and the recorded interface are different, determining that the current interface does not match the recorded interface;
[0335] In a case where the fifth node sub-factor corresponding to the current interface and the recorded interface is the same, determining that the current interface matches the recorded interface;
[0336] In the case where the first node sub-factor corresponding to the current interface is the same as that corresponding to the recorded interface, and the second node sub-factor corresponding to the current interface is the same as that corresponding to the recorded interface, and the fifth node sub-factor corresponding to the current interface is different from that corresponding to the recorded interface, and the similarity between the third node sub-factor corresponding to the current interface and the recorded interface is greater than a first similarity threshold, and / or the similarity between the fourth node sub-factor corresponding to the current interface and the recorded interface is greater than a second similarity threshold, it is determined that the current interface matches the recorded interface;
[0337] In the case where the first node sub-factor corresponding to the current interface is the same as that corresponding to the recorded interface, and the second node sub-factor corresponding to the current interface is the same as that corresponding to the recorded interface, and the fifth node sub-factor corresponding to the current interface is different from that corresponding to the recorded interface, and the similarity between the third node sub-factor corresponding to the current interface and the recorded interface is less than a first similarity threshold, and the similarity between the fourth node sub-factor corresponding to the current interface and the recorded interface is less than a second similarity threshold, it is determined that the current interface does not match the recorded interface;
[0338] Among them, the first node sub-factor is determined based on the window name of the window to which the interface belongs, the second node sub-factor is determined based on the operable elements in the interface, the third node sub-factor is determined based on the interface layout of the interface, the fourth node sub-factor is determined based on the interface screen of the interface, and the fifth node sub-factor is determined based on the interface function description information of the interface.
[0339] Optionally, the path determination module 1502 is used to:
[0340] In the case that the current interface does not belong to the target interface, determining the node corresponding to the start interface as the first node;
[0341] Determine the target path information of the target operation path based on the first node, the second node corresponding to the target interface, and the edge information in the operation trajectory model, where the target operation path is an operation path from the start interface to the target interface;
[0342] The jump module 1503 is also used for:
[0343] Jump to the startup interface.
[0344] Optionally, the edge information includes a starting node identifier of a starting node corresponding to a starting interface before the operation behavior, a terminating node identifier of a terminating node corresponding to a terminating interface after the operation behavior, and behavior information of the operation behavior;
[0345] The path determination module 1502 is used to:
[0346] Determine a behavior edge list based on a first node identifier corresponding to the first node, a second node identifier corresponding to the second node, and the start node identifier and the end node identifier included in the edge information in the operation trajectory model, wherein the behavior edge list includes the behavior edges corresponding to the operation behaviors arranged in time sequence, and the behavior edges in the behavior edge list connect the first node and the second node;
[0347] Based on the behavior edge list, the target path information of the target operation path is determined.
[0348] Optionally, the path determination module 1502 is used to:
[0349] In the case where there is a single behavior edge list, determining the behavior edge list as the target path information of the target operation path;
[0350] When there are multiple behavior edge lists, the i-th behavior edge list is determined as the target path information of the target operation path; when the target operation path corresponding to the i-th behavior edge list is unreachable, the i+1-th behavior edge list is determined as the target path information of the target operation path, wherein the path length of the operation path represented by the i+1-th behavior edge list is greater than the path length of the operation path represented by the i-th behavior edge list, and i is a positive integer.
[0351] Optionally, the jump module 1503 is used to:
[0352] Based on the target path information, determine target edge information corresponding to the target behavior edge between nodes on the target operation path;
[0353] Based on the target behavior information included in the target side information, the target operation behavior indicated by the target behavior information is simulated in the interface until jumping to the target interface.
[0354] Optionally, in a case where the target operation behavior indicated by the target behavior information is related to a target interface control, the target behavior information includes a node element identifier of a target node element corresponding to the target interface control and a target behavior type of the target operation behavior;
[0355] The jump module 1503 is used to:
[0356] Based on the node element identifier in the target behavior information, a target node element factor of the target node element is acquired, wherein the target node element factor includes node element sub-factors that characterize control features of the target interface control from different dimensions;
[0357] Determine the target interface control from the interface based on the target node element factor and the node element factors corresponding to each interface control in the interface;
[0358] Based on the target behavior type included in the target behavior information, the target operation behavior on the target interface control is simulated in the interface.
[0359] Optionally, the interface determination module 1501 is used to:
[0360] The target interface in the application to be tested is determined based on the target function to be tested in the application to be tested and the node information of the nodes in the operation trajectory model.
[0361] Optionally, the node information includes atomic function information, where the atomic function information is used to indicate the atomic function of the interface, and the node factor of the node information includes a fifth node sub-factor determined based on the interface function description information;
[0362] The interface determination module 1501 is used to:
[0363] When the atomic function information and / or the fifth node sub-factor in the node information of the node matches the target function, the interface corresponding to the node is determined as the target interface in the application to be tested.
[0364] Optionally, the testing module 1504 is used to:
[0365] Combine the automated test basic events to obtain automated test combined events;
[0366] Generate an automated test supplementary event based on the operation behavior in the target interface in the operation trajectory model;
[0367] Based on the automated test basic event, the automated test combined event and the automated test supplementary event, automated testing is performed in the target interface.
[0368] Optionally, the path determination module 1502 is used to:
[0369] During the automated testing process, when the current interface does not belong to the target interface, determining interface test coverage data of different target interfaces;
[0370] Based on the interface test coverage data, determining a target jump interface from the plurality of target interfaces;
[0371] Based on the operation trajectory model and the target jump interface, the target path information is determined, where the target path information is path information of the target operation path that jumps to the target jump interface.
[0372] Optionally, the device further includes a function determination module, configured to:
[0373] Displaying a function tree corresponding to the application to be tested, wherein the function tree is used to represent the hierarchical structure of functions in the function to be tested;
[0374] Based on the function selection operation in the function tree, the target function to be tested in the application to be tested is determined.
[0375] In summary, in the embodiment of the present application, the operation trajectory model is used to record the operation process in the interface, wherein the operation trajectory model includes the node information of the corresponding node of the interface and the edge information of the corresponding behavior edge of the operation behavior in the interface. With the help of the node information and edge information in the operation trajectory model, the computer device can determine the target operation path to jump to the target interface when identifying other interfaces outside the target interface corresponding to the function to be tested, that is, determine the interface to be passed through when jumping to the target interface and the operation behavior performed in the interface, so as to automatically jump to the target interface based on the target path information corresponding to the target operation path, and then perform automated testing in the target interface. Compared with automated testing based on randomly generated events, which leads to insufficient testing of some key functions, the automated testing scheme provided by the embodiment of the present application can jump back to the interface of the function to be tested when leaving the interface of the function to be tested, improve the automated testing coverage of the interface of the function to be tested, and help improve the comprehensiveness of the test of the function to be tested.
[0376] See also Fig.16 , Fig.16 16 is a schematic diagram of a computer device provided by an exemplary embodiment of the present application. The computer device may also include one or more of the following components: a processor 1610 and a memory 1620.
[0377] Optionally, the processor 1610 uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 1620, and calling data stored in the memory 1620. Optionally, the processor 1610 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 1610 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a neural network processor (NPU), and a baseband chip. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content that needs to be displayed on the touch display; the NPU is used to implement artificial intelligence (AI) functions; and the baseband chip is used to process wireless communications. It is understandable that the above-mentioned baseband chip may not be integrated into the processor 1610, but may be implemented by a separate chip.
[0378] The memory 1620 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 1620 includes a non-transitory computer-readable storage medium. The memory 1620 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 1620 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function, instructions for implementing the following various method embodiments, etc.; the data storage area may store data created according to the use of the electronic device, etc.
[0379] In addition, those skilled in the art will understand that the structure of the computer device shown in the above figures does not constitute a limitation on the computer device, and the computer device may include more (such as communication components, display components) or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0380] An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores at least one computer instruction, and the at least one computer instruction is used to be executed by a processor to implement the automated testing method described in the above embodiment.
[0381] On the other hand, an embodiment of the present application provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the automated testing method described in the above embodiment.
[0382] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0383] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. An automated testing method, characterized in that: The method comprises: Based on a target function to be tested in the application to be tested, determining a target interface in the application to be tested, wherein the target interface refers to an interface for realizing the target function; During the automated testing process, when the current interface does not belong to the target interface, the target path information is determined based on the operation trajectory model, the operation trajectory model includes the node information of the node corresponding to the interface in the application to be tested and the edge information of the behavior edge corresponding to the operation behavior in the interface, the target path information is the path information of the target operation path to jump to the target interface, and the target operation path is composed of nodes and behavior edges between nodes; Jump to the target interface based on the target path information; Perform automated testing in the target interface.
2. The method according to claim 1, characterized in that The step of determining the target path information based on the operation trajectory model when the current interface does not belong to the target interface includes: In a case where the current interface does not belong to the target interface, determining a first node corresponding to the current interface based on the node information in the operation trajectory model; The target path information of the target operation path is determined based on the first node, the second node corresponding to the target interface, and the edge information in the operation trajectory model, where the target operation path is an operation path from the current interface to the target interface.
3. The method according to claim 2, characterized in that The node information includes a node factor of a node, and the node factor includes node sub-factors representing interface features of the interface from different dimensions; The determining, based on the node information in the operation trajectory model, a first node corresponding to the current interface includes: Based on interface features of different dimensions of the current interface, generating the node factor corresponding to the current interface; Determining the recorded interface that matches the current interface based on the node factor of the recorded node corresponding to the recorded interface in the operation trajectory model and the node factor corresponding to the current interface; The recorded node corresponding to the matched recorded interface is determined as the first node corresponding to the current interface.
4. The method according to claim 3, characterized in that The node factor comprises a first node sub-factor, a second node sub-factor, a third node sub-factor, a fourth node sub-factor and a fifth node sub-factor; The determining the recorded interface matching the current interface based on the node factor of the recorded node corresponding to the recorded interface in the operation trajectory model and the node factor corresponding to the current interface includes: When the first node sub-factors corresponding to the current interface and the recorded interface are different, determining that the current interface does not match the recorded interface; In a case where the second node sub-factors corresponding to the current interface and the recorded interface are different, determining that the current interface does not match the recorded interface; In a case where the fifth node sub-factor corresponding to the current interface and the recorded interface is the same, determining that the current interface matches the recorded interface; In the case where the first node sub-factor corresponding to the current interface is the same as that corresponding to the recorded interface, and the second node sub-factor corresponding to the current interface is the same as that corresponding to the recorded interface, and the fifth node sub-factor corresponding to the current interface is different from that corresponding to the recorded interface, and the similarity between the third node sub-factor corresponding to the current interface and the recorded interface is greater than a first similarity threshold, and / or the similarity between the fourth node sub-factor corresponding to the current interface and the recorded interface is greater than a second similarity threshold, it is determined that the current interface matches the recorded interface; In the case where the first node sub-factor corresponding to the current interface is the same as that corresponding to the recorded interface, and the second node sub-factor corresponding to the current interface is the same as that corresponding to the recorded interface, and the fifth node sub-factor corresponding to the current interface is different from that corresponding to the recorded interface, and the similarity between the third node sub-factor corresponding to the current interface and the recorded interface is less than a first similarity threshold, and the similarity between the fourth node sub-factor corresponding to the current interface and the recorded interface is less than a second similarity threshold, it is determined that the current interface does not match the recorded interface; Among them, the first node sub-factor is determined based on the window name of the window to which the interface belongs, the second node sub-factor is determined based on the operable elements in the interface, the third node sub-factor is determined based on the interface layout of the interface, the fourth node sub-factor is determined based on the interface screen of the interface, and the fifth node sub-factor is determined based on the interface function description information of the interface.
5. The method according to claim 1, characterized in that The step of determining the target path information based on the operation trajectory model when the current interface does not belong to the target interface includes: In the case that the current interface does not belong to the target interface, determining the node corresponding to the start interface as the first node; Determine the target path information of the target operation path based on the first node, the second node corresponding to the target interface, and the edge information in the operation trajectory model, where the target operation path is an operation path from the start interface to the target interface; Before jumping to the target interface based on the target path information, the method further includes: Jump to the startup interface.
6. The method according to claim 2 or 5, characterized in that: The edge information includes a starting node identifier of a starting node corresponding to a starting interface before the operation behavior, a terminating node identifier of a terminating node corresponding to a terminating interface after the operation behavior, and behavior information of the operation behavior; The determining the target path information of the target operation path based on the first node, the second node corresponding to the target interface, and the edge information in the operation trajectory model includes: Determine a behavior edge list based on a first node identifier corresponding to the first node, a second node identifier corresponding to the second node, and the start node identifier and the end node identifier included in the edge information in the operation trajectory model, wherein the behavior edge list includes the behavior edges corresponding to the operation behaviors arranged in time sequence, and the behavior edges in the behavior edge list connect the first node and the second node; Based on the behavior edge list, the target path information of the target operation path is determined.
7. The method according to claim 6, characterized in that The determining, based on the behavior edge list, the target path information of the target operation path includes: In the case where there is a single behavior edge list, determining the behavior edge list as the target path information of the target operation path; When there are multiple behavior edge lists, the i-th behavior edge list is determined as the target path information of the target operation path; when the target operation path corresponding to the i-th behavior edge list is unreachable, the i+1-th behavior edge list is determined as the target path information of the target operation path, wherein the path length of the operation path represented by the i+1-th behavior edge list is greater than the path length of the operation path represented by the i-th behavior edge list, and i is a positive integer.
8. The method according to any one of claims 1 to 7, characterized in that: The jumping to the target interface based on the target path information includes: Based on the target path information, determine target edge information corresponding to the target behavior edge between nodes on the target operation path; Based on the target behavior information included in the target side information, the target operation behavior indicated by the target behavior information is simulated in the interface until jumping to the target interface.
9. The method according to claim 8, characterized in that In the case where the target operation behavior indicated by the target behavior information is related to a target interface control, the target behavior information includes a node element identifier of a target node element corresponding to the target interface control and a target behavior type of the target operation behavior; The simulating, in the interface, the target operation behavior indicated by the target behavior information based on the target behavior information included in the target side information includes: Based on the node element identifier in the target behavior information, a target node element factor of the target node element is acquired, wherein the target node element factor includes node element sub-factors that characterize control features of the target interface control from different dimensions; Determine the target interface control from the interface based on the target node element factor and the node element factors corresponding to each interface control in the interface; Based on the target behavior type included in the target behavior information, the target operation behavior on the target interface control is simulated in the interface.
10. The method according to any one of claims 1 to 7, characterized in that: The determining of a target interface in the application to be tested based on a target function to be tested in the application to be tested includes: The target interface in the application to be tested is determined based on the target function to be tested in the application to be tested and the node information of the nodes in the operation trajectory model.
11. The method according to claim 10, characterized in that The node information includes atomic function information, where the atomic function information is used to indicate the atomic function of the interface, and the node factor of the node information includes a fifth node sub-factor determined based on the interface function description information; The determining the target interface in the application to be tested based on the target function to be tested in the application to be tested and the node information of the node in the operation trajectory model includes: When the atomic function information and / or the fifth node sub-factor in the node information of the node matches the target function, the interface corresponding to the node is determined as the target interface in the application to be tested.
12. The method according to any one of claims 1 to 7, characterized in that: The automated testing in the target interface includes: Combine the automated test basic events to obtain automated test combined events; Generate an automated test supplementary event based on the operation behavior in the target interface in the operation trajectory model; Based on the automated test basic event, the automated test combined event and the automated test supplementary event, automated testing is performed in the target interface.
13. The method according to any one of claims 1 to 7, characterized in that: In the automated testing process, when the current interface does not belong to the target interface, determining the target path information based on the operation trajectory model includes: During the automated testing process, when the current interface does not belong to the target interface, determining interface test coverage data of different target interfaces; Based on the interface test coverage data, determining a target jump interface from the plurality of target interfaces; Based on the operation trajectory model and the target jump interface, the target path information is determined, where the target path information is path information of the target operation path that jumps to the target jump interface.
14. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Displaying a function tree corresponding to the application to be tested, wherein the function tree is used to represent the hierarchical structure of functions in the function to be tested; Based on the function selection operation in the function tree, the target function to be tested in the application to be tested is determined.
15. An automated testing device, characterized in that: The device comprises: An interface determination module, used to determine a target interface in the application to be tested based on a target function to be tested in the application to be tested, wherein the target interface refers to an interface for realizing the target function; A path determination module is used to determine target path information based on an operation trajectory model during an automated test process when the current interface does not belong to the target interface, wherein the operation trajectory model includes node information of nodes corresponding to the interface in the application to be tested and edge information of behavior edges corresponding to operation behaviors in the interface, wherein the target path information is path information of a target operation path for jumping to the target interface, and the target operation path is composed of nodes and behavior edges between nodes; A jump module, used for jumping to the target interface based on the target path information; The test module is used to perform automated testing in the target interface.
16. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one computer instruction, and the at least one computer instruction is loaded and executed by the processor to implement the automated testing method according to any one of claims 1 to 14.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer instruction, and the at least one computer instruction is used to be executed by a processor to implement the automated testing method according to any one of claims 1 to 14.
18. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the automated testing method as described in any one of claims 1 to 14.