CN109656827A - A kind of control tree generation method and terminal device - Google Patents

A kind of control tree generation method and terminal device Download PDF

Info

Publication number
CN109656827A
CN109656827A CN201811542495.5A CN201811542495A CN109656827A CN 109656827 A CN109656827 A CN 109656827A CN 201811542495 A CN201811542495 A CN 201811542495A CN 109656827 A CN109656827 A CN 109656827A
Authority
CN
China
Prior art keywords
node
tree
control tree
application
initial control
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811542495.5A
Other languages
Chinese (zh)
Other versions
CN109656827B (en
Inventor
蒋晓海
金伟光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Testin Information Technology Co Ltd
Original Assignee
Beijing Testin Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Testin Information Technology Co Ltd filed Critical Beijing Testin Information Technology Co Ltd
Priority to CN201811542495.5A priority Critical patent/CN109656827B/en
Publication of CN109656827A publication Critical patent/CN109656827A/en
Application granted granted Critical
Publication of CN109656827B publication Critical patent/CN109656827B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

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

Abstract

The invention discloses a kind of control tree generation methods, comprising: generates the initial control tree of application to be tested, the node in initial control tree and the control in application to be tested correspond;According to each node region in initial control tree, at least one destination node is determined;Based at least one destination node, target widget tree is generated, is tested with treating test application.The embodiment of the present invention can efficiently search the control in control tree, to improve the efficiency for applying automatic test.

Description

A kind of control tree generation method and terminal device
Technical field
The present invention relates to automatic test field more particularly to a kind of control tree generation method and terminal devices.
Background technique
In application delivery before use, the performance of application would generally be checked by application test.When carrying out using test, It can use testing tool, according to test case, tested application operated under the defined conditions, to find to apply Mistake is measured application quality, and is assessed whether application is able to satisfy design requirement.
In application automatic test course, need to obtain the corresponding control tree of application to be tested, based on lookup control Control in tree realizes the test to respective application performance etc..As it can be seen that the efficiency that the control in control tree is searched, it can shadow The response efficiency of automatic test.
Therefore, it is necessary to a kind of control tree generation methods, efficiently to search the control in control tree, to improve Using the efficiency of automatic test.
Summary of the invention
The embodiment of the present invention provides a kind of control tree generation method and terminal device, it is intended to realize to the control in control tree It is efficiently searched, to improve the efficiency using automatic test.
The embodiment of the present invention adopts the following technical solutions:
In a first aspect, the embodiment of the present invention provides a kind of control tree generation method, comprising:
The initial control tree of application to be tested is generated, in the node in the initial control tree and the application to be tested Control corresponds;
According to each node region in the initial control tree, at least one destination node is determined;
Based at least one described destination node, target widget tree is generated, to test the application to be tested.
Optionally, described according in the initial control tree in the control tree generation method that the application first aspect provides Each node region, determine at least one destination node, comprising:
Using any node in the initial control tree as first node, detect whether the first node is in default In region;
In the case where the first node is in the predeterminable area, determine that the first node is destination node;
Above procedure is repeated, until traversing each node in the initial control tree.
Optionally, described according in the initial control tree in the control tree generation method that the application first aspect provides Each node region, determine at least one destination node, comprising:
Using any node in the initial control tree as second node, based on each node in the initial control tree Between inheritance, judge the second node with the presence or absence of child node;
In the case where child node is not present in the second node, if the second node is in predeterminable area, really The fixed second node is destination node;
In the second node there are in the case where child node, if any child node of the second node is in described pre- If in region, it is determined that the second node is destination node;
Above procedure is repeated, until traversing each node in the initial control tree.
Optionally, in the control tree generation method that the application first aspect provides, the predeterminable area is greater than terminal screen Display area.
Optionally, in the control tree generation method that the application first aspect provides, the predeterminable area is the viewing area The default integral multiple in domain, the default integer are greater than or equal to 9.
Optionally, described based at least one described target in the control tree generation method that the application first aspect provides Node generates target widget tree, comprising:
By the corresponding control information of destination node each at least one described destination node, stored according to preset format Into control file;
Based on the control file, the target widget tree is generated.
Optionally, in the control tree generation method that the application first aspect provides, the preset format includes expansible mark Remember language format.
Optionally, described based at least one described target in the control tree generation method that the application first aspect provides Node generates target widget tree, further includes:
Other nodes in each node in the initial control tree in addition at least one described destination node are given up.
Second aspect, the embodiment of the present invention provide a kind of terminal device, comprising:
First generation module, for generating the initial control tree of application to be tested, node in the initial control tree with Control in the application to be tested corresponds;
Determining module, for determining at least one target section according to each node region in the initial control tree Point;
Second generation module generates target widget tree based at least one described destination node, to be tested to answer to described With being tested.
The third aspect, the embodiment of the present application provide a kind of terminal device, comprising:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the place when executed It manages device and executes following operation:
The initial control tree of application to be tested is generated, in the node in the initial control tree and the application to be tested Control corresponds;
According to each node region in the initial control tree, at least one destination node is determined;
Based at least one described destination node, target widget tree is generated, to test the application to be tested.
Fourth aspect, the embodiment of the present application provide a kind of computer readable storage medium, the computer-readable storage medium Matter stores one or more programs, one or more of programs when the electronic equipment for being included multiple application programs executes, So that the electronic equipment executes following operation:
The initial control tree of application to be tested is generated, in the node in the initial control tree and the application to be tested Control corresponds;
According to each node region in the initial control tree, at least one destination node is determined;
Based at least one described destination node, target widget tree is generated, to test the application to be tested.
At least one above-mentioned technical solution used in the embodiment of the present invention can reach it is following the utility model has the advantages that
The embodiment of the present invention needs during treating test application progress automatic test based on application to be tested Control tree complete automatic test course in required control lookup, then need to generate the target widget tree of application to be tested with Applied in the automatic test course for treating test application, it is preferred that can be based in the initial control tree of application to be tested Each node region, filter out at least one destination node for generating target widget tree, with realize to initial control Tree is simplified, that is to say, that realizes simplifying for the control required to look up in the automatic test course for treating test application.Such as This, the initial control tree by treating test application is simplified, and reduction is applied to the automatic test course of application to be tested In control tree scale, can application automatic test course in, realization the control in control tree is efficiently searched, from And improve the reliability of the efficiency and test result using automatic test.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present invention, constitutes a part of the invention, this hair Bright illustrative embodiments and their description are used to explain the present invention, and are not constituted improper limitations of the present invention.In the accompanying drawings:
Fig. 1 is the flow diagram of control tree generation method in the embodiment of the present invention;
Fig. 2 is the schematic diagram of predeterminable area in the embodiment of the present invention;
Fig. 3 is the another flow diagram of control tree generation method in the embodiment of the present invention;
Fig. 4 is the structural schematic diagram of terminal device in the embodiment of the present invention;
Fig. 5 is the another structural schematic diagram of terminal device in the embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts Example, shall fall within the protection scope of the present invention.
Before being delivered for use using (abbreviation of application program (APP, Application)), it will usually be tested by application To check the performance of application.When carrying out using test, testing tool can use, according to test case, in defined condition Under tested application is operated, to find application error, measure application quality, and want to whether application is able to satisfy design It asks and is assessed.
In application automatic test course, need to obtain the corresponding control tree of application to be tested, based on lookup control Control in tree realizes the test to respective application performance etc..As it can be seen that the efficiency that the control in control tree is searched, it can shadow The response efficiency of automatic test, that is to say, that if control tree acquisition is abundant, acquisition fast, entire application is automatically The process for changing test can be relatively more efficient.
In addition, in actual application automatic test course, when control tree got, is multi-level, and can exceed Screen ranges, such as certain catalogues for reading application, might have thousands of chapters and sections catalogues, then the control actually got Tree, it will have more than the space of tens screens.But existing in these controls does not have practical use for application test That is, there is useless information for application automatic test in control, and can also be during the test to lookup in control tree Effective control causes very big interference, for example, because of the interference of useless control, cause to have found not existing control or The control outside screen is had found, in this way, being unfavorable for smoothly completing for script recording;Moreover, if the control tree got is very big, Also the speed that control is searched in test process can be largely effected on.
Therefore, the embodiment of the present invention provides a kind of control tree generation method and terminal device, to can be efficiently to control Control in part tree is searched, to improve the reliability of the efficiency and test result using automatic test.
The technical solution provided below in conjunction with attached drawing, each embodiment that the present invention will be described in detail.
Shown in Figure 1, the embodiment of the present invention provides a kind of control tree generation method, is executed by terminal device.
This method may particularly include:
Step S101: generating the initial control tree of application to be tested, in the node in initial control tree and application to be tested Control correspond.
Optionally, application to be tested can be to be suitably mounted to using IOS operating system (apple mobile device operation system System) terminal device on application, be readily applicable to be mounted on the terminal device using Android (Android) operating system Application;It can certainly be the application being suitably mounted on the terminal device using other kinds of operating system.
Optionally, it during generating the initial control tree of application to be tested, can successively parse in application to be tested Each control, and each control is used as to each node of control tree correspondingly, is closed with the succession between each node of control tree System characterizes the incidence relation between each control of application to be tested, to obtain the initial control tree of application to be tested.
Step S103: according to each node region in initial control tree, at least one destination node is determined.
Step S105: being based at least one destination node, generates target widget tree, is tested with treating test application.
It is appreciated that can be realized based on the concrete condition of each node region in initial control tree to initial control The screening of node on part tree obtains at least one destination node, carries out automatic test for treating test application to generate Target widget tree.
The embodiment of the present invention needs during treating test application progress automatic test based on application to be tested Control tree complete automatic test course in required control lookup, then need to generate the target widget tree of application to be tested with Applied in the automatic test course for treating test application, it is preferred that can be based in the initial control tree of application to be tested Each node region, filter out at least one destination node for generating target widget tree, with realize to initial control Tree is simplified, that is to say, that realizes simplifying for the control required to look up in the automatic test course for treating test application.Such as This, the initial control tree by treating test application is simplified, and reduction is applied to the automatic test course of application to be tested In control tree scale, can application automatic test course in, realization the control in control tree is efficiently searched, from And improve the reliability of the efficiency and test result using automatic test.
Optionally, the destination node in the embodiment of the present invention may include the script record in application automatic testing process The corresponding node of the control for needing to be recorded in link processed can carry out visualization display in the screen interface of terminal device The corresponding node of control, in this way, simplified by treating the node in the corresponding initial control tree of test application, then it can be with base In the corresponding each effective control of each destination node on the target widget tree simplified, it is efficiently completed script recording, then phase It is recorded compared with based on the script to be tested realized using corresponding initial control tree, can significantly improve recording efficiency.
Optionally, it for documented scheme in above-mentioned steps S103, can be realized by different specific embodiments, with The node in the initial control tree of test application is treated to be screened, simplified.
In a specific embodiment of the embodiment of the present invention, above-mentioned steps S103 can be executed as following process:
Using any node in initial control tree as first node, whether detection first node is in predeterminable area; In the case where first node is in predeterminable area, determine that first node is destination node;Above procedure is repeated, until Traverse each node in initial control tree.
It is appreciated that in this specific embodiment, the tool of each node region in initial control tree can be based only upon Body situation is realized and treats the screening of the node in the corresponding initial control tree of test application, simplifies, to generate for to be tested Using the target widget tree tested.
It, can be equal to each node in initial control tree during being simplified to the node in initial control tree Execute node whether the judgement in the region (i.e. predeterminable area) being set in advance, i.e., to all nodes in initial control tree It is traversed, if it is determined that the node in the predeterminable area, is then determined as destination node by node, that is to say, that will initially control The node being located in predeterminable area on part tree is screened as the destination node on target widget tree, in this way, can be accurate And it reliably obtains for the target widget tree in application automatic test course.
Optionally, when being traversed to each node in initial control tree, can using preorder traversal, inorder traversal and Any mode in postorder traversal, wherein preorder traversal refers to the root node for accessing initial control tree first and then traverses a left side Subtree finally traverses right subtree, when traversing left and right subtree, still first accesses root node, then traverses left subtree, and last time Right subtree is gone through, is returned if binary tree is sky, until having traversed each node in initial control tree;Inorder traversal refers to first Then the left subtree for traversing initial control tree accesses root node, finally traverses right subtree, terminate to return if binary tree is sky, Otherwise the process for repeating inorder traversal left subtree, access root node, inorder traversal right subtree, until having traversed in initial control tree Each node;Postorder traversal refers to the left subtree for traversing initial control tree first, then traverses right subtree, finally accesses root section Point still traverses left subtree, then traverses right subtree, finally access root node, if binary tree is when traversing left and right subtree It is empty then terminate to return, otherwise repeatedly postorder traversal left subtree, postorder traversal right subtree, the process for accessing root node, until traversal Each node in complete initial control tree.
It is of course also possible to carry out unordered traversal to each node in initial control tree, traversed initially as long as can ensure that Each node of control tree, is not omitted, that is to say, that can guarantee to hold each node in initial control tree Row node whether the traversal mode of the judgement in predeterminable area, fall within the protection scope of the present invention.
In another specific embodiment of the embodiment of the present invention, above-mentioned steps S103 can be executed as following process:
Using any node in initial control tree as second node, based between each node in initial control tree after Relationship is held, judges second node with the presence or absence of child node;In the case where child node is not present in second node, if at second node In in predeterminable area, it is determined that second node is destination node;In second node there are in the case where child node, if second node Any child node be in predeterminable area, it is determined that second node is destination node;Above procedure is repeated, until traversal Each node in initial control tree.
It, can be in conjunction with each node region in initial control tree and initial it is appreciated that in this specific embodiment The concrete condition of inheritance in control tree between each node realizes the section treated in the corresponding initial control tree of test application The screening of point is simplified, to generate the target widget tree tested for treating test application.
It, can be equal to each node in initial control tree during being simplified to the node in initial control tree The judgement whether node has child node is executed, for there is no the node of child node in initial control tree, i.e., using directly judgement Whether node is in the region (i.e. predeterminable area) being set in advance, if it is determined that node is in the predeterminable area, then by the node It is determined as destination node;And for there is the node of child node in initial control tree, then it whether needs based on each child node default Concrete condition in region determines whether the node (father node of i.e. each child node) can be as destination node, if the node Under at least one child node be determined in predeterminable area, then the node can be determined as destination node, that is to say, that For the judgment step for thering is the node of child node whether to be in predeterminable area without executing node, need to only the node be being traversed Child node after, determine whether the node remains with the child node in predeterminable area.In this way, by initial control tree Part of nodes execute whether node is located at the judgement in predeterminable area, can be efficiently completed to all in initial control tree The screening of node is simplified, and the acquisition efficiency of the destination node on target widget tree is improved, to improve for treating test application The formation efficiency for the target widget tree tested, accurately and reliably to obtain for the mesh in application automatic test course Mark control tree.
Further, in the above-mentioned any specific implementation of the present invention, optionally, predeterminable area is greater than the aobvious of terminal screen Show region.
It is appreciated that in embodiments of the present invention, the big predeterminable area of the range based on the display area than terminal screen, Destination node is screened in each node in initial control tree, to meet the size for reducing initial control tree, filter out effectively It, can be to avoid effective control outside screen indication range be omitted, i.e., outside reduction screen indication range while control Influence of the control to target widget tree is generated.
It is further preferred that predeterminable area be terminal screen display area default integral multiple, preset integer be greater than Or the integer equal to 9.
It is appreciated that the setting value of predeterminable area is empirical value, it can be optionally the pre- of the display area of terminal screen If integral multiple, in order to reach the effective control neither filtered out in initial control tree, information, and excessive useless control is avoided Part, information are mixed into target widget tree, and default integer can be taken as the number more than or equal to 9;To reach raising to control tree The search speed of control and the purpose for improving transmission speed of the target widget tree between terminal device and the end PC, for example, The interface of some terminal devices, the size of a control tree can be several million or more than ten000000, but pass through above-mentioned filtering, screening, essence It can be several hundred kb after letter;Obviously, raising of the control tree for the search speed of control, the transmission speed of control tree after simplifying, Effect can be obvious, and the control that can be also reduced outside screen ranges certainly causes control lookup in application automatic test course Many interference.
It is further preferred that predeterminable area is rectangular area, as shown in Fig. 2, the width 3a of predeterminable area is terminal screen 3 times of width a of display area, the length 3b of predeterminable area be 3 times of length b of display area of terminal screen, then in advance If region is preferably 9 times of the display area of terminal screen, and the display area of terminal screen is being placed in predeterminable area When center, any the first of predeterminable area is straight where in any the second of the display area of place straight line and terminal screen Target area between line is greater than the display area of terminal screen, and target area belongs to predeterminable area, wherein the first side and second Side is adjacent and is arranged in parallel.
Optionally, scheme documented by above-mentioned steps S105 in the embodiment of the present invention can be realized by following process:
By the corresponding control information of destination node each at least one destination node, store according to preset format to control In part file.
Based on control file, target widget tree is generated.
It is appreciated that by that will screen, the corresponding control information of each destination node simplifying out is by certain format (i.e. preset format) is stored into control file, then can be generated based on the content stored in control file convenient for answering to be tested With the target widget tree tested.
Optionally, preset format can be that control file can be made to have structural language format, it is preferred that default lattice Formula includes extensible markup language format, i.e. XML (Extensible Markup Language) format, in this way, not only can be with The search efficiency for improving control is also convenient for the positioning that subsequent script recording process carries out control, accurate and efficient.
Optionally, scheme documented by above-mentioned steps S105 in the embodiment of the present invention, can also comprise the following processes:
Other nodes in each node in initial control tree in addition at least one destination node are given up.
It is appreciated that in the embodiment of the present application, for being not determined to the remaining of destination node in initial control tree Other nodes can be given up, and interfere to avoid during generating in target widget tree, complete to initial control The filtering of node on tree.
It optionally, can be unified by initial control tree after filtering out at least one destination node in initial control tree Other upper all remaining nodes are given up;The case where can also not being destination node with a node in the initial control tree of every determination Under, it is directly given up, whether another node then gone to judge again in initial control tree is destination node, is so recycled past It is multiple, until having traversed all nodes in initial control tree.
It is specifically described below with reference to control tree generating process of the Fig. 3 to the embodiment of the present invention, the control tree generation side Method the following steps are included:
Step S301: the initial control tree of application to be tested is obtained.
Step S302: the root node of initial control tree is determined.
Step S303: the node of initial control tree is traversed.
Step S304: judging whether it has child node for each node in initial control tree, if not having, after The next node of the continuous initial control tree of traversal, that is, return to step S303, if there is child node, then follow the steps S305.
Step S305: whether the node for detecting the not child node in initial control tree exceeds in predeterminable area, if super Out, S306 is thened follow the steps, it is no to then follow the steps S307.
Step S306: without child node and predeterminable area will be exceeded, then gives up this node.
Step S307: retaining the node and have child node to be located at the node in predeterminable area that itself is located in predeterminable area, And it adds it in the file of XML format of building.
Step S308: detecting whether to complete the judgement to node each in initial control tree, if executing step S309, if It is no, S303 is returned to step, to continue to traverse the remaining node in initial control tree.
Step S309: the content stored in the file based on XML format generates control tree to be tested.
It is appreciated that needing to obtain the initial control tree of application to be tested first, then root node is judged, if Root node has child node, then just judging each child node, and if there is child node, successively carries out recurrence judgement down, Start to recall to father node when determining the not leaf node of child node.Wherein, the content meaning in recurrence judgement Think of is exactly: if leaf node has exceeded certain rectangular extent, just skips, then father node is exactly no child node, Because child node is filtered;Then father node is judged again whether in range, if not, equally filtering out;If leaf Child node is in range, then Kubo stays, traces back to father node, this father node is to have child node and child node is located at square at this time Within the scope of shape, then father node is not just by the filtering of this range.
An appropriate filter type is found in practice through the foregoing embodiment, that is, is obtaining the first of application to be tested After beginning control tree, will itself beyond outside predeterminable area or without child node be located at the node in predeterminable area and be all discharged and exist Outside, treat that the simplifying of the node in the initial control tree of test application, the size of control tree is shunk to realize;It is then based on screening The file of control information composition XML format out, and then generated based on the content recorded in file for completing application to be tested Automatic test target widget tree, and can make include in the corresponding control of the node remained on target widget tree Control is imitated, garbage is filtered out, and then when carrying out control lookup based on the target widget tree, the effect of lookup can be improved Rate, and reduce search procedure in by screen ranges outside control interference probability;In addition, simplifying based on control tree, is inciting somebody to action The target widget tree of generation is transmitted to extraneous (end PC, Personal Computer, individual calculus by Socket (socket) Machine) speed can also be improved and improve script recording efficiency.
Shown in Figure 4, the embodiment of the present invention also provides a kind of terminal device, may particularly include:
First generation module 401, for generating the initial control tree of application to be tested, node in initial control tree with to Control in test application corresponds;
Determining module 403, for determining at least one target section according to each node region in initial control tree Point;
Second generation module 405, be based at least one destination node, generate target widget tree, with treat test application into Row test.
Preferably, in terminal device provided in an embodiment of the present invention, above-mentioned determining module 403 can be used for:
Using any node in initial control tree as first node, whether detection first node is in predeterminable area;
In the case where first node is in predeterminable area, determine that first node is destination node;
Above procedure is repeated, until traversing each node in initial control tree.
Preferably, in terminal device provided in an embodiment of the present invention, above-mentioned determining module 403 can be used for:
Using any node in initial control tree as second node, based between each node in initial control tree after Relationship is held, judges second node with the presence or absence of child node;
In the case where child node is not present in second node, if second node is in predeterminable area, it is determined that the second section Point is destination node;
In second node there are in the case where child node, if any child node of second node is in predeterminable area, Determine that second node is destination node;
Above procedure is repeated, until traversing each node in initial control tree.
Preferably, in terminal device provided in an embodiment of the present invention, predeterminable area is greater than the display area of terminal screen.
Preferably, in terminal device provided in an embodiment of the present invention, predeterminable area is the default integral multiple of display area, in advance If integer is greater than or equal to 9.
Preferably, in terminal device provided in an embodiment of the present invention, above-mentioned second generation module 405 can be used for:
By the corresponding control information of destination node each at least one destination node, store according to preset format to control In part file;
Based on control file, target widget tree is generated.
Preferably, in terminal device provided in an embodiment of the present invention, preset format includes extensible markup language format.
Preferably, in terminal device provided in an embodiment of the present invention, above-mentioned second generation module 405 be can be also used for:
Other nodes in each node in initial control tree in addition at least one destination node are given up.
It is understood that terminal device provided in an embodiment of the present invention, can be realized the aforementioned control executed by terminal device The each process for setting generation method, related illustrate about control tree generation method is suitable for terminal device, no longer superfluous herein It states.
The embodiment of the present invention needs during treating test application progress automatic test based on application to be tested Control tree complete automatic test course in required control lookup, then need to generate the target widget tree of application to be tested with Applied in the automatic test course for treating test application, it is preferred that can be based in the initial control tree of application to be tested Each node region, filter out at least one destination node for generating target widget tree, with realize to initial control Tree is simplified, that is to say, that realizes simplifying for the control required to look up in the automatic test course for treating test application.Such as This, the initial control tree by treating test application is simplified, and reduction is applied to the automatic test course of application to be tested In control tree scale, can application automatic test course in, realization the control in control tree is efficiently searched, from And improve the reliability of the efficiency and test result using automatic test.
A kind of hardware structural diagram of Fig. 5 terminal device of each embodiment to realize the present invention.
The terminal device 500 includes but is not limited to: radio frequency unit 501, network module 502, audio output unit 503, defeated Enter unit 504, sensor 505, display unit 506, user input unit 507, interface unit 508, memory 509, processor The components such as 510 and power supply 511.It will be understood by those skilled in the art that the not structure of 500 structure of terminal device shown in Fig. 5 The restriction of paired terminal equipment, terminal device may include components more more or fewer than diagram, or combine certain components, or The different component layout of person.In embodiments of the present invention, terminal device 500 includes but is not limited to mobile phone, tablet computer, notebook Computer, palm PC, car-mounted terminal, wearable device and pedometer etc..
Wherein, processor 510, for executing following procedure:
The initial control tree of application to be tested is generated, the node in initial control tree and the control in application to be tested are one by one It is corresponding;
According to each node region in initial control tree, at least one destination node is determined;
Based at least one destination node, target widget tree is generated, is tested with treating test application.
The embodiment of the present invention needs during treating test application progress automatic test based on application to be tested Control tree complete automatic test course in required control lookup, then need to generate the target widget tree of application to be tested with Applied in the automatic test course for treating test application, it is preferred that can be based in the initial control tree of application to be tested Each node region, filter out at least one destination node for generating target widget tree, with realize to initial control Tree is simplified, that is to say, that realizes simplifying for the control required to look up in the automatic test course for treating test application.Such as This, the initial control tree by treating test application is simplified, and reduction is applied to the automatic test course of application to be tested In control tree scale, can application automatic test course in, realization the control in control tree is efficiently searched, from And improve the reliability of the efficiency and test result using automatic test.
It should be understood that the embodiment of the present invention in, radio frequency unit 501 can be used for receiving and sending messages or communication process in, signal Send and receive, specifically, by from base station downlink data receive after, to processor 510 handle;In addition, by uplink Data are sent to base station.In general, radio frequency unit 501 includes but is not limited to antenna, at least one amplifier, transceiver, coupling Device, low-noise amplifier, duplexer etc..In addition, radio frequency unit 501 can also by wireless communication system and network and other set Standby communication.
Terminal device 500 provides wireless broadband internet by network module 502 for user and accesses, and such as helps user It sends and receive e-mail, browse webpage and access streaming video etc..
Audio output unit 503 can be received by radio frequency unit 501 or network module 502 or in memory 509 The audio data of storage is converted into audio signal and exports to be sound.Moreover, audio output unit 503 can also provide and end The relevant audio output of specific function that end equipment 500 executes is (for example, call signal receives sound, message sink sound etc. Deng).Audio output unit 503 includes loudspeaker, buzzer and receiver etc..
Input unit 504 is for receiving audio or video signal.Input unit 504 may include graphics processor (Graphics Processing Unit, GPU) 5041 and microphone 5042, graphics processor 5041 is in video acquisition mode Or the image data of the static images or video obtained in image capture mode by image capture apparatus (such as camera) carries out Reason.Treated, and picture frame may be displayed on display unit 506.Through graphics processor 5041, treated that picture frame can be deposited Storage is sent in memory 509 (or other storage mediums) or via radio frequency unit 501 or network module 502.Mike Wind 5042 can receive sound, and can be audio data by such acoustic processing.Treated audio data can be The format output that mobile communication base station can be sent to via radio frequency unit 501 is converted in the case where telephone calling model.
Terminal device 500 further includes at least one sensor 505, such as optical sensor, motion sensor and other biographies Sensor.Specifically, optical sensor includes ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 5061, and proximity sensor can close when terminal device 500 is moved in one's ear Display panel 5061 and/or backlight.As a kind of motion sensor, accelerometer sensor can detect in all directions (general For three axis) size of acceleration, it can detect that size and the direction of gravity when static, can be used to identify terminal device posture (ratio Such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap);It passes Sensor 505 can also include fingerprint sensor, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer, wet Meter, thermometer, infrared sensor etc. are spent, details are not described herein.
Display unit 506 is for showing information input by user or being supplied to the information of user.Display unit 506 can wrap Display panel 5061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be used Forms such as (Organic Light-Emitting Diode, OLED) configure display panel 5061.
User input unit 507 can be used for receiving the number or character information of input, and generate the use with terminal device Family setting and the related key signals input of function control.Specifically, user input unit 507 include touch panel 5071 and Other input equipments 5072.Touch panel 5071, also referred to as touch screen collect the touch operation of user on it or nearby (for example user uses any suitable objects or attachment such as finger, stylus on touch panel 5071 or in touch panel 5071 Neighbouring operation).Touch panel 5071 may include both touch detecting apparatus and touch controller.Wherein, touch detection Device detects the touch orientation of user, and detects touch operation bring signal, transmits a signal to touch controller;Touch control Device processed receives touch information from touch detecting apparatus, and is converted into contact coordinate, then gives processor 510, receiving area It manages the order that device 510 is sent and is executed.Furthermore, it is possible to more using resistance-type, condenser type, infrared ray and surface acoustic wave etc. Seed type realizes touch panel 5071.In addition to touch panel 5071, user input unit 507 can also include other input equipments 5072.Specifically, other input equipments 5072 can include but is not limited to physical keyboard, function key (such as volume control button, Switch key etc.), trace ball, mouse, operating stick, details are not described herein.
Further, touch panel 5071 can be covered on display panel 5061, when touch panel 5071 is detected at it On or near touch operation after, send processor 510 to determine the type of touch event, be followed by subsequent processing device 510 according to touching The type for touching event provides corresponding visual output on display panel 5061.Although in Fig. 5, touch panel 5071 and display Panel 5061 is the function that outputs and inputs of realizing terminal device as two independent components, but in some embodiments In, can be integrated by touch panel 5071 and display panel 5061 and realize the function that outputs and inputs of terminal device, it is specific this Place is without limitation.
Interface unit 508 is the interface that external device (ED) is connect with terminal device 500.For example, external device (ED) may include having Line or wireless head-band earphone port, external power supply (or battery charger) port, wired or wireless data port, storage card end Mouth, port, the port audio input/output (I/O), video i/o port, earphone end for connecting the device with identification module Mouthful etc..Interface unit 508 can be used for receiving the input (for example, data information, electric power etc.) from external device (ED) and By one or more elements that the input received is transferred in terminal device 500 or can be used in 500 He of terminal device Data are transmitted between external device (ED).
Memory 509 can be used for storing software program and various data.Memory 509 can mainly include storing program area The storage data area and, wherein storing program area can (such as the sound of application program needed for storage program area, at least one function Sound playing function, image player function etc.) etc.;Storage data area can store according to mobile phone use created data (such as Audio data, phone directory etc.) etc..In addition, memory 509 may include high-speed random access memory, it can also include non-easy The property lost memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts.
Processor 510 is the control centre of terminal device, utilizes each of various interfaces and the entire terminal device of connection A part by running or execute the software program and/or module that are stored in memory 509, and calls and is stored in storage Data in device 509 execute the various functions and processing data of terminal device, to carry out integral monitoring to terminal device.Place Managing device 510 may include one or more processing units;Preferably, processor 510 can integrate application processor and modulatedemodulate is mediated Manage device, wherein the main processing operation system of application processor, User Page and application program etc., modem processor is main Processing wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 510.
Terminal device 500 can also include the power supply 511 (such as battery) powered to all parts, it is preferred that power supply 511 Can be logically contiguous by power-supply management system and processor 510, to realize management charging by power-supply management system, put The functions such as electricity and power managed.
In addition, terminal device 500 includes some unshowned functional modules, details are not described herein.
Preferably, the embodiment of the present invention also provides a kind of terminal device, including processor 510, and memory 509 is stored in On memory 509 and the computer program that can run on the processor 510, the computer program are executed by processor 510 Each process of the above-mentioned control tree generation method embodiment of Shi Shixian, and identical technical effect can be reached, to avoid repeating, this In repeat no more.
The embodiment of the present invention also provides a kind of computer readable storage medium, and meter is stored on computer readable storage medium Calculation machine program, the computer program realize each process of above-mentioned control tree generation method embodiment when being executed by processor, and Identical technical effect can be reached, to avoid repeating, which is not described herein again.Wherein, the computer readable storage medium, such as Read-only memory (Read-Only Memory, abbreviation ROM), random access memory (Random Access Memory, abbreviation RAM), magnetic or disk etc..
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the device that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or device.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in a storage medium In (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal (can be mobile phone, computer, service Device, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The embodiment of the present invention is described with above attached drawing, but the invention is not limited to above-mentioned specific Embodiment, the above mentioned embodiment is only schematical, rather than restrictive, those skilled in the art Under the inspiration of the present invention, without breaking away from the scope protected by the purposes and claims of the present invention, it can also make very much Form belongs within protection of the invention.

Claims (10)

1. a kind of control tree generation method characterized by comprising
The initial control tree of application to be tested is generated, the node in the initial control tree and the control in the application to be tested It corresponds;
According to each node region in the initial control tree, at least one destination node is determined;
Based at least one described destination node, target widget tree is generated, to test the application to be tested.
2. method according to claim 1, each node region according in the initial control tree determines at least One destination node, comprising:
Using any node in the initial control tree as first node, detect whether the first node is in predeterminable area It is interior;
In the case where the first node is in the predeterminable area, determine that the first node is destination node;
Above procedure is repeated, until traversing each node in the initial control tree.
3. method according to claim 1, each node region according in the initial control tree determines at least One destination node, comprising:
Using any node in the initial control tree as second node, based between each node in the initial control tree Inheritance, judge the second node with the presence or absence of child node;
In the case where child node is not present in the second node, if the second node is in predeterminable area, it is determined that institute Stating second node is destination node;
In the second node there are in the case where child node, if any child node of the second node is in the preset areas In domain, it is determined that the second node is destination node;
Above procedure is repeated, until traversing each node in the initial control tree.
4. according to Claims 2 or 3 the method, which is characterized in that the predeterminable area is greater than the display area of terminal screen.
5. method according to claim 4, which is characterized in that the predeterminable area is the default integer of the display area Times, the default integer is greater than or equal to 9.
6. method according to claim 1, which is characterized in that it is described based at least one described destination node, generate target Control tree, comprising:
By the corresponding control information of destination node each at least one described destination node, store according to preset format to control In part file;
Based on the control file, the target widget tree is generated.
7. method according to claim 6, which is characterized in that the preset format includes extensible markup language format.
8. method according to claim 6, which is characterized in that it is described based at least one described destination node, generate target Control tree, further includes:
Other nodes in each node in the initial control tree in addition at least one described destination node are given up.
9. a kind of terminal device characterized by comprising
First generation module, for generating the initial control tree of application to be tested, node in the initial control tree with it is described Control in application to be tested corresponds;
Determining module, for determining at least one destination node according to each node region in the initial control tree;
Second generation module generates target widget tree based at least one described destination node, with to it is described it is to be tested apply into Row test.
10. a kind of terminal device characterized by comprising
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the processor when executed Execute following operation:
The initial control tree of application to be tested is generated, the node in the initial control tree and the control in the application to be tested It corresponds;
According to each node region in the initial control tree, at least one destination node is determined;
Based at least one described destination node, target widget tree is generated, to test the application to be tested.
CN201811542495.5A 2018-12-17 2018-12-17 Control tree generation method and terminal equipment Active CN109656827B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811542495.5A CN109656827B (en) 2018-12-17 2018-12-17 Control tree generation method and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811542495.5A CN109656827B (en) 2018-12-17 2018-12-17 Control tree generation method and terminal equipment

Publications (2)

Publication Number Publication Date
CN109656827A true CN109656827A (en) 2019-04-19
CN109656827B CN109656827B (en) 2021-10-19

Family

ID=66114341

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811542495.5A Active CN109656827B (en) 2018-12-17 2018-12-17 Control tree generation method and terminal equipment

Country Status (1)

Country Link
CN (1) CN109656827B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110765015A (en) * 2019-10-24 2020-02-07 北京云聚智慧科技有限公司 Method for testing application to be tested and electronic equipment
CN111752540A (en) * 2020-06-28 2020-10-09 北京百度网讯科技有限公司 Tree component generation method, device, equipment and computer storage medium
CN112149033A (en) * 2020-09-14 2020-12-29 京东数字科技控股股份有限公司 Method and device for acquiring H5 page control, electronic equipment and storage medium
CN112527689A (en) * 2021-02-09 2021-03-19 腾讯科技(深圳)有限公司 Application testing method and device and storage medium
CN113076257A (en) * 2021-04-19 2021-07-06 西安闻泰信息技术有限公司 Test script recording method, device, medium and computer equipment
CN113742011A (en) * 2020-09-28 2021-12-03 北京海益同展信息科技有限公司 Method, mobile terminal and system for acquiring control tree
CN114020648A (en) * 2022-01-04 2022-02-08 广东拓思软件科学园有限公司 Application control testing method and device, electronic equipment and storage medium
CN116541305A (en) * 2023-06-26 2023-08-04 京东方艺云(杭州)科技有限公司 Abnormality detection method and device, electronic equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100146420A1 (en) * 2008-12-10 2010-06-10 Microsoft Corporation Gui testing
US20100306738A1 (en) * 2007-12-03 2010-12-02 Ravi Verma Templating system and method for updating content in real time
CN102663126A (en) * 2012-04-23 2012-09-12 奇智软件(北京)有限公司 Method and device for displaying webpage in mobile terminal
CN102841790A (en) * 2012-07-02 2012-12-26 北京大学 Web application interface dynamic adapting method for heterogeneous terminal
CN103019928A (en) * 2011-09-27 2013-04-03 北京新媒传信科技有限公司 Automatic testing method and system
US20130254669A1 (en) * 2012-03-26 2013-09-26 Verizon Patent And Licensing Inc. Development life cycle management tool for set-top box widgets
CN103336742A (en) * 2013-07-18 2013-10-02 北京航空航天大学 Automation software black box testing system and method based on Android
CN105487832A (en) * 2015-11-25 2016-04-13 天脉聚源(北京)科技有限公司 Circulating display method and apparatus
US9483387B1 (en) * 2014-03-17 2016-11-01 Amazon Technologies, Inc. Tree comparison functionality for services
CN107193750A (en) * 2017-07-04 2017-09-22 北京云测信息技术有限公司 A kind of script method for recording and device
CN108920226A (en) * 2018-05-04 2018-11-30 维沃移动通信有限公司 screen recording method and device

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100306738A1 (en) * 2007-12-03 2010-12-02 Ravi Verma Templating system and method for updating content in real time
US20100146420A1 (en) * 2008-12-10 2010-06-10 Microsoft Corporation Gui testing
CN103019928A (en) * 2011-09-27 2013-04-03 北京新媒传信科技有限公司 Automatic testing method and system
US20130254669A1 (en) * 2012-03-26 2013-09-26 Verizon Patent And Licensing Inc. Development life cycle management tool for set-top box widgets
CN102663126A (en) * 2012-04-23 2012-09-12 奇智软件(北京)有限公司 Method and device for displaying webpage in mobile terminal
CN102841790A (en) * 2012-07-02 2012-12-26 北京大学 Web application interface dynamic adapting method for heterogeneous terminal
CN103336742A (en) * 2013-07-18 2013-10-02 北京航空航天大学 Automation software black box testing system and method based on Android
US9483387B1 (en) * 2014-03-17 2016-11-01 Amazon Technologies, Inc. Tree comparison functionality for services
CN105487832A (en) * 2015-11-25 2016-04-13 天脉聚源(北京)科技有限公司 Circulating display method and apparatus
CN107193750A (en) * 2017-07-04 2017-09-22 北京云测信息技术有限公司 A kind of script method for recording and device
CN108920226A (en) * 2018-05-04 2018-11-30 维沃移动通信有限公司 screen recording method and device

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110765015A (en) * 2019-10-24 2020-02-07 北京云聚智慧科技有限公司 Method for testing application to be tested and electronic equipment
CN111752540A (en) * 2020-06-28 2020-10-09 北京百度网讯科技有限公司 Tree component generation method, device, equipment and computer storage medium
CN111752540B (en) * 2020-06-28 2023-06-20 北京百度网讯科技有限公司 Tree component generation method, device, equipment and computer storage medium
CN112149033A (en) * 2020-09-14 2020-12-29 京东数字科技控股股份有限公司 Method and device for acquiring H5 page control, electronic equipment and storage medium
CN112149033B (en) * 2020-09-14 2024-07-16 京东科技控股股份有限公司 Method and device for acquiring H5 page control, electronic equipment and storage medium
CN113742011A (en) * 2020-09-28 2021-12-03 北京海益同展信息科技有限公司 Method, mobile terminal and system for acquiring control tree
CN112527689A (en) * 2021-02-09 2021-03-19 腾讯科技(深圳)有限公司 Application testing method and device and storage medium
CN113076257A (en) * 2021-04-19 2021-07-06 西安闻泰信息技术有限公司 Test script recording method, device, medium and computer equipment
CN114020648A (en) * 2022-01-04 2022-02-08 广东拓思软件科学园有限公司 Application control testing method and device, electronic equipment and storage medium
CN116541305A (en) * 2023-06-26 2023-08-04 京东方艺云(杭州)科技有限公司 Abnormality detection method and device, electronic equipment and storage medium
CN116541305B (en) * 2023-06-26 2023-12-15 京东方艺云(杭州)科技有限公司 Abnormality detection method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109656827B (en) 2021-10-19

Similar Documents

Publication Publication Date Title
CN109656827A (en) A kind of control tree generation method and terminal device
CN103455256A (en) Method and terminal for rotating display picture of screen
CN108491123A (en) A kind of adjusting application program image target method and mobile terminal
CN104423822B (en) Record the method and device of automatic test script
CN110308839A (en) A kind of file management method and terminal device
CN107832601A (en) A kind of application control method and mobile terminal
CN107807861A (en) Freeze screen solution method, mobile terminal and computer-readable recording medium
CN108541009A (en) A kind of detection method and terminal device of communications status
CN109600297A (en) A kind of mark sweep-out method and terminal device
CN109542279A (en) A kind of terminal equipment control method and terminal device
CN107704133A (en) Freeze screen monitoring with solving method, mobile terminal and computer-readable recording medium
CN108282834A (en) A kind of method and terminal of terminal access LTE network
CN109726121A (en) A kind of identifying code acquisition methods and terminal device
CN110309004A (en) The processing method and terminal of data
CN109544172A (en) A kind of display methods and terminal device
CN109195191A (en) A kind of cell reselection control method and terminal
CN108733993A (en) A kind of method for information display and terminal
CN107908492A (en) Blank screen detection method, mobile terminal and computer-readable recording medium
CN107766222A (en) Blank screen detection method, mobile terminal and computer-readable recording medium
CN104123210B (en) Test the method, apparatus and system of browser performance
CN107066090A (en) The method and mobile terminal of a kind of control fingerprint recognition module
CN110022235A (en) Information processing method, terminal and server
CN107992378B (en) A kind of document handling method and mobile terminal
CN109561192A (en) A kind of antenna fault detection method and device
CN104166899B (en) The method and terminal of voice interface

Legal Events

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