CN103279420A - Optimized automation testing method and system for application program of mobile terminal - Google Patents

Optimized automation testing method and system for application program of mobile terminal Download PDF

Info

Publication number
CN103279420A
CN103279420A CN201310229401XA CN201310229401A CN103279420A CN 103279420 A CN103279420 A CN 103279420A CN 201310229401X A CN201310229401X A CN 201310229401XA CN 201310229401 A CN201310229401 A CN 201310229401A CN 103279420 A CN103279420 A CN 103279420A
Authority
CN
China
Prior art keywords
node
destination node
application program
mobile terminal
set membership
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
CN201310229401XA
Other languages
Chinese (zh)
Other versions
CN103279420B (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

Images

Abstract

The invention discloses an optimized automation testing method and system for an application program of a mobile terminal, which improves efficiency and development quality of the automation testing of the application program of the mobile terminal. According to the technical scheme, the optimized automation testing method comprises the steps of: selecting a corresponding node to obtain a set membership between the selected corresponding node and a target node; storing the set membership between the corresponding node and the target node in an array; finding the target node through a value for indicating an attributive based on the set membership stored in the array and turning back an element object corresponding to the found target node; and operating a corresponding testing control to carry out the automation testing based on the element object turned back after the finding.

Description

The application program for mobile terminal automated testing method and the system that optimize
Technical field
The present invention relates to program testing method and system, relate in particular to a kind of application program at portable terminal, the method and system that carries out automatic test through optimizing.
Background technology
At present, the software of Android mobile phone end along with the popular application of Android system more and more widely, so the exploitation that Android mobile phone end is used is also more and more, has adopted automatic test gradually at test phase.In automatic test course, the operation of clicking a control is very frequent.Must find the X at the element place that will click in the click method that tradition is used, the Y coordinate figure.But for the mobile phone at the adaptive interface of difference, the position X at element place, the Y value is different, and this also just adaptive problem occurred.Address this is that several different methods: thus a kind of be that Aspect Ratio according to different mobile phones comes the position of location element to trigger click event.Another kind is exactly by HierarchyViewer(visual debugging acid, LinearLayout and FrameLayout layout have all been used in each interface, and text box TextView and picture box ImageView control) self function HierarchyViewer.findViewById (MID) reaches the click purpose, so Android self with instrument HierarchyViewer become the requisite a instrument of automatic test course.But these two kinds of methods all exist defective.
For preceding a kind of method, the magnitude relationship of screen between the different mobile phones is changed into ratio, use the pixel that this ratio multiply by mobile phone screen to recomputate new position coordinates, thereby and have the inaccurate problem that causes click location to be made mistakes in back that converts at the element coordinate time that converts.
For a kind of method in back, its implementation is searched control by function HierarchyViewer.findViewById (MID) as shown in Figure 1, namely progressively travel through the element of all loose-leaf in order, find the id attribute of element, id property value and the expection id property value that prestores are compared, if equate then to return the element object of this id property value correspondence, this by control id(sign) attribute (attribute of the marker element uniqueness position of containing in LinearLayout and FrameLayout layout and text box and the picture box control among the Hierarchyviewer) looks for element to have efficiency, and waste of time is inadvisable concerning some need the very high method of testing of time degree of accuracy.Particularly, its shortcoming is: 1) whenever search the node of once specifying id need consuming time more, many when node, when level is dark, consuming time especially obvious, the robotization inefficiency; Need carry out the control position when 2) clicking control again to the conversion of coordinate; 3) do not load when finishing when this element, can frequently quote and can not find the mistake that this has the element of specifying id; 4) for a plurality of elements of identical id attribute, use when searching control by id, what return is first element that finds, and this element control object element not necessarily.
Summary of the invention
The objective of the invention is to address the above problem, a kind of application program for mobile terminal automated testing method and system of optimization is provided, improve efficient and the development quality of application program for mobile terminal automatic test.
Technical scheme of the present invention is: the present invention has disclosed a kind of application program for mobile terminal automated testing method of optimization, comprising:
Choose relative node, obtain selected relative node to the set membership of destination node;
The set membership of relative node and destination node is stored in the array;
Based on the set membership of storage of array, search destination node and return the element object of the destination node correspondence that finds by the value that indicates attribute;
According to searching the element object of returning, the corresponding test control of operation carries out automatic test.
Embodiment according to the application program for mobile terminal automated testing method of optimization of the present invention, node relationships is to store with tree form data structure, wherein destination node be root node or the most close root node have a control that indicates attribute, and destination node is the child node of relative node.
According to an embodiment of the application program for mobile terminal automated testing method of optimization of the present invention, obtain the set membership of destination node and relative 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 carries of Android system.
The present invention has also disclosed a kind of application program for mobile terminal automatization test system of optimization, comprising:
The node relationships acquisition module is chosen relative node, obtains selected relative node to the set membership of destination node;
The node relationships memory module is stored in the set membership of relative node and destination node in the array;
Destination node is searched module, based on the set membership of storage of array, searches destination node and returns the element object of the destination node correspondence that finds by the value that indicates attribute;
The control test module, according to searching the element object of returning, the corresponding test control of operation carries out automatic test.
Embodiment according to the application program for mobile terminal automatization test system of optimization of the present invention, node relationships is to store with tree form data structure, wherein destination node be root node or the most close root node have a control that indicates attribute, and destination node is the child node of relative node.
According to an embodiment of the application program for mobile terminal automatization test system of optimization of the present invention, the node relationships acquisition module is the set membership that obtains destination node and relative 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 carries of Android system.
The present invention contrasts prior art following beneficial effect: the solution of the present invention is to specify the step of id attribute to be optimized to searching in the automatic test, child node is converted into the children order of father node, this relativeness is stored in the array, directly utilizes this relation on purpose to find and return needed element object.Such optimization makes searches in the test case of destination node by the id property value a large amount of the execution, saved the running time, promote efficient and test speed that robotization is carried out, and improved efficient and the development quality of portable terminal (especially Android mobile phone) client application automatic test to a great extent.
Description of drawings
Fig. 1 shows the process flow diagram of traditional application program automated testing method.
Fig. 2 shows the process flow diagram of 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 preferred embodiment of the application program for mobile terminal automatization test system of optimization of the present invention.
Embodiment
The invention will be further described below in conjunction with drawings and Examples.
The embodiment of the application program for mobile terminal automated testing method of optimizing
Fig. 2 shows the flow process of preferred embodiment of the application program for mobile terminal automated testing method of optimization of the present invention, sees also Fig. 2, is the detailed description to the implementation step of the automated testing method of present embodiment below.
Step S11: choose relative node, obtain selected relative node to the set membership of destination node.
Node relationships is with tree form data structure storage, wherein destination node be root node or the most close root node have a control that indicates attribute (MID can abbreviate id as among the application), and destination node is the child node of relative node.See also loose-leaf tree structure shown in Figure 3, store with this tree structure shown in Figure 3 between the node.
In the present embodiment, be the set membership (according to downtree shape structure, 0 is Base Serial Number from top to bottom) that obtains destination node and relative node by the layout of visual debugging acid.In the Android system, this visual debugging acid is exactly the debugging acid of the HierarchyViewer that carries of Android system.
Step S12: the set membership of relative node and destination node is stored in the array.
If since 0 volume order, destination node is the children[0 of relative node from top to bottom] .children[0] .children[0] .children[2], the value that deposits in the array is (0,0,0,2).
Step S13: based on the set membership of storage of array, search destination node and return the element object of the destination node correspondence that finds by the value that indicates attribute.
It is immeasurable 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 the node number).If adopt the method after optimizing to search, the array after namely will recording in script function is as the parameter transmission, owing to having reserved at the array middle finger position, so average time complexity is the 1(unit interval).Facts have proved that this unit interval is almost 0.And be to search destination node according to the id property value of relative node in this step, and return the node object of destination node.
Step S14: according to searching the element object of returning, the corresponding test control of operation carries out automatic test.
The embodiment of the application program for mobile terminal automatization test system of optimizing
Fig. 4 shows the structure of preferred embodiment of the application program for mobile terminal automatization test system of optimization of the present invention.See also Fig. 4, the automatization test system of present embodiment comprises: node relationships acquisition module 1, node relationships memory module 2, destination node are searched module 3, control test module 4.
Node relationships acquisition module 1 is chosen relative node, obtains selected relative node to the set membership of destination node.
Node relationships is with tree form data structure storage, wherein destination node be root node or the most close root node have a control that indicates attribute (MID can abbreviate id as among the application), and destination node is the child node of relative node.See also loose-leaf tree structure shown in Figure 3, store with this tree structure shown in Figure 3 between the node.
In the present embodiment, be the set membership (according to downtree shape structure, 0 is Base Serial Number from top to bottom) that obtains destination node and relative node by the layout of visual debugging acid.In the Android system, this visual debugging acid is exactly the debugging acid of the HierarchyViewer that carries of Android system.
Node relationships memory module 2 is stored in the set membership of relative node and destination node in the array.If since 0 volume order, destination node is the children[0 of relative node from top to bottom] .children[0] .children[0] .children[2], the value that deposits in the array is (0,0,0,2).
Destination node is searched module 3 based on the set membership of storage of array, searches destination node and returns the element object of the destination node correspondence that finds by the value that indicates attribute.
It is immeasurable 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 the node number).If adopt the method after optimizing to search, the array after namely will recording in script function is as the parameter transmission, owing to having reserved at the array middle finger position, so average time complexity is the 1(unit interval).Facts have proved that this unit interval is almost 0.And the destination node of present embodiment to search module 3 be to search destination node according to the relative id property value of node, and return the node object of destination node.
Control test module 4 is according to searching the element object of returning, and the corresponding test control of operation carries out automatic test.
Above-described embodiment provides to those of ordinary skills and realizes and use of the present invention; those of ordinary skills can be under the situation that does not break away from invention thought of the present invention; above-described embodiment is made various modifications or variation; thereby protection scope of the present invention do not limit by above-described embodiment, and should be the maximum magnitude that meets the inventive features that claims mention.

Claims (8)

1. the application program for mobile terminal automated testing method of an optimization comprises:
Choose relative node, obtain selected relative node to the set membership of destination node;
The set membership of relative node and destination node is stored in the array;
Based on the set membership of storage of array, search destination node and return the element object of the destination node correspondence that finds by the value that indicates attribute;
According to searching the element object of returning, the corresponding test control of operation carries out automatic test.
2. the application program for mobile terminal automated testing method of optimization according to claim 1, it is characterized in that, node relationships is to store with tree form data structure, wherein destination node be root node or the most close root node have a control that indicates attribute, and destination node is the child node of relative node.
3. the application program for mobile terminal automated testing method of optimization according to claim 2 is characterized in that, obtains the set membership of destination node and relative node by the layout of visual debugging acid.
4. the application program for mobile terminal automated testing method of optimization according to claim 3 is characterized in that, this visual debugging acid is the debugging acid of the HierarchyViewer that carries of Android system.
5. the application program for mobile terminal automatization test system of an optimization comprises:
The node relationships acquisition module is chosen relative node, obtains selected relative node to the set membership of destination node;
The node relationships memory module is stored in the set membership of relative node and destination node in the array;
Destination node is searched module, based on the set membership of storage of array, searches destination node and returns the element object of the destination node correspondence that finds by the value that indicates attribute;
The control test module, according to searching the element object of returning, the corresponding test control of operation carries out automatic test.
6. the application program for mobile terminal automatization test system of optimization according to claim 5, it is characterized in that, node relationships is to store with tree form data structure, wherein destination node be root node or the most close root node have a control that indicates attribute, and destination node is the child node of relative node.
7. the application program for mobile terminal automatization test system of optimization according to claim 6 is characterized in that, the node relationships acquisition module is the set membership that obtains destination node and relative node by the layout of visual debugging acid.
8. the application program for mobile terminal automatization test system of optimization according to claim 7 is characterized in that, this visual debugging acid is the debugging acid of the HierarchyViewer that carries of Android system.
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 true CN103279420A (en) 2013-09-04
CN103279420B 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)

Cited By (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
CN107402882A (en) * 2017-07-21 2017-11-28 杭州迪普科技股份有限公司 Web page method of testing and device
CN109086204A (en) * 2018-07-20 2018-12-25 北京小米移动软件有限公司 The foundation of node relationships tree, page marks and recognition methods, device and storage medium
CN110874318A (en) * 2018-08-31 2020-03-10 浙江宇视科技有限公司 Software testing method and device and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040070612A1 (en) * 2002-09-30 2004-04-15 Microsoft Corporation System and method for making user interface elements known to an application and user
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040070612A1 (en) * 2002-09-30 2004-04-15 Microsoft Corporation System and method for making user interface elements known to an application and user
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
张燕华 等: "迭代模式中基于可复用构件的自动化测试框架研究", 《中国测试》 *

Cited By (6)

* 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
CN107402882A (en) * 2017-07-21 2017-11-28 杭州迪普科技股份有限公司 Web page method of testing and device
CN109086204A (en) * 2018-07-20 2018-12-25 北京小米移动软件有限公司 The foundation of node relationships tree, page marks and recognition methods, device and storage medium
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
CN110874318A (en) * 2018-08-31 2020-03-10 浙江宇视科技有限公司 Software testing method and device and computer readable storage medium
CN110874318B (en) * 2018-08-31 2023-10-24 浙江宇视科技有限公司 Software testing method and device and computer readable storage medium

Also Published As

Publication number Publication date
CN103279420B (en) 2016-02-24

Similar Documents

Publication Publication Date Title
CN102523129B (en) Universal avionics bus test analysis method and device
CN101719095A (en) Method and device for managing regression testing
CN103955543A (en) Multimode-based clothing image retrieval method
CN103279420A (en) Optimized automation testing method and system for application program of mobile terminal
US9665612B2 (en) Run-time decision of bulk insert for massive data loading
CN107463366A (en) A kind of interface mobilism method based on mobile App
CN104636349A (en) Method and equipment for compression and searching of index data
CN100507921C (en) Words display process in embedded system and system thereof
CN104539750A (en) IP locating method and device
CN104572999B (en) Heterogeneous data-based error data detection method and device
CN105354138A (en) Method for determining specific control attribute of mobile phone page
CN104536874A (en) Client collapse locating method and device
CN104166730A (en) Method and device for displaying search result
CN103744896A (en) Method and device for data processing
CN102982147B (en) A kind of method and apparatus improving data message integration efficiency
CN103699534A (en) Display method and device for data object in system directory
CN104375814A (en) Generation method and device of an interface document
CN108694242B (en) Node searching method, equipment, storage medium and device based on DOM
CN104102704A (en) System control displaying method and system control displaying device
CN103593445A (en) Data filling method and device
CN104808995A (en) Method and device for storing application contents over applications
CN103544036A (en) Page loading method, terminal and system
CN105930354A (en) Storage model conversion method and device
CN103049296B (en) For the method and apparatus of download equipment Auto-matching intended application
CN105159921A (en) Method and apparatus for de-duplicating point-of-interest (POI) data in map

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

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.

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

Granted publication date: 20160224

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