CN104881364A - Automated testing method and system applied to Android system - Google Patents
Automated testing method and system applied to Android system Download PDFInfo
- Publication number
- CN104881364A CN104881364A CN201510361963.9A CN201510361963A CN104881364A CN 104881364 A CN104881364 A CN 104881364A CN 201510361963 A CN201510361963 A CN 201510361963A CN 104881364 A CN104881364 A CN 104881364A
- Authority
- CN
- China
- Prior art keywords
- control
- target widget
- android
- interface
- tropism
- Prior art date
Links
- 230000000875 corresponding Effects 0.000 claims abstract description 23
- 230000010415 tropism Effects 0.000 claims description 46
- 239000011159 matrix materials Substances 0.000 claims description 10
- 230000002452 interceptive Effects 0.000 claims description 7
- 238000001914 filtration Methods 0.000 claims description 6
- 230000001808 coupling Effects 0.000 claims description 4
- 238000010168 coupling process Methods 0.000 claims description 4
- 238000005859 coupling reactions Methods 0.000 claims description 4
- 238000000034 methods Methods 0.000 abstract description 4
- 238000005516 engineering processes Methods 0.000 description 8
- 230000000694 effects Effects 0.000 description 4
- 238000004458 analytical methods Methods 0.000 description 3
- 241000282693 Cercopithecidae Species 0.000 description 1
- 238000004364 calculation methods Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006011 modification reactions Methods 0.000 description 1
- 239000011257 shell materials Substances 0.000 description 1
Abstract
Description
Technical field
The present invention relates to software system test technical field, especially relate to the automated testing method and system that are applied to Android system.
Background technology
The automatic test of existing Android system (android) has Monkey to test, and it is a kind of random testing tool, cannot operate according to the self-defining method of tester.
The Uiautomator automatic test of existing Google can be tested according to the self-defining step of tester, but needs user manually to write test code to operate, and method of testing is not quick.
Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide the automated testing method and system that are applied to Android system, realize the automatic test of Android system in conjunction with control recording technology etc., promote testing efficiency, solve variety of problems of the prior art.
For realizing above-mentioned target and other related objectives, the invention provides a kind of automated testing method being applied to Android system, comprising: the operation about control test that record operation interface receives; Operation interface during operation according to acceptance, to obtain target widget information corresponding to described operation information; Record the target widget information of described acquisition; Run described target widget to complete automatic test.
Optionally, described operation interface comprises: the projection interface generated by projection by the interactive interface of mobile terminal.
Optionally, operation interface during described operation according to acceptance, to obtain target widget information corresponding to described operation information, comprising: with described operation interface for coordinate plane, obtains the coordinate data of the operation correspondence position recorded; According to the interface layout files of operation interface when accepting described operation, obtain and wherein eachly treat selected control; Respectively treat that selected control, screening is maximally related as described target widget with described coordinate data from described.
Optionally, describedly respectively to treat selected control that screening and described coordinate data are maximally related as described target widget from described, comprising: by two point coordinate definition matrix scopes show each described in treat selected control, described 2 comprise: upper left point and lower-right most point; The coordinate data filtering out described operation fall within interior and matrix scope minimum treat that selected control is as described target widget.
Optionally, described operation has multiple, and the corresponding target widget of each operation, the target widget of each operation correspondence all has respective unique tropism.
Optionally, the described automated testing method being applied to Android system, comprising: be recorded in operating corresponding target widget information with each in control script.
Optionally, described tropism comprises: text label tropism, resource ID tropism and content describe the one in tropism.
Optionally, the described target widget of described operation, to complete automatic test, comprising: obtain described control script; According to described control script record the tropism of each target widget, being stored in each target widget in Android system the pending control screening tropism coupling one by one; When tropism is mated, judge in the interface layout files of operation interface when whether pending control that this tropism is mated is present in described acceptance described operation; If exist, then run this pending control to perform respective operations; If do not exist, then terminate described control script; When all target widget respective operations that described control script records all perform, terminate described control script.
Optionally, described screening has been come by UIautomator software.
For realizing above-mentioned target and other related objectives, the invention provides a kind of automatization test system being applied to Android system, comprising: operation note module, for recording the operation about control test that operation interface receives; Parsing module, for operation interface during operation according to acceptance, to obtain target widget information corresponding to described operation information; Control information logging modle, for recording the target widget information of described acquisition; Control runs module, for running described target widget to complete automatic test.
As mentioned above, the invention provides a kind of automated testing method and the system that are applied to Android system, the operation about control test that record operation interface receives; Operation interface during operation according to acceptance, to obtain target widget information corresponding to described operation information; Record the target widget information of described acquisition; Run described target widget to complete automatic test; The present invention, by control recording technology etc., realizes the automatic test of Android system, promotes testing efficiency, solves variety of problems of the prior art.
Accompanying drawing explanation
Fig. 1 is shown as the schematic flow sheet being applied to the automated testing method of Android system in one embodiment of the invention.
Fig. 2 is shown as the schematic flow sheet of the control script operation method in one embodiment of the invention.
Fig. 3 is shown as the structural representation being applied to the automatization test system of Android system in one embodiment of the invention.
Element numbers explanation
1 automatization test system being applied to Android system
11 operation note modules
12 parsing modules
13 control information logging modles
14 controls run module
S1 ~ S4 method step
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art the content disclosed by this instructions can understand other advantages of the present invention and effect easily.The present invention can also be implemented or be applied by embodiments different in addition, and the every details in this instructions also can based on different viewpoints and application, carries out various modification or change not deviating under spirit of the present invention.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.
As shown in Figure 1, the invention provides a kind of automated testing method being applied to Android system, comprising:
Step S1: the operation about control test that record operation interface receives.
In one embodiment, described operation interface comes from the mobile terminal (such as mobile phone or panel computer etc.) being such as provided with Android operation system, preferably, described operation interface comprises: the projection interface generated by projection by the interactive interface (GUI) of mobile terminal, because the interactive interface of projection interface and mobile terminal is proportional, if set up coordinate plane respectively with both, can mutually transform between each point coordinate then in projection interface and in interactive interface, therefore the operation of user at projection interface corresponding can be converted to the operation at mobile terminal interactive interface, such as click, long by or Text Input etc., described test case as being the test to UI interface, then only need to click, long by or the simple operations such as Text Input, the present invention attempts manual operations to be recorded using the foundation as test automatically by control, refers to hereinafter.
Step S2: operation interface during operation according to acceptance, to obtain target widget information corresponding to described operation information.
In one embodiment, operation interface during described operation according to acceptance, to obtain target widget information corresponding to described operation information, comprising: with described operation interface for coordinate plane, obtains the coordinate data of the operation correspondence position recorded; According to the interface layout files of operation interface when accepting described operation, obtain and wherein eachly treat selected control; Respectively treat that selected control, screening is maximally related as described target widget with described coordinate data from described.
Concrete, the location of described screening and target widget, and the acquisition to its tropism, from mobile phone screen display technique, the coordinate that user operation inputs can be obtained, secondly current interface topology file (being XML file, such as windouw_dump.xml file in the present embodiment) is obtained by adb order adb shell system/bin/uiautomator dump.Resolve xml file (xml document analysis technology is unyielding within the scope of this patent, only does step reference, does not describe in detail) by code analysis technology, parse each control and tropism thereof.Being located by control algorithm is bend in which target widget; Finally target widget information is dished out; The control information dished out is exactly the tropism information that user clicks the control of screen.
Further, describedly respectively to treat selected control that screening and described coordinate data are maximally related as described target widget from described, comprising: by two point coordinate definition matrix scopes show each described in treat selected control, described 2 comprise: upper left point and lower-right most point; The coordinate data filtering out described operation fall within interior and matrix scope minimum treat that selected control is as described target widget.
Specifically, the calculation of points inputted by user goes out the involved control in this some position.Namely find out this control, core algorithm step, control information adopts matrix display, i.e. upper left and position, 2, bottom right, 2 definition rectangular extent.User click screen some time, equivalent matrix upper left and 2, bottom right overlap, row as: [138,473] [138,473], secondly parse all controls in xml by code analysis technology, lift 4 controls [0,0] [480,800] temporarily; [0,110] [480,800]; [87,289] [205,321]; [87,289] [205,321]; [24,464] [456,536], compare with the some position of user's input successively, the condition met is needed to have, the value of user's input is compared with the value parsed successively, gets two numbers and be all greater than the value parsed in first [] of user's input, and the value in second [] of user's input is got two numbers and is all less than the value parsed.Temporarily to be exemplified by example, qualified have [0,0] [480,800]; [0,110] [480,800]; [24,464] [456,536], and calculate its area (existing upper left and bottom right two point coordinate, can obtain rectangular area) by two-point method, choose that minimum control of area for exporting control [24,464] [456,536], therefore the scope of this target widget just in [24,464] [456,536] in, above in order to illustrate more clear, adopt case method to be described, actual conditions can carry out comparing in even thousands of controls up to a hundred.
Step S3: the target widget information recording described acquisition.
In one embodiment, described operation has multiple, and the corresponding target widget of each operation, the target widget of each operation correspondence all has respective unique tropism.
About the tropism of described control, available functionality controls in general android mobile phone is divided into text label tropism (text) substantially, resource ID tropism (resource-id), content describes tropism (content-desc) and (does not get rid of other and can use control tropism, at present just conventional for these three kinds), these three kinds of tropisms, by just obtaining out required control tropism after above-mentioned control location, various tropism is corresponding different operating respectively.
Step S4: run described target widget to complete automatic test.
In one embodiment, the described target widget of described operation, to complete automatic test, comprising: obtain described control script; According to described control script record the tropism of each target widget, being stored in each target widget in Android system the pending control screening tropism coupling one by one; When tropism is mated, judge in the interface layout files of operation interface when whether pending control that this tropism is mated is present in described acceptance described operation; If exist, then run this pending control to perform respective operations; If do not exist, then terminate described control script; When all target widget respective operations that described control script records all perform, terminate described control script.
In one embodiment, screening and the operation of control can adopt uiautomator software engineering to realize, and the thinking be worth by biography is designed.
Refer to Fig. 2, the flow process of display control script operation method: the list (control script) that the control calling acquisition is aggregated into; The control recorded in list is screened one by one and calls, because in android system, control tropism is unique, therefore by uiautomator software engineering successively at text, resource-id, inquire about in the call method of content-desc, if meet one of them, be the space corresponding with action required; And then, by exists () method, verify whether this control information is present in the interface (if do not exist, then carrying out such as error handling processing, this list script end of run) of acceptance operation; If exist, carry out operation control to realize respective operations (click, length is pressed, input character etc.).After end of operation, whether in addition detect follow-up control in list needs operation, if had, then returns tropism examination bag and again circulates.If no, then test end.
In control script operation method, its design code thinking is the type of filtering and screening control, distinguish text, resource-id, content-desc tropism, by exists () method, according to the uniqueness of control, judge whether it exists one by one; Preferably, after above-mentioned projection interface operation recognition mechanism, control location Filtering system and the relative program of control operating mechanism are write, jar bag can be broken into, copy into mobile terminal, calling execution by the test machine issue an order connecting mobile terminal, realizing various click in android equipment long by waiting operation.
As shown in Figure 3, the invention provides a kind of automatization test system 1 being applied to Android system, its know-why is roughly the same with said method embodiment, feature in said method embodiment can be applicable to described system embodiment, described system 1 comprises: operation note module 11, for recording the operation about control test that operation interface receives; Parsing module 12, for operation interface during operation according to acceptance, to obtain target widget information corresponding to described operation information; Control information logging modle 13, for recording the target widget information of described acquisition; Control runs module 14, for running described target widget to complete automatic test.
In one embodiment, described operation interface comprises: the projection interface generated by projection by the interactive interface of mobile terminal.
In one embodiment, operation interface during described operation according to acceptance, to obtain target widget information corresponding to described operation information, comprising: with described operation interface for coordinate plane, obtains the coordinate data of the operation correspondence position recorded; According to the interface layout files of operation interface when accepting described operation, obtain and wherein eachly treat selected control; Respectively treat that selected control, screening is maximally related as described target widget with described coordinate data from described.
In one embodiment, describedly respectively to treat selected control that screening and described coordinate data are maximally related as described target widget from described, comprise: by two point coordinate definition matrix scopes show each described in treat selected control, described 2 comprise: upper left point and lower-right most point; The coordinate data filtering out described operation fall within interior and matrix scope minimum treat that selected control is as described target widget.
In one embodiment, described operation has multiple, and the corresponding target widget of each operation, the target widget of each operation correspondence all has respective unique tropism.
In one embodiment, the described automated testing method being applied to Android system, comprising: be recorded in operating corresponding target widget information with each in control script.
In one embodiment, described tropism comprises: text label tropism, resource ID tropism and content describe the one in tropism.
In one embodiment, the described target widget of described operation, to complete automatic test, comprising: obtain described control script; According to described control script record the tropism of each target widget, being stored in each target widget in Android system the pending control screening tropism coupling one by one; When tropism is mated, judge in the interface layout files of operation interface when whether pending control that this tropism is mated is present in described acceptance described operation; If exist, then run this pending control to perform respective operations; If do not exist, then terminate described control script; When all target widget respective operations that described control script records all perform, terminate described control script.
In one embodiment, described screening has been come by UIautomator software.
In sum, the invention provides a kind of automated testing method and the system that are applied to Android system, the operation about control test that record operation interface receives; Operation interface during operation according to acceptance, to obtain target widget information corresponding to described operation information; Record the target widget information of described acquisition; Run described target widget to complete automatic test; The present invention, by control recording technology etc., realizes the automatic test of Android system, promotes testing efficiency, solves variety of problems of the prior art.
The technology that current android automatic test is best, manually write control scripted code, user is needed to understand certain Scripting language, user's left-hand seat degree is not good, and technical scheme of the present invention clicks effect by simulated screen, direct recording ActiveX Techniques, reaches same operating effect and precision.There is stability and compatibility and operability in the advantage of one; This robotization is a kind of automatic test thinking and the framework of android equipment, and be tentatively write by java language, in like manner also can use C#, other programming languages such as VB, C++/C realize.The integrated testability of android equipment can be realized and and can carry and expand other functional tests and performance test.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all without prejudice under spirit of the present invention and category, can modify above-described embodiment or changes.Therefore, such as have in bent technical field usually know the knowledgeable do not depart from complete under disclosed spirit and technological thought all equivalence modify or change, must be contained by claim of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510361963.9A CN104881364A (en) | 2015-06-26 | 2015-06-26 | Automated testing method and system applied to Android system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510361963.9A CN104881364A (en) | 2015-06-26 | 2015-06-26 | Automated testing method and system applied to Android system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104881364A true CN104881364A (en) | 2015-09-02 |
Family
ID=53948866
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510361963.9A CN104881364A (en) | 2015-06-26 | 2015-06-26 | Automated testing method and system applied to Android system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104881364A (en) |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105138458A (en) * | 2015-09-10 | 2015-12-09 | 上海斐讯数据通信技术有限公司 | Method and system for recording automatic testing scripts by combining intelligent terminal and computer terminal |
CN105138463A (en) * | 2015-09-25 | 2015-12-09 | 成都中科创达软件有限公司 | Testing method and system for mobile terminal software |
CN105224456A (en) * | 2015-09-29 | 2016-01-06 | 北京奇虎科技有限公司 | A kind of test script generates methods, devices and systems |
CN105354138A (en) * | 2015-10-12 | 2016-02-24 | 上海斐讯数据通信技术有限公司 | Method for determining specific control attribute of mobile phone page |
CN105608010A (en) * | 2016-01-26 | 2016-05-25 | 杭州德澜科技有限公司 | Home appliance APP automatic stability testing equipment |
CN105718370A (en) * | 2016-01-21 | 2016-06-29 | 上海斐讯数据通信技术有限公司 | Android equipment test method and test device |
CN105868112A (en) * | 2016-03-29 | 2016-08-17 | 上海斐讯数据通信技术有限公司 | Interactive automatic testing method and system |
CN106445764A (en) * | 2016-09-29 | 2017-02-22 | 福州大学 | Method for realizing automatic testing of stability of android facility |
CN106681899A (en) * | 2015-11-06 | 2017-05-17 | 北京京东尚科信息技术有限公司 | Android-UI automatic testing method and system based on Jmeter |
CN107357724A (en) * | 2017-06-27 | 2017-11-17 | 深圳市泰衡诺科技有限公司上海分公司 | Automatic software test method and device in Android system |
CN107729223A (en) * | 2017-08-31 | 2018-02-23 | 福建天晴数码有限公司 | A kind of method and device of recording user operation on mobile terminals |
CN105740151B (en) * | 2016-02-03 | 2018-05-08 | 惠州Tcl移动通信有限公司 | A kind of mobile terminal UI controls check processing method and system |
WO2018120721A1 (en) * | 2016-12-30 | 2018-07-05 | 上海壹账通金融科技有限公司 | Method and system for testing user interface, electronic device, and computer readable storage medium |
CN108490336A (en) * | 2018-03-14 | 2018-09-04 | 广州视源电子科技股份有限公司 | Board test method, system, readable storage medium storing program for executing and computer equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101630286A (en) * | 2009-08-07 | 2010-01-20 | 金蝶软件(中国)有限公司 | Automatic testing method and automatic testing device |
CN103164300A (en) * | 2011-12-13 | 2013-06-19 | 腾讯科技(深圳)有限公司 | Mobile terminal touch screen automatic testing method and device |
CN103309797A (en) * | 2012-03-09 | 2013-09-18 | 阿里巴巴集团控股有限公司 | Automatic testing method and device of user interface |
US20140123111A1 (en) * | 2012-10-26 | 2014-05-01 | Samsung Electronics Co., Ltd. | Automatic testing apparatus for embedded software and automatic testing method thereof |
CN104598287A (en) * | 2013-10-30 | 2015-05-06 | 贝壳网际(北京)安全技术有限公司 | Method and device for detecting malicious program and client side |
-
2015
- 2015-06-26 CN CN201510361963.9A patent/CN104881364A/en not_active Application Discontinuation
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101630286A (en) * | 2009-08-07 | 2010-01-20 | 金蝶软件(中国)有限公司 | Automatic testing method and automatic testing device |
CN103164300A (en) * | 2011-12-13 | 2013-06-19 | 腾讯科技(深圳)有限公司 | Mobile terminal touch screen automatic testing method and device |
CN103309797A (en) * | 2012-03-09 | 2013-09-18 | 阿里巴巴集团控股有限公司 | Automatic testing method and device of user interface |
US20140123111A1 (en) * | 2012-10-26 | 2014-05-01 | Samsung Electronics Co., Ltd. | Automatic testing apparatus for embedded software and automatic testing method thereof |
CN104598287A (en) * | 2013-10-30 | 2015-05-06 | 贝壳网际(北京)安全技术有限公司 | Method and device for detecting malicious program and client side |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105138458A (en) * | 2015-09-10 | 2015-12-09 | 上海斐讯数据通信技术有限公司 | Method and system for recording automatic testing scripts by combining intelligent terminal and computer terminal |
CN105138463A (en) * | 2015-09-25 | 2015-12-09 | 成都中科创达软件有限公司 | Testing method and system for mobile terminal software |
CN105224456A (en) * | 2015-09-29 | 2016-01-06 | 北京奇虎科技有限公司 | A kind of test script generates methods, devices and systems |
CN105354138A (en) * | 2015-10-12 | 2016-02-24 | 上海斐讯数据通信技术有限公司 | Method for determining specific control attribute of mobile phone page |
CN106681899A (en) * | 2015-11-06 | 2017-05-17 | 北京京东尚科信息技术有限公司 | Android-UI automatic testing method and system based on Jmeter |
CN105718370A (en) * | 2016-01-21 | 2016-06-29 | 上海斐讯数据通信技术有限公司 | Android equipment test method and test device |
CN105608010A (en) * | 2016-01-26 | 2016-05-25 | 杭州德澜科技有限公司 | Home appliance APP automatic stability testing equipment |
CN105740151B (en) * | 2016-02-03 | 2018-05-08 | 惠州Tcl移动通信有限公司 | A kind of mobile terminal UI controls check processing method and system |
CN105868112A (en) * | 2016-03-29 | 2016-08-17 | 上海斐讯数据通信技术有限公司 | Interactive automatic testing method and system |
CN106445764A (en) * | 2016-09-29 | 2017-02-22 | 福州大学 | Method for realizing automatic testing of stability of android facility |
WO2018120721A1 (en) * | 2016-12-30 | 2018-07-05 | 上海壹账通金融科技有限公司 | Method and system for testing user interface, electronic device, and computer readable storage medium |
CN107357724A (en) * | 2017-06-27 | 2017-11-17 | 深圳市泰衡诺科技有限公司上海分公司 | Automatic software test method and device in Android system |
CN107729223A (en) * | 2017-08-31 | 2018-02-23 | 福建天晴数码有限公司 | A kind of method and device of recording user operation on mobile terminals |
CN108490336A (en) * | 2018-03-14 | 2018-09-04 | 广州视源电子科技股份有限公司 | Board test method, system, readable storage medium storing program for executing and computer equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10540272B2 (en) | Software test automation system and method | |
US9424167B2 (en) | Automated testing of an application system | |
US9389849B2 (en) | Test case pattern matching | |
US9524230B2 (en) | Testing coordinator | |
CN104679658B (en) | The test method and system of WEB page | |
CN104391797B (en) | The recognition methods of GUI controls and device | |
US8943423B2 (en) | User interface indicators for changed user interface elements | |
US6654950B1 (en) | Software rehosting system and method | |
WO2016196701A1 (en) | Natural language engine for coding and debugging | |
US8448146B2 (en) | Generation of functional tests for re-hosted applications | |
Alégroth et al. | JAutomate: A tool for system-and acceptance-test automation | |
US8015239B2 (en) | Method and system to reduce false positives within an automated software-testing environment | |
US8356282B1 (en) | Integrated development environment for the development of electronic signal testing strategies | |
US8196113B2 (en) | Realtime creation of datasets in model based testing | |
US8225288B2 (en) | Model-based testing using branches, decisions, and options | |
US6421822B1 (en) | Graphical user interface for developing test cases using a test object library | |
US6332211B1 (en) | System and method for developing test cases using a test object library | |
US7810070B2 (en) | System and method for software testing | |
US6928625B2 (en) | Systems and methods for managing process control in a graphical user interface | |
US8381184B2 (en) | Dynamic test coverage | |
US9152521B2 (en) | Systems and methods for testing content of mobile communication devices | |
US8589886B2 (en) | System and method for automatic hardware and software sequencing of computer-aided design (CAD) functionality testing | |
US8171406B1 (en) | Automating user interface navigation | |
CN105117233B (en) | API Calls method and device | |
WO2017005148A1 (en) | Automatic software-testing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
C06 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
EXSB | Decision made by sipo to initiate substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20150902 |
|
RJ01 | Rejection of invention patent application after publication |