CN103279420B - The application program for mobile terminal automated testing method optimized and system - Google Patents

The application program for mobile terminal automated testing method optimized and system Download PDF

Info

Publication number
CN103279420B
CN103279420B CN201310229401.XA CN201310229401A CN103279420B CN 103279420 B CN103279420 B CN 103279420B CN 201310229401 A CN201310229401 A CN 201310229401A CN 103279420 B CN103279420 B CN 103279420B
Authority
CN
China
Prior art keywords
node
destination node
counterpart
set membership
mobile terminal
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.)
Expired - Fee Related
Application number
CN201310229401.XA
Other languages
Chinese (zh)
Other versions
CN103279420A (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 Mesh Technology Co ltd
Original Assignee
Wangsu Science and 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 Wangsu Science and Technology Co Ltd filed Critical Wangsu Science and Technology Co Ltd
Priority to CN201310229401.XA priority Critical patent/CN103279420B/en
Publication of CN103279420A publication Critical patent/CN103279420A/en
Application granted granted Critical
Publication of CN103279420B publication Critical patent/CN103279420B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of application program for mobile terminal automated testing method and system of optimization, improve efficiency and the development quality of application program for mobile terminal automatic test.Its technical scheme is: choose counterpart node, and the counterpart node selected by acquisition is to the set membership of destination node; The set membership of counterpart node and destination node is stored in array; Based on the set membership of storage of array, by indicating the value of attribute and search destination node and returning element object corresponding to the destination node that finds; According to searching the element object returned, the test control of operation correspondence carries out automatic test.

Description

The application program for mobile terminal automated testing method optimized and system
Technical field
The present invention relates to program testing method and system, particularly relate to a kind of application program for mobile terminal, through optimize the method and system carrying out automatic test.
Background technology
At present, the software of Android mobile phone end along with the popular application of Android system more and more extensive, the exploitation of therefore Android mobile phone end application also gets more and more, and gradually have employed automatic test at test phase.In automatic test course, the operation clicking a control is very frequent.The X at the element place that will click must be found, Y-coordinate value in the click method that tradition uses.But for the mobile phone of different adaptor interface, the position X at element place, Y value is different, and this has also just occurred adaptation issues.Address this is that multiple method: a kind of is come the position of location element according to the Aspect Ratio of different mobile phone thus trigger click event.Another kind is exactly by HierarchyViewer(visual debugging acid, each interface all employ LinearLayout and FrameLayout layout, and text box TextView and picture box ImageView control) self function HierarchyViewer.findViewById (MID) reaches click object, therefore Android self with instrument HierarchyViewer become the requisite a instrument of automatic test course.But these two kinds of methods all also exist defect.
For a kind of front method, the magnitude relationship of screen between different mobile phone is changed into ratio, use the pixel that this ratio is multiplied by mobile phone screen to recalculate new position coordinates, and carry out conversion element coordinate time exist convert after the inaccurate thus problem causing click location to be made mistakes.
For a kind of rear method, its implementation searches control by function HierarchyViewer.findViewById (MID) as shown in Figure 1, namely the element of all loose-leaf is progressively traveled through in order, find the id attribute of element, id property value is compared with the expection id property value prestored, if equal, return the element object that this id property value is corresponding, thisly being indicated by control id() attribute (attribute of the marker element unique location contained in LinearLayout and FrameLayout layout and text box and picturebox control in Hierarchyviewer) looks for element to there is efficiency, and waste of time is concerning inadvisable some need the method for testing that time degree of accuracy is very high.Specifically, its shortcoming is: 1) often search and once specify the node of id needs consuming time more, when node is many, level is dark, consuming time especially obvious, robotization inefficiency; 2) need to re-start the conversion of control location to coordinate when clicking control; 3) when this element has not loaded, the mistake that can not find this and have the element of specifying id can frequently be quoted; 4) for multiple elements of identical id attribute, use when searching control by id, what return is first element found, and this element control not necessarily object element.
Summary of the invention
The object of the invention is to solve the problem, provide a kind of application program for mobile terminal automated testing method and system of optimization, improve efficiency and the development quality of application program for mobile terminal automatic test.
Technical scheme of the present invention is: the application program for mobile terminal automated testing method that present invention is disclosed a kind of optimization, comprising:
Choose counterpart node, the counterpart node selected by acquisition is to the set membership of destination node;
The set membership of counterpart node and destination node is stored in array;
Based on the set membership of storage of array, by indicating the value of attribute and search destination node and returning element object corresponding to the destination node that finds;
According to searching the element object returned, the test control of operation correspondence carries out automatic test.
According to an embodiment of the application program for mobile terminal automated testing method of optimization of the present invention, node relationships stores with tree form data structure, wherein destination node is root node or the control having sign attribute near root node, and destination node is the child node of counterpart node.
According to an embodiment of the application program for mobile terminal automated testing method of optimization of the present invention, obtained the set membership of destination node and counterpart node by the layout of visual debugging acid.
According to an embodiment of the application program for mobile terminal automated testing method of optimization of the present invention, this visual debugging acid is the debugging acid of the HierarchyViewer that Android system carries.
Present invention further teaches a kind of application program for mobile terminal automatization test system of optimization, comprising:
Node relationships acquisition module, chooses counterpart node, and the counterpart node selected by acquisition is to the set membership of destination node;
Node relationships memory module, is stored in array by the set membership of counterpart node and destination node;
Destination node searches module, based on the set membership of storage of array, by indicating the value of attribute and search destination node and returning element object corresponding to the destination node that finds;
Components testing module, according to searching the element object returned, the test control of operation correspondence carries out automatic test.
According to an embodiment of the application program for mobile terminal automatization test system of optimization of the present invention, node relationships stores with tree form data structure, wherein destination node is root node or the control having sign attribute near root node, and destination node is the child node of counterpart node.
According to an embodiment of the application program for mobile terminal automatization test system of optimization of the present invention, node relationships acquisition module is the set membership being obtained destination node and counterpart node by the layout of visual debugging acid.
According to an embodiment of the application program for mobile terminal automatization test system of optimization of the present invention, this visual debugging acid is the debugging acid of the HierarchyViewer that Android system carries.
The present invention contrasts prior art following beneficial effect: the solution of the present invention specifies the step of id attribute to be optimized to searching in automatic test, child node is converted into the children order of father node, this relativeness is stored in array, directly utilizes this relation on purpose to find and return required element object.Such optimization makes to search in the test case of destination node a large amount of execution by id property value, save the running time, improve efficiency and the test speed of automated execution, and greatly enhance efficiency and the development quality of mobile terminal (especially Android mobile phone) client application automatic test.
Accompanying drawing explanation
Fig. 1 shows the process flow diagram of traditional application program automated testing method.
Fig. 2 shows the process flow diagram of the preferred embodiment of the application program for mobile terminal automated testing method of optimization of the present invention.
Fig. 3 shows loose-leaf tree structure figure.
Fig. 4 shows the structural drawing of the preferred embodiment of the application program for mobile terminal automatization test system of optimization of the present invention.
Embodiment
Below in conjunction with drawings and Examples, the invention will be further described.
the embodiment of the application program for mobile terminal automated testing method optimized
Fig. 2 shows the flow process of the preferred embodiment of the application program for mobile terminal automated testing method of optimization of the present invention, refers to Fig. 2, and here is the detailed description of the implementation step of automated testing method to the present embodiment.
Step S11: choose counterpart node, the counterpart node selected by acquisition is to the set membership of destination node.
Node relationships stores with tree form data structure, and wherein destination node is root node or has near root node the control indicating attribute (MID, in the application can referred to as id), and destination node is the child node of counterpart node.Loose-leaf tree structure shown in Figure 3, stores with this tree structure shown in Fig. 3 between node.
In the present embodiment, be the set membership (according to falling tree structure, 0 is Base Serial Number from top to bottom) being obtained destination node and counterpart node by the layout of visual debugging acid.In Android system, this visual debugging acid is exactly the debugging acid of the HierarchyViewer that Android system carries.
Step S12: the set membership of counterpart node and destination node is stored in array.
If from top to bottom from 0 volume order, destination node is children [0] .children [0] .children [0] .children [2] of counterpart node, in array stored in value be (0,0,0,2).
Step S13: based on the set membership of storage of array, by indicating the value of attribute and search destination node and returning element object corresponding to the destination node that finds.
It is immeasurable for searching the time that this step of id takies in whole test process, if adopt traditional sequential search method, average time complexity is n/2 unit interval (n is node number).If adopt optimize after method search, namely in script function using record after array as Parameter transfer, because position has been reserved at array middle finger, so average time complexity is the 1(unit interval).Facts have proved, this unit interval is almost 0.And be search destination node according to the id property value of counterpart node in this step, and return the node object of destination node.
Step S14: according to searching the element object returned, the test control of operation correspondence carries out automatic test.
the embodiment of the application program for mobile terminal automatization test system optimized
Fig. 4 shows the structure of the preferred embodiment of the application program for mobile terminal automatization test system of optimization of the present invention.Refer to Fig. 4, the automatization test system of the present embodiment comprises: node relationships acquisition module 1, node relationships memory module 2, destination node search module 3, components testing module 4.
Node relationships acquisition module 1 chooses counterpart node, and the counterpart node selected by acquisition is to the set membership of destination node.
Node relationships stores with tree form data structure, and wherein destination node is root node or has near root node the control indicating attribute (MID, in the application can referred to as id), and destination node is the child node of counterpart node.Loose-leaf tree structure shown in Figure 3, stores with this tree structure shown in Fig. 3 between node.
In the present embodiment, be the set membership (according to falling tree structure, 0 is Base Serial Number from top to bottom) being obtained destination node and counterpart node by the layout of visual debugging acid.In Android system, this visual debugging acid is exactly the debugging acid of the HierarchyViewer that Android system carries.
The set membership of counterpart node and destination node is stored in array by node relationships memory module 2.If from top to bottom from 0 volume order, destination node is children [0] .children [0] .children [0] .children [2] of counterpart node, in array stored in value be (0,0,0,2).
Destination node searches the set membership of module 3 based on storage of array, by indicating the value of attribute and search destination node and returning element object corresponding to the destination node that finds.
It is immeasurable for searching the time that id takies in whole test process, if adopt traditional sequential search method, average time complexity is n/2 unit interval (n is node number).If adopt optimize after method search, namely in script function using record after array as Parameter transfer, because position has been reserved at array middle finger, so average time complexity is the 1(unit interval).Facts have proved, this unit interval is almost 0.And the destination node of the present embodiment to search module 3 be search destination node according to the id property value of counterpart node, and return the node object of destination node.
Components testing module 4 is according to searching the element object returned, and the test control of operation correspondence carries out automatic test.
Above-described embodiment is available to those of ordinary skill in the art to realize and uses of the present invention; those of ordinary skill in the art can be without departing from the present invention in the case of the inventive idea; various modifications or change are made to above-described embodiment; thus protection scope of the present invention not limit by above-described embodiment, and should be the maximum magnitude meeting the inventive features that claims are mentioned.

Claims (4)

1. the application program for mobile terminal automated testing method optimized, comprising:
Choose counterpart node, counterpart node selected by acquisition is to the set membership of destination node, node relationships stores with tree form data structure, and wherein destination node is root node or the control having sign attribute near root node, and destination node is the child node of counterpart node;
The set membership of counterpart node and destination node is stored in array;
Based on the set membership of storage of array, by indicating the value of attribute and search destination node and returning element object corresponding to the destination node that finds;
According to searching the element object returned, the test control of operation correspondence carries out automatic test.
2. the application program for mobile terminal automated testing method of optimization according to claim 1, is characterized in that, the layout in the debugging acid of the HierarchyViewer carried by Android system obtains the set membership of destination node and counterpart node.
3. the application program for mobile terminal automatization test system optimized, comprising:
Node relationships acquisition module, choose counterpart node, counterpart node selected by acquisition is to the set membership of destination node, node relationships stores with tree form data structure, wherein destination node is root node or the control having sign attribute near root node, and destination node is the child node of counterpart node;
Node relationships memory module, is stored in array by the set membership of counterpart node and destination node;
Destination node searches module, based on the set membership of storage of array, by indicating the value of attribute and search destination node and returning element object corresponding to the destination node that finds;
Components testing module, according to searching the element object returned, the test control of operation correspondence carries out automatic test.
4. the application program for mobile terminal automatization test system of optimization according to claim 3, it is characterized in that, node relationships acquisition module is the set membership that the layout of the debugging acid of the HierarchyViewer carried by Android system obtains destination node and counterpart node.
CN201310229401.XA 2013-06-08 2013-06-08 The application program for mobile terminal automated testing method optimized and system Expired - Fee Related CN103279420B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310229401.XA CN103279420B (en) 2013-06-08 2013-06-08 The application program for mobile terminal automated testing method optimized and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310229401.XA CN103279420B (en) 2013-06-08 2013-06-08 The application program for mobile terminal automated testing method optimized and system

Publications (2)

Publication Number Publication Date
CN103279420A CN103279420A (en) 2013-09-04
CN103279420B true CN103279420B (en) 2016-02-24

Family

ID=49061949

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310229401.XA Expired - Fee Related CN103279420B (en) 2013-06-08 2013-06-08 The application program for mobile terminal automated testing method optimized and system

Country Status (1)

Country Link
CN (1) CN103279420B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107256148A (en) * 2017-05-24 2017-10-17 龙芯中科技术有限公司 The generation method and system at interface, electronic equipment and storage medium
CN107402882B (en) * 2017-07-21 2020-11-06 杭州迪普科技股份有限公司 Web page testing method and device
CN109086204B (en) * 2018-07-20 2022-03-11 北京小米移动软件有限公司 Node relation tree establishing method, page marking method, page identifying method, page marking device, page identifying device and storage medium
CN110874318B (en) * 2018-08-31 2023-10-24 浙江宇视科技有限公司 Software testing method and device and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655817A (en) * 2009-09-24 2010-02-24 成都市华为赛门铁克科技有限公司 Method and apparatus for testing graphical user interface
CN102243586A (en) * 2011-07-22 2011-11-16 于秀山 Method for automatically acquiring software function diagram

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2495038C (en) * 2002-09-30 2012-11-06 Microsoft Corporation System and method for making user interface elements known to an application and user

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655817A (en) * 2009-09-24 2010-02-24 成都市华为赛门铁克科技有限公司 Method and apparatus for testing graphical user interface
CN102243586A (en) * 2011-07-22 2011-11-16 于秀山 Method for automatically acquiring software function diagram

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
迭代模式中基于可复用构件的自动化测试框架研究;张燕华 等;《中国测试》;20120930;第38卷(第5期);第91-94页 *

Also Published As

Publication number Publication date
CN103279420A (en) 2013-09-04

Similar Documents

Publication Publication Date Title
WO2020155777A1 (en) Ui automated function testing method, testing device, testing apparatus, and storage medium
CN108089893B (en) Method and device for determining redundant resources, terminal equipment and storage medium
CN102523129B (en) Universal avionics bus test analysis method and device
CN103279420B (en) The application program for mobile terminal automated testing method optimized and system
CN105138793B (en) Distribution network line QuickDraw method
US20200142658A1 (en) Historian interface system
CN110515896B (en) Model resource management method, model file manufacturing method, device and system
CN105404507A (en) Process template construction method and system
CN102890632A (en) Screen adaptation method, system and terminal device
CN108197030B (en) Software interface automatic test cloud platform device based on deep learning and test method
CN105354022A (en) Generation method and device of page layout file
CN105138752A (en) Differentiation comparison and display method for SCD documents in intelligent substation with historical retrospect function
CN104750585A (en) Terminal detecting method and terminal detecting device
CN110969000B (en) Data merging processing method and device
CN108958612B (en) Method for controlling page sliding, method and system for controlling page, terminal device and medium
CN104375814A (en) Generation method and device of an interface document
CN105069092A (en) Report display method, system and mobile terminal
CN102622233A (en) System and method for automatically generating user interface applicable to certain interactive terminal equipment
CN107766519B (en) Method for visually configuring data structure
JP6377743B2 (en) Method and apparatus for building an intermediate character library
CN104808995A (en) Method and device for storing application contents over applications
CN117390195A (en) Knowledge traceability connecting method, system, equipment and medium based on graph editor
CN116931783A (en) Front-end massive tree structure display method and device, electronic equipment and medium
CN103856466A (en) Acquisition terminal device capable of configuring protocols automatically
CN104461927A (en) Electronic device and electronic device configuration information storage and reading method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201125

Address after: 100083 Beijing Haidian District 39 Xueyuan Road 6 real estate building.

Patentee after: Beijing Mesh Technology Co.,Ltd.

Address before: 200030 Shanghai Xuhui District Xietu Road No. 2669 15 Floor

Patentee before: WANGSU SCIENCE & TECHNOLOGY Co.,Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160224