CN117349178A - User page testing method and device - Google Patents

User page testing method and device Download PDF

Info

Publication number
CN117349178A
CN117349178A CN202311429285.6A CN202311429285A CN117349178A CN 117349178 A CN117349178 A CN 117349178A CN 202311429285 A CN202311429285 A CN 202311429285A CN 117349178 A CN117349178 A CN 117349178A
Authority
CN
China
Prior art keywords
current
page
node
exploration
control element
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311429285.6A
Other languages
Chinese (zh)
Inventor
董海滨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xinhuasan Technology Service Co ltd
Original Assignee
Xinhuasan Technology Service Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xinhuasan Technology Service Co ltd filed Critical Xinhuasan Technology Service Co ltd
Priority to CN202311429285.6A priority Critical patent/CN117349178A/en
Publication of CN117349178A publication Critical patent/CN117349178A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The embodiment of the application provides a user page testing method and device. According to the embodiment of the application, based on the exploration action information corresponding to the current node, the corresponding exploration action is executed on the current node, and an action execution result is obtained; further, whether the current UI page is successfully jumped to the next UI page after the current node is executed with the corresponding exploring action is judged, so that a new current node is determined, and the corresponding exploring action operation is executed for the current node based on the exploring action information corresponding to the current node; by exploring the current node and exploring other elements in the current UI page when the next UI page does not exist, the comprehensive and accurate testing of the user page is ensured, meanwhile, different programming and configuration of different application programs are not needed in the testing method, and the problems of complex programming of test cases and low testing efficiency in the related technology are solved.

Description

User page testing method and device
Technical Field
The present disclosure relates to the field of automated testing, and in particular, to a user page testing method and apparatus.
Background
With the popularization of mobile terminal devices, mobile applications have become an essential and important tool in people's daily lives. Among many testing methods, UI (User Interface) page testing techniques are capable of testing UI control elements on an application to determine whether a test result of the tested application meets an expected result. There are various automatic UI test tools on the market, and the conventional method often needs a test engineer to write a test script for each user page to be tested, and the method is very complicated and has low test efficiency.
Disclosure of Invention
In view of this, the present application provides a method and apparatus for testing user pages, so as to solve the problems of complex writing and low testing efficiency caused by the need of writing test scripts for each user page to be tested in the related art.
The technical scheme provided by the application is as follows:
according to an embodiment of a first aspect of the present application, a user page testing method is provided, which is applied to a processor in an electronic device, and the method includes:
when a current control element in an application program to be tested is triggered to Start a Start operation, starting an exploration operation on a User Interface (UI) page to which the current control element belongs, taking the current control element as a root node of a target exploration tree, taking the root node as a current node of a current layer in the target exploration tree, and taking the UI page as a current UI page;
executing corresponding exploring actions on the current node to obtain action executing results; the action execution result at least comprises a screenshot of the current node after the corresponding exploring action is executed;
if the current node is successfully jumped to the next UI page after the corresponding exploration action is executed, traversing control elements in the next UI page, taking the traversed control elements as child nodes of the current node, wherein the child nodes are positioned at the next layer of the current layer in the target exploration tree, taking the next layer of the current layer in the target exploration tree as the current layer, taking the child nodes of the current node as the current nodes of the current layer in the target exploration tree, taking the next UI page as the current UI page, and executing the corresponding exploration action on the current node;
If the current node fails to jump after the corresponding exploring action is executed, other control elements which are not executed with the exploring action in the current UI page are used as the current node of the current layer, and the corresponding exploring action is executed for the current node.
Optionally, the Start operation is triggered by an externally input instruction.
Optionally, performing a corresponding exploration action on the current node includes:
checking whether the current node is configured into a state to be corrected or not, wherein the state to be corrected is used for indicating the current node to execute corresponding correction actions, and the correction actions are different from exploring actions corresponding to the current node;
if yes, executing corresponding corrective action on the current node;
and if not, executing corresponding exploring actions on the current node.
Optionally, the current node of the current layer is selected according to a target control element sequence corresponding to the current UI page, and the target control element sequence corresponding to the current UI page is determined by the following method:
storing all control elements in the current UI page into a first control element sequence;
deleting the control elements with repeated UI page identifications from the first control element sequence based on the UI page identifications of the control elements which are configured in advance so as to obtain a second control element sequence; the UI page identifier is used for indicating a UI page to which the control element jumps after corresponding exploration actions are executed;
Deleting preset control elements containing specific information from the second control element sequence to obtain a third control element sequence;
and sorting the control elements in the third control element sequence according to the configured traversal depth of each control element so as to obtain a target control element sequence corresponding to the current UI page.
Optionally, the method further comprises:
if the control elements which are not executed with the exploration actions do not exist in the current UI page, returning to the UI page corresponding to the upper layer of the current layer in the target exploration tree, taking the UI page corresponding to the upper layer of the current layer as the current UI page, taking the upper layer of the current layer as the current layer, taking other control elements which are not executed with the exploration actions in the current UI page as the current node of the current layer, and executing the corresponding exploration actions on the current node until the returned UI page is the UI page which the root node belongs to.
According to an embodiment of a second aspect of the present application, there is provided a user page testing apparatus, the apparatus being applied to a processor in an electronic device, the apparatus comprising:
the system comprises an exploration unit, a target exploration tree, a UI page and a control unit, wherein the exploration unit is used for starting an initial operation when a current control element in an application program to be tested is triggered, starting exploration operation on the UI page of a user interface to which the current control element belongs, taking the current control element as a root node of the target exploration tree, taking the root node as a current node of a current layer in the target exploration tree, and taking the UI page as a current UI page;
The execution unit is used for executing corresponding exploration actions on the current node and obtaining action execution results; the action execution result at least comprises a screenshot of the current node after the corresponding exploring action is executed;
if the current node is successfully jumped to the next UI page after the corresponding exploration action is executed, traversing control elements in the next UI page, taking the traversed control elements as child nodes of the current node, wherein the child nodes are positioned at the next layer of the current layer in the target exploration tree, taking the next layer of the current layer in the target exploration tree as the current layer, taking the child nodes of the current node as the current nodes of the current layer in the target exploration tree, taking the next UI page as the current UI page, and executing the corresponding exploration action on the current node;
if the current node fails to jump after the corresponding exploring action is executed, other control elements which are not executed with the exploring action in the current UI page are used as the current node of the current layer, and the corresponding exploring action is executed for the current node.
Optionally, the Start operation is triggered by an externally input instruction.
Optionally, the execution unit is specifically configured to:
checking whether the current node is configured into a state to be corrected or not, wherein the state to be corrected is used for indicating the current node to execute corresponding correction actions, and the correction actions are different from exploring actions corresponding to the current node;
if yes, executing corresponding corrective action on the current node;
and if not, executing corresponding exploring actions on the current node.
Optionally, the current node of the current layer is selected according to a target control element sequence corresponding to the current UI page, and the target control element sequence corresponding to the current UI page is determined by the following method:
storing all control elements in the current UI page into a first control element sequence;
deleting the control elements with repeated UI page identifications from the first control element sequence based on the UI page identifications of the control elements which are configured in advance so as to obtain a second control element sequence; the UI page identifier is used for indicating a UI page to which the control element jumps after corresponding exploration actions are executed;
deleting preset control elements containing specific information from the second control element sequence to obtain a third control element sequence;
And sorting the control elements in the third control element sequence according to the configured traversal depth of each control element so as to obtain a target control element sequence corresponding to the current UI page.
Optionally, the execution unit is further configured to:
if the control elements which are not executed with the exploration actions do not exist in the current UI page, returning to the UI page corresponding to the upper layer of the current layer in the target exploration tree, taking the UI page corresponding to the upper layer of the current layer as the current UI page, taking the upper layer of the current layer as the current layer, taking other control elements which are not executed with the exploration actions in the current UI page as the current node of the current layer, and executing the corresponding exploration actions on the current node until the returned UI page is the UI page which the root node belongs to.
According to an embodiment of a third aspect of the present application, an electronic device is presented, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method according to the first aspect when executing the program.
According to an embodiment of the fourth aspect of the present application, a computer-readable storage medium is presented, which stores a computer program which, when executed by a processor, implements the method according to the first aspect.
As can be seen from the above technical solutions, in the embodiments of the present application, based on the exploration action information corresponding to the current node, the corresponding exploration action is executed on the current node, and an action execution result is obtained; further, whether the current UI page is successfully jumped to the next UI page after the current node is executed with the corresponding exploring action is judged, so that a new current node is determined, and the corresponding exploring action operation is executed for the current node based on the exploring action information corresponding to the current node; by exploring the current node and exploring other elements in the current UI page when the next UI page does not exist, the comprehensive and accurate testing of the user page is ensured, meanwhile, different programming and configuration of different application programs are not needed in the testing method, and the problems of complex programming and low testing efficiency caused by the fact that testing scripts are required to be programmed for each user page to be tested in the related technology are solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a flowchart of an implementation of a user page testing method provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of a target exploration tree according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 4 is a block diagram of a user page testing apparatus according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first message may also be referred to as a second message, and similarly, a second message may also be referred to as a first message, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
The technical solutions in the embodiments of the present application are described in further detail below with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a flowchart illustrating a user page testing method according to an embodiment of the present application, where the method is applied to a processor in an electronic device.
As shown in fig. 1, the method may include the steps of:
step 101, when a current control element in an application program to be tested is triggered to Start a Start operation, starting an exploration operation on a user interface UI page to which the current control element belongs, taking the current control element as a root node of a target exploration tree, taking the root node as a current node of a current layer in the target exploration tree, and taking the UI page as a current UI page.
In this embodiment, the application to be tested may be installed in the electronic device, or may be sent to the electronic device by another device, and the obtaining of the application to be tested is not limited in this embodiment.
In this embodiment, the control element may represent an element that may perform a search operation and is included in a UI page to be searched of an application to be tested, and as an embodiment, assuming that the UI page is a shopping page in a certain shopping software, the control element may be a commodity picture presented in the shopping page, a search box in the shopping page, and the like, and the search operation may be clicking, sliding, and the like, which will be described in detail below, and will not be repeated herein.
In this embodiment, any control element in any UI page to be explored in the application to be tested may be selected as a current control element, and a Start operation is triggered for the current element.
As one example, the Start operation may be triggered by an externally entered instruction.
As one example, the Start operation may also be triggered by exploring test cases already present in the configuration file.
In this embodiment, when a test case exists in the configuration file, the user page test may be triggered by preferentially using the test case in the configuration file.
In this embodiment, the current control element is used as the root node of the target exploration tree, and the target exploration tree will be described according to fig. 2, which is not described herein.
This ends the description of step 101, and step 102 is performed as follows.
Step 102, executing corresponding exploring actions on the current node to obtain action execution results; the action execution result at least comprises a screenshot after the current node is executed with the corresponding exploring action.
In this embodiment, the corresponding exploration action may be performed on the current node based on the exploration action information corresponding to the current node. The exploring action information corresponding to the current node refers to a data type corresponding to an action which is configured by default by the node and can be executed on the node.
As one embodiment, based on the exploration action information corresponding to the current node, performing the corresponding exploration action for the current node may include:
if the exploration action information is of the back type, the corresponding exploration action is returned to the last page; if the exploration action information is of the Tap type, the corresponding exploration action is a clicking action; if the exploration action information is LongTap type, the corresponding exploration action is long-press action; if the exploration action information is of an input character string type, the corresponding exploration action is taken as an input action; if the search action information is log type, the corresponding search action is output only log action.
In this embodiment, after executing the exploration action, the processor may save the current exploration action, the request time, and the screenshot after executing the corresponding exploration action in the element graph set Store corresponding to the current node, and add the node to the clicked element list clickedElementList, and record the click sequence number. The node currently executing the exploring action may also be marked on the screenshot by a marking frame, and as an embodiment, the marking frame may be red, and the center point of the marking frame may be the center position of the node currently executing the exploring action.
As one embodiment, performing the corresponding exploration action on the current node includes:
checking whether the current node is configured into a state to be corrected or not, wherein the state to be corrected is used for indicating the current node to execute corresponding correction actions, and the correction actions are different from exploring actions corresponding to the current node;
if yes, executing corresponding corrective action on the current node;
and if not, executing corresponding exploring actions on the current node.
In this embodiment, when performing the exploring action, the processor may check whether the current node is configured to be in a state to be corrected, specifically, may check whether the current node is configured with corrective action information, where the corrective action information is different from the exploring action information configured by the current node, and the corrective action information is used to indicate that the current UI page is successfully jumped to the next UI page after the corresponding corrective action is performed on the current node. If the current node is in a state to be corrected, the current node is indicated to have a correction action (marked as fixElementAction) to be executed, and the correction action is different from the exploration action corresponding to the current node and can be used for skipping pages without exploration.
As an embodiment, if the application program to be tested is a piece of shopping software, a control element "login" is clicked in a to-be-explored page of the shopping software, a login page for inputting a user name and a password is entered, and after the correct user name and password are input, the shopping page is entered. When the user page testing method is executed, user names and passwords are not required to be input during each test, only the nodes corresponding to the control elements are required to be configured into a state to be corrected, the correction action is set to click the control elements to log in, and then the user page testing method directly jumps to the shopping page, so that the user page testing method can realize that the login page without exploration is skipped, and the shopping page is directly explored.
In this embodiment, since some UI pages, such as login pages, are known in advance by a tester before testing that pops up after clicking the control element "login", for such a UI page known in advance and not requiring exploration, the node may be configured in advance to be in a state to be corrected before executing the user page testing method, and a correction action corresponding to the state is configured, so that the login page may be skipped during the first exploration without inputting a user name and a password.
Meanwhile, as some UI pages such as popup advertisements are not clear to testers before testing, which control element will pop up after executing what kind of exploration action, for such a previously unknown UI page, after the user page testing method is executed for the first time, the node that needs to execute the correction action can be configured into a to-be-corrected state according to the first exploration result, so that the login page can be skipped when the user page testing method is executed next time, and no user name and password need to be input.
In this embodiment, the method may further include: before performing the exploring action, performing a pre-action; after the exploring action is performed, a post-action is performed.
In this embodiment, the precondition (referred to as before element) refers to a precondition that needs to be executed before the current node performs the exploring action, that is, a precondition operation that needs to be performed on the node. In one embodiment, in the case that the application to be detected has an on-screen advertisement, the pre-action may be waiting for a preset duration (for example, 10 seconds) for traversing the elements in the UI page after the on-screen advertisement is completed.
After executing the above-mentioned search action, the processor checks whether the current action is a post-action (denoted as AfterAll), which is an action to restore the current UI page to an initial state after the search action is executed. As an embodiment, when the exploring action of the current node is to input 5 numbers, the post-action of the exploring action may be to delete the input numbers, so that the numbers can still be input again when the user page testing method is performed to the node next time.
In this embodiment, the corresponding exploration action is executed on the current node, and after the action execution result is obtained, the method may further include:
storing the action execution result of the current node into a set; the set is characterized by keys and values, and the action execution result of the current node comprises: a key corresponding to a current node, wherein the key represents character string information compiled by a control element corresponding to the current node in the current UI page; the Value represents the action execution result of the current node. The compiled character string information of the control element corresponding to the current node is used for identifying the control element.
In this embodiment, an YAML (YAML Ain't Markup Language, YAML is not a markup language) file may be used as the Conf profile to initialize the element graph collection Store to Store node information corresponding to the current node: and taking the compiled node character string information in the application program to be tested as a key, and taking the node information as a value to store an action execution result. The node information may represent an XML (Extensible Markup Language ) file of the page at the time of the request and response, hash values of the request and response, picture addresses of the request and response, time of the request and response, sequence numbers of clicking on the node, status of the node, and basic attributes of the node elements.
In this embodiment, for the current UI page, filtering may be performed according to a custom rule, and sorting may be performed according to a preset traversal depth of the control element, so as to determine the next UI node that needs to be executed currently. Specifically, the method comprises the following steps:
the current node of the current layer can be selected according to a target control element sequence corresponding to the current UI page, and the target control element sequence corresponding to the current UI page can be determined by the following method:
storing all control elements in the current UI page into a first control element sequence;
deleting the control elements with repeated UI page identifications from the first control element sequence based on the UI page identifications of the control elements which are configured in advance so as to obtain a second control element sequence; the UI page identifier is used for indicating a UI page to which the control element jumps after corresponding exploration actions are executed;
deleting preset control elements containing specific information from the second control element sequence to obtain a third control element sequence;
and sorting the control elements in the third control element sequence according to the configured traversal depth of each control element so as to obtain a target control element sequence corresponding to the current UI page.
In this embodiment, based on the UI page identifier configured in advance for each control element, the control element repeated by the UI page identifier is deleted from the first control element sequence, which specifically may be the following operations:
for each control element in the first control element sequence, detecting whether other control elements with the same UI page identification as the control element which is configured in advance exist in the first control element sequence, and if so, deleting the detected other control elements.
In this embodiment, the control elements including the specific information may include control elements in a preset control element blacklist, control elements for returning to a node at a previous layer, and control elements that have been executed with an exploration action, where it is understood that all the control elements are control elements that need not to be traversed and need to be deleted from a control element sequence.
In this embodiment, all control elements in the current UI page are saved in the first control element sequence, all control elements are de-duplicated to obtain a second control element sequence, then control elements existing in a control element blacklist, control elements used for returning to the upper layer and control element information are in a click state, that is, control elements on which exploration actions have been executed are deleted from the second control element sequence, so as to obtain a third control element sequence, and it is ensured that only control elements which have not been clicked and traversed participate in subsequent processing.
In this embodiment, the control elements in the third control element sequence may be ordered according to the configured traversal depth of each control element, so as to obtain a target control element sequence corresponding to the current UI page; wherein, as one embodiment, the larger the traversal depth to which the control element is configured, the more forward the control element ranks.
Finally, the control elements ordered at the first are taken out of the target control element sequence and used as UI control elements to be executed next. Optionally, if the next control element is not obtained in the current step, the current UI page may be refreshed or slid, and the above method for obtaining the target element sequence may be re-executed to obtain more control elements.
In this embodiment, the exploration boundary of the traversal node may be preset in the configuration file, so as to control the timing of stopping traversal. These exploration boundaries are defined by a configuration file and may include the following:
the method comprises the steps of exceeding the maximum traversal depth, exceeding the longest traversal time, jumping out of the white list range after traversing to the white list of the page, jumping to another APP after executing node actions, having no new child node under the page, needing to search for a return node and failing to refresh the page.
As an embodiment, if the maximum traversal depth MaxDepth is preset to be 10, the traversal depth exceeds the depth and the rollback is performed. The maximum traversal time MaxTime is preset to 10800, which means that the traversal is stopped when the total traversal time exceeds the time. The maximum refreshing frequency AfterAllMax can be preset to be 2, which means that after all control elements on the current page execute corresponding exploring actions, the page is refreshed or slid, and when the refresh or the sliding is performed for more than two times, the page is automatically retracted.
So far, the description of step 102 is ended, and step 103 is performed as follows.
Step 103, if the current node is successfully jumped to the next UI page after the corresponding exploration action is executed, traversing control elements in the next UI page, taking the traversed control elements as child nodes of the current node, the child nodes being in the next layer of the current layer in the target exploration tree, taking the next layer of the current layer in the target exploration tree as the current layer, taking the child nodes of the current node as the current node of the current layer in the target exploration tree, taking the next UI page as the current UI page, and executing the corresponding exploration action on the current node
Step 104, if the current node fails to jump after the corresponding exploring action is executed, taking other control elements which are not executed with the exploring action in the current UI page as the current node of the current layer, and executing the corresponding exploring action on the current node.
The exploration methods described in step 103 and step 104 will be described with reference to fig. 2, and are not repeated here.
In this embodiment, each UI page may be configured with a return flag bit, where when the return flag bit is true, it indicates that when the current node executes the exploration action to jump to the UI page, it is not necessary to explore the node in the UI page, and the current layer where the current node is located may be directly returned, and other nodes in the current layer that are not executed with the exploration action may be explored.
In this embodiment, the method may further include:
if the control elements which are not executed with the exploration actions do not exist in the current UI page, returning to the UI page corresponding to the upper layer of the current layer in the target exploration tree, taking the UI page corresponding to the upper layer of the current layer as the current UI page, taking the upper layer of the current layer as the current layer, taking other control elements which are not executed with the exploration actions in the current UI page as the current node of the current layer, and executing the corresponding exploration actions on the current node until the returned UI page is the UI page which the root node belongs to.
In this embodiment, if the current UI page fails to skip after the current node is executed with the corresponding exploring action, other control elements in the current UI page that are not executed with the exploring action are used as the current node of the current layer to begin exploring. If no other control elements which are not executed with the exploration actions exist in the current UI page, namely the traversal is completed, the program can continue to execute the return operation until the UI page of the initial root node is returned, the traversal is completed, and test screenshots before and after each action is executed in the traversal process are recorded so as to generate a test report.
This concludes the description of the data transmission method in fig. 1.
The embodiment executes corresponding exploring actions on the current node based on the exploring action information corresponding to the current node to obtain action executing results; further, whether the current UI page is successfully jumped to the next UI page after the current node is executed with the corresponding exploring action is judged, so that a new current node is determined, and the corresponding exploring action operation is executed for the current node based on the exploring action information corresponding to the current node; by exploring the current node and exploring other elements in the current UI page when the next UI page does not exist, the comprehensive and accurate testing of the user page is ensured, meanwhile, different programming and configuration of different application programs are not needed in the testing method, and the problems of complex programming and low testing efficiency caused by the fact that testing scripts are required to be programmed for each user page to be tested in the related technology are solved.
Referring to fig. 2, fig. 2 is a schematic diagram of a target exploration tree according to an embodiment of the present application. As shown in fig. 2, the root node of the target search tree is node 1.
The working procedure of the present user page test method is briefly described below with reference to fig. 2:
When the control element 1 is triggered to Start operation, the control element is taken as a root node of a current node (marked as node 1) as a current layer (marked as layer 1), a corresponding exploration action (such as clicking on the control element corresponding to the node 1) is executed, an action execution result (such as screenshot on a current page) is obtained, and at the moment, the current UI page (marked as page 1) is successfully jumped to a next UI page (marked as page 2).
Traversing the control elements in the page 2, wherein when the control elements in the page 2 are found to comprise the elements 2 and 5, the elements 2 and 5 are used as child nodes of the node 1 and are marked as the nodes 2 and 5, and the layer where the child nodes are located is marked as the layer 2; one node of the nodes 2 and 5 is selected as the current node, and the selection rule can be preset, wherein the node 2 is selected on the assumption that the selection is performed from small to large according to the numerical order of the nodes, the node 2 is taken as the current node, and the operation of exploring actions is repeatedly performed. And executing corresponding exploration actions on the node 2 (such as clicking a control element corresponding to the node 2) to obtain an action execution result, wherein the current UI page, namely the page 2, is successfully jumped to the next UI page (marked as page 3).
Traversing the control elements in the page 3, wherein when the control elements in the page 3 are found to comprise the elements 3 and 4, the elements 3 and 4 are used as child nodes of the node 2 and are marked as the nodes 3 and 4, and the layer where the child nodes are located is marked as the layer 3; one node of the nodes 3 and 4 is selected as the current node, and the selection rule can be preset, wherein the node 3 is selected on the assumption that the selection is performed from small to large according to the numerical order of the nodes, the node 3 is taken as the current node, and the operation of exploring actions is repeatedly performed. And executing a corresponding exploration action on the node 3 (for example, clicking a control element corresponding to the node 3) to obtain an action execution result, and taking the control element which is not executed with the exploration action in the page 3, namely, the element 4, as the current node of the current layer when the current UI page, namely, the page 3, is not successfully jumped to the next UI page.
Taking a control element which is not executed with the exploration action in the page 3, namely an element 4, as a current node of the current layer, executing the corresponding exploration action on the node 4 (for example, clicking the control element corresponding to the node 4), obtaining an action execution result, and taking other control elements which are not executed with the exploration action in the page 3 as the current node of the current layer when the current UI page, namely the page 3, is not successfully jumped to the next UI page.
Since no other control elements which are not executed with the exploration action exist in the page 3 at this time, returning to the page 2, taking the control element which is not executed with the exploration action in the page 2, namely the element 5, as the current node of the current layer, executing the corresponding exploration action on the node 5 (for example, clicking the control element corresponding to the node 5), and obtaining an action execution result, wherein the current UI page, namely the page 2, is successfully jumped to the page 4.
Traversing the control elements in the page 4, and when the control elements in the page 4 are found to only comprise the element 6, taking the element 6 as a child node of the node 5, and marking the layer where the child node is positioned as the layer 4; the node 6 is selected as the current node, and the operation of the search action is repeatedly performed. And executing corresponding exploration actions on the node 6 (for example, clicking a control element corresponding to the node 6) to obtain an action execution result, wherein when the current UI page, namely the page 4, is not successfully jumped to the next UI page, other control elements in the page 4, on which the exploration actions are not executed, are taken as the current node of the current layer.
Since no other control elements which are not executed with the exploration action exist in the page 4 at this time, the page 2 is returned, and since no other control elements which are not executed with the exploration action exist in the page 2 at this time, the page 1 is returned, and since the page 1 is the UI page described by the root node, the traversal is ended, and the traversal and the test of all nodes under the root node, namely the node 1, are completed.
This concludes the description of the target exploration tree schematic of fig. 2.
Fig. 3 shows a schematic block diagram of an electronic device according to an exemplary embodiment of the present application. Referring to fig. 3, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a nonvolatile memory, and may include hardware required by other services. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the terminal interaction device on the logic level. Of course, other implementations, such as logic devices or combinations of hardware and software, are not excluded from the present application, that is, the execution subject of the following processing flows is not limited to each logic unit, but may be hardware or logic devices.
Referring to fig. 4, fig. 4 is a block diagram of a user page testing apparatus according to an embodiment of the present application. The apparatus is applied to a processor in an electronic device, and as shown in fig. 4, the apparatus may include an exploration unit 401 and an execution unit 402. Specifically, the device comprises:
the exploration unit 401 is configured to, when a current control element in an application to be tested is triggered to Start a Start operation, start an exploration operation on a UI page of a user interface to which the current control element belongs, take the current control element as a root node of a target exploration tree, take the root node as a current node of a current layer in the target exploration tree, and take the UI page as a current UI page;
an execution unit 402, configured to execute a corresponding exploration action on the current node, and obtain an action execution result; the action execution result at least comprises a screenshot of the current node after the corresponding exploring action is executed;
if the current node is successfully jumped to the next UI page after the corresponding exploration action is executed, traversing control elements in the next UI page, taking the traversed control elements as child nodes of the current node, wherein the child nodes are positioned at the next layer of the current layer in the target exploration tree, taking the next layer of the current layer in the target exploration tree as the current layer, taking the child nodes of the current node as the current nodes of the current layer in the target exploration tree, taking the next UI page as the current UI page, and executing the corresponding exploration action on the current node;
If the current node fails to jump after the corresponding exploring action is executed, other control elements which are not executed with the exploring action in the current UI page are used as the current node of the current layer, and the corresponding exploring action is executed for the current node.
Optionally, the Start operation is triggered by an externally input instruction.
Optionally, the execution unit 402 is specifically configured to:
checking whether the current node is configured into a state to be corrected or not, wherein the state to be corrected is used for indicating the current node to execute corresponding correction actions, and the correction actions are different from exploring actions corresponding to the current node;
if yes, executing corresponding corrective action on the current node;
and if not, executing corresponding exploring actions on the current node.
Optionally, the current node of the current layer is selected according to a target control element sequence corresponding to the current UI page, and the target control element sequence corresponding to the current UI page is determined by the following method:
storing all control elements in the current UI page into a first control element sequence;
deleting the control elements with repeated UI page identifications from the first control element sequence based on the UI page identifications of the control elements which are configured in advance so as to obtain a second control element sequence; the UI page identifier is used for indicating a UI page to which the control element jumps after corresponding exploration actions are executed;
Deleting preset control elements containing specific information from the second control element sequence to obtain a third control element sequence;
and sorting the control elements in the third control element sequence according to the configured traversal depth of each control element so as to obtain a target control element sequence corresponding to the current UI page.
Optionally, the execution unit 402 is further configured to:
if the control elements which are not executed with the exploration actions do not exist in the current UI page, returning to the UI page corresponding to the upper layer of the current layer in the target exploration tree, taking the UI page corresponding to the upper layer of the current layer as the current UI page, taking the upper layer of the current layer as the current layer, taking other control elements which are not executed with the exploration actions in the current UI page as the current node of the current layer, and executing the corresponding exploration actions on the current node until the returned UI page is the UI page which the root node belongs to.
This concludes the description of the user page testing apparatus in fig. 4.
Correspondingly, the embodiment of the application also provides a computer readable storage medium, and a plurality of computer instructions are stored on the computer readable storage medium, and when the computer instructions are executed, the method disclosed in the above example of the application can be realized.
By way of example, the above-described computer-readable storage media may be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, and the like. For example, the computer readable storage medium may be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, a storage drive (e.g., hard drive), a solid state drive, any type of storage disk (e.g., optical disk, dvd, etc.), or a similar storage medium, or a combination thereof.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present application.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Moreover, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing description of the preferred embodiments of the present invention is not intended to limit the invention to the precise form disclosed, and any modifications, equivalents, improvements and alternatives falling within the spirit and principles of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A user page testing method, wherein the method is applied to a processor in an electronic device, the method comprising:
When a current control element in an application program to be tested is triggered to Start a Start operation, starting an exploration operation on a User Interface (UI) page to which the current control element belongs, taking the current control element as a root node of a target exploration tree, taking the root node as a current node of a current layer in the target exploration tree, and taking the UI page as a current UI page;
executing corresponding exploring actions on the current node to obtain action executing results; the action execution result at least comprises a screenshot of the current node after the corresponding exploring action is executed;
if the current node is successfully jumped to the next UI page after the corresponding exploration action is executed, traversing control elements in the next UI page, taking the traversed control elements as child nodes of the current node, wherein the child nodes are positioned at the next layer of the current layer in the target exploration tree, taking the next layer of the current layer in the target exploration tree as the current layer, taking the child nodes of the current node as the current nodes of the current layer in the target exploration tree, taking the next UI page as the current UI page, and executing the corresponding exploration action on the current node;
If the current node fails to jump after the corresponding exploring action is executed, other control elements which are not executed with the exploring action in the current UI page are used as the current node of the current layer, and the corresponding exploring action is executed for the current node.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the Start operation is triggered by an externally input instruction.
3. The method of claim 1, wherein performing a corresponding exploration action on the current node comprises:
checking whether the current node is configured into a state to be corrected or not, wherein the state to be corrected is used for indicating the current node to execute corresponding correction actions, and the correction actions are different from exploring actions corresponding to the current node;
if yes, executing corresponding corrective action on the current node;
and if not, executing corresponding exploring actions on the current node.
4. The method of claim 1, wherein the current node of the current layer is selected according to a target control element sequence corresponding to a current UI page, and the target control element sequence corresponding to the current UI page is determined by the following method:
Storing all control elements in the current UI page into a first control element sequence;
deleting the control elements with repeated UI page identifications from the first control element sequence based on the UI page identifications of the control elements which are configured in advance so as to obtain a second control element sequence; the UI page identifier is used for indicating a UI page to which the control element jumps after corresponding exploration actions are executed;
deleting preset control elements containing specific information from the second control element sequence to obtain a third control element sequence;
and sorting the control elements in the third control element sequence according to the configured traversal depth of each control element so as to obtain a target control element sequence corresponding to the current UI page.
5. The method according to claim 1, characterized in that the method further comprises:
if the control elements which are not executed with the exploration actions do not exist in the current UI page, returning to the UI page corresponding to the upper layer of the current layer in the target exploration tree, taking the UI page corresponding to the upper layer of the current layer as the current UI page, taking the upper layer of the current layer as the current layer, taking other control elements which are not executed with the exploration actions in the current UI page as the current node of the current layer, and executing the corresponding exploration actions on the current node until the returned UI page is the UI page which the root node belongs to.
6. A user page testing apparatus for use with a processor in an electronic device, the apparatus comprising:
the system comprises an exploration unit, a target exploration tree, a UI page and a control unit, wherein the exploration unit is used for starting an initial operation when a current control element in an application program to be tested is triggered, starting exploration operation on the UI page of a user interface to which the current control element belongs, taking the current control element as a root node of the target exploration tree, taking the root node as a current node of a current layer in the target exploration tree, and taking the UI page as a current UI page;
the execution unit is used for executing corresponding exploration actions on the current node and obtaining action execution results; the action execution result at least comprises a screenshot of the current node after the corresponding exploring action is executed;
if the current node is successfully jumped to the next UI page after the corresponding exploration action is executed, traversing control elements in the next UI page, taking the traversed control elements as child nodes of the current node, wherein the child nodes are positioned at the next layer of the current layer in the target exploration tree, taking the next layer of the current layer in the target exploration tree as the current layer, taking the child nodes of the current node as the current nodes of the current layer in the target exploration tree, taking the next UI page as the current UI page, and executing the corresponding exploration action on the current node;
If the current node fails to jump after the corresponding exploring action is executed, other control elements which are not executed with the exploring action in the current UI page are used as the current node of the current layer, and the corresponding exploring action is executed for the current node.
7. The apparatus of claim 6, wherein the device comprises a plurality of sensors,
the Start operation is triggered by an externally input instruction.
8. The apparatus of claim 6, wherein the execution unit is specifically configured to:
checking whether the current node is configured into a state to be corrected or not, wherein the state to be corrected is used for indicating the current node to execute corresponding correction actions, and the correction actions are different from exploring actions corresponding to the current node;
if yes, executing corresponding corrective action on the current node;
and if not, executing corresponding exploring actions on the current node.
9. The apparatus of claim 6, wherein the current node of the current layer is selected according to a target control element sequence corresponding to a current UI page, and wherein the target control element sequence corresponding to the current UI page is determined by:
storing all control elements in the current UI page into a first control element sequence;
Deleting the control elements with repeated UI page identifications from the first control element sequence based on the UI page identifications of the control elements which are configured in advance so as to obtain a second control element sequence; the UI page identifier is used for indicating a UI page to which the control element jumps after corresponding exploration actions are executed;
deleting preset control elements containing specific information from the second control element sequence to obtain a third control element sequence;
and sorting the control elements in the third control element sequence according to the configured traversal depth of each control element so as to obtain a target control element sequence corresponding to the current UI page.
10. The apparatus of claim 6, wherein the execution unit is further to:
if the control elements which are not executed with the exploration actions do not exist in the current UI page, returning to the UI page corresponding to the upper layer of the current layer in the target exploration tree, taking the UI page corresponding to the upper layer of the current layer as the current UI page, taking the upper layer of the current layer as the current layer, taking other control elements which are not executed with the exploration actions in the current UI page as the current node of the current layer, and executing the corresponding exploration actions on the current node until the returned UI page is the UI page which the root node belongs to.
CN202311429285.6A 2023-10-30 2023-10-30 User page testing method and device Pending CN117349178A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311429285.6A CN117349178A (en) 2023-10-30 2023-10-30 User page testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311429285.6A CN117349178A (en) 2023-10-30 2023-10-30 User page testing method and device

Publications (1)

Publication Number Publication Date
CN117349178A true CN117349178A (en) 2024-01-05

Family

ID=89370897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311429285.6A Pending CN117349178A (en) 2023-10-30 2023-10-30 User page testing method and device

Country Status (1)

Country Link
CN (1) CN117349178A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012155147A2 (en) * 2011-05-12 2012-11-15 Webtrends, Inc. Graphical-user-interface-based method and system for designing and configuring web-site testing and analysis
CN109086203A (en) * 2018-07-20 2018-12-25 百度在线网络技术(北京)有限公司 The detection method and device of the page
CN110737578A (en) * 2018-07-20 2020-01-31 北京奇虎科技有限公司 test application method and device
CN111290940A (en) * 2018-12-10 2020-06-16 中国移动通信集团江西有限公司 Automatic testing method, device, equipment and medium for APP
CN114625658A (en) * 2022-03-22 2022-06-14 中国平安人寿保险股份有限公司 APP stability test method, device, equipment and computer readable storage medium
CN114996156A (en) * 2022-06-24 2022-09-02 拉扎斯网络科技(上海)有限公司 Method and device for testing small program, electronic equipment and readable storage medium
CN116048982A (en) * 2023-01-03 2023-05-02 深圳华为云计算技术有限公司 Page test method and device and computing device cluster
CN116302930A (en) * 2022-12-26 2023-06-23 中国工商银行股份有限公司 Application testing method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012155147A2 (en) * 2011-05-12 2012-11-15 Webtrends, Inc. Graphical-user-interface-based method and system for designing and configuring web-site testing and analysis
CN109086203A (en) * 2018-07-20 2018-12-25 百度在线网络技术(北京)有限公司 The detection method and device of the page
CN110737578A (en) * 2018-07-20 2020-01-31 北京奇虎科技有限公司 test application method and device
CN111290940A (en) * 2018-12-10 2020-06-16 中国移动通信集团江西有限公司 Automatic testing method, device, equipment and medium for APP
CN114625658A (en) * 2022-03-22 2022-06-14 中国平安人寿保险股份有限公司 APP stability test method, device, equipment and computer readable storage medium
CN114996156A (en) * 2022-06-24 2022-09-02 拉扎斯网络科技(上海)有限公司 Method and device for testing small program, electronic equipment and readable storage medium
CN116302930A (en) * 2022-12-26 2023-06-23 中国工商银行股份有限公司 Application testing method and device
CN116048982A (en) * 2023-01-03 2023-05-02 深圳华为云计算技术有限公司 Page test method and device and computing device cluster

Similar Documents

Publication Publication Date Title
CN107622008B (en) Traversal method and device for application page
US9760347B2 (en) Method and system to identify GUI objects for non-markup-language-presented applications
CN111818123B (en) Network front-end remote playback method, device, equipment and storage medium
CN110221959B (en) Application program testing method, device and computer readable medium
US20160283357A1 (en) Call stack relationship acquiring method and apparatus
CN105630686A (en) Traversal testing method and device for applications and mobile terminal
CN107133165B (en) Browser compatibility detection method and device
CN107066519B (en) Task detection method and device
CN104166619A (en) Performance measuring method and terminal of application program
CN110554962A (en) Regression testing process covering method, server and computer readable storage medium
CN108399125B (en) Automatic testing method and device, computer equipment and storage medium
EP2951680B1 (en) Acquiring identification of an application lifecycle management entity associated with similar code
CN113065300A (en) Method, system and device for backtracking simulation waveform in chip EDA (electronic design automation) simulation
CN108509348A (en) A kind of test method and mobile terminal of system aging
CN111782328A (en) Application processing method and device
CN112783764B (en) Automatic testing method and device for application program, storage medium and terminal
CN107341100A (en) The collocation method and device of camera parameter
CN109558307B (en) Game program testing method and system
CN109684213A (en) A kind of test method, device and storage medium
CN106897224B (en) Method and device for determining software testing range
CN113312322A (en) STDF file reading and writing method, medium, equipment and device
CN117349178A (en) User page testing method and device
CN114238119A (en) Automatic testing method and system for android application and storage medium
CN113987378A (en) Page rendering time duration monitoring method and device, electronic equipment and storage medium
CN104239199A (en) Virtual robot generation method, automatic test method and related device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination