WO2018082462A1 - 应用界面遍历方法、系统和测试设备 - Google Patents

应用界面遍历方法、系统和测试设备 Download PDF

Info

Publication number
WO2018082462A1
WO2018082462A1 PCT/CN2017/107288 CN2017107288W WO2018082462A1 WO 2018082462 A1 WO2018082462 A1 WO 2018082462A1 CN 2017107288 W CN2017107288 W CN 2017107288W WO 2018082462 A1 WO2018082462 A1 WO 2018082462A1
Authority
WO
WIPO (PCT)
Prior art keywords
interface
control
target
target interface
traversed
Prior art date
Application number
PCT/CN2017/107288
Other languages
English (en)
French (fr)
Inventor
林晨
陈晓霞
黄永德
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2018082462A1 publication Critical patent/WO2018082462A1/zh
Priority to US16/358,774 priority Critical patent/US10990511B2/en

Links

Images

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
    • 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/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range

Definitions

  • the present application relates to the field of computer technology, and in particular to application interface traversal.
  • the embodiment of the present application provides an application interface traversal method, system, and test device, so as to solve the problem that the manual traversal of each application interface is prone to interface omission and low traversal efficiency.
  • an application interface traversal method including:
  • the entered interface is used as the target interface
  • the control, the sub-interface, and the parent interface of the target interface have all traversed, determine whether the target interface is the main interface, and if the target interface is the main interface, determine that the application interface traversal is completed;
  • the target interface is not the main interface, return to the upper level interface of the target interface, use the upper layer interface as the target interface, and execute a list of controls for obtaining the target interface.
  • the target interface has an untraversed control, a sub-interface, or a parent interface
  • entering an interface corresponding to the untraversed control and corresponding to the untraversed sub-interface including:
  • the obtaining a list of controls of the target interface includes:
  • a list of controls corresponding to the target interface is extracted from the preset database, and when the target interface is an interface that has not been traversed, the list of controls obtained by processing the target interface is obtained.
  • the control list of the target interface is extracted from the preset database, when the target interface is an interface that has not been traversed.
  • the list of controls that will be processed by the target interface is used as a list of controls for the target interface, including:
  • the preset database extracts the A list of controls of the target interface, the control list is used as a control list of the target interface. If the target interface is an interface that has not been traversed, the target interface is processed, and the obtained control list is used as a control list of the target interface. Store the list of controls in the default database.
  • the target interface is processed to obtain a control list of the target interface, including:
  • the target interface is tested using the UiAutomator test framework to obtain a list of controls that match the target interface;
  • the target interface is an interface that has been traversed, including:
  • Traversing the list of controls obtained by testing the target interface obtaining a valid control of the target interface, extracting coordinate values of each valid control, generating a string according to the coordinate values of the valid controls; determining whether the character has been traversed in the interface list The string, if yes, indicates that the target interface is an interface that has been traversed; otherwise, the target interface is an interface that has not been traversed.
  • the UiAutomator test framework is used to test the target interface, and a list of controls matching the target interface is obtained, including:
  • control list includes a static control sublist and a dynamic control sublist
  • the process of obtaining the dynamic control sublist is:
  • the UiAutomator test framework is used to detect and add controls from each display interface to the dynamic control sublist.
  • control motion control moves according to a preset rule to obtain a plurality of consecutive display interfaces under the target interface, including:
  • the motion control when the motion control is located at the initial position, the first control in the display interface corresponding to the motion control is recorded as the reference control of the current display interface, and the last control is used as the tail control of the current display interface; the tail of the previous display interface The control is located in the next display interface, and the tail control of the previous display interface serves as a reference control for the next display interface.
  • the determining whether the control of the target interface has been traversed all comprises:
  • the two interfaces are mutually similar interfaces.
  • the implementation method can make the same effective control in the multiple interfaces of the mutual class interface only need to be traversed once, thereby avoiding the situation that all the effective controls in the multiple interfaces of the mutual class interface need to be traversed, thereby shortening the situation.
  • the interface traversal time of the application under test can make the same effective control in the multiple interfaces of the mutual class interface only need to be traversed once, thereby avoiding the situation that all the effective controls in the multiple interfaces of the mutual class interface need to be traversed, thereby shortening the situation.
  • the method further includes:
  • a jump relationship between the untraversed control and the interface corresponding to the untraversed control is stored.
  • the application provides an application interface traversal system, including:
  • a control list obtaining unit configured to: when the trigger signal is obtained, calibrate the current interface of the currently tested application as a target interface, obtain a control list of the target interface, and output a trigger signal to the first determining unit;
  • the first determining unit is configured to: when the trigger signal output by the control list obtaining unit is obtained, determine whether the target interface has an untraversed control, a sub-interface, or a parent interface, and if yes, enter the control list and the traversal is not traversed.
  • the corresponding interface of the control entering the untraversed sub-interface or the untraversed parent interface, obtaining a trigger signal outputted by the unit to the control list, and if not, outputting the trigger signal to the second determining unit;
  • a second determining unit configured to determine whether the target interface is a main interface after obtaining the trigger signal, and if yes, determine that the application interface traversal is completed, and if not, return to the upper level interface of the target interface, where the upper layer is A layer interface is used as a target interface, and a trigger signal is outputted to the control list acquisition unit.
  • the first determining unit includes:
  • the control judging unit is configured to: when the target interface has an untraversed control, trigger the untraversed control, enter an interface corresponding to the untraversed control, and output a trigger signal to the control list obtaining unit, when the target interface exists When the control is not traversed, the trigger signal is output to the sub-interface judgment unit;
  • the sub-interface judging unit is configured to enter the untraversed sub-interface when the target interface has an untraversed sub-interface, and output a trigger signal to the control list obtaining unit, where the target interface does not have an untraversed control and does not exist When the sub-interface is not traversed, the trigger signal is output to the parent interface judgment unit;
  • the parent interface determining unit is configured to enter the untraversed parent interface when the target interface has an untraversed parent interface, and output a trigger signal to the control list obtaining unit, when it is determined that the target interface does not have a parent interface that is not traversed Judgment
  • the control, the sub-interface, and the parent interface of the target interface are all traversed, and a trigger signal is output to the second determining unit.
  • control list obtaining unit includes:
  • a new interface determining unit configured to: when the target interface is an traversed interface, extract a list of controls from the target interface, and when the target interface is an untraversed interface, the target interface is The list of controls processed is used as a list of controls for the target interface.
  • the new interface determining unit is specifically configured to:
  • Processing the target interface to obtain a control list of the target interface and determining, according to the control list, whether the target interface is an traversed interface, and when the target interface is an traversed interface, extracted from a preset database
  • the control list corresponding to the target interface, the control list extracted by the preset database is used as a control list of the target interface, and if the target interface is an interface that has not been traversed, the control list obtained by processing the target interface is obtained.
  • the control list is stored in the preset database.
  • the new interface determining unit includes:
  • the sub-new interface judging unit is configured to traverse the control list obtained by testing the target interface, obtain a valid control of the target interface, extract coordinate values of each valid control, generate a character string according to the coordinate values of the valid controls, and determine that the Traversing the interface list to see whether the string exists. If yes, it indicates that the target interface is an interface that has been traversed. Otherwise, it indicates that the target interface is an interface that has not been traversed.
  • control list includes a static control sublist and a dynamic control sublist, where the static control sublist is used to store a static control at the same level as the motion control, and the dynamic control sublist is used for A control that controls a display state controlled by a motion control, the control list obtaining unit, further includes:
  • a dynamic control sub-list collecting unit configured to control the motion control to move according to a preset rule to obtain a plurality of consecutive display interfaces under the target interface; control the UiAutomator test frame detection and add the control in each display interface to the Dynamic control sublist.
  • the dynamic control sub-list collection unit includes:
  • a dynamic control unit for controlling the motion control to move from the initial position according to a preset rule to obtain a plurality of consecutive display interfaces corresponding to the motion control under the target interface
  • the motion control when the motion control is in the initial position, the first control in the display interface corresponding to the motion control is recorded as the reference control of the current display interface, and the last control is used as the tail control of the current display interface; the tail control of the previous display interface is located In the next display interface, the tail control of the previous display interface serves as a reference control for the next display interface.
  • the method further includes:
  • the class interface determining unit is configured to obtain a valid control of the target interface, and determine, according to the effective control of the target interface and the effective control of the traversed interface, whether the interface of the target interface exists in the traversed interface, and if so, obtain the A valid control that has been traversed in the class interface; the target interface has a valid control that has been traversed in the interface The same valid control is marked as having traversed the control, and according to the markup result obtained in the foregoing, it is judged whether the effective control of the target interface has been traversed all;
  • the two interfaces are mutually similar interfaces.
  • the method further includes:
  • the jump relationship extracting unit is configured to store a jump relationship between the untraversed control and the interface that does not traverse the corresponding time when entering an interface corresponding to the untraversed control.
  • the application provides a testing device, including any one of the application interface traversal systems of the second aspect.
  • the method includes:
  • the application under test is the currently launched application of the test terminal connected to the test device.
  • the method includes:
  • the application interface traverses the system, and is further configured to store the saved data information to the test terminal connected to the test device.
  • the application provides an application interface traversal device, the device including a processor and a memory:
  • the memory is configured to store program code and transmit the program code to the processor
  • the processor is operative to perform any of the application interface traversal methods of the first aspect in accordance with instructions in the program code.
  • the present application provides a storage medium for storing program code for performing any of the application interface traversal methods of the first aspect.
  • the present application provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform any of the application interface traversal methods of the first aspect.
  • the application provides an application interface traversal method, including:
  • the intelligent processing device uses the entered interface as the target interface
  • the smart processing device acquires a control list of the target interface.
  • the target interface has an untraversed control, a sub-interface, or a parent interface
  • the smart processing device enters an interface corresponding to the untraversed control, the untraversed sub-interface, or The untraversed parent interface;
  • the intelligent processing device determines whether the target interface is the main interface. If the target interface is the main interface, the intelligent processing device determines that the application interface traversal is completed.
  • the intelligent processing device returns the upper level interface of the target interface, uses the upper layer interface as the target interface, and executes the control list for acquiring the target interface.
  • the smart processing device when the target interface has an untraversed control, a sub-interface, or a parent interface, the smart processing device enters an interface corresponding to the untraversed control, and the un-traversed child
  • the interface corresponding to the control corresponding to the interface or the parent interface that is not traversed includes:
  • the intelligent processing device determines whether the control of the target interface has been traversed. If the determination result is no, the intelligent processing device triggers the untraversed control and enters an interface corresponding to the untraversed control. If the determination result is yes, The intelligent processing device determines whether the target interface has an untraversed sub-interface. If yes, the intelligent processing device enters the untraversed sub-interface. If not, the intelligent processing device determines whether the target interface has an untraversed parent interface. If present, the intelligent processing device enters the untraversed parent interface. If not, the smart processing device determines that the target interface does not have an untraversed control, sub-interface or parent interface.
  • the obtaining a control list of the target interface includes:
  • the intelligent processing device When the target interface is an interface that has been traversed, the intelligent processing device extracts a control list corresponding to the target interface from a preset database, and when the target interface is an interface that has not been traversed, the intelligent processing device will The list of controls processed by the target interface is used as a list of controls for the target interface.
  • the intelligent processing device when the target interface is an interface that has been traversed, extracts a control list with the target interface from a preset database, where the target interface is not traversed. When the interface is over, the smart processing device will process the control list obtained by processing the target interface as a control list of the target interface, including:
  • the intelligent processing device processes the target interface to obtain a control list of the target interface, and determines, according to the control list, whether the target interface is an traversed interface, and when the target interface is an traversed interface, the intelligent processing The device extracts the control list of the target interface from the preset database, and uses the control list as a control list of the target interface. If the target interface is an interface that has not been traversed, the intelligent processing device processes the target interface. The obtained control list is used as a control list of the target interface, and the control list is stored in the preset database.
  • the smart processing device processes the target interface to obtain a control list of the target interface, including:
  • the intelligent processing device uses the UiAutomator test framework to test the target interface, and obtains a list of controls that match the target interface;
  • the target interface is an interface that has been traversed, including:
  • the intelligent processing device traverses the control list obtained by testing the target interface, obtains a valid control of the target interface, extracts coordinate values of each valid control, and generates a character string according to coordinate values of the valid controls; the intelligent processing device determines that Traversing the interface list to see whether the string exists. If yes, it indicates that the target interface is an interface that has been traversed. Otherwise, the target interface is an interface that has not been traversed.
  • the smart processing device uses the UiAutomator test framework to test the target interface, and obtains a list of controls that match the target interface, including:
  • the intelligent processing device obtains a list of controls obtained by testing the target interface by using a UiAutomator test framework, where the control list includes a static control sublist and a dynamic control sublist;
  • the process of obtaining the dynamic control sublist is:
  • the intelligent processing device controls the motion control to move according to a preset rule to obtain a plurality of consecutive display interfaces under the target interface;
  • the intelligent processing device uses the UiAutomator test framework to detect and add controls in each display interface to the dynamic control sublist.
  • the smart processing device controls the motion control to move according to the preset rule to obtain a plurality of consecutive display interfaces under the target interface, including:
  • the intelligent processing device controls the motion control to move from the initial position according to a preset rule to obtain a plurality of consecutive display interfaces corresponding to the motion control under the target interface;
  • the motion control when the motion control is located at the initial position, the first control in the display interface corresponding to the motion control is recorded as the reference control of the current display interface, and the last control is used as the tail control of the current display interface; the tail of the previous display interface The control is located in the next display interface, and the tail control of the previous display interface serves as a reference control for the next display interface.
  • the smart processing device determines whether the control of the target interface has been traversed, including:
  • the smart processing device obtains a control list of the target interface, and determines, according to the control list of the target interface and the control list of the traversed interface, whether the interface of the target interface exists in the traversed interface, and if yes, the intelligent processing device acquires Valid controls that have been traversed in this type of interface;
  • the intelligent processing device marks the valid control in the control list of the target interface that is the same as the valid control that has been traversed in the interface as the traversed control, and determines whether the effective control of the target interface has been traversed according to the previously obtained marking result. ;
  • the two interfaces are mutually similar interfaces.
  • the method further includes:
  • the smart processing device marks the untraversed control as having traversed the control in the list of controls
  • the intelligent processing device stores a jump relationship between the untraversed control and an interface corresponding to the untraversed control.
  • the application provides a test device, including any of the above application interface traversal systems.
  • the traversal method provided by the embodiment of the present application enters the tested application, uses the entered interface as a target interface, obtains a control list of the target interface, and determines whether the target interface has an untraversed control, a sub-interface, or a parent interface.
  • the target interface is the main interface
  • the control, the sub-interface, and the parent interface of the target interface are all traversed
  • the application can automatically traverse the interfaces of the tested application without any interface omission, and the user only needs to view the display content of each interface traversed, thereby improving the traversal efficiency.
  • FIG. 1 is a schematic diagram of a hardware architecture disclosed in an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of an application interface traversal method disclosed in an embodiment of the present application
  • FIG. 3 is a schematic flowchart of an application interface traversal method according to another embodiment of the present disclosure.
  • FIG. 4 is a schematic flowchart of determining whether a target interface has an untraversed control, a sub-interface, and a parent interface according to an embodiment of the present disclosure
  • FIG. 5 is a schematic diagram of a process for obtaining a list of controls for a current sale according to an embodiment of the present disclosure
  • FIG. 6 is a schematic diagram of a process for obtaining a dynamic control sublist according to an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an application interface traversal system according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of a server according to an embodiment of the present application.
  • the application interface traversal mode provided by the embodiment of the present application does not require the user to manually view and test each application interface, but the device itself can detect the entered application as the target interface. Then, obtaining a control list of the target interface, and using the control list to determine whether the target interface has an untraversed control, a sub-interface, or a parent interface. If there is a control, a sub-interface, or a parent interface that is not traversed, the description is not yet All application interface traversal is completed, you need to go to these untraversed controls, sub-interfaces or parent interface to traverse. Wherein, whenever the target interface changes, the changed interface is used as the target interface.
  • the target interface When it is determined that the target interface does not have an untraversed control, a sub-interface or a parent interface, it is determined whether the target interface is the main interface. If the target interface is the main interface, it indicates that all the interfaces below the main interface level are traversed, and the application interface traversal is completed, thereby automatically traversing each interface of the tested application; and if the target interface is not the main interface, Then, the upper level interface of the target interface can be returned, the upper level interface is used as the target interface, and the control list of the target interface is re-acquired and the subsequent steps are performed until the target interface is determined as the main interface.
  • FIG. 1 is a schematic diagram of a hardware architecture of an embodiment of the present application.
  • the hardware architecture may include a memory 101, a processor 102, and a display 103.
  • the memory 101 can be used to store software programs and modules corresponding to the application interface traversal method in the embodiment of the present application.
  • the processor 102 can be used to traverse the interface of the tested application one by one by running a software program and a module stored in the memory 101.
  • the display 103 can be used to display the display content of the various interfaces traversed to the user.
  • FIG. 2 is a schematic flowchart of an application interface traversal method according to an embodiment of the present disclosure.
  • the method may be applied to an intelligent processing device, such as a mobile phone, a tablet computer, a notebook computer, and the like.
  • the method may include:
  • an interface of the tested application is first entered, wherein the interface may be any one of the default interfaces, for example, the currently open interface of the tested application.
  • the entered interface may be the main interface of the application under test.
  • the main interface of the tested application may enter the leaf interface (the bottom layer interface) of the tested application step by step according to the interface triggering sequence/hierarchical relationship of the tested application, and then the leaf interface. Traversing, when the leaf interface traversal is over, return to the previous interface.
  • the interface triggering sequence/hierarchy relationship of the tested application may refer to a preset triggering rule, for example, setting a priority according to a preset rule in a control, a sub-interface, and a parent interface in the same interface.
  • the definition of the sub-interface may be: an interface that appears later than the target interface and triggers the control to reach on the target interface during the traversal process, and the interface may be considered as a sub-interface of the target interface.
  • the definition of the parent interface may be: during the traversal process, the interface that appears earlier than the target interface and clicks on the target interface may be considered as the parent interface of the target interface, wherein one interface may correspond to multiple parents.
  • the interface for example, the interfaces A, B, and C can all enter the interface K1 through the trigger control, and the interfaces A, B, and C can all be the parent interfaces of the interface K1.
  • the traversal process it is necessary to traverse the multiple interfaces of the application under test.
  • the interface changes the changed interface can be used as the target interface, and the target interface can be analyzed and judged.
  • each new interface is traversed, a list of controls of the new interface is stored, wherein each control in each interface is stored in the control list. Since each valid control is triggered, it will enter an interface corresponding to the valid control. Therefore, in the list of controls storing the new interface, which controls in the interface are recorded as controls that have been traversed, and which controls are Controls that have not been traversed.
  • the target interface is an interface that has been traversed, it indicates that some controls, sub-interfaces, or parent interfaces in the target interface have been traversed, so a list of controls matching the target interface can be retrieved from the preset database. . If the target interface is a new interface (ie, an interface that has not been traversed before), the target interface is processed to obtain a control list of the target interface, and the control list is saved to the preset database.
  • the interface layout information and the screenshot of the target interface may be first retrieved, and the interface layout information and screenshots of the target interface are saved to the preset database, and further, The layout information and screenshots of each interface obtained by the call are presented to the user in the form of a structure tree, so that when the user wants to view the target interface, the user can more easily see the interface layout information and screenshot of the target interface.
  • the specific process of S203 may be: processing the target interface, obtaining a control list of the target interface, extracting feature information of the control list, according to characteristics of the control list
  • the information determines whether the target interface is an interface that has been traversed, and determines the target according to the feature information of the control list.
  • the control list corresponding to the target interface is extracted from the preset database, and the control list extracted by the preset database is used as the control list of the target interface, according to the control list.
  • the control list obtained by processing the target interface is used as a control list of the target interface, and the control list is stored in the preset database.
  • S204 Determine whether the target interface has an untraversed control, a sub-interface or a parent interface. If yes, execute S205. If the control, the sub-interface, and the parent interface of the target interface have all traversed, perform S206.
  • the condition for judging whether an interface is completely traversed is to determine whether the interface has an untraversed control, a sub-interface or a parent interface. If it exists, it indicates that the interface has not been traversed yet. You can check whether the control list is viewed by There are controls that are not traversed.
  • the control traversal identifier of the control is activated.
  • the control does not exist in the interface that is entered after the control is triggered, it indicates that the interface does not have the traversal control and the sub-interface, and then , will trigger the child interface traversal ID of the control.
  • the state of the control traversal identifier and the sub-interface traversal identifier corresponding to each control of the target interface it can be determined whether the target interface has an untraversed sub-interface and a control.
  • each sub-interface may correspond to at least one parent interface.
  • the parent-child relationship between the two interfaces is recorded, and the parent-child relationship is corresponding to the entered sub-interface, and the interface where the control is located is used as the sub-interface.
  • the parent interface if the control traversal identifier and the child interface traversal identifier of other controls in the parent interface are all activated, activate the parent interface traversal identifier corresponding to the parent-child relationship.
  • the parent-child relationship corresponding to the target interface is obtained, and it is determined whether there is a parent-child relationship in which the parent interface traversal identifier is not activated. If yes, it indicates that the target interface has a parent interface that is not traversed. If not, Indicates that the target interface does not have a parent interface that is not traversed.
  • S205 Enter an interface corresponding to the untraversed control, enter a sub-interface that is not traversed, or a parent interface that is not traversed, and execute S202.
  • each time the control, sub-interface or parent interface of the target interface is determined to be traversed it is necessary to determine whether the application interface is traversed.
  • the target interface is traversed by the underlying interface for the application to be tested. Therefore, whether the target interface is the main interface of the tested application determines whether all interfaces of the tested application are all All the traversal, if the target interface is the main interface, and the control, sub-interface and parent interface of the target interface are all traversed, it can be considered that all the interfaces below the main interface level are traversed, so that the interface traversal of the tested application can be determined. carry out.
  • the preset button of the device to be tested can be triggered to return to the upper layer interface of the target interface, and it is determined whether the returned upper layer interface is still the target interface, if still As the target interface, it indicates that the target interface is the main interface of the application under test.
  • the method returns to the interface A by triggering the preset button of the device to be loaded, for example, by returning the return button on the device of the application under test to return to the target interface.
  • a layer-level interface of course, if the target interface is the main interface, the returned upper-level interface is still the target interface. Therefore, referring to FIG. 3, between S207 and S202, the method may further include: S208: determining the previous one returned. Whether the layer interface is still the target interface. If yes, it is determined that the application interface traversal is completed. Otherwise, the returned upper layer interface is used as the target interface, and S202 is executed.
  • the traversal method after entering the tested application, uses the entered interface as a target interface, obtains a control list of the target interface, and determines whether the target interface has an untraversed control, a sub-interface, or a parent interface, if Exist, enter the interface corresponding to the untraversed control, enter the untraversed sub-interface or the untraversed parent interface; if the control, sub-interface and parent interface of the target interface have all traversed, determine whether the target interface is the main interface, and if so, Determining the completion of the application interface traversal, if not, returning to the upper level interface of the target interface, using the upper level interface as the target interface, and re-acquiring the control list of the target interface and performing subsequent steps until the target interface is determined interface.
  • the target interface is the main interface
  • the control, the sub-interface, and the parent interface of the target interface are all traversed, it can be considered that all the interfaces below the main interface level are traversed, thereby determining the interface traversal of the tested application.
  • the embodiment of the present application can automatically traverse each interface of the tested application without any interface omission, and the user only needs to view the display content of each interface traversed, thereby improving the traversal efficiency.
  • the determining when determining whether the target interface has an untraversed control, a sub-interface, or a parent interface, the determining may be performed according to a preset order, for example, determining whether the target interface has an untraversed sub-interface. Then, it is determined whether there is a parent interface that is not traversed, and finally, whether there is a control that is not traversed, and of course, other determination orders may be used.
  • the S203 and S204 may specifically include:
  • S2041 trigger a control that is not traversed, and enter an interface corresponding to the untraversed control
  • the S203 may specifically include:
  • the target interface is tested by using a UiAutomator test framework, and a list of controls matching the target interface is obtained.
  • the UiAutomator test framework is a JAVA class library, which includes some custom UI (user interface) function tests for automating and running the test case engine; in this step, the UiAutomator test framework pair is used.
  • the target interface is tested to obtain a list of controls of the target interface;
  • S2032 traverse the control list obtained by testing the target interface, and obtain a valid control of the target interface, where the effective control of the target interface is stored in the control list.
  • the effective control includes a clickable control static control, a dynamic control, and a text control;
  • S2033 Extract the coordinate values of each valid control, and generate a string according to the coordinate values of each valid control.
  • the coordinate value of each valid control can be extracted, and a string is generated according to all the extracted coordinate values.
  • the application may also first group the effective controls in the target interface, and divide the effective controls of the same type into the same group. Each group of valid controls only takes the coordinates of the first valid control in the group, and the The coordinate connection of a valid control grows a string, which is a simple layout string of the interface.
  • the simple layout string of the traversed interface is stored in the preset database, of course, for convenience
  • the simple layout string may be MD5 encoded first, and the MD5 value corresponding to the simple layout string is obtained, and the value is stored in the preset database;
  • the determining whether the string has been traversed in the interface list may be: determining whether the MD5 value is traversed in the interface list.
  • the character string (simple layout string) corresponding to the interface is stored in the preset database, and the method may be determined by querying whether the string exists in the preset database. Whether the target interface belongs to the traversed interface, if the string exists in the preset database, it may be determined that the target interface belongs to the traversed interface, and vice versa, if the string does not exist in the preset database, It can be determined that the target interface does not belong to the interface that has been traversed.
  • S2035 Extract a control list corresponding to the character string from a preset database, and use a control list extracted by the preset database as a control list of the target interface.
  • control list obtained through the UiAutomator test framework is used as a control list of the target interface, and the control list is stored in the preset database.
  • the control list when the target interface is tested by using the UiAutomator test framework, and the control list matching the target interface is obtained, the control list includes static composed of static controls.
  • the control sub-list also includes a dynamic control sub-list composed of dynamic controls, wherein the static control is a static control that can be seen by opening the interface for the first time, and the dynamic control is a control that needs to be sliding or other scrolling control.
  • the following focuses on the process of generating the dynamic control sublist, which is dynamic.
  • the generating process of the control sub-list may include: controlling the motion control to move from the initial position according to the preset rule to obtain a plurality of consecutive display interfaces under the target interface.
  • the UiAutomator test framework is used to detect and add controls in each display interface to the dynamic control sublist.
  • the continuous display interface may be continuously configured according to user requirements, and may be selected according to user requirements.
  • the continuous relationship between the successive display interfaces may be as follows: when the motion control is located at the initial position, the first control record in the display interface corresponding to the dynamic control For the reference control of the current display interface, the last control is used as the tail control of the current display interface; the tail control of the previous display interface is located in the next display interface, and the tail control of the previous display interface is used as the reference control of the next display interface.
  • the specific process of obtaining the dynamic control sublist may be as follows:
  • S601 setting a first screen corresponding to an initial position of the sliding control as a current display interface, and using a first control of the current display interface as a reference control;
  • the sliding control is moved according to the preset direction, and the moving distance is a distance between an upper boundary of a tail control of the current display interface and an upper boundary of the current display interface;
  • S606 Set the obtained display interface after the sliding control is set as the target interface, and use the tail control of the previous target interface as the reference control of the current display interface, and execute S503.
  • N is an empirical value, for example, it can be set to 2
  • N is an empirical value, for example, it can be set to 2
  • the interface corresponding to the control list and the target interface are mutually similar interfaces, and the valid control that has been traversed in the interface does not need to be traversed again in the target interface, and the control list of the target interface is The valid controls with the same valid controls that have been traversed in the interface are marked as traversing the control. If all the valid controls in the target interface are marked as traversing the control, it can be considered that all the effective controls of the target interface have been traversed. Otherwise, if there are valid controls in the target interface that are not marked as traversing the control, Then you can think that the effective controls of the target interface are not all traversed.
  • the above string or MD5 value may also be used for determining, for example, the character string corresponding to the target interface and the traversed
  • a string corresponding to an interface is compared, if the difference between the strings corresponding to the two interfaces is within the permitted range, it may be determined that the two interfaces are mutually similar interfaces, and for example, the target interface corresponds to
  • the MD5 value is compared with the MD5 value corresponding to an interface that has been traversed, if the difference between the MD5 values corresponding to the two interfaces is within the allowable range, it can be determined that the two interfaces are mutually similar interfaces.
  • the untriggered control when the untriggered control is triggered to enter a new interface, the untraversed control and the non-traversed need to be stored.
  • the control corresponds to the jump relationship between the interfaces.
  • the control list of the target interface is obtained, and according to the control list of the target interface and the control list of the traversed interface, it is determined whether the interface of the target interface exists in the traversed interface, and if yes, obtain the A valid control that has been traversed in the class interface, and marks the active control in the control list of the target interface that is the same as the valid control that has been traversed in the interface, as having traversed the control, and judges the target interface according to the previously obtained marked result. Whether the valid controls have been traversed all.
  • an application interface traversal system including:
  • the control list obtaining unit 100 is configured to calibrate the current interface of the currently tested application as a target interface, obtain a control list of the target interface, and output a trigger signal to the first determining unit;
  • the first determining unit 200 is configured to: when the trigger signal output by the control list obtaining unit is obtained, determine whether the target interface has an untraversed control, a sub-interface, or a parent interface, and if yes, enter the control list.
  • the traversing control corresponding interface entering the untraversed sub-interface or the untraversed parent interface, obtaining a trigger signal output by the unit to the control list, and if not, outputting the trigger signal to the second determining unit;
  • the second determining unit 300 is configured to determine whether the target interface is the main interface after obtaining the trigger signal, and if yes, determine that the application interface traversal is completed, and if not, return to the upper level interface of the target interface, and
  • the layer interface serves as a target interface, and outputs a trigger signal to the control list acquisition unit.
  • the above solution may further include a device selection unit to be tested, which may be used to select and enter the application to be tested, and when entering the application to be tested, may preferentially enter the main interface of the application under test, and when determining that the main interface is not traversed And the sub-interface, and then the main interface starts to follow the trigger sequence/hierarchical relationship of the interface of the tested application, and sequentially enters each of the tested applications. interface.
  • a device selection unit to be tested which may be used to select and enter the application to be tested, and when entering the application to be tested, may preferentially enter the main interface of the application under test, and when determining that the main interface is not traversed And the sub-interface, and then the main interface starts to follow the trigger sequence/hierarchical relationship of the interface of the tested application, and sequentially enters each of the tested applications. interface.
  • the first determining unit 200 includes:
  • a control determining unit configured to: when the target interface has an untraversed control, trigger the untraversed control, enter an interface corresponding to the untraversed control, and output a trigger signal to the control list obtaining unit, when the target When there is a control that is not traversed on the interface, the trigger signal is output to the sub-interface judgment unit;
  • the sub-interface judging unit is configured to enter the untraversed sub-interface when the target interface has an untraversed sub-interface, and output a trigger signal to the control list obtaining unit, when the target interface does not have an untraversed control and does not When there is a sub-interface that is not traversed, the trigger signal is output to the parent interface determining unit;
  • the parent interface determining unit is configured to enter the untraversed parent interface when the target interface has an untraversed parent interface, and output a trigger signal to the control list obtaining unit, when it is determined that the target interface does not have a parent interface that is not traversed And determining that the control, the sub-interface, and the parent interface of the target interface have all traversed, and outputting a trigger signal to the second determining unit.
  • control list obtaining unit 100 includes:
  • a new interface determining unit configured to: when the target interface is an traversed interface, extract a list of controls from the target interface, and when the target interface is an untraversed interface, the target interface is The list of controls processed is used as a list of controls for the target interface.
  • the new interface determining unit may be configured to: process the target interface, obtain a control list of the target interface, and determine, according to the control list, whether the target interface is an traversed interface, when the target When the interface is an interface that has been traversed, the control list with the target interface is extracted from the preset database, and the control list extracted by the preset database is used as the control list of the target interface, if the target interface is an interface that has not been traversed.
  • the control list obtained by processing the target interface is used as a control list of the target interface, and the control list is stored in the preset database.
  • the new interface determining unit includes:
  • the sub-new interface judging unit is configured to traverse the control list obtained by testing the target interface, obtain a valid control of the target interface, extract coordinate values of each valid control, generate a string according to coordinate values of each valid control, and determine that the interface has been traversed. Whether the string exists in the list. If yes, it indicates that the target interface is an interface that has been traversed. Otherwise, the target interface is an interface that has not been traversed.
  • control list includes a static control sublist and a dynamic control sublist
  • static control sublist is used to store a static control at the same level as the motion control
  • dynamic control sublist is used to store the display controlled by the motion control.
  • the state of the control, the control list gets the unit, including:
  • the dynamic control sub-list collecting unit is configured to control the motion control to move according to the preset rule to obtain a plurality of continuous display interfaces under the target interface; control the UiAutomator test frame detection and add the control in each display interface to the dynamic control sub- List.
  • the dynamic control sub-list collection unit includes:
  • a dynamic control unit for controlling the motion control to move from the initial position according to a preset rule to Obtaining a plurality of consecutive display interfaces corresponding to the motion control under the interface
  • the motion control when the motion control is in the initial position, the first control in the display interface corresponding to the motion control is recorded as the reference control of the current display interface, and the last control is used as the tail control of the current display interface; the tail control of the previous display interface is located In the next display interface, the tail control of the previous display interface serves as the reference control for the next display interface.
  • the system may further include: a class interface determining unit, configured to obtain an effective control of the target interface, and determine whether the target exists in the traversed interface according to the effective control of the target interface and the effective control of the traversed interface.
  • the interface interface of the interface if present, obtains a valid control that has been traversed in the interface; mark the effective control in the target interface that is the same as the valid control that has been traversed in the class interface as having traversed the control, according to the previously obtained markup As a result, it is judged whether the effective controls of the target interface have all traversed;
  • the two interfaces are mutually similar interfaces.
  • the above system may further include:
  • the jump relationship extracting unit is configured to store a jump relationship between the untraversed control and the interface that does not traverse the corresponding time when entering an interface corresponding to the untraversed control.
  • test device which can be a mobile phone, a computer, a PC, or the like to which any of the above interface traversal systems are applied.
  • the tested application may refer to a currently activated application of the test terminal connected to the test device.
  • the application interface traverses the system for storing the interface, and is also used to store the saved data information to
  • the test terminal connected to the test device includes the interface layout information of each interface traversed, the interface screenshot file, the control list, and the jump relationship between the control and the interface.
  • the embodiment of the present application further provides a server, as shown in FIG. 8, which may include:
  • the number of processors 801 in the browser server may be one or more, and one processor is taken as an example in FIG.
  • the processor 801, the memory 802, the input device 803, and the output device 804 may be connected by a bus or other means, and the input device 803 and the output device 804 may be interfaces of the communication module, such as an interface of the GSM module. .
  • the bus connection is taken as an example.
  • the memory 802 can be used to store software programs and modules, and the processor 801 executes various functional applications and data processing of the browser server by running software programs and modules stored in the memory 802.
  • the memory 802 can mainly include a storage program area and a storage data area, wherein the storage program area can store an operating system, an application required for at least one function, and the like.
  • memory 802 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • Input device 803 can be used to receive input numeric or character information and to generate key signal inputs related to user settings and function controls of the browser server.
  • the processor 801 loads the executable file corresponding to the process of one or more applications into the memory 802 according to the following instructions, and is executed by the processor 801 to be stored in the memory 802.
  • the application to implement various functions:
  • the entered interface is used as the target interface
  • the control, the sub-interface, and the parent interface of the target interface have all traversed, determine whether the target interface is the main interface, and if the target interface is the main interface, determine that the application interface traversal is completed;
  • the target interface is not the main interface, return to the upper level interface of the target interface, use the upper layer interface as the target interface, and execute the control list for obtaining the target interface.
  • the target interface has an untraversed control, a sub-interface, or a parent interface
  • obtain a list of controls of the target interface including:
  • a list of controls corresponding to the target interface is extracted from the preset database, and when the target interface is an interface that has not been traversed, the list of controls obtained by processing the target interface is obtained.
  • the control list of the target interface is extracted from the preset database, and when the target interface is an interface that has not been traversed, the target interface is processed.
  • the list of controls serves as a list of controls for the target interface, including:
  • the preset database extracts the A list of controls of the target interface, the control list is used as a control list of the target interface. If the target interface is an interface that has not been traversed, the target interface is processed, and the obtained control list is used as a control list of the target interface. Store the list of controls in the default database.
  • processing the target interface to obtain a list of controls of the target interface including:
  • the target interface is tested using the UiAutomator test framework to obtain a list of controls that match the target interface;
  • the target interface is an interface that has been traversed, including:
  • the target interface is tested by using the UiAutomator test framework, and a list of controls matching the target interface is obtained, including:
  • control list includes a static control sublist and a dynamic control sublist
  • the process of obtaining the dynamic control sublist is:
  • the UiAutomator test framework is used to detect and add controls from each display interface to the dynamic control sublist.
  • control motion control moves according to the preset rule to obtain a plurality of consecutive display interfaces under the target interface, including:
  • the motion control when the motion control is located at the initial position, the first control in the display interface corresponding to the motion control is recorded as the reference control of the current display interface, and the last control is used as the tail control of the current display interface; the tail of the previous display interface The control is located in the next display interface, and the tail control of the previous display interface serves as a reference control for the next display interface.
  • control of the target interface including:
  • the two interfaces are mutually similar interfaces.
  • the method further includes:
  • a jump relationship between the untraversed control and the interface corresponding to the untraversed control is stored.
  • the embodiment of the present application further provides a storage medium for storing program code, which is used to execute any one of the application interface traversal methods described in the foregoing various embodiments.
  • the embodiment of the present application further provides a computer program product comprising instructions, when executed on a computer, causing the computer to execute any one of the application interface traversal methods described in the foregoing various embodiments.
  • the steps of a method or algorithm described in connection with the embodiments disclosed herein can be implemented directly in hardware, a software module executed by a processor, or a combination of both.
  • the software module can be placed in random access memory (RAM), memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or technical field. Any other form of storage medium known.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

本申请提供一种应用界面遍历方法、系统和测试设备,方法通过将每次进入的界面作为目标界面,获取目标界面的控件列表,判断目标界面是否存在未遍历的控件、子界面或父界面,如果存在,进入未遍历的控件对应的界面、进入未遍历的子界面或未遍历的父界面;若目标界面的控件、子界面和父界面已全部遍历,判断目标界面是否为主界面,如果是,确定应用界面遍历完成,如果否,由当返回目标界面的上一层级界面,将上一层界面作为目标界面,并执行获取所述目标界面的控件列表。实现了自动遍历被测试应用的各个界面,不会出现界面遗漏,并且用户只需对遍历到的各个界面的显示内容进行查看即可,提高了遍历效率。

Description

应用界面遍历方法、系统和测试设备
本申请要求于2016年11月01日提交中国专利局、申请号为201610942112.8、申请名称为“一种应用界面遍历方法、系统和测试设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,具体涉及应用界面遍历。
背景技术
在一款应用软件进行正式发布之前,需要遍历该应用的每一个界面,以检查不同语言下界面显示的正确性。
现有的技术方案通常采用人工的方式对被测应用的每一个界面进行遍历。由于语言种类以及被测试应用的界面数量繁多,导致该界面遍历过程过于繁琐。并且在该界面遍历过程中,需要用户手动对各个应用界面进行查看和测试,而由于每个界面可能会关联多个子界面,因此用户无法保证每一次遍历的界面均为新的界面、没有因遗漏导致未遍历的界面。可见,人工操作的方式容易造成在遍历界面的过程中遗漏界面,且工作量大、效率低的问题。
发明内容
有鉴于此,本申请实施例提供一种应用界面遍历方法、系统和测试设备,以解决止人工遍历各个应用界面容易出现界面遗漏、遍历效率低的问题。
为实现上述目的,第一方面,本申请提供了一种应用界面遍历方法,包括:
当进入所述被测应用的一个界面时,将进入的界面作为目标界面;
获取该目标界面的控件列表,当该目标界面存在未遍历的控件、子界面或父界面时,进入该未遍历的控件对应的界面、该未遍历的子界面或该未遍历的父界面;
当该目标界面的控件、子界面和父界面已全部遍历时,判断该目标界面是否为主界面,若该目标界面为主界面,则确定应用界面遍历完成;
若该目标界面不是主界面,则返回该目标界面的上一层级界面,将该上一层界面作为目标界面,并执行获取目标界面的控件列表。
在第一方面的一种可能的实现方式中,该当该目标界面存在未遍历的控件、子界面或父界面时,进入该未遍历的控件对应的界面、与该未遍历的子界面相对应的控件所对应的界面或该未遍历的父界面,包括:
判断该目标界面的控件是否已全部遍历,如果判断结果为否,则触发未遍历的控件,进入与该未遍历的控件相对应的界面,如果判断结果为是,判断该目标界面是否存在未遍历的子界面,如果存在,进入该未遍历的子界面,如果不存在,判断该目标界面是否存在未遍历的父界面,如果存在,进入该未遍历的父界面,如果不存在,则判定该目标界面不存在未遍历的控件、子界面或父界面。
在第一方面的一种可能的实现方式中,该获取该目标界面的控件列表,包括:
当该目标界面为已遍历过的界面时,由预设数据库中提取与该目标界面对应的控件列表,当该目标界面为未遍历过的界面时,将对该目标界面进行处理得到的控件列表作为该目标界面的控件列表。
在第一方面的一种可能的实现方式中,该当该目标界面为已遍历过的界面时,由预设数据库中提取与该目标界面的控件列表,当该目标界面为未遍历过的界面时,将对该目标界面进行处理得到的控件列表作为目标界面的控件列表,包括:
对该目标界面进行处理,得到该目标界面的控件列表,依据该控件列表判断该目标界面是否是已遍历过的界面,当该目标界面为已遍历过的界面时,由预设数据库中提取该目标界面的控件列表,将该控件列表作为该目标界面的控件列表,如果该目标界面为未遍历过的界面时,将对该目标界面进行处理,得到的控件列表作为该目标界面的控件列表,将该控件列表存储至该预设数据库中。
在第一方面的一种可能的实现方式中,该对该目标界面进行处理,得到该目标界面的控件列表,包括:
采用UiAutomator测试框架对该目标界面进行测试,得到与该目标界面相匹配的控件列表;
该依据该控件列表判断该目标界面是否是已遍历过的界面,包括:
遍历对该目标界面进行测试得到的控件列表,得到该目标界面的有效控件,提取各个有效控件的坐标值,依据该各个有效控件的坐标值生成字符串;判断已遍历界面列表中是否存在该字符串,如果是,表明该目标界面为已遍历过的界面,否则,表明目标界面为未遍历过的界面。
在第一方面的一种可能的实现方式中,该采用UiAutomator测试框架对该目标界面进行测试,得到与该目标界面相匹配的控件列表,包括:
获取采用UiAutomator测试框架对该目标界面进行测试后得到的控件列表,该控件列表中包括静态控件子列表和动态控件子列表;
该动态控件子列表的获取过程为:
控制运动控件依据预设规则运动,以在该目标界面下得到多个连续的显示界面;
采用该UiAutomator测试框架检测并将每个显示界面中的控件加入动态控件子列表。
在第一方面的一种可能的实现方式中,该控制运动控件依据预设规则运动,以在该目标界面下得到多个连续的显示界面,包括:
控制运动控件由初始位置处依据预设规则运动,以在该目标界面下得到与该运动控件相对应的多个连续的显示界面;
其中,该运动控件位于该初始位置时,该运动控件对应的显示界面中的首个控件记为当前显示界面的参照控件,最后一个控件作为该当前显示界面的尾控件;上一个显示界面的尾控件位于下一个显示界面中,且该上一个显示界面的尾控件作为下一个显示界面的参照控件。
在第一方面的一种可能的实现方式中,该判断该目标界面的控件是否已全部遍历,包括:
获取该目标界面的控件列表,依据该目标界面的控件列表和已遍历界面的控件列表,判断已遍历的界面中是否存在该目标界面的类界面,如果存在,获取该类界面中已遍历过的有效控件;
将该目标界面的控件列表中与该类界面中已遍历过的有效控件相同的有效控件标记为已遍历控件,根据前面得到的标记结果判断该目标界面的有效控件是否已全部遍历;
其中,如果两个界面具有N个不同的有效控件,且该N在许可范围之内,则这两个界面互为类界面。
该实现方式可以使得互为类界面的多个界面中的同一个有效控件只需要遍历一次,避免了互为类界面的多个界面中的所有有效控件都需要被遍历的情况发生,从而缩短了被测应用的界面遍历时间。
在第一方面的一种可能的实现方式中,在该进入未遍历的控件对应的界面之后,还包括:
在该控件列表中将该未遍历的控件标记为已遍历控件;
存储该未遍历的控件与该未遍历的控件对应的界面之间的跳转关系。
第二方面,本申请提供了一种应用界面遍历系统,包括:
控件列表获取单元,用于当获取到触发信号时,将当前被测应用的当前界面标定为目标界面,获取该目标界面的控件列表,向第一判断单元输出触发信号;
该第一判断单元,用于获取到所述控件列表获取单元输出的触发信号时,判断该目标界面是否存在未遍历的控件、子界面或父界面,如果存在,进入该控件列表中该未遍历的控件对应的界面、进入该未遍历的子界面或该未遍历的父界面,向该控件列表获取该单元输出的触发信号,如果不存在,向第二判断单元输出该触发信号;
第二判断单元,用于当获取到该触发信号后,判断该目标界面是否为主界面,如果是,确定应用界面遍历完成,如果否,返回该目标界面的上一层级界面,将所述上一层界面作为目标界面,并向所述控件列表获取单元输出触发信号。
在第二方面的一种可能的实现方式中,该第一判断单元包括:
控件判断单元,用于当该目标界面存在未遍历的控件时,触发该未遍历的控件,进入与该未遍历的控件相对应的界面,向控件列表获取单元输出触发信号,当该目标界面存在未遍历的控件时,向子界面判断单元输出触发信号;
该子界面判断单元,用于当该目标界面存在未遍历的子界面时,进入该未遍历的子界面,向控件列表获取单元输出触发信号,当该目标界面不存在未遍历的控件且不存在未遍历的子界面时,向父界面判断单元输出触发信号;
该父界面判断单元,用于当该目标界面存在未遍历的父界面时,进入该未遍历的父界面,向控件列表获取单元输出触发信号,当确定该目标界面不存在未遍历的父界面时,判 定该目标界面的控件、子界面和父界面已全部遍历,向该第二判断单元输出触发信号。
在第二方面的一种可能的实现方式中,该控件列表获取单元,包括:
新界面判断单元,用于当该目标界面为已遍历过的界面时,由预设数据库中提取与该目标界面的控件列表,当该目标界面为未遍历过的界面时,将对该目标界面进行处理得到的控件列表作为该目标界面的控件列表。
在第二方面的一种可能的实现方式中,该新界面判断单元,具体被配置为:
对该目标界面进行处理,得到该目标界面的控件列表,依据该控件列表判断该目标界面是否是已遍历过的界面,当该目标界面为已遍历过的界面时,由预设数据库中提取与该目标界面对应的控件列表,将由预设数据库提取得到的该控件列表作为该目标界面的控件列表,如果该目标界面为未遍历过的界面时,将对该目标界面进行处理得到的该控件列表作为该目标界面的控件列表,将该控件列表存储至该预设数据库中。
在第二方面的一种可能的实现方式中,该新界面判断单元,包括:
UiAutomator测试框架,用于对该目标界面进行测试,得到与该目标界面相匹配的控件列表;
子新界面判断单元,用于遍历对该目标界面进行测试得到的控件列表,得到该目标界面的有效控件,提取各个有效控件的坐标值,依据该各个有效控件的坐标值生成字符串,判断已遍历界面列表中是否存在该字符串,如果是,表明该目标界面为已遍历过的界面,否则,表明该目标界面为未遍历过的界面。
在第二方面的一种可能的实现方式中,控件列表包括静态控件子列表和动态控件子列表,该静态控件子列表用于存储与运动控件同一层级的静态控件,该动态控件子列表用于存储受运动控件控制显示状态的控件,该控件列表获取单元,还包括:
动态控件子列表采集单元,用于控制该运动控件依据预设规则运动,以在该目标界面下得到多个连续的显示界面;控制该UiAutomator测试框架检测并将每个显示界面中的控件加入该动态控件子列表。
在第二方面的一种可能的实现方式中,该动态控件子列表采集单元,包括:
动态控件控制单元,用于控制该运动控件由初始位置处依据预设规则运动,以在该目标界面下得到与该运动控件相对应的多个连续的显示界面;
其中,该运动控件位于初始位置时,该运动控件对应的显示界面中的首个控件记为当前显示界面的参照控件,最后一个控件作为当前显示界面的尾控件;上一个显示界面的尾控件位于下一个显示界面中,且该上一个显示界面的尾控件作为该下一个显示界面的参照控件。
在第二方面的一种可能的实现方式中,还包括:
类界面判断单元,用于获取该目标界面的有效控件,依据该目标界面的有效控件和已遍历界面的有效控件,判断已遍历的界面中是否存在该目标界面的类界面,如果存在,获取该类界面中已遍历过的有效控件;将该目标界面中与该类界面中已遍历过的有效控件相 同的有效控件标记为已遍历控件,根据前面得到的标记结果判断该目标界面的有效控件是否已全部遍历;
其中,如果两个界面具有N个不同的有效控件,且该N在许可范围之内,则这两个界面互为类界面。
在第二方面的一种可能的实现方式中,还包括:
跳转关系提取单元,用于每当进入与该未遍历的控件相对应的界面时,存储该未遍历的控件与未遍历对应的界面之间的跳转关系。
第二方面中各个部分可能的实现方式的有益效果,参见第一方面中与之对应的方法的有益效果。
第三方面,本申请提供了一种测试设备,包括了第二方面中的任意一项应用界面遍历系统。
在第三方面的一种可能的实现方式中,包括:
该被测应用为与该测试设备相连的测试终端的当前启动的应用。
在第三方面的一种可能的实现方式中,包括:
应用界面遍历系统,还用于,将保存的数据信息存储至与该测试设备相连的测试终端。
第四方面,本申请提供了一种应用界面遍历设备,该设备包括处理器以及存储器:
该存储器用于存储程序代码,并将该程序代码传输给该处理器;
该处理器用于根据该程序代码中的指令执行第一方面中任一应用界面遍历方法。
第五方面,本申请提供了一种存储介质,该存储介质用于存储程序代码,该程序代码用于执行第一方面中任一应用界面遍历方法。
第六方面,本申请提供了一种包括指令的计算机程序产品,当其在计算机上运行时,使得该计算机执行第一方面中任一应用界面遍历方法。
第七方面,本申请提供了一种应用界面遍历方法,包括:
当进入该被测应用的一个界面时,智能处理设备将进入的界面作为目标界面;
该智能处理设备获取该目标界面的控件列表,当该目标界面存在未遍历的控件、子界面或父界面时,该智能处理设备进入该未遍历的控件对应的界面、该未遍历的子界面或该未遍历的父界面;
当该目标界面的控件、子界面和父界面已全部遍历时,该智能处理设备判断该目标界面是否为主界面,若该目标界面为主界面,则该智能处理设备确定应用界面遍历完成;
若该目标界面不是主界面,则该智能处理设备返回该目标界面的上一层级界面,将该上一层界面作为目标界面,并执行该获取该目标界面的控件列表。
在第七方面的一种可能的实现方式中,该当该目标界面存在未遍历的控件、子界面或父界面时,该智能处理设备进入该未遍历的控件对应的界面、与该未遍历的子界面相对应的控件所对应的界面或该未遍历的父界面,包括:
该智能处理设备判断该目标界面的控件是否已全部遍历,如果判断结果为否,则该智能处理设备触发未遍历的控件,进入与该未遍历的控件相对应的界面,如果判断结果为是,该智能处理设备判断该目标界面是否存在未遍历的子界面,如果存在,该智能处理设备进入该未遍历的子界面,如果不存在,该智能处理设备判断该目标界面是否存在未遍历的父界面,如果存在,该智能处理设备进入该未遍历的父界面,如果不存在,则该智能处理设备判定该目标界面不存在未遍历的控件、子界面或父界面。
在第七方面的一种可能的实现方式中,该获取该目标界面的控件列表,包括:
当该目标界面为已遍历过的界面时,该智能处理设备由预设数据库中提取与该目标界面对应的控件列表,当该目标界面为未遍历过的界面时,该智能处理设备将对该目标界面进行处理得到的控件列表作为该目标界面的控件列表。
在第七方面的一种可能的实现方式中,该当该目标界面为已遍历过的界面时,该智能处理设备由预设数据库中提取与该目标界面的控件列表,当该目标界面为未遍历过的界面时,该智能处理设备将对该目标界面进行处理得到的控件列表作为目标界面的控件列表,包括:
该智能处理设备对该目标界面进行处理,得到该目标界面的控件列表,依据该控件列表判断该目标界面是否是已遍历过的界面,当该目标界面为已遍历过的界面时,该智能处理设备由预设数据库中提取该目标界面的控件列表,将该控件列表作为该目标界面的控件列表,如果该目标界面为未遍历过的界面时,该智能处理设备将对该目标界面进行处理,得到的控件列表作为该目标界面的控件列表,将该控件列表存储至该预设数据库中。
在第七方面的一种可能的实现方式中,该智能处理设备对该目标界面进行处理,得到该目标界面的控件列表,包括:
该智能处理设备采用UiAutomator测试框架对该目标界面进行测试,得到与该目标界面相匹配的控件列表;
该依据该控件列表判断该目标界面是否是已遍历过的界面,包括:
该智能处理设备遍历对该目标界面进行测试得到的控件列表,得到该目标界面的有效控件,提取各个有效控件的坐标值,依据该各个有效控件的坐标值生成字符串;该智能处理设备判断已遍历界面列表中是否存在该字符串,如果是,表明该目标界面为已遍历过的界面,否则,表明目标界面为未遍历过的界面。
在第七方面的一种可能的实现方式中,该智能处理设备采用UiAutomator测试框架对该目标界面进行测试,得到与该目标界面相匹配的控件列表,包括:
该智能处理设备获取采用UiAutomator测试框架对该目标界面进行测试后得到的控件列表,该控件列表中包括静态控件子列表和动态控件子列表;
该动态控件子列表的获取过程为:
该智能处理设备控制运动控件依据预设规则运动,以在该目标界面下得到多个连续的显示界面;
该智能处理设备采用该UiAutomator测试框架检测并将每个显示界面中的控件加入动态控件子列表。
在第七方面的一种可能的实现方式中,该智能处理设备控制运动控件依据预设规则运动,以在该目标界面下得到多个连续的显示界面,包括:
该智能处理设备控制运动控件由初始位置处依据预设规则运动,以在该目标界面下得到与该运动控件相对应的多个连续的显示界面;
其中,该运动控件位于该初始位置时,该运动控件对应的显示界面中的首个控件记为当前显示界面的参照控件,最后一个控件作为该当前显示界面的尾控件;上一个显示界面的尾控件位于下一个显示界面中,且该上一个显示界面的尾控件作为下一个显示界面的参照控件。
在第七方面的一种可能的实现方式中,该智能处理设备判断该目标界面的控件是否已全部遍历,包括:
该智能处理设备获取该目标界面的控件列表,依据该目标界面的控件列表和已遍历界面的控件列表,判断已遍历的界面中是否存在该目标界面的类界面,如果存在,该智能处理设备获取该类界面中已遍历过的有效控件;
该智能处理设备将该目标界面的控件列表中与该类界面中已遍历过的有效控件相同的有效控件标记为已遍历控件,根据前面得到的标记结果判断该目标界面的有效控件是否已全部遍历;
其中,如果两个界面具有N个不同的有效控件,且该N在许可范围之内,则这两个界面互为类界面。
在第七方面的一种可能的实现方式中,在进入未遍历的控件对应的界面之后,还包括:
该智能处理设备在该控件列表中将该未遍历的控件标记为已遍历控件;
该智能处理设备存储该未遍历的控件与该未遍历的控件对应的界面之间的跳转关系。
第八方面,本申请提供了一种测试设备,包括上述任意一应用界面遍历系统。
基于上述技术方案,本申请实施例提供的遍历方法,进入被测应用,将进入的界面作为目标界面,获取目标界面的控件列表,判断目标界面是否存在未遍历的控件、子界面或父界面,如果存在,进入未遍历的控件对应的界面、进入未遍历的子界面或未遍历的父界面;若目标界面的控件、子界面和父界面已全部遍历,判断目标界面是否为主界面,如果是,确定应用界面遍历完成,如果否,则返回该目标界面的上一层级界面,将该上一层级界面作为目标界面,并重新获取该目标界面的控件列表以及执行后续步骤,直至确定目标界面为主界面。此时,由于目标界面为主界面,并且该目标界面的控件、子界面和父界面全部遍历完成,因此,可以认为主界面层级以下的界面全部遍历完成,从而可以确定该被测应用的界面遍历完成。可见,本申请可以实现自动遍历被测应用的各个界面,不会出现界面遗漏,并且用户只需对遍历到的各个界面的显示内容进行查看即可,提高了遍历效率。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。
图1为本申请实施例公开的一种硬件架构示意图;
图2为本申请实施例公开的一种应用界面遍历方法的流程示意图;
图3为本申请另一实施例公开的一种应用界面遍历方法的流程示意图;
图4为本申请实施例公开的一种判断目标界面是否存在未遍历的控件、子界面和父界面的流程示意图;
图5为本申请实施例公开的获取当前接卖弄的控件列表的过程示意图;
图6为本申请实施例公开的一种获取动态控件子列表的过程示意图;
图7为本申请实施例公开的一种应用界面遍历系统的结构示意图;
图8为本申请实施例公开的一种服务器的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例提供的应用界面遍历方式,并不需要用户手动对各个应用界面进行查看和测试,而是设备本身检测到进入了被测应用之后,可以将进入的界面作为目标界面。然后,获取到该目标界面的控件列表,并利用该控件列表判断该目标界面是否存在未遍历的控件、子界面或父界面,若存在未遍历的控件、子界面或父界面,则说明还没有将所有应用界面遍历完成,需要进入到这些未遍历的控件、子界面或父界面进行遍历。其中,每当目标界面发生变化时,将变化后的界面作为目标界面。当确定目标界面不存在未遍历的控件、子界面或父界面时,判断该目标界面是否为主界面。如果该目标界面为主界面,则说明主界面层级以下的界面全部完成遍历,可以确定该应用界面遍历完成,从而实现了自动遍历被测试应用的各个界面;而如果该目标界面不是主界面时,则可以返回该目标界面的上一层级界面,将该上一层级界面作为目标界面,并重新获取该目标界面的控件列表以及执行后续步骤,直至确定目标界面为主界面。
图1示出了本申请实施例的硬件架构示意图,参照图1,该硬件架构可以包括:存储器101、处理器102和显示器103。
存储器101可用于存储本申请实施例中的应用界面遍历方法对应的软件程序以及模块。处理器102可用于通过运行存储在存储器101的软件程序以及模块,对被测应用的界面进行一一遍历。显示器103可用于将遍历到的各个界面的显示内容对用户进行展示。
图2为本申请实施例提供的应用界面遍历方法的流程示意图,该方法可应用于智能处理设备中,例如手机、平板电脑、笔记本电脑等;参照图2,该方法可以包括:
S201:进入被测应用。
在实施例中,当需要遍历一个被测试应用时,先进入该被测应用的一个界面,其中该界面可以为默认的任意一个界面,例如,被测应用当前打开的界面。
当然,为了便于遍历,在一种实施方式中,当需要对被测应用进行遍历时,在进入被测应用时,进入的界面可以是该被测应用的主界面。在进入被测应用的主界面后,该被测试应用的主界面可以依据该被测应用的界面触发顺序/层级关系,逐级进入该被测应用的叶子界面(底层界面),然后对叶子界面进行遍历,当叶子界面遍历结束后,返回上一层界面。其中,该被测应用的界面触发顺序/层级关系,可以指的是预设的触发规则,例如,对同一个界面中的控件、子界面和父界面依据预设规则设定一优先级,当一个界面同时存在未遍历的控件、子界面、父界面时,首先进入优先级最高的界面。
需要说明的是,子界面的定义可以为:遍历过程中,晚于目标界面出现且在该目标界面触发控件可到达的界面,可以认为该界面是该目标界面的子界面。而父界面的定义可以为:遍历过程中,早于目标界面出现且在该目标界面点击可到达的界面,可以认为该界面是该目标界面的父界面,其中,一个界面可以对应有多个父界面,例如:界面A、B、C均可以通过触发控件进入界面K1,那么界面A、B、C均可以为界面K1的父界面。
S202:当进入所述被测应用的一个界面时,将进入的界面作为目标界面。
在遍历过程中,需要遍历被测应用的多个界面,每当进入一个界面时,需要对本次进入的界面进行分析判断,由此,需要对被测应用的界面进行监测,以便每当目标界面发生变化时,可以将变化后的界面作为目标界面,并对该目标界面进行分析与判断。
S203;获取目标界面的控件列表。
在本申请实施例中,每遍历一个新界面后,都会存储该新界面的控件列表,其中,该控件列表中存储有每个界面内的各个有效控件。由于每个有效控件被触发后,都会进入一个与该有效控件相对应的界面,因此,在存储新界面的控件列表中,会记录该界面中的哪些控件是已遍历过的控件,哪些控件是未遍历过的控件。
由此,每当进入一个界面后,首先需要判断当前界面是否是已经遍历过的界面。如果该目标界面是已经遍历过的界面,则表明该目标界面中的一些控件、子界面或父界面已经进行过遍历,因此,可以由预设数据库中调取与该目标界面相匹配的控件列表。而如果该目标界面为一个新界面(即之前未遍历过的界面),则对该目标界面进行处理,得到该目标界面的控件列表,并将该控件列表保存至该预设数据库。为方便用户在后续过程中想要查看目标界面,可以先调取该目标界面的界面布局信息和截图,并将该目标界面的界面布局信息和截图保存至预设数据库中,进一步地,还可以将调取得到的各个界面的布局信息和截图以结构树的形式展现给用户,这样,当用户想要查看目标界面时,该用户可以更加便捷地看到该目标界面的界面布局信息和截图。
接下来,对本申请实施例中如何判断目标界面是否为新的界面进行具体介绍。
具体的,在判断目标界面是否为新的界面时,S203的具体过程可以为:对目标界面进行处理,得到目标界面的控件列表,提取所述控件列表的特征信息,依据所述控件列表的特征信息判断目标界面是否是已遍历过的界面,当依据所述控件列表的特征信息判定目标 界面为已遍历过的界面时,由预设数据库中提取与所述目标界面所对应的控件列表,将由预设数据库提取得到的控件列表作为所述目标界面的控件列表,当依据所述控件列表的特征信息判定目标界面为未遍历过的界面时,将对目标界面进行处理得到的控件列表作为目标界面的控件列表,将所述控件列表存储至所述预设数据库中。
S204:判断目标界面是否存在未遍历的控件、子界面或父界面,如果存在,执行S205;若目标界面的控件、子界面和父界面已全部遍历,执行S206。
在本步骤中,判断一个界面是否完全遍历的条件是判断该界面是否存在未遍历的控件、子界面或父界面,如果存在,表明该界面仍未遍历完成,可以通过查看控件列表的方式查看是否存在未遍历的控件。
在遍历过程中,由于每个界面的子界面都是通过触发其控件进入的,由此,可以对每个控件设置两个标识,其中一个标识为控件遍历标识,另一个标识可以为子界面遍历标识。
具体地,在遍历过程中,当触发某一控件后,即激活该控件的控件遍历标识,当触发该控件后进入的界面中不存在控件时,表明该界面不存在未遍历控件和子界面,接着,将触发该控件的子界面遍历标识。这样,通过判断与目标界面的各个控件对应的控件遍历标识和子界面遍历标识的状态,即可判断目标界面是否存在未遍历的子界面和控件。
在本申请实施例中,每个子界面可能对应有至少一个父界面。当通过一界面中的一个控件进入其子界面后,记录这两个界面之间的父子关系,将该父子关系与进入的该子界面相对应,而将该控件所处的界面作为该子界面的父界面,如果该父界面中的其他控件的控件遍历标识和子界面遍历标识已全部激活,激活与该父子关系对应的父界面遍历标识。此时每当进入一个界面后,获取目标界面对应的各个父子关系,判断是否存在父界面遍历标识未被激活的父子关系,如果是,则表明目标界面存在未遍历的父界面,如果不存在,表明目标界面不存在未遍历的父界面。
S205:进入未遍历的控件对应的界面、进入未遍历的子界面或未遍历的父界面,执行S202。
执行S206:判断目标界面是否为主界面,如果是,确定应用界面遍历完成,否则,执行S207。
在本步骤中,每当判定目标界面的控件、子界面或父界面全部遍历完成后,还需判断一次应用界面是否遍历完成。此时,目标界面由于本申请实施例是由底层界面对被测应用进行遍历的,因此,可以通过判定目标界面是否为该被测应用的主界面,来确定该被测应用的所有界面是否都已全部遍历,如果目标界面为主界面,且目标界面的控件、子界面和父界面全部遍历完成,则可以认为主界面层级以下的界面全部遍历完成,从而可以确定本次被测应用的界面遍历完成。具体地,在判断目标界面是否为主界面时,可以通过触发加载被测应用设备的预设按键返回目标界面的上一层界面,并判断返回的上一层界面是否仍为目标界面,如果仍为目标界面,则表明目标界面是所述被测应用的主界面。
S207:由目标界面返回目标界面的上一层级界面,执行S202。
在本步骤中,如果目标界面的控件、子界面和父界面全部遍历完成以后,则需要进入其上一层的界面继续遍历,例如,界面A是界面B上一层级界面,界面B中的控件、子界 面和父界面全部遍历完成后,因此通过触发加载当前应用的设备的预设按键的方式返回至界面A,比如,可以通过加载所述被测应用的设备上的返回键返回至目标界面的上一层级界面,当然,如果目标界面为主界面时,返回的上一层级界面仍为目标界面,由此,参见图3,在S207和S202之间,还可以包括:S208:判断返回的上一层界面是否仍为目标界面,如果是,确定应用界面遍历完成,否则,将返回的上一层界面作为目标界面,并执行S202。
可见,本申请实施例提供的遍历方法,在进入被测应用之后,将进入的界面作为目标界面,获取目标界面的控件列表,判断目标界面是否存在未遍历的控件、子界面或父界面,如果存在,进入未遍历的控件对应的界面、进入未遍历的子界面或未遍历的父界面;若目标界面的控件、子界面和父界面已全部遍历,判断目标界面是否为主界面,如果是,确定应用界面遍历完成,如果否,由当返回目标界面的上一层级界面,将该上一层级界面作为目标界面,并重新获取该目标界面的控件列表以及执行后续步骤,直至确定目标界面为主界面。此时,由于目标界面为主界面,并且该目标界面的控件、子界面和父界面全部遍历完成,因此,可以认为主界面层级以下的界面全部遍历完成,从而可以确定该被测应用的界面遍历完成。可见,本申请实施例可以实现自动遍历被测应用的各个界面,不会出现界面遗漏,并且用户只需对遍历到的各个界面的显示内容进行查看即可,提高了遍历效率。
在本申请上述实施例公开的技术方案中,判断目标界面是否存在未遍历的控件、子界面或父界面时,可以依据预设顺序进行判定,例如先判定目标界面是否存在未遍历的子界面,然后判断是否存在未遍历的父界面,最终判断是否存在未遍历的控件,当然也可以采用其他判定顺序,例如参见图4,所述S203和S204具体可以包括:
S2031:判断目标界面的控件是否已全部遍历,如果判断结果为否,执行S2041,如果判断结果为是,执行S2032;
其中,判断目标界面的控件是否已全部遍历的具体过程,可以参见上文所示;
S2032:判断目标界面是否存在未遍历的子界面,如果存在,执行S2042,如果不存在,执行S2033;
其中,判断目标界面是否存在未遍历的子界面的具体过程,可以参见上文所示;
S2033:判断目标界面是否存在未遍历的父界面,如果存在,执行S2043,如果不存在,执行S206;
其中,判断目标界面是否存在未遍历的父界面的具体过程,可以参见上文所示;
S2041:触发未遍历的控件,进入与所述未遍历的控件相对应的界面;
S2042:进入所述未遍历的子界面;
S2043:进入未遍历的父界面。
本申请另一实施例中,还公开了一种获取目标界面的控件列表的具体方式,参见图5,所述S203具体可以包括:
S2031:采用UiAutomator测试框架对所述目标界面进行测试,得到与所述目标界面相匹配的控件列表。
其中,所述UiAutomator测试框架为一种JAVA类库,其包含一些自定义的UI(用户界面)功能测试,用以自动化和跑test case的引擎;在本步骤中,通过所述UiAutomator测试框架对目标界面进行测试,得到目标界面的控件列表;
S2032:遍历对目标界面进行测试得到的控件列表,得到所述目标界面的有效控件,所述控件列表中存储有目标界面的各个有效控件。
在本步骤中,遍历目标界面的控件列表,得到目标界面的有效控件,所述有效控件包括可点击控件静态控件、动态控件以及文本控件等;
S2033:提取各个有效控件的坐标值,依据各个有效控件的坐标值生成字符串。在本步骤中,可提取每一个有效控件的坐标值,依据提取到的所有坐标值生成一字符串,当然,采用这种方式生成的字符串长度过长,不利于后续使用,针对于此,本申请还可以先对目标界面中的有效控件进行分组,将相同类型的有效控件分为同一组,每个组有效控件中只取该组中第一个有效控件的坐标,将所有组的第一个有效控件的坐标连接成长字符串,此为界面的简易布局串,所述简易布局串生成后,将遍历过的界面的简易布局串存储至所述预设数据库中,当然,为了方便后续过程中判断,也可以先对简易布局串进行MD5编码,得到简易布局串对应的MD5值,将该值存储至所述预设数据库中;
S2034:判断已遍历界面列表中是否存在所述字符串,如果是,执行S2035,否则执行S2036。
如果所述预设数据库中存储的是MD5值,那么,所述判断已遍历界面列表中是否存在所述字符串具体可以为:判断已遍历界面列表中是否存在所述MD5值。
由于每遍历一个界面,均将该界面对应的所述字符串(简易布局串)存储到所述预设数据库中,因此,可通过查询所述预设数据库中是否存在该字符串的方式,判定目标界面是否属于已遍历过的界面,若所述预设数据库中存在该字符串,则可以确定该目标界面属于已遍历过的界面,反之,若所述预设数据库中不存在该字符串,则可以确定该目标界面不属于已遍历过的界面。
S2035:由预设数据库中提取与所述字符串相对应的控件列表,将由预设数据库提取得到的控件列表作为所述目标界面的控件列表。
S2036:将通过UiAutomator测试框架得到的控件列表作为目标界面的控件列表,并将所述控件列表存储至预设数据库中。
在本申请上述实施例公开的技术方案中,当采用UiAutomator测试框架对所述目标界面进行测试,得到与所述目标界面相匹配的控件列表时,所述控件列表既包括由静态控件组成的静态控件子列表,也包括由动态控件组成的动态控件子列表,其中,所述静态控件为首次打开界面即可见的静态控件,所述动态控件为需要滑动控件或其他能够滚动的控件(在此记为运动控件)运动到某一位置才可见的控件。由于获取静态控件的过程较为简单,只需直接对该目标界面进行扫描即可,因此,并不对获取静态控件的过程进行更深一步阐述,下面重点对动态控件子列表的生成过程进行阐述,该动态控件子列表的生成过程可以包括:控制所述运动控件由初始位置依据预设规则运动,以在目标界面下得到多个连续的显示界面。
每得到一个显示界面后,采用UiAutomator测试框架检测并将每个显示界面中的控件加入动态控件子列表。
本申请实施例公开的技术方案中,可以依据用户需求设定所述连续的显示界面具体以何种方式连续,可以依据用户需求自行选择。
例如,在本申请实施例公开的技术方案中,上述各个连续的显示界面之间的连续关系可以如下:所述运动控件位于初始位置时,所述动态控件对应的显示界面中的首个控件记为当前显示界面的参照控件,最后一个控件作为当前显示界面的尾控件;上一个显示界面的尾控件位于下一个显示界面中,且上一个显示界面的尾控件作为下一个显示界面的参照控件。
具体的,参见图6,当所述运动控件为滑动控件时,获取动态控件子列表的具体过程可以如下:
S601:将滑动控件的初始位置对应的第一屏设置为当前显示界面,将当前显示界面的第一个控件作为参照控件;
S602:将获取当前显示界面中的最后一个完整控件作为尾控件;
S603:将当前显示界面中所述参照控件到尾控件之间的所有控件加入动态控件子列表;
S604:判断所述滑动控件能否按照预设方向继续运动,如果可以,执行S505;
S605:按照所述预设方向运动所述滑动控件,运动距离为当前显示界面的尾控件上边界到当前显示界面的上边界之间的距离;
S606:将运动所述滑动控件后的得到的显示界面设置为目标界面,将上一个目标界面的尾控件作为当前显示界面的参照控件,执行S503。
在本申请实施例公开的技术方案中,在遍历各个界面的控件时,由上述S2031至S2036可知,只有有效控件坐标完全一致的界面才会被判断为同一界面,但是在实际运行中,会存在多个相似界面,这些相似界面之间往往只相差1-2个有效控件。如果按照常规的遍历方式,这些相似界面中的所有有效控件都需要被遍历,这会造成同一个控件出现遍历多次的情况,从而会导致存在无用遍历,同时也会导致遍历时间成倍增加。
针对于此,为缩短遍历时间,在本申请实施例中,若两个界面之间仅存在1-N个(N为经验值,例如其可以置为2)之内不相同的有效控件,则可以将这两个界面称为同一类界面,也就是说,这两个界面互为类界面。
为了加快遍历速度,上述方案中,判断目标界面的控件是否已全部遍历,具体可以包括:
获取目标界面的控件列表;
依据目标界面的所述控件列表和已遍历界面的控件列表,判断已遍历的界面中是否存在所述目标界面的类界面,如果存在,获取所述类界面中已遍历过的有效控件;
将所述目标界面的控件列表中与所述类界面中已遍历过的有效控件相同的有效控件标记为已遍历控件,根据前面得到的标记结果判断目标界面的有效控件是否已全部遍历。
在上述方案中,获取到目标界面的控件列表之后,将该控件列表与已遍历过的其他界面的控件列表进行对比,判断已遍历过的其他界面的控件列表中是否存在至少一控件列表, 该控件列表中的全部有效控件与该目标界面的控件列表中的全部有效控件都相同,或该控件列表与该目标界面的控件列表之间具有不同的有效控件,且不同的有效控件的数量在许可范围之内。如果存在,则认为该控件列表对应的界面与目标界面互为类界面,且该界面中已遍历过的有效控件无需再次在该目标界面中进行遍历,并将该目标界面的控件列表中与该界面中已遍历过的有效控件相同的有效控件标记为已遍历控件。若该目标界面中的全部有效控件都被标记为已遍历控件,则可以认为该目标界面的有效控件都已全部遍历,反之,若该目标界面中存在未被标记为已遍历控件的有效控件,则可以认为该目标界面的有效控件并没有全部遍历。
当然,除了上述通过采用控件列表进行对比的方式判断是否存在目标界面的类界面之外,还可以采用上述字符串或MD5值的方式进行判定,例如,目标界面对应的字符串和已遍历过的一界面对应的字符串进行对比时,若这两个界面各自所对应的字符串之间的差异在许可范围之内,则可以判定这两个界面互为类界面,又例如,目标界面对应的MD5值和已遍历过的一界面对应的MD5值进行对比时,若这两个界面各自所对应的MD5值之间的差异在许可范围之内,也可以判定这两个界面互为类界面。
在本申请上述实施例公开的技术方案中,为了方便用户了解各个界面之间的跳转关系,当触发未遍历过的控件进入一个新的界面时,还需要在存储未遍历的控件与未遍历的控件对应的界面之间的跳转关系。
可见,本申请实施例通过获取目标界面的控件列表,并依据该目标界面的控件列表和已遍历界面的控件列表,判断已遍历的界面中是否存在该目标界面的类界面,如果存在,获取该类界面中已遍历过的有效控件,并将该目标界面的控件列表中与该类界面中已遍历过的有效控件相同的有效控件标记为已遍历控件,并根据前面得到的标记结果判断目标界面的有效控件是否已全部遍历。这样,使得互为类界面的多个界面中的同一个有效控件只需要遍历一次,避免了互为类界面的多个界面中的所有有效控件都需要被遍历的情况发生,从而缩短了被测应用的界面遍历时间。
参见图7,与上述方法相对应,本申请还公开了一种应用界面遍历系统,包括:
控件列表获取单元100,用于将当前被测应用的当前界面标定为目标界面,获取该目标界面的控件列表,向第一判断单元输出触发信号;
该第一判断单元200,用于获取到所述控件列表获取单元输出的触发信号时,判断该目标界面是否存在未遍历的控件、子界面或父界面,如果存在,进入该控件列表中该未遍历的控件对应的界面、进入该未遍历的子界面或该未遍历的父界面,向所述控件列表获取该单元输出的触发信号,如果不存在,向第二判断单元输出该触发信号;
第二判断单元300,用于当获取到触发信号后,判断该目标界面是否为主界面,如果是,确定应用界面遍历完成,如果否,返回该目标界面的上一层级界面,将该上一层界面作为目标界面,并向所述控件列表获取单元输出触发信号。
上述方案中,还可以包括被测应用选择单元,其可以用于选择并进入被测应用,在进入被测应用时,可优先进入被测应用的主界面,当判断得到主界面的未遍历控件和子界面时,再由所述主界面开始按照被测应用的界面触发顺序/层级关系,依次进入被测应用的各 界面。
与上述方法相对应,所述第一判断单元200包括:
控件判断单元,用于当该目标界面存在未遍历的控件时,触发所述未遍历的控件,进入与所述未遍历的控件相对应的界面,向控件列表获取单元输出触发信号,当该目标界面存在未遍历的控件时,向子界面判断单元输出触发信号;
该子界面判断单元,用于当该目标界面存在未遍历的子界面时,进入所述未遍历的子界面,向控件列表获取单元输出触发信号,当该目标界面不存在未遍历的控件且不存在未遍历的子界面时,向父界面判断单元输出触发信号;
该父界面判断单元,用于当该目标界面存在未遍历的父界面时,进入该未遍历的父界面,向控件列表获取单元输出触发信号,当确定该目标界面不存在未遍历的父界面时,判定该目标界面的控件、子界面和父界面已全部遍历,向所述第二判断单元输出触发信号。
与上述方法相对应,控件列表获取单元100,包括:
新界面判断单元,用于当该目标界面为已遍历过的界面时,由预设数据库中提取与该目标界面的控件列表,当该目标界面为未遍历过的界面时,将对该目标界面进行处理得到的控件列表作为该目标界面的控件列表。
具体的,所述新界面判断单元具体可以被配置为:对该目标界面进行处理,得到该目标界面的控件列表,依据所述控件列表判断该目标界面是否是已遍历过的界面,当该目标界面为已遍历过的界面时,由预设数据库中提取与该目标界面的控件列表,将由预设数据库提取得到的控件列表作为该目标界面的控件列表,如果该目标界面为未遍历过的界面时,将对该目标界面进行处理得到的控件列表作为该目标界面的控件列表,将所述控件列表存储至所述预设数据库中。
与上述方法相对应,为了方便对该对目标界面进行处理得到目标界面的控件列表,该新界面判断单元,包括:
UiAutomator测试框架,用于对该目标界面进行测试,得到与该目标界面相匹配的控件列表;
子新界面判断单元,用于遍历对目标界面进行测试得到的控件列表,得到该目标界面的有效控件,提取各个有效控件的坐标值,依据各个有效控件的坐标值生成字符串,判断已遍历界面列表中是否存在该字符串,如果是,表明该目标界面为已遍历过的界面,否则,表明目标界面为未遍历过的界面。
与上述方法相对应,该控件列表包括静态控件子列表和动态控件子列表,该静态控件子列表用于存储与运动控件同一层级的静态控件,该动态控件子列表用于存储受运动控件控制显示状态的控件,该控件列表获取单元,包括:
动态控件子列表采集单元,用于控制该运动控件依据预设规则运动,以在目标界面下得到多个连续的显示界面;控制UiAutomator测试框架检测并将每个显示界面中的控件加入动态控件子列表。
与上述方法相对应,该动态控件子列表采集单元,包括:
动态控件控制单元,用于控制该运动控件由初始位置处依据预设规则运动,以在目标 界面下得到与该运动控件相对应的多个连续的显示界面;
其中,该运动控件位于初始位置时,该运动控件对应的显示界面中的首个控件记为当前显示界面的参照控件,最后一个控件作为当前显示界面的尾控件;上一个显示界面的尾控件位于下一个显示界面中,且上一个显示界面的尾控件作为下一个显示界面的参照控件。
与上述方法相对应,上述系统还可以包括:类界面判断单元,用于获取目标界面的有效控件,依据目标界面的有效控件和已遍历界面的有效控件,判断已遍历的界面中是否存在该目标界面的类界面,如果存在,获取该类界面中已遍历过的有效控件;将该目标界面中与类界面中已遍历过的有效控件相同的有效控件标记为已遍历控件,根据前面得到的标记结果判断目标界面的有效控件是否已全部遍历;
其中,如果两个界面具有N个不同的有效控件,且该N在许可范围之内,则这两个界面互为类界面。
与上述方法相对应,上述系统还可以包括:
跳转关系提取单元,用于每当进入与该未遍历的控件相对应的界面时,存储该未遍历的控件与未遍历对应的界面之间的跳转关系。
对应于上述系统,本申请还公开了一种测试设备,该测试装备可以为应用有上述任意一项界面遍历系统的手机、电脑、PC机等。
在上述方案中,该被测应用可以指的是与该测试设备相连的测试终端的当前启动的应用。
当该被测应用可以指的是与该测试设备相连的测试终端的当前启动的应用时,为了方便工作人员遍历各个界面,该应用界面遍历系统,还用于,将保存的数据信息存储至与该测试设备相连的测试终端,该保存的数据信息包括遍历的各个界面的界面布局信息、界面截图文件、控件列表以及控件与界面之间的跳转关系。
本申请实施例还提供一种服务器,参见图8所示,可以包括:
处理器801、存储器802、输入装置803和输出装置804。浏览器服务器中的处理器801的数量可以一个或多个,图8中以一个处理器为例。在本发明的一些实施例中,处理器801、存储器802、输入装置803和输出装置804可通过总线或其它方式连接,输入装置803和输出装置804可以为通信模块的接口,如GSM模块的接口。其中,图8中以通过总线连接为例。
存储器802可用于存储软件程序以及模块,处理器801通过运行存储在存储器802的软件程序以及模块,从而执行浏览器服务器的各种功能应用以及数据处理。存储器802可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等。此外,存储器802可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。输入装置803可用于接收输入的数字或字符信息,以及产生与浏览器服务器的用户设置以及功能控制有关的键信号输入。
具体在本实施例中,处理器801会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行文件加载到存储器802中,并由处理器801来运行存储在存储器802中的应用程序,从而实现各种功能:
当进入该被测应用的一个界面时,将进入的界面作为目标界面;
获取该目标界面的控件列表,当该目标界面存在未遍历的控件、子界面或父界面时,进入该未遍历的控件对应的界面、该未遍历的子界面或该未遍历的父界面;
当该目标界面的控件、子界面和父界面已全部遍历时,判断该目标界面是否为主界面,若该目标界面为主界面,则确定应用界面遍历完成;
若该目标界面不是主界面,则返回该目标界面的上一层级界面,将该上一层界面作为目标界面,并执行该获取该目标界面的控件列表。
可选的,当该目标界面存在未遍历的控件、子界面或父界面时,进入该未遍历的控件对应的界面、与该未遍历的子界面相对应的控件所对应的界面或该未遍历的父界面,包括:
判断该目标界面的控件是否已全部遍历,如果判断结果为否,则触发未遍历的控件,进入与该未遍历的控件相对应的界面,如果判断结果为是,判断该目标界面是否存在未遍历的子界面,如果存在,进入该未遍历的子界面,如果不存在,判断该目标界面是否存在未遍历的父界面,如果存在,进入该未遍历的父界面,如果不存在,则判定该目标界面不存在未遍历的控件、子界面或父界面。
可选的,获取该目标界面的控件列表,包括:
当该目标界面为已遍历过的界面时,由预设数据库中提取与该目标界面对应的控件列表,当该目标界面为未遍历过的界面时,将对该目标界面进行处理得到的控件列表作为该目标界面的控件列表。
可选的,当该目标界面为已遍历过的界面时,由预设数据库中提取与该目标界面的控件列表,当该目标界面为未遍历过的界面时,将对该目标界面进行处理得到的控件列表作为目标界面的控件列表,包括:
对该目标界面进行处理,得到该目标界面的控件列表,依据该控件列表判断该目标界面是否是已遍历过的界面,当该目标界面为已遍历过的界面时,由预设数据库中提取该目标界面的控件列表,将该控件列表作为该目标界面的控件列表,如果该目标界面为未遍历过的界面时,将对该目标界面进行处理,得到的控件列表作为该目标界面的控件列表,将该控件列表存储至该预设数据库中。
可选的,对该目标界面进行处理,得到该目标界面的控件列表,包括:
采用UiAutomator测试框架对该目标界面进行测试,得到与该目标界面相匹配的控件列表;
依据该控件列表判断该目标界面是否是已遍历过的界面,包括:
遍历对该目标界面进行测试得到的控件列表,得到该目标界面的有效控件,提取各个有效控件的坐标值,依据该各个有效控件的坐标值生成字符串;判断已遍历界面列表中是 否存在该字符串,如果是,表明该目标界面为已遍历过的界面,否则,表明目标界面为未遍历过的界面。
可选的,采用UiAutomator测试框架对该目标界面进行测试,得到与该目标界面相匹配的控件列表,包括:
获取采用UiAutomator测试框架对该目标界面进行测试后得到的控件列表,该控件列表中包括静态控件子列表和动态控件子列表;
该动态控件子列表的获取过程为:
控制运动控件依据预设规则运动,以在该目标界面下得到多个连续的显示界面;
采用该UiAutomator测试框架检测并将每个显示界面中的控件加入动态控件子列表。
可选的,控制运动控件依据预设规则运动,以在该目标界面下得到多个连续的显示界面,包括:
控制运动控件由初始位置处依据预设规则运动,以在该目标界面下得到与该运动控件相对应的多个连续的显示界面;
其中,该运动控件位于该初始位置时,该运动控件对应的显示界面中的首个控件记为当前显示界面的参照控件,最后一个控件作为该当前显示界面的尾控件;上一个显示界面的尾控件位于下一个显示界面中,且该上一个显示界面的尾控件作为下一个显示界面的参照控件。
可选的,判断该目标界面的控件是否已全部遍历,包括:
获取该目标界面的控件列表,依据该目标界面的控件列表和已遍历界面的控件列表,判断已遍历的界面中是否存在该目标界面的类界面,如果存在,获取该类界面中已遍历过的有效控件;
将该目标界面的控件列表中与该类界面中已遍历过的有效控件相同的有效控件标记为已遍历控件,根据前面得到的标记结果判断该目标界面的有效控件是否已全部遍历;
其中,如果两个界面具有N个不同的有效控件,且该N在许可范围之内,则这两个界面互为类界面。
可选的,在进入未遍历的控件对应的界面之后,还包括:
在该控件列表中将该未遍历的控件标记为已遍历控件;
存储该未遍历的控件与该未遍历的控件对应的界面之间的跳转关系。
本申请实施例还提供一种存储介质,用于存储程序代码,该程序代码用于执行前述各个实施例所述的应用界面遍历方法中的任意一种实施方式。
本申请实施例还提供一种包括指令的计算机程序产品,当其在计算机上运行时,使得计算机执行前述各个实施例所述的应用界面遍历方法中的任意一种实施方式。
为了描述的方便,描述以上系统时以功能分为各种模块分别描述。当然,在实施本申请时可以把各模块的功能在同一个或多个软件和/或硬件中实现。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统或系统实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的系统及系统实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本申请对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。

Claims (33)

  1. 一种应用界面遍历方法,包括:
    当进入所述被测应用的一个界面时,将进入的界面作为目标界面;
    获取所述目标界面的控件列表,当所述目标界面存在未遍历的控件、子界面或父界面时,进入所述未遍历的控件对应的界面、所述未遍历的子界面或所述未遍历的父界面;
    当所述目标界面的控件、子界面和父界面已全部遍历时,判断所述目标界面是否为主界面,若所述目标界面为主界面,则确定应用界面遍历完成;
    若所述目标界面不是主界面,则返回所述目标界面的上一层级界面,将所述上一层界面作为目标界面,并执行所述获取所述目标界面的控件列表。
  2. 根据权利要求1所述的应用界面遍历方法,所述当所述目标界面存在未遍历的控件、子界面或父界面时,进入所述未遍历的控件对应的界面、与所述未遍历的子界面相对应的控件所对应的界面或所述未遍历的父界面,包括:
    判断所述目标界面的控件是否已全部遍历,如果判断结果为否,则触发未遍历的控件,进入与所述未遍历的控件相对应的界面,如果判断结果为是,判断所述目标界面是否存在未遍历的子界面,如果存在,进入所述未遍历的子界面,如果不存在,判断所述目标界面是否存在未遍历的父界面,如果存在,进入所述未遍历的父界面,如果不存在,则判定所述目标界面不存在未遍历的控件、子界面或父界面。
  3. 根据权利要求1所述的应用界面遍历方法,所述获取所述目标界面的控件列表,包括:
    当所述目标界面为已遍历过的界面时,由预设数据库中提取与所述目标界面对应的控件列表,当所述目标界面为未遍历过的界面时,将对所述目标界面进行处理得到的控件列表作为所述目标界面的控件列表。
  4. 根据权利要求3所述的应用界面遍历方法,所述当所述目标界面为已遍历过的界面时,由预设数据库中提取与所述目标界面的控件列表,当所述目标界面为未遍历过的界面时,将对所述目标界面进行处理得到的控件列表作为目标界面的控件列表,包括:
    对所述目标界面进行处理,得到所述目标界面的控件列表,依据所述控件列表判断所述目标界面是否是已遍历过的界面,当所述目标界面为已遍历过的界面时,由预设数据库中提取所述目标界面的控件列表,将所述控件列表作为所述目标界面的控件列表,如果所述目标界面为未遍历过的界面时,将对所述目标界面进行处理,得到的控件列表作为所述目标界面的控件列表,将所述控件列表存储至所述预设数据库中。
  5. 根据权利要求4所述的应用界面遍历方法,所述对所述目标界面进行处理,得到所述目标界面的控件列表,包括:
    采用UiAutomator测试框架对所述目标界面进行测试,得到与所述目标界面相匹配的控件列表;
    所述依据所述控件列表判断所述目标界面是否是已遍历过的界面,包括:
    遍历对所述目标界面进行测试得到的控件列表,得到所述目标界面的有效控件,提取各个有效控件的坐标值,依据所述各个有效控件的坐标值生成字符串;判断已遍历界面列表中是否存在所述字符串,如果是,表明所述目标界面为已遍历过的界面,否则,表明目标界面为未遍历过的界面。
  6. 根据权利要求5所述的应用界面遍历方法,所述采用UiAutomator测试框架对所述目标界面进行测试,得到与所述目标界面相匹配的控件列表,包括:
    获取采用UiAutomator测试框架对所述目标界面进行测试后得到的控件列表,所述控件列表中包括静态控件子列表和动态控件子列表;
    所述动态控件子列表的获取过程为:
    控制运动控件依据预设规则运动,以在所述目标界面下得到多个连续的显示界面;
    采用所述UiAutomator测试框架检测并将每个显示界面中的控件加入动态控件子列表。
  7. 根据权利要求6所述的应用界面遍历方法,所述控制运动控件依据预设规则运动,以在所述目标界面下得到多个连续的显示界面,包括:
    控制运动控件由初始位置处依据预设规则运动,以在所述目标界面下得到与所述运动控件相对应的多个连续的显示界面;
    其中,所述运动控件位于所述初始位置时,所述运动控件对应的显示界面中的首个控件记为当前显示界面的参照控件,最后一个控件作为所述当前显示界面的尾控件;上一个显示界面的尾控件位于下一个显示界面中,且所述上一个显示界面的尾控件作为下一个显示界面的参照控件。
  8. 根据权利要求2所述的应用界面遍历方法,所述判断所述目标界面的控件是否已全部遍历,包括:
    获取所述目标界面的控件列表,依据所述目标界面的控件列表和已遍历界面的控件列表,判断已遍历的界面中是否存在所述目标界面的类界面,如果存在,获取所述类界面中已遍历过的有效控件;
    将所述目标界面的控件列表中与所述类界面中已遍历过的有效控件相同的有效控件标记为已遍历控件,根据前面得到的标记结果判断所述目标界面的有效控件是否已全部遍历;
    其中,如果两个界面具有N个不同的有效控件,且所述N在许可范围之内,则这两个界面互为类界面。
  9. 根据权利要求1所述的应用界面遍历方法,在所述进入未遍历的控件对应的界面之后,还包括:
    在所述控件列表中将所述未遍历的控件标记为已遍历控件;
    存储所述未遍历的控件与所述未遍历的控件对应的界面之间的跳转关系。
  10. 一种应用界面遍历系统,包括:
    控件列表获取单元,用于将当前被测应用的当前界面标定为目标界面,获取所述目标界面的控件列表,向第一判断单元输出触发信号;
    所述第一判断单元,用于获取到所述控件列表获取单元输出的触发信号时,判断所述目标界面是否存在未遍历的控件、子界面或父界面,如果存在,进入所述控件列表中所述未遍历的控件对应的界面、进入所述未遍历的子界面或所述未遍历的父界面,向所述控件列表获取所述单元输出的触发信号,如果不存在,向第二判断单元输出所述触发信号;
    第二判断单元,用于当获取到所述触发信号后,判断所述目标界面是否为主界面,如果是,确定应用界面遍历完成,如果否,返回所述目标界面的上一层级界面,将所述上一层界面作为目标界面,并向所述控件列表获取单元输出触发信号。
  11. 根据权利要求10所述的应用界面遍历系统,所述第一判断单元包括:
    控件判断单元,用于当所述目标界面存在未遍历的控件时,触发所述未遍历的控件,进入与所述未遍历的控件相对应的界面,向控件列表获取单元输出触发信号,当所述目标界面存在未遍历的控件时,向子界面判断单元输出触发信号;
    所述子界面判断单元,用于当所述目标界面存在未遍历的子界面时,进入所述未遍历的子界面,向控件列表获取单元输出触发信号,当所述目标界面不存在未遍历的控件且不存在未遍历的子界面时,向父界面判断单元输出触发信号;
    所述父界面判断单元,用于当所述目标界面存在未遍历的父界面时,进入所述未遍历的父界面,向控件列表获取单元输出触发信号,当确定所述目标界面不存在未遍历的父界面时,判定所述目标界面的控件、子界面和父界面已全部遍历,向所述第二判断单元输出触发信号。
  12. 根据权利要求10所述的应用界面遍历系统,所述控件列表获取单元,包括:
    新界面判断单元,用于当所述目标界面为已遍历过的界面时,由预设数据库中提取与所述目标界面的控件列表,当所述目标界面为未遍历过的界面时,将对所述目标界面进行处理得到的控件列表作为所述目标界面的控件列表。
  13. 根据权利要求12所述的应用界面遍历系统,所述新界面判断单元,具体被配置为:
    对所述目标界面进行处理,得到所述目标界面的控件列表,依据所述控件列表判断所述目标界面是否是已遍历过的界面,当所述目标界面为已遍历过的界面时,由预设数据库中提取与所述目标界面对应的控件列表,将由预设数据库提取得到的所述控件列表作为所述目标界面的控件列表,如果所述目标界面为未遍历过的界面时,将对所述目标界面进行处理得到的所述控件列表作为所述目标界面的控件列表,将所述控件列表存储至所述预设数据库中。
  14. 根据权利要求13所述的应用界面遍历系统,所述新界面判断单元,包括:
    UiAutomator测试框架,用于对所述目标界面进行测试,得到与所述目标界面相匹配的控件列表;
    子新界面判断单元,用于遍历对所述目标界面进行测试得到的控件列表,得到所述目标界面的有效控件,提取各个有效控件的坐标值,依据所述各个有效控件的坐标值生成字符串,判断已遍历界面列表中是否存在所述字符串,如果是,表明所述目标界面为已遍历 过的界面,否则,表明所述目标界面为未遍历过的界面。
  15. 根据权利要求14所述的应用界面遍历系统,控件列表包括静态控件子列表和动态控件子列表,所述静态控件子列表用于存储与运动控件同一层级的静态控件,所述动态控件子列表用于存储受运动控件控制显示状态的控件,所述控件列表获取单元,还包括:
    动态控件子列表采集单元,用于控制所述运动控件依据预设规则运动,以在所述目标界面下得到多个连续的显示界面;控制所述UiAutomator测试框架检测并将每个显示界面中的控件加入所述动态控件子列表。
  16. 根据权利要求15所述的应用界面遍历系统,所述动态控件子列表采集单元,包括:
    动态控件控制单元,用于控制所述运动控件由初始位置处依据预设规则运动,以在所述目标界面下得到与所述运动控件相对应的多个连续的显示界面;
    其中,所述运动控件位于初始位置时,所述运动控件对应的显示界面中的首个控件记为当前显示界面的参照控件,最后一个控件作为当前显示界面的尾控件;上一个显示界面的尾控件位于下一个显示界面中,且所述上一个显示界面的尾控件作为所述下一个显示界面的参照控件。
  17. 根据权利要求10所述的应用界面遍历系统,还包括:
    类界面判断单元,用于获取所述目标界面的有效控件,依据所述目标界面的有效控件和已遍历界面的有效控件,判断已遍历的界面中是否存在所述目标界面的类界面,如果存在,获取所述类界面中已遍历过的有效控件;将所述目标界面中与所述类界面中已遍历过的有效控件相同的有效控件标记为已遍历控件,根据前面得到的标记结果判断所述目标界面的有效控件是否已全部遍历;
    其中,如果两个界面具有N个不同的有效控件,且所述N在许可范围之内,则这两个界面互为类界面。
  18. 根据权利要求10所述的应用界面遍历系统,还包括:
    跳转关系提取单元,用于每当进入与所述未遍历的控件相对应的界面时,存储所述未遍历的控件与未遍历对应的界面之间的跳转关系。
  19. 一种测试设备,权利要求10-18任意一项所述的应用界面遍历系统。
  20. 根据权利要求19所述的测试设备,包括:
    所述被测应用为与所述测试设备相连的测试终端的当前启动的应用。
  21. 根据权利要求20所述的测试设备,包括:
    应用界面遍历系统,还用于,将保存的数据信息存储至与所述测试设备相连的测试终端。
  22. 一种应用界面遍历设备,所述设备包括处理器以及存储器:
    所述存储器用于存储程序代码,并将所述程序代码传输给所述处理器;
    所述处理器用于根据所述程序代码中的指令执行权利要求1-9任一项所述的应用界面遍历方法。
  23. 一种存储介质,所述存储介质用于存储程序代码,所述程序代码用于执行权利要求1-9任一项所述的应用界面遍历方法。
  24. 一种包括指令的计算机程序产品,当其在计算机上运行时,使得所述计算机执行权利要求1-9任一项所述的应用界面遍历方法。
  25. 一种应用界面遍历方法,包括:
    当进入所述被测应用的一个界面时,智能处理设备将进入的界面作为目标界面;
    所述智能处理设备获取所述目标界面的控件列表,当所述目标界面存在未遍历的控件、子界面或父界面时,所述智能处理设备进入所述未遍历的控件对应的界面、所述未遍历的子界面或所述未遍历的父界面;
    当所述目标界面的控件、子界面和父界面已全部遍历时,所述智能处理设备判断所述目标界面是否为主界面,若所述目标界面为主界面,则所述智能处理设备确定应用界面遍历完成;
    若所述目标界面不是主界面,则所述智能处理设备返回所述目标界面的上一层级界面,将所述上一层界面作为目标界面,并执行所述获取所述目标界面的控件列表。
  26. 根据权利要求25所述的应用界面遍历方法,所述当所述目标界面存在未遍历的控件、子界面或父界面时,所述智能处理设备进入所述未遍历的控件对应的界面、与所述未遍历的子界面相对应的控件所对应的界面或所述未遍历的父界面,包括:
    所述智能处理设备判断所述目标界面的控件是否已全部遍历,如果判断结果为否,则所述智能处理设备触发未遍历的控件,进入与所述未遍历的控件相对应的界面,如果判断结果为是,所述智能处理设备判断所述目标界面是否存在未遍历的子界面,如果存在,所述智能处理设备进入所述未遍历的子界面,如果不存在,所述智能处理设备判断所述目标界面是否存在未遍历的父界面,如果存在,所述智能处理设备进入所述未遍历的父界面,如果不存在,则所述智能处理设备判定所述目标界面不存在未遍历的控件、子界面或父界面。
  27. 根据权利要求25所述的应用界面遍历方法,所述获取所述目标界面的控件列表,包括:
    当所述目标界面为已遍历过的界面时,所述智能处理设备由预设数据库中提取与所述目标界面对应的控件列表,当所述目标界面为未遍历过的界面时,所述智能处理设备将对所述目标界面进行处理得到的控件列表作为所述目标界面的控件列表。
  28. 根据权利要求27所述的应用界面遍历方法,所述当所述目标界面为已遍历过的界面时,所述智能处理设备由预设数据库中提取与所述目标界面的控件列表,当所述目标界面为未遍历过的界面时,所述智能处理设备将对所述目标界面进行处理得到的控件列表作为目标界面的控件列表,包括:
    所述智能处理设备对所述目标界面进行处理,得到所述目标界面的控件列表,依据所述控件列表判断所述目标界面是否是已遍历过的界面,当所述目标界面为已遍历过的界面时,所述智能处理设备由预设数据库中提取所述目标界面的控件列表,将所述控件列表作 为所述目标界面的控件列表,如果所述目标界面为未遍历过的界面时,所述智能处理设备将对所述目标界面进行处理,得到的控件列表作为所述目标界面的控件列表,将所述控件列表存储至所述预设数据库中。
  29. 根据权利要求28所述的应用界面遍历方法,所述智能处理设备对所述目标界面进行处理,得到所述目标界面的控件列表,包括:
    所述智能处理设备采用UiAutomator测试框架对所述目标界面进行测试,得到与所述目标界面相匹配的控件列表;
    所述依据所述控件列表判断所述目标界面是否是已遍历过的界面,包括:
    所述智能处理设备遍历对所述目标界面进行测试得到的控件列表,得到所述目标界面的有效控件,提取各个有效控件的坐标值,依据所述各个有效控件的坐标值生成字符串;所述智能处理设备判断已遍历界面列表中是否存在所述字符串,如果是,表明所述目标界面为已遍历过的界面,否则,表明目标界面为未遍历过的界面。
  30. 根据权利要求29所述的应用界面遍历方法,所述智能处理设备采用UiAutomator测试框架对所述目标界面进行测试,得到与所述目标界面相匹配的控件列表,包括:
    所述智能处理设备获取采用UiAutomator测试框架对所述目标界面进行测试后得到的控件列表,所述控件列表中包括静态控件子列表和动态控件子列表;
    所述动态控件子列表的获取过程为:
    所述智能处理设备控制运动控件依据预设规则运动,以在所述目标界面下得到多个连续的显示界面;
    所述智能处理设备采用所述UiAutomator测试框架检测并将每个显示界面中的控件加入动态控件子列表。
  31. 根据权利要求30所述的应用界面遍历方法,所述智能处理设备控制运动控件依据预设规则运动,以在所述目标界面下得到多个连续的显示界面,包括:
    所述智能处理设备控制运动控件由初始位置处依据预设规则运动,以在所述目标界面下得到与所述运动控件相对应的多个连续的显示界面;
    其中,所述运动控件位于所述初始位置时,所述运动控件对应的显示界面中的首个控件记为当前显示界面的参照控件,最后一个控件作为所述当前显示界面的尾控件;上一个显示界面的尾控件位于下一个显示界面中,且所述上一个显示界面的尾控件作为下一个显示界面的参照控件。
  32. 根据权利要求26所述的应用界面遍历方法,所述智能处理设备判断所述目标界面的控件是否已全部遍历,包括:
    所述智能处理设备获取所述目标界面的控件列表,依据所述目标界面的控件列表和已遍历界面的控件列表,判断已遍历的界面中是否存在所述目标界面的类界面,如果存在,所述智能处理设备获取所述类界面中已遍历过的有效控件;
    所述智能处理设备将所述目标界面的控件列表中与所述类界面中已遍历过的有效控件 相同的有效控件标记为已遍历控件,根据前面得到的标记结果判断所述目标界面的有效控件是否已全部遍历;
    其中,如果两个界面具有N个不同的有效控件,且所述N在许可范围之内,则这两个界面互为类界面。
  33. 根据权利要求25所述的应用界面遍历方法,在进入未遍历的控件对应的界面之后,还包括:
    所述智能处理设备在所述控件列表中将所述未遍历的控件标记为已遍历控件;
    所述智能处理设备存储所述未遍历的控件与所述未遍历的控件对应的界面之间的跳转关系。
PCT/CN2017/107288 2016-11-01 2017-10-23 应用界面遍历方法、系统和测试设备 WO2018082462A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/358,774 US10990511B2 (en) 2016-11-01 2019-03-20 Apparatus and application interface traversing method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610942112.8A CN108009078B (zh) 2016-11-01 2016-11-01 一种应用界面遍历方法、系统和测试设备
CN201610942112.8 2016-11-01

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/358,774 Continuation US10990511B2 (en) 2016-11-01 2019-03-20 Apparatus and application interface traversing method

Publications (1)

Publication Number Publication Date
WO2018082462A1 true WO2018082462A1 (zh) 2018-05-11

Family

ID=62047254

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/107288 WO2018082462A1 (zh) 2016-11-01 2017-10-23 应用界面遍历方法、系统和测试设备

Country Status (3)

Country Link
US (1) US10990511B2 (zh)
CN (1) CN108009078B (zh)
WO (1) WO2018082462A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109491890A (zh) * 2018-10-16 2019-03-19 深圳壹账通智能科技有限公司 应用程序的接口扫描方法及终端设备
CN113094281A (zh) * 2021-04-28 2021-07-09 杭州网易云音乐科技有限公司 一种混合式App的测试方法及装置

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109062793B (zh) * 2018-07-23 2022-03-04 北京云测信息技术有限公司 一种滚轮控件的测试方法、装置及电子设备
CN109614176B (zh) * 2018-10-30 2021-10-15 努比亚技术有限公司 一种应用界面布局方法、终端及计算机可读存储介质
CN111243580B (zh) * 2018-11-28 2023-06-09 Tcl科技集团股份有限公司 语音控制方法、装置及计算机可读存储介质
CN110442820A (zh) * 2019-07-24 2019-11-12 上海易点时空网络有限公司 用于网页的图片合成方法以及装置
CN110515835B (zh) * 2019-07-30 2023-05-23 上海云扩信息科技有限公司 一种基于机器视觉和dom树结构的测试方法
CN110580221A (zh) * 2019-08-21 2019-12-17 东软集团股份有限公司 控件测试方法、装置、存储介质及电子设备
CN112532966A (zh) * 2019-08-27 2021-03-19 中兴通讯股份有限公司 机顶盒测试方法、装置、机顶盒及计算机可读存储介质
CN111208929B (zh) * 2020-01-03 2021-11-02 广州虎牙科技有限公司 多层级界面的响应方法、装置、设备及存储介质
CN111309622A (zh) * 2020-02-27 2020-06-19 中国平安人寿保险股份有限公司 应用程序测试方法、装置、终端设备以及存储介质
CN112019839A (zh) * 2020-09-18 2020-12-01 四川长虹电器股份有限公司 一种安卓智能电视应用自动化测试方法
CN115292571B (zh) * 2022-08-08 2023-03-28 烟台中科网络技术研究所 一种App数据采集方法及系统
CN117149663B (zh) * 2023-10-30 2024-02-02 合肥中科类脑智能技术有限公司 多目标检测算法的部署方法、装置、电子设备和介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455414A (zh) * 2012-06-04 2013-12-18 腾讯科技(深圳)有限公司 获取控件的逻辑位置的方法及装置
CN105138357A (zh) * 2015-08-11 2015-12-09 中山大学 一种移动应用操作助手的实现方法及其装置
CN105302715A (zh) * 2014-07-30 2016-02-03 腾讯科技(深圳)有限公司 应用程序用户界面的获取方法和装置
US20160162590A1 (en) * 2014-05-12 2016-06-09 International Business Machines Corporation Browser Search Result Option to Facilitate Human Spidering

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7240325B2 (en) * 2002-09-11 2007-07-03 International Business Machines Corporation Methods and apparatus for topology discovery and representation of distributed applications and services
US7779374B1 (en) * 2006-09-29 2010-08-17 Breker Verification Systems, Inc. Generating self-checking test cases from reduced case analysis graphs
CN101403967A (zh) * 2008-11-12 2009-04-08 恒生电子股份有限公司 界面保存和显示方法、客户端和服务器
US9152537B2 (en) * 2013-02-08 2015-10-06 Facebook, Inc. Semantic stack trace
CN104572430B (zh) * 2013-10-24 2018-04-27 腾讯科技(深圳)有限公司 一种终端应用界面的测试方法、装置和系统
CN105022687B (zh) * 2014-04-22 2018-10-26 腾讯科技(深圳)有限公司 自动化测试方案中滑动操作的实现方法及装置
CN105630686B (zh) * 2016-03-24 2018-12-18 厦门美图移动科技有限公司 一种应用遍历测试方法、设备和移动终端
US10169220B2 (en) * 2016-08-05 2019-01-01 International Business Machines Corporation Prioritizing resiliency tests of microservices

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455414A (zh) * 2012-06-04 2013-12-18 腾讯科技(深圳)有限公司 获取控件的逻辑位置的方法及装置
US20160162590A1 (en) * 2014-05-12 2016-06-09 International Business Machines Corporation Browser Search Result Option to Facilitate Human Spidering
CN105302715A (zh) * 2014-07-30 2016-02-03 腾讯科技(深圳)有限公司 应用程序用户界面的获取方法和装置
CN105138357A (zh) * 2015-08-11 2015-12-09 中山大学 一种移动应用操作助手的实现方法及其装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109491890A (zh) * 2018-10-16 2019-03-19 深圳壹账通智能科技有限公司 应用程序的接口扫描方法及终端设备
CN113094281A (zh) * 2021-04-28 2021-07-09 杭州网易云音乐科技有限公司 一种混合式App的测试方法及装置
CN113094281B (zh) * 2021-04-28 2024-05-03 杭州网易云音乐科技有限公司 一种混合式App的测试方法及装置

Also Published As

Publication number Publication date
US10990511B2 (en) 2021-04-27
CN108009078A (zh) 2018-05-08
US20190213114A1 (en) 2019-07-11
CN108009078B (zh) 2021-04-27

Similar Documents

Publication Publication Date Title
WO2018082462A1 (zh) 应用界面遍历方法、系统和测试设备
CN108665297B (zh) 异常访问行为的检测方法、装置、电子设备和存储介质
US20190303269A1 (en) Methods and systems for testing visual aspects of a web page
WO2018109589A1 (en) Updating data records by adding editing functions to non-editable display elements
WO2020215563A1 (zh) 用于文本分类的训练样本生成方法、装置和计算机设备
US20130055117A1 (en) User interface validation assistant
WO2015010566A1 (zh) 综合信息精准搜索方法
CN109803152A (zh) 违规审核方法、装置、电子设备以及存储介质
US10949399B2 (en) Dynamically synchronizing electronic surveys and collaborative survey representation documents
US20200201856A1 (en) Entity extraction rules harvesting and performance
US20150242380A1 (en) Checking testing coverage
CA2956207C (en) Program code comparison and reporting
US20220374334A1 (en) Techniques for visual software test automation management
US20220374339A1 (en) Techniques for visual software test automation management
CN111159016A (zh) 一种规范检测方法及装置
US20220374338A1 (en) Techniques for visual software test automation management
US10503743B2 (en) Integrating search with application analysis
US11068617B2 (en) Secure access to multi-tenant relational data
CN112306870A (zh) 一种基于直播app的数据处理方法和装置
JP5422589B2 (ja) モジュール解析システム、モジュール解析方法及びモジュール解析プログラム
CN110795101A (zh) Sql代码信息显示方法、装置、计算机装置及存储介质
CN115481025A (zh) 自动化测试的脚本录制方法、装置、计算机设备及介质
CN112699372A (zh) 漏洞处理方法、装置和计算机可读存储介质
JP5020274B2 (ja) 意味ドリフトの発生評価方法及び装置
US9524307B2 (en) Asynchronous error checking in structured documents

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17867313

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17867313

Country of ref document: EP

Kind code of ref document: A1