Movatterモバイル変換


[0]ホーム

URL:


CN105095088A - Calculator automatic test method and test system based on uiautomator test framework - Google Patents

Calculator automatic test method and test system based on uiautomator test framework
Download PDF

Info

Publication number
CN105095088A
CN105095088ACN201510555286.4ACN201510555286ACN105095088ACN 105095088 ACN105095088 ACN 105095088ACN 201510555286 ACN201510555286 ACN 201510555286ACN 105095088 ACN105095088 ACN 105095088A
Authority
CN
China
Prior art keywords
test
component object
tested
uiautomator
counter
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.)
Pending
Application number
CN201510555286.4A
Other languages
Chinese (zh)
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.)
Xiamen Meitu Mobile Technology Co Ltd
Original Assignee
Xiamen Meitu Mobile 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 Xiamen Meitu Mobile Technology Co LtdfiledCriticalXiamen Meitu Mobile Technology Co Ltd
Priority to CN201510555286.4ApriorityCriticalpatent/CN105095088A/en
Publication of CN105095088ApublicationCriticalpatent/CN105095088A/en
Pendinglegal-statusCriticalCurrent

Links

Landscapes

Abstract

The invention discloses a calculator automatic test method and test system based on a uiautomator test framework. The test method comprises the following steps of acquiring a control attribute of a calculator interface corresponding to an item to be tested; using the control attribute to locate a control element to be tested; under the uiautomator test framework, encapsulating the control element into a component object that can be uniquely identified; encoding the component object, and compiling the component object into an executable script according to the item to be tested; finally, starting the executable script and then an automatic test can be performed. By adopting the calculator automatic test method and test system based on the uiautomator test framework, automatic calculation and automatic result judgment can be performed on the calculator, test can be performed repeatedly, the test efficiency and accuracy are higher, and the stability of software and the system can be enhanced.

Description

Based on counter automated testing method and the test macro of uiautomator test frame
Technical field
The present invention relates to automatization testing technique field, particularly the system of a kind of counter automated testing method based on uiautomator test frame and application the method thereof.
Background technology
Automatic test has saving manpower, time, hardware resource, increases work efficiency and judge the advantages such as accuracy, and therefore, on the basis of traditional-handwork test, automatic test is just being introduced gradually in the test job of mobile terminal APP.For mobile phone calculator, the automated testing method of current main flow has based on the automatic test under Robotium framework, first application interface is carried out layering by it, carry out encoding and be compiled as can perform script according to the solo method that the various functions of correspondence calls in Robotium, imported in test machine, started automatic test; Then according to the test setting judging point of various functions, call screenshotss function and sectional drawing is carried out to test result; Finally the sectional drawing got and expected results are compared and verify, export test report; But the method to the differentiation of test result by call screenshotss function to result of calculation carry out after sectional drawing the later stage again people be that comparison differentiates, efficiency is low, not easily in a large number, repeatedly carry out the stability testing to ensure software.
Summary of the invention
The present invention, for solving the problem, provides a kind of counter automated testing method based on uiautomator test frame and test macro, automatically can calculate and automatic discrimination result mobile phone calculator.
For achieving the above object, the technical solution used in the present invention is:
Based on a counter automated testing method for uiautomator test frame, it comprises the following steps:
10. obtain the control property at the counter interface corresponding to project to be tested;
Control property described in 20. utilizations orients control element to be tested;
30. under uiautomator test frame, described control element is encapsulated as the component object that can uniquely identify;
Described component object is encoded by 40., and is compiled as can performs script according to project to be tested;
Performed script described in 50. startups carries out automatic test.
Preferably, in described step 10, obtain the control property at the counter interface corresponding to project to be tested, be obtain counter by uiautomatorviewer instrument each interface corresponding to project to be tested on all control properties.
Preferably, described control property is utilized to orient control element to be tested in described step 20, be to be identified control element to be tested by the mode of tag search according to described control property and locate, each control element is provided with corresponding control property and identification label.
Preferably, in described step 30, described control element being encapsulated as the component object that can uniquely identify, is the control title of described control element, control regions, control annotation information and control built-in attribute are carried out being encapsulated as the component object that can uniquely identify.
Preferably, in described step 40, after described component object is encoded, carry out being compiled as can perform script according to the testing procedure of project to be tested and test loop number of times.
Preferably, the project to be tested of described counter comprises one or more following combination: the display test of the mapping test of calculator panel button, data display field, check and remove calculate historical record test, the test of general panels and fundamental operation function, science panel and special calculation function test.
Preferably, carry out in described step 50 in automatic test course, automatically calculate, automatic acquisition result of calculation, automatic decision test result, and carry out automatic cycle testing according to the cycle index preset, finally generate test report.
Preferably, in described step 30, described control element is encapsulated as the component object that can uniquely identify, and the character string directly obtained for identifying this component object, in automatic test course, by the character string of this component object and the character string preset are carried out contrasting the judgement carrying out test result.
In addition, present invention also offers a kind of counter automatization test system based on uiautomator test frame, it comprises:
Control property acquisition module, for obtaining the control property at the counter interface corresponding to project to be tested;
Control element locating module, its utilize described in control property orient control element to be tested;
Component object package module, described control element is encapsulated as the component object that can uniquely identify by it under uiautomator test frame;
Step collector, described component object is encoded by it, and is compiled as can performs script according to project to be tested;
Automatic test module, carries out automatic test for starting described performed script.
Preferably, described control element is encapsulated as the component object that can uniquely identify by described component object package module, and the character string directly obtained for identifying this component object, carry out in automatic test course calling automatic test module, by the character string of this component object and the character string preset are carried out contrasting the judgement carrying out test result.
The invention has the beneficial effects as follows:
(1), automatically can calculate mobile phone calculator, automatic discrimination result, can test be repeated, ensure that test efficiently, is fully carried out, potential leak can be found better;
(2), adopt uiautomator test frame, test specification is wider, more convenient operation:
A, prior art adopt Robotium test frame can only carry out independent test for certain specific apk, and working range has limitation; The present invention adopts uiautomator test frame can carry out automatic test to all operations of whole system, and test specification is wider;
When using Robotium framework to test on simulator or prototype in b, prior art, must make test pack and tested bag into identical signature, this process relates to heavily signature and waits operation; And Robotium calls screenshotss function also needs a precondition: the access limit to SD card will be added in the AndroidManifest.xml of tested application; The present invention adopts uiautomator framework then without the need to the operation of so complicated prerequisite and restriction, more convenient operation;
(3) be, call screenshotss function to carry out sectional drawing to test key point to the judgement of result of calculation in prior art, then by the manpower comparing in later stage to judging; The present invention is by being encapsulated as the component object that can uniquely identify by described control element, and the character string directly obtained for identifying this component object, in automatic test course, by the character string of this component object and the character string preset are carried out contrasting the judgement carrying out test result, without the need to manual intervention, really realize automatic test, and test process does not take additional storage capacity;
(4), the control title of described control element, control regions, control annotation information and control built-in attribute carry out being encapsulated as the component object that can uniquely identify by the present invention, and information of its encapsulation is abundanter, and identity is better.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide a further understanding of the present invention, forms a part of the present invention, and schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the general flow chart of counter automated testing method of the present invention;
Fig. 2 is the structural representation of counter automatization test system of the present invention.
Embodiment
In order to make technical matters to be solved by this invention, technical scheme and beneficial effect clearly, understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
As shown in Figure 1, a kind of counter automated testing method based on uiautomator test frame of the present invention, it comprises the following steps:
10. obtain the control property at the counter interface corresponding to project to be tested;
Control property described in 20. utilizations orients control element to be tested;
30. under uiautomator test frame, described control element is encapsulated as the component object that can uniquely identify;
Described component object is encoded by 40., and is compiled as can performs script according to project to be tested;
Performed script described in 50. startups carries out automatic test.
Obtain the control property at the counter interface corresponding to project to be tested in described step 10, be obtain counter by uiautomatorviewer instrument each interface corresponding to project to be tested on all control properties.
Described control property is utilized to orient control element to be tested in described step 20, be to be identified control element to be tested by the mode of tag search according to described control property and locate, each control element is provided with corresponding control property and identification label.
In described step 30, described control element being encapsulated as the component object (UiObject) that can uniquely identify, is the control title (packagename) of described control element, control regions (bounds), control annotation information (content-desc) and control built-in attribute are carried out being encapsulated as the component object that can uniquely identify; And, by obtaining the character string for identifying this component object, in automatic test course, by the character string of this component object and the character string preset being carried out contrasting the judgement carrying out test result, whether the component object after can directly passing through to judge to have encapsulated exists just easily can realize checking.Such as, the long test by function, do not provide the long method touched the button in the Solo class of Robotium test frame of the prior art, need the coordinate first obtaining button, then length realizes by the transfer mode that coordinate is such, and step is complicated, and workload is large; The Uiautomator test frame that the present invention adopts then provides the method for operating to the nearly all needs of component object after encapsulate, presses function, only need UiObject.longClick () directly to realize as long, efficiently faster.
In described step 40, after described component object is encoded, carry out being compiled as can perform script according to the testing procedure of project to be tested and test loop number of times.
In described step 50, performed script after compiling is imported in test machine, use adbshell instruction or special Test Application just can start this can perform script and carry out automatic test, and carrying out in automatic test course, automatically calculate, automatic acquisition result of calculation, automatic decision test result, and carry out automatic cycle testing according to the cycle index preset, finally generate test report.The present invention can calculate mobile phone calculator and automatic discrimination test result each time automatically, after completing loop test number of times, automatically exports test report, without the need to manual intervention.
Wherein, the project to be tested of described counter comprises one or more following combination: the display test of the mapping test of calculator panel button, data display field, check and remove calculate historical record test, the test of general panels and fundamental operation function, science panel and special calculation function test.
As shown in Figure 2, present invention also offers a kind of counter automatization test system based on uiautomator test frame, it comprises:
Control property acquisition module A, for obtaining the control property at the counter interface corresponding to project to be tested;
Control element locating module B, its utilize described in control property orient control element to be tested;
Component object package module C, described control element is encapsulated as the component object that can uniquely identify by it under uiautomator test frame;
Step collector D, described component object is encoded by it, and is compiled as can performs script according to project to be tested;
Automatic test module E, carries out automatic test for starting described performed script.
In the present embodiment, described control element is encapsulated as the component object that can uniquely identify by described component object package module C, and the character string directly obtained for identifying this component object, carry out in automatic test course calling automatic test module E, by the character string of this component object and the character string preset are carried out contrasting the judgement carrying out test result.
Compared with automated testing method of the prior art, the present invention is simple to operate, after getting control property, just can encapsulate the script edit that unique discernible component object completes all functions test item, eliminate some complex operations required in Robotium test frame; Meanwhile, this method of testing can calculate automatically, automatic acquisition judge result of calculation, artificially contrasts sectional drawing without the need to the later stage, and can repeat, automatically exports test report.Therefore, the present invention can more efficiently, ensure the carrying out of test fully, improve and find the ability of potential leak, strengthen the stability of software, system.
It should be noted that, each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.For system class embodiment, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.And, in this article, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.In addition, one of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be ROM (read-only memory), disk or CD etc.
Above-mentioned explanation illustrate and describes the preferred embodiments of the present invention, be to be understood that the present invention is not limited to the form disclosed by this paper, should not regard the eliminating to other embodiments as, and can be used for other combinations various, amendment and environment, and can in invention contemplated scope herein, changed by the technology of above-mentioned instruction or association area or knowledge.And the change that those skilled in the art carry out and change do not depart from the spirit and scope of the present invention, then all should in the protection domain of claims of the present invention.

Claims (10)

CN201510555286.4A2015-09-022015-09-02Calculator automatic test method and test system based on uiautomator test frameworkPendingCN105095088A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201510555286.4ACN105095088A (en)2015-09-022015-09-02Calculator automatic test method and test system based on uiautomator test framework

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201510555286.4ACN105095088A (en)2015-09-022015-09-02Calculator automatic test method and test system based on uiautomator test framework

Publications (1)

Publication NumberPublication Date
CN105095088Atrue CN105095088A (en)2015-11-25

Family

ID=54575583

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201510555286.4APendingCN105095088A (en)2015-09-022015-09-02Calculator automatic test method and test system based on uiautomator test framework

Country Status (1)

CountryLink
CN (1)CN105095088A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN105912236A (en)*2016-04-112016-08-31天脉聚源(北京)传媒科技有限公司Test information obtaining method and apparatus
CN106021102A (en)*2016-05-162016-10-12北京奇虎科技有限公司Automated test file generation method and apparatus
CN106383780A (en)*2016-09-052017-02-08努比亚技术有限公司Monkey test method and device
CN106445764A (en)*2016-09-292017-02-22福州大学Method for realizing automatic testing of stability of android facility
CN106681925A (en)*2017-01-042017-05-17广州四三九九信息科技有限公司UIAutomator-based automatic testing method and device
CN106776319A (en)*2016-12-152017-05-31广州酷狗计算机科技有限公司Automatic test approach and device
CN106991045A (en)*2017-03-242017-07-28广州酷狗计算机科技有限公司Page method of calibration and device
CN107085554A (en)*2017-04-112017-08-22武汉斗鱼网络科技有限公司A kind of method and apparatus for adding control mark
CN108073511A (en)*2016-11-142018-05-25平安科技(深圳)有限公司test code generating method and device
CN108733555A (en)*2017-04-252018-11-02中移信息技术有限公司A kind of application testing method and device
CN108829606A (en)*2018-06-292018-11-16北京金山安全软件有限公司Input method performance test method and device
CN110618934A (en)*2019-08-152019-12-27重庆金融资产交易所有限责任公司Front-end automatic test debugging method and device and computer readable storage medium
CN117591438A (en)*2024-01-192024-02-23易方信息科技股份有限公司Automatic testing method and related device for UI component atomization

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20120110174A1 (en)*2008-10-212012-05-03Lookout, Inc.System and method for a scanning api
CN104331363A (en)*2014-10-172015-02-04上海斐讯数据通信技术有限公司Automatic testing method for Android device
CN104615538A (en)*2015-02-052015-05-13天津市康凯特软件科技有限公司Mobile phone application testing method based on mobile phone interface control elements
CN104683317A (en)*2013-12-032015-06-03腾讯科技(深圳)有限公司Extraction method and system for UI data, client and server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20120110174A1 (en)*2008-10-212012-05-03Lookout, Inc.System and method for a scanning api
CN104683317A (en)*2013-12-032015-06-03腾讯科技(深圳)有限公司Extraction method and system for UI data, client and server
CN104331363A (en)*2014-10-172015-02-04上海斐讯数据通信技术有限公司Automatic testing method for Android device
CN104615538A (en)*2015-02-052015-05-13天津市康凯特软件科技有限公司Mobile phone application testing method based on mobile phone interface control elements

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
LOGGINGSELENIUM: "Android uiautomator使用入门官方教程", 《HTTP://WWW.TUICOOL.COM/ARTICLES/RVZIRM》*
VSHUANG: "Android 自动化测试(4)<uiautomator>", 《HTTP://BLOG.CSDN.NET/VSHUANG/ARTICLE/DETAILS/40210163》*
XZY2046: "Android自动化测试之UIAutomator", 《HTTP://BLOG.CSDN.NET/XZY2046/ARTICLE/DETAILS/39269463》*
喜欢蓝色的我: "android自动化测试框架(一)uiautomator", 《HTTP://KM-MOON11.ITEYE.COM/BLOG/2228196》*

Cited By (17)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN105912236A (en)*2016-04-112016-08-31天脉聚源(北京)传媒科技有限公司Test information obtaining method and apparatus
CN106021102A (en)*2016-05-162016-10-12北京奇虎科技有限公司Automated test file generation method and apparatus
CN106021102B (en)*2016-05-162019-05-28北京奇虎科技有限公司The generation method and device of automatic test file
CN106383780A (en)*2016-09-052017-02-08努比亚技术有限公司Monkey test method and device
CN106445764A (en)*2016-09-292017-02-22福州大学Method for realizing automatic testing of stability of android facility
CN108073511A (en)*2016-11-142018-05-25平安科技(深圳)有限公司test code generating method and device
CN106776319A (en)*2016-12-152017-05-31广州酷狗计算机科技有限公司Automatic test approach and device
CN106776319B (en)*2016-12-152020-02-14广州酷狗计算机科技有限公司Automatic test method and device
CN106681925A (en)*2017-01-042017-05-17广州四三九九信息科技有限公司UIAutomator-based automatic testing method and device
CN106991045A (en)*2017-03-242017-07-28广州酷狗计算机科技有限公司Page method of calibration and device
CN107085554A (en)*2017-04-112017-08-22武汉斗鱼网络科技有限公司A kind of method and apparatus for adding control mark
CN107085554B (en)*2017-04-112019-09-20武汉斗鱼网络科技有限公司A kind of method and apparatus of addition control mark
CN108733555A (en)*2017-04-252018-11-02中移信息技术有限公司A kind of application testing method and device
CN108829606A (en)*2018-06-292018-11-16北京金山安全软件有限公司Input method performance test method and device
CN110618934A (en)*2019-08-152019-12-27重庆金融资产交易所有限责任公司Front-end automatic test debugging method and device and computer readable storage medium
CN117591438A (en)*2024-01-192024-02-23易方信息科技股份有限公司Automatic testing method and related device for UI component atomization
CN117591438B (en)*2024-01-192024-05-14易方信息科技股份有限公司Automatic testing method and related device for UI component atomization

Similar Documents

PublicationPublication DateTitle
CN105095088A (en)Calculator automatic test method and test system based on uiautomator test framework
CN105446868B (en)System compatibility test method, testing case management and relevant apparatus
CN102375778B (en)Method and system for automatically testing digital signal processor (DSP)
CN105184160B (en)A kind of method of the Android phone platform application program malicious act detection based on API object reference relational graphs
CN112558946A (en)Method, device and equipment for generating code and computer readable storage medium
CN104461873B (en)The method of testing and device of a kind of application program
US10354031B2 (en)Information processing by interpenetrating signal transmission channel in design for testability of chip
CN107133174A (en)Test case code automatically generating device and method
CN104407980A (en)Mobile application automated testing device and method
CN109684847A (en)Self-repairing method, device, equipment and the storage medium of script loophole
CN104423961B (en)A kind of method and system for generating test script
CN108897724A (en)Function schedule determines method and device
CN104598274A (en)Automatic instrumentation, compiling and installing method and system
CN109062790A (en)The upgrading test method of car-mounted terminal bluetooth firmware
CN104268079A (en)POS (Point Of Sale) application program testing method and system
CN103970659A (en)Android application software automation testing method based on pile pitching technology
CN108415821A (en)The generation method and device of test report
CN104268473A (en)Method and device for detecting application programs
CN107577944A (en)Website malicious code detecting method and device based on code syntax analyzer
CN104778118A (en)Improvement method for automatic testing technology
CN109614107A (en)A kind of integrated approach and device of Software Development Kit
CN107451058A (en)A kind of software development methodology and device
CN104699617A (en)Automated testing method for games
CN108132881A (en)A kind of automated testing method and system
CN105005497A (en)Method and apparatus for calling local function in Java card virtual machine

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
WD01Invention patent application deemed withdrawn after publication

Application publication date:20151125

WD01Invention patent application deemed withdrawn after publication

[8]ページ先頭

©2009-2025 Movatter.jp