[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN102841845A - Automatic testing method of Android device software - Google Patents

Automatic testing method of Android device software Download PDF

Info

Publication number
CN102841845A
CN102841845A CN2012102659620A CN201210265962A CN102841845A CN 102841845 A CN102841845 A CN 102841845A CN 2012102659620 A CN2012102659620 A CN 2012102659620A CN 201210265962 A CN201210265962 A CN 201210265962A CN 102841845 A CN102841845 A CN 102841845A
Authority
CN
China
Prior art keywords
recording
testing method
test
automatic testing
device software
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
CN2012102659620A
Other languages
Chinese (zh)
Other versions
CN102841845B (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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201210265962.0A priority Critical patent/CN102841845B/en
Publication of CN102841845A publication Critical patent/CN102841845A/en
Application granted granted Critical
Publication of CN102841845B publication Critical patent/CN102841845B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

本发明涉及一种Android设备软件自动测试方法,包括自动脚本录制、回放和验证步骤,其中录制包括:101)启动被测程序,并创建一层覆盖在被测程序上的透明可视(View)层;所述透明View层是android.view.View的子类;102)按测试要求操作屏幕或按键;在操作过程中,所述透明View层截取记录对应触控/按键事件,再通过向被测程序发送对应一致的模拟触控/按键事件传递操作指令;被测程序执行所述操作指令。这种自动测试方法,基于Android系统本身,无须使用shell命令和高性能pc,从而提升测试安全、可靠、广泛和易实施性。

Figure 201210265962

The present invention relates to a kind of Android device software automatic testing method, comprises automatic script recording, playback and verification steps, wherein recording comprises: 101) start the program under test, and create a layer of transparent visual (View) covered on the program under test layer; the transparent View layer is a subclass of android.view.View; 102) operate the screen or buttons according to the test requirements; in the operation process, the transparent View layer intercepts and records the corresponding touch/key event, and then passes to the The test program sends corresponding and consistent simulated touch/key event transfer operation instructions; the test program executes the operation instructions. This automatic testing method, based on the Android system itself, does not need to use shell commands and high-performance PCs, thereby improving the safety, reliability, extensiveness and ease of implementation of the test.

Figure 201210265962

Description

一种Android设备软件自动测试方法An Android device software automatic testing method

技术领域 technical field

本发明涉及软件黑盒测试技术,具体涉及一种安卓(Android)设备软件自动测试方法,尤其应用于智能手机。The invention relates to software black-box testing technology, in particular to an Android (Android) device software automatic testing method, especially applied to smart phones.

背景技术 Background technique

现有,Android系统软件自动化测试工具中大致分为三种,其一是由测试开发者为某个程序的某个测试路径预先设计好测试工具(比如目前流行的Juit(java单元测试)和Robotium(一种基于Android的黑盒自动化测试框架),再用来自动化测试,这样的好处是省去了测试员的工作量,但却大大地增加了测试开发者的工作量,首先一个程序是存在多条测试路径的,测试开发者就必须得根据不同的测试路径来设计测试工具,若不这样也就做不到程序测试的全面性。所以做不好上述问题也就做不好自动化测试,同时也会导致产品存在严重的风险与缺陷。或许你可以说采用人工的方式进行测试!这样确实可以解决自动化测试的问题,但传统的人工测试覆盖面窄,周期长,人工成本高等问题又是各厂商所不能接受的。Existing, Android system software automation test tool is roughly divided into three kinds, one is that test developer pre-designs test tool for a certain test path of a certain program (such as the current popular Juit (java unit test) and Robotium (an Android-based black-box automated testing framework), which is then used for automated testing. This has the advantage of saving the workload of the tester, but greatly increasing the workload of the test developer. First, a program exists If there are multiple test paths, test developers must design test tools according to different test paths. Otherwise, the comprehensiveness of program testing will not be achieved. Therefore, if the above problems cannot be done well, automated testing will not be done well. At the same time, it will also lead to serious risks and defects in the product. Maybe you can say that testing is done manually! This can indeed solve the problem of automated testing, but traditional manual testing has narrow coverage, long cycle, and high labor costs. unacceptable by the manufacturer.

其二是采用计算机(pc)连接Android终端的方式,其实现是通过在pc机上装有Android自带的安卓驱动(ADB)工具或是通过通用串行总线(USB)实现与外围设备连接并配置好套接字(Socket)通讯参数,在界面上通过标准小窗口工具箱(swt)/jface工具展示出来,在底层则通过壳(shell)命令来获取设备被测程序的信息来生成相应测试脚本,这样虽能解决上述问题,但它脱离不了电脑,做不到随时随地自动化测试,工具的便捷性与实用性非常差,比如申请号为:201110446674.0的专利。The second is to use a computer (pc) to connect to the Android terminal, which is realized by installing Android's own Android driver (ADB) tool on the pc or connecting and configuring the peripheral device through the universal serial bus (USB). Socket communication parameters are displayed on the interface through the standard small window toolbox (swt)/jface tool, and at the bottom layer, the information of the device under test is obtained through the shell command to generate the corresponding test script , although the above problems can be solved like this, it cannot be separated from the computer, and it cannot be automated testing anytime and anywhere. The convenience and practicality of the tool are very poor, such as the patent application number: 201110446674.0.

其三是通过开放设备的最高管理权限,通过获得该设备的最高使用权限时才能使用的shell命令来获取设备被测程序的信息来生成相应测试脚本,该方式与Android系统底层连接紧密,不利于Android设备的安全,易成为黑客入侵的工具/技术,比如申请号为:201010616361.0的专利的安全问题就令人担忧。The third is to obtain the information of the program under test on the device by opening the highest management authority of the device and the shell command that can only be used when the highest use authority of the device is obtained to generate the corresponding test script. This method is closely connected with the bottom layer of the Android system, which is not conducive to The security of Android devices is easy to become a tool/technology for hackers, such as the security issue of the patent application number: 201010616361.0, which is worrying.

所以说在现行的测试技术亦中都不足以做好Android系统的自动化测试,亟待改进。Therefore, in the current testing technology, it is not enough to do a good job in the automated testing of the Android system, and it needs to be improved urgently.

发明内容 Contents of the invention

本发明需要解决的技术问题是,如何提供一种Android设备软件自动测试方法,无须使用shell命令和高性能pc进行自动化测试,从而提升测试安全、可靠、广泛和易实施性。The technical problem to be solved in the present invention is how to provide an automatic testing method for Android device software without using shell commands and high-performance PCs for automatic testing, thereby improving test safety, reliability, extensiveness and ease of implementation.

本发明的上述技术问题这样解决:构建一种Android设备软件自动测试方法,包括以下自动脚本录制步骤:Above-mentioned technical problem of the present invention is solved like this: build a kind of Android device software automatic testing method, comprise following automatic script recording step:

101)启动被测程序,并创建一层透明可视(View)层;所述View层是android.view.View的子类;101) start the program under test, and create a layer of transparent visible (View) layer; the View layer is a subclass of android.view.View;

102)按测试要求操作屏幕或按键;102) Operate the screen or buttons according to the test requirements;

在操作过程中,所述透明View层截取记录对应触控/按键事件,再通过向被测程序发送对应一致的模拟触控/按键事件传递操作指令;被测程序执行所述操作指令。During operation, the transparent View layer intercepts and records corresponding touch/key events, and then transmits operation instructions by sending corresponding and consistent simulated touch/key events to the program under test; the program under test executes the operation instructions.

按照本发明提供的Android设备软件自动测试方法,步骤102)中通过回调函数HandleEvent和自动测试框架Instrumention向被测程序发送模拟触控/按键事件。According to the Android device software automatic testing method provided by the present invention, in step 102), the simulated touch/key event is sent to the program under test through the callback function HandleEvent and the automatic testing framework Instrumention.

按照本发明提供的Android设备软件自动测试方法,步骤102)中被测程序执行所述操作指令包括更新屏幕界面。According to the Android device software automatic testing method provided by the present invention, in step 102), the program under test executes the operation instructions including updating the screen interface.

按照本发明提供的Android设备软件自动测试方法,当透明View监听到有UP动作时先暂时移除本身并传递录制信息到回调函数HandleEvent中,而回调函数HandleEvent则根据录制的信息结合自动化测试框架Instrumention发送模拟触控/按键事件来更新被测程序界面,步骤102)中截取记录包括记录对应屏幕界面。According to the Android device software automatic testing method provided by the present invention, when the transparent View monitors that there is an UP action, it temporarily removes itself and transmits the recording information to the callback function HandleEvent, and the callback function HandleEvent is combined with the automated testing framework Instrumentation according to the recorded information. Sending simulated touch/key events to update the program interface under test, and intercepting the record in step 102) includes recording the corresponding screen interface.

按照本发明提供的Android设备软件自动测试方法,所述自动脚本录制步骤包括跨进程录制,这在基于shell和pc的方式中无法做到。According to the Android device software automatic testing method provided by the present invention, the automatic script recording step includes cross-process recording, which cannot be achieved in a shell-based and PC-based manner.

按照本发明提供的Android设备软件自动测试方法,所述录制步骤还包括通过预先定义的交互方式通知透明View层结束录制,生成录制脚本,具体是:所述录制步骤还包括当透明View监听到有结束录制请求后结束录制并通知后台服务RecordService提取录制信息,生成录制脚本。According to the Android device software automatic testing method provided by the present invention, the recording step also includes notifying the transparent View layer to end the recording through a predefined interactive mode, and generating a recording script, specifically: the recording step also includes when the transparent View monitors that there is After the recording request ends, the recording ends and the background service RecordService is notified to extract the recording information and generate a recording script.

按照本发明提供的Android设备软件自动测试方法,该自动测试方法还包括脚本回放步骤:根据录制脚本向被测程序发送与录制脚本对应的一系列模拟触控/按键事件。According to the Android device software automatic testing method provided by the present invention, the automatic testing method also includes a script playback step: sending a series of simulated touch/key events corresponding to the recorded script to the program under test according to the recorded script.

按照本发明提供的Android设备软件自动测试方法,所述脚本回放步骤多次重复。According to the Android device software automatic testing method provided by the present invention, the script playback step is repeated many times.

按照本发明提供的Android设备软件自动测试方法,所述回放步骤还包括脚本解析和有效性检测子步骤。According to the Android device software automatic testing method provided by the present invention, the playback step further includes script analysis and validity detection sub-steps.

按照本发明提供的Android设备软件自动测试方法,该自动测试方法还包括结果验证步骤。According to the Android device software automatic testing method provided by the present invention, the automatic testing method also includes a result verification step.

按照本发明提供的Android设备软件自动测试方法,结果验证步骤包括但不限制于以下方式:According to the Android device software automatic testing method provided by the present invention, the result verification step includes but is not limited to the following methods:

(一)所述结果验证步骤包括截取被测程序屏幕输出和自动/人工图像比对;(1) said result verification step includes intercepting the screen output of the program under test and automatic/manual image comparison;

(二)所述结果验证步骤包括记录被测程序数据输出和自动数值比对。(2) The result verification step includes recording the data output of the tested program and automatic numerical comparison.

本发明提供的Android设备软件自动测试方法,尤其应用于智能手机,较现有技术具有以下优点:The Android device software automatic testing method provided by the invention is especially applied to smart phones, and has the following advantages compared with the prior art:

1、被测程序可以通过本发明来录制不同测试路径的测试脚本,并且不需要编写任何代码或修改测试脚本,避免手动录制不同测试路径的脚本来解决程序测试路径多样性与测试工具开发者设计工具困难、工作量大的问题;1. The program under test can record test scripts of different test paths through the present invention, and does not need to write any code or modify test scripts, avoiding manual recording of scripts of different test paths to solve the problem of program test path diversity and test tool developer design Difficult tools and heavy workload;

2、不需要借助pc机来实现自动录制,且不需要Android设备的最高管理权限;利用技术完全模拟人机交互功能,可以录制90%以上的程序测试路径多样性的测试脚本,从而减少自动化测试工具的开发量以及人力资本的投入,大大地提高了自动化测试效率;2. There is no need to use a PC to realize automatic recording, and no need for the highest management authority of Android devices; using technology to completely simulate the human-computer interaction function, more than 90% of test scripts with a variety of program test paths can be recorded, thereby reducing automated testing The development of tools and the investment of human capital have greatly improved the efficiency of automated testing;

3、通过采集元素坐标进行自动化测试的,由于录制时只会根据界面的切换而进行录制测试脚本,故而能进行跨进程的脚本录制与脚本回放测试;3. For automated testing by collecting element coordinates, since the recording test script will only be recorded according to the switching of the interface during recording, cross-process script recording and script playback testing can be performed;

4、可用于回归测试,冒烟测试以及功能测试,更实用、更安全、更便捷和更可靠。4. It can be used for regression testing, smoke testing and functional testing, which is more practical, safer, more convenient and more reliable.

附图说明 Description of drawings

下面结合附图和具体实施例进一步对本发明进行详细说明:Below in conjunction with accompanying drawing and specific embodiment the present invention is further described in detail:

图1为本发明优选具体实施例触摸屏智能手机上的自动化测试软件的程序流程示意图。Fig. 1 is a schematic diagram of the program flow of the automatic test software on the smart phone with touch screen according to the preferred embodiment of the present invention.

具体实施方式 Detailed ways

首先,说明本发明基础和关键:At first, explain the foundation and key of the present invention:

(一)基本思想(1) Basic idea

在录制过程中,当被测程序启动时同时创建一层透明的View放置于被测程序上。当有事件发生时,该View所实现的监听方法会记录动作被测程序所点触元素所在的坐标或者该设备的按键值并生成测试脚本保存于手机存储卡上。回放时,再根据对应脚本解析算法结合Instrumentation(Android平台的一种自动化测试框架)实现跨进程的回放测试。During the recording process, when the program under test starts, a transparent View is created and placed on the program under test. When an event occurs, the monitoring method implemented by the View will record the coordinates of the element touched by the program under test or the key value of the device and generate a test script and save it on the memory card of the mobile phone. During playback, the cross-process playback test is realized according to the corresponding script parsing algorithm combined with Instrumentation (an automated test framework for the Android platform).

(二)自定义View层(2) Custom View layer

该自定义的透明View继承自android.view.View,通过复写它的按键事件onKeyDown()、onKeyUp()、onKeyLong()以及触控事件的onTouchEvent()以上的几个方法来监听设备动作事件,同时该步骤还会在启动该被测程序时把被测程序的Target Package、ActivityName(被测程序的包名与主类名)与当前设备的信息(自定义代号为0)封装成一条特殊的字符串(格式为:″自定义代号″+″,″+″TargetPackage″+″,″+″Activity Name″+″,″+″XX″)添加到StringBuffer(java中一个类似于String的字符串缓冲区)中)。The custom transparent View inherits from android.view.View, and monitors device action events by overriding its key events onKeyDown(), onKeyUp(), onKeyLong() and touch event onTouchEvent(). At the same time, this step will also package the Target Package, ActivityName (package name and main class name of the program under test) and the information of the current device (custom code is 0) of the program under test into a special String (format: "custom code"+", "+"TargetPackage"+", "+"Activity Name"+", "+"XX") is added to StringBuffer (a string similar to String in java buffer)).

第二,结合优选实施例详细说明本发明具体实现:Second, describe in detail the specific implementation of the present invention in conjunction with preferred embodiments:

如图1所示,本发明优选具体实施例触摸屏智能手机上的自动化测试软件程序具体包括以下步骤:As shown in Figure 1, the automatic test software program on the touch screen smart phone of the preferred embodiment of the present invention specifically includes the following steps:

301)启动程序,选择开始录制(该步骤的实现是获取当前设备的所有可见可操作的程序并罗列出来显示在屏幕上,单击选择某项后会启动该程序,同时也会创建一层自定义的透明View覆盖其上;启动被测程序时把被测程序的Target Package,Activity Name与当前设备的信息封装成一条特殊的字符串添加到StringBuffer中;301) Start the program, choose to start recording (the realization of this step is to obtain all visible and operable programs of the current device and list them on the screen, and click to select an item to start the program, and also create a layer of self- The defined transparent View covers it; when the program under test is started, the Target Package, Activity Name and current device information of the program under test are encapsulated into a special string and added to the StringBuffer;

302)在录制中,随意点触屏幕(该步骤的实现是通过监听到当前测试员对该透明View的一些模拟键盘/触屏事件后,规则如下:302) During the recording, touch the screen at will (this step is realized by listening to some simulated keyboard/touch screen events of the current tester on the transparent View, the rules are as follows:

如果是按键事件则取事件的代号(自定义代号为1)跟动作类型(类型分为:UP(弹起),DOWN(按下),LONG(长按))和按键值(比如设备的″返回键″的键值为4)。If it is a button event, take the event code (custom code is 1) and the action type (the types are divided into: UP (bounce), DOWN (press), LONG (long press)) and the button value (such as the "" The return key " has a key value of 4).

如果是触控事件则取事件代号(自定义代号为2)跟动作类型(类型分为:UP(弹起),DOWN(按下),MOVE(移动))以及该界面控件元素所处的X轴Y轴的坐标(注:一个单击的动作由一个DOWN跟一个UP两个动作组成;而一个移动的动作由一个DOWN跟多个MOVE及一个UP动作组成)并把其值封装成一条特殊的字符串(其一格式为:″自定义代号″+″,″+″动作类型″+″,″+″X轴坐标″+″,″+″Y轴坐标″)分别添加到StringBuffer和List集合(java中一种有序的序列)中,同时对该事件的动作类型进行判断,规则如下:If it is a touch event, take the event code (the custom code is 2) and the action type (the types are divided into: UP (bounce), DOWN (press), MOVE (move)) and the X where the interface control element is located. The coordinates of the axis Y axis (note: a click action is composed of a DOWN and an UP action; and a moving action is composed of a DOWN, multiple MOVE and an UP action) and encapsulate its value into a special The character strings (one format is: "custom code"+", "+" action type "+", "+" X-axis coordinates "+", "+"Y-axis coordinates") are added to StringBuffer and List respectively Set (an ordered sequence in java), while judging the action type of the event, the rules are as follows:

如果动作类型是up类型的话则暂时移除该透明view,然后从List集合中循环取出每条字符串时经转换成字符串数组后判断该字符串数组首个元素的值,如果值为“1”,则取其后的所有元素的值并结合Instrumentation的sendKeySync()方法发送模拟键盘事件。如果值为“2”,则取其后的所有元素的值并结合Instrumentation的sendPointerSync()方法发送触控事件。并由此实现了在透明view上的触摸动作/点按设备按键的各种动作事件(比如在透明的view下我们是看得到被测程序界面上的某些控件的,当你点击(该动作由down跟up类型组成,也就是说该动作是先按下再松开)某个控件时它是没反应的,因为点击的对象是透明的view,当后台程序监测到刚才点击动作中包含有UP动作类型时,程序会暂时的移除该透明view,然后取出刚刚保存到List集合中的事件信息,经解析后结合Instrumentation()的sendPointerSync()方法发送点击动作,故此就实现界面的跳转或更新),当该动作完后又把该透明view覆盖其上并清空List类的所有值,故而通过这样周而复始的方式才实现了脚步的录制,直至程序监听到退出命令);If the action type is up type, temporarily remove the transparent view, and then loop out each string from the List collection and convert it into a string array to determine the value of the first element of the string array. If the value is "1" ", take the values of all the elements after it and combine with Instrumentation's sendKeySync() method to send simulated keyboard events. If the value is "2", take the values of all elements after it and send touch events in combination with Instrumentation's sendPointerSync() method. And thus realize the touch action on the transparent view/click various action events of the device button (for example, under the transparent view, we can see some controls on the interface of the program under test, when you click (the action Composed of down and up types, that is to say, the action is to press first and then release) when a certain control is unresponsive, because the clicked object is a transparent view, when the background program detects that the click action just now contains When the action type is UP, the program will temporarily remove the transparent view, and then take out the event information just saved in the List collection, and after parsing, combine with the sendPointerSync() method of Instrumentation() to send the click action, so the interface jump is realized or update), when the action is completed, the transparent view is covered on it and all values of the List class are cleared, so the footsteps are recorded in this repeated way until the program listens to the exit command);

303)退出录制时点击屏幕下方的X监听图标(该步骤的实现是把保存在公用临时区信息写入到本地存储卡上,经此自动化测试脚本也就录制好了);303) When exiting the recording, click the X monitoring icon at the bottom of the screen (the realization of this step is to write the information stored in the public temporary area to the local memory card, and the automated test script will be recorded after this);

304)当步骤303)完成后程序会返回到主界面,这时选择开始测试(该步骤的机制是通过实现一个简单的文件管理器,其目的是用来管理本发明录制的测试脚本);304) After step 303) is completed, the program will return to the main interface, and at this time select to start testing (the mechanism of this step is to implement a simple file manager, whose purpose is to manage the test script recorded by the present invention);

305)找到刚录制的脚本并点击,程序自动开始检测(该步骤的实现是通过找到测试脚本文件后,进而检测测试脚本是否有效,如果有效则直接进入步骤307);305) Find the script that has just been recorded and click, and the program automatically starts to detect (the realization of this step is to detect whether the test script is valid after finding the test script file, and then directly enter step 307 if it is valid);

306)若检测到测试脚本无效时,程序会提示测试员是重新录制还是取消(该步骤的实现是如果测试员选择了重新录制则直接进入步骤302),反之则取消);306) If it is detected that the test script is invalid, the program will prompt the tester whether to re-record or cancel (the realization of this step is to directly enter step 302 if the tester selects re-recording), otherwise cancel);

307)程序进入解析阶段,解析完后提示测试员设置测试次数和测试延时或者点击″取消″(该步骤的实现是若是由步骤305)跳转的则直接解析该测试脚本文件并把每条解析出来的字符串添加到List集合中);307) The program enters the parsing stage, and after parsing, the tester is prompted to set the number of tests and the test delay or click "cancel" (if the realization of this step is by step 305) to jump, then directly parse the test script file and put each The parsed string is added to the List collection);

308)设置好后,点击“确定”后程序会根据设置的信息进行自动化测试(该步骤的实现是取得步骤307)中解析后List类后,通过循环取值的方法来取出每一条带有事件信息的字符串并通过String的spit(″,″)方法转换成一个字符串数组并根据该字符串的首个元素的值来进行判断,规则如下:308) After setting, after clicking "OK", the program will perform automated testing according to the set information (the realization of this step is to obtain the List class after parsing in step 307), and take out each item with an event by looping the value method The string of information is converted into a string array through the spit(″,″) method of String and judged according to the value of the first element of the string. The rules are as follows:

如果值为“0”,则取其第二个元素跟第三个元素的值来启动被测程序;If the value is "0", take the values of the second element and the third element to start the program under test;

如果值为“1”,则取其后的所有元素的值并结合Instrumentation的send KeySync()方法发送模拟键盘事件;If the value is "1", take the values of all the elements after it and combine with Instrumentation's send KeySync() method to send simulated keyboard events;

如果值为“2”,则取其后的所有元素的值并结合Instrumentation的send PointerSync()方法发送触控事件;If the value is "2", take the values of all elements after it and send touch events in combination with Instrumentation's send PointerSync() method;

309)在自动化测试时,程序会在屏幕上显示测试进度,中途也可手动停止测试;309) During the automated test, the program will display the test progress on the screen, and the test can also be stopped manually in the middle;

310)当测试执行完毕后,程序会弹出对话框询问测试员是否继续;310) After the test is executed, the program will pop up a dialog box to ask the tester whether to continue;

311)若点击继续,则自动化测试重新开始,若点击停止,自动化测试则退出;311) If you click to continue, the automated test will restart, if you click to stop, the automated test will exit;

312)结束。312) End.

最后,以上所述仅为本发明的较佳实施例,凡依本发明权利要求范围所做的均等变化与修饰,皆应属本发明权利要求的涵盖范围。Finally, the above descriptions are only preferred embodiments of the present invention, and all equivalent changes and modifications made according to the scope of the claims of the present invention shall fall within the scope of the claims of the present invention.

Claims (9)

1.一种Android设备软件自动测试方法,其特征在于,包括以下自动脚本录制步骤: 1. an Android device software automatic testing method, is characterized in that, comprises following automatic script recording step: 101)启动被测程序,并创建一层覆盖在被测程序上的透明View层;所述View层是android.view.View的子类; 101) start the program under test, and create a transparent View layer covering the program under test; the View layer is a subclass of android.view.View; 102)按测试要求操作屏幕或按键; 102) Operate the screen or buttons according to the test requirements; 在操作过程中,所述透明View层截取记录对应触控/按键事件,再通过向被测程序发送对应一致的模拟触控/按键事件传递操作指令;被测程序执行所述操作指令。 During operation, the transparent View layer intercepts and records corresponding touch/key events, and then transmits operation instructions by sending corresponding and consistent simulated touch/key events to the program under test; the program under test executes the operation instructions. 2.根据权利要求1所述Android设备软件自动测试方法,其特征在于,步骤102)中通过解析录制的测试脚本结合自动测试框架向被测程序发送模拟触控/按键事件。 2. according to the described Android device software automatic testing method of claim 1, it is characterized in that, in the step 102), send simulated touch/key event to program under test by analyzing the test script of recording in conjunction with automatic test frame. 3.根据权利要求2所述Android设备软件自动测试方法,其特征在于,当透明View监听到有UP动作时先暂时移除本身并传递录制信息到回调函数HandleEvent中,而回调函数HandleEvent则根据录制的信息结合自动化测试框架Instrumention发送模拟触控/按键事件来更新被测程序界面,步骤102)中截取记录包括记录对应屏幕界面。 3. according to the described Android device software automatic testing method of claim 2, it is characterized in that, when transparent View monitors to have UP action, first temporarily removes itself and transmits recording information in the callback function HandleEvent, and callback function HandleEvent then according to recording The information is combined with the automated testing framework Instrumention to send simulated touch/key events to update the interface of the program under test, and the intercepting record in step 102) includes recording the corresponding screen interface. 4.根据权利要求3所述Android设备软件自动测试方法,其特征在于,自动脚本录制步骤包括跨进程录制。 4. according to the described Android device software automatic testing method of claim 3, it is characterized in that, automatic script recording step comprises cross-process recording. 5.根据权利要求1-4任一项所述Android设备软件自动测试方法,其特征在于,所述录制步骤还包括当透明View监听到有结束录制请求后结束录制并通知后台服务RecordService提取录制信息,生成录制脚本。  5. according to any one of claim 1-4 described Android device software automatic testing method, it is characterized in that, described recording step also comprises when transparent View listens to have end recording request to end recording and notify background service RecordService to extract recording information , to generate a recording script. the 6.根据权利要求5所述Android设备软件自动测试方法,其特征在于,该自动测试方法还包括脚本回放步骤:根据录制脚本向被测程序发送与录制脚本对应的一系列模拟触控/按键事件。 6. according to the described Android device software automatic testing method of claim 5, it is characterized in that, this automatic testing method also comprises script playback step: according to recording script, send a series of simulated touch/key events corresponding to recording script to program under test . 7.根据权利要求6所述Android设备软件自动测试方法,其特征在于,所述回放步骤还包括脚本解析和有效性检测子步骤。 7. according to the described Android device software automatic testing method of claim 6, it is characterized in that, described playback step also comprises script parsing and validity detection sub-step. 8.根据权利要求6所述Android设备软件自动测试方法,其特征在于,该自动测试方法还包括结果验证步骤,所述结果验证步骤包括截取被测程序屏幕输出和自动/人工图像比对。 8. according to the described Android device software automatic testing method of claim 6, it is characterized in that, this automatic testing method also comprises result verifying step, and described result verifying step comprises intercepting tested program screen output and automatic/artificial image comparison. 9.根据权利要求6所述Android设备软件自动测试方法,其特征在于,该自动测试方法还包括结果验证步骤,所述结果验证步骤包括记录被测程序数据输出和自动数值比对。  9. Android device software automatic testing method according to claim 6, is characterized in that, this automatic testing method also comprises result verification step, and described result verification step comprises recording tested program data output and automatic value comparison. the
CN201210265962.0A 2012-07-30 2012-07-30 Automatic testing method of Android device software Expired - Fee Related CN102841845B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210265962.0A CN102841845B (en) 2012-07-30 2012-07-30 Automatic testing method of Android device software

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210265962.0A CN102841845B (en) 2012-07-30 2012-07-30 Automatic testing method of Android device software

Publications (2)

Publication Number Publication Date
CN102841845A true CN102841845A (en) 2012-12-26
CN102841845B CN102841845B (en) 2015-02-11

Family

ID=47369235

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210265962.0A Expired - Fee Related CN102841845B (en) 2012-07-30 2012-07-30 Automatic testing method of Android device software

Country Status (1)

Country Link
CN (1) CN102841845B (en)

Cited By (30)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103226445A (en) * 2013-05-10 2013-07-31 广东国笔科技股份有限公司 Handwriting input method, system and terminal
CN103365779A (en) * 2013-07-09 2013-10-23 广东欧珀移动通信有限公司 Software test method and system
CN103928038A (en) * 2014-04-29 2014-07-16 广东欧珀移动通信有限公司 Electronic equipment test recording and playing back method
CN103995718A (en) * 2014-05-08 2014-08-20 百度在线网络技术(北京)有限公司 Method and device for collecting program information
CN104008047A (en) * 2013-02-27 2014-08-27 腾讯科技(深圳)有限公司 Intelligent terminal program testing method and system
WO2014169565A1 (en) * 2013-08-21 2014-10-23 中兴通讯股份有限公司 Terminal testing method and device
CN104239202A (en) * 2013-06-09 2014-12-24 刘伟 Non-Root testing method and system of interactive intelligent equipment
CN104346276A (en) * 2013-08-08 2015-02-11 腾讯科技(深圳)有限公司 Method and device for software tests
CN104407980A (en) * 2014-12-17 2015-03-11 用友软件股份有限公司 Mobile application automated testing device and method
CN104679631A (en) * 2015-03-23 2015-06-03 重庆蓝岸通讯技术有限公司 Testing method and system for equipment based on Android system
CN104699607A (en) * 2015-03-06 2015-06-10 惠州Tcl移动通信有限公司 Automation testing method and system for mobile terminal
CN104866384A (en) * 2014-02-20 2015-08-26 纬创资通股份有限公司 Method and system for rapidly testing and detecting mobile device
CN104899132A (en) * 2014-03-05 2015-09-09 腾讯科技(深圳)有限公司 Application software test method, apparatus and system
TWI510913B (en) * 2013-11-12 2015-12-01 Inst Information Industry Test device and test method thereof
CN105183654A (en) * 2015-09-18 2015-12-23 厦门美图移动科技有限公司 Android automatic testing screen recording mechanism and system disengaged from PC
CN105320595A (en) * 2014-07-31 2016-02-10 腾讯科技(深圳)有限公司 Application test method and device
CN105335283A (en) * 2014-08-01 2016-02-17 阿里巴巴集团控股有限公司 Application testing method and device in terminal equipment
CN105451077A (en) * 2015-12-02 2016-03-30 Tcl集团股份有限公司 Key processing method and system based on module TV
CN105653438A (en) * 2014-11-12 2016-06-08 成都鼎桥通信技术有限公司 Method and device for cross-process automated testing of Android device
WO2016115801A1 (en) * 2015-01-21 2016-07-28 中兴通讯股份有限公司 Method and device for replaying user operation
CN105930265A (en) * 2016-04-11 2016-09-07 武汉卡比特信息有限公司 Image recognition based software test method
WO2017008744A1 (en) * 2015-07-13 2017-01-19 西安中兴新软件有限责任公司 Automation script acquisition method and device, and automation script application method and device
CN106980575A (en) * 2017-04-01 2017-07-25 深圳天珑无线科技有限公司 A kind of event-handling method and device
CN107491386A (en) * 2016-06-13 2017-12-19 富士通株式会社 The method and apparatus for recording test script
CN108182131A (en) * 2017-12-13 2018-06-19 东软集团股份有限公司 Monitor method, apparatus, storage medium and the electronic equipment of application operation state
CN108733555A (en) * 2017-04-25 2018-11-02 中移信息技术有限公司 A kind of application testing method and device
CN109550232A (en) * 2018-11-02 2019-04-02 北京硬壳科技有限公司 Touch control device and its response method, device
CN111143200A (en) * 2019-12-12 2020-05-12 广州华多网络科技有限公司 Method and device for recording and playing back touch event, storage medium and equipment
CN111881054A (en) * 2020-08-04 2020-11-03 携程计算机技术(上海)有限公司 User interface automation test method, system, equipment and storage medium
CN113157186A (en) * 2021-05-20 2021-07-23 读书郎教育科技有限公司 Method and equipment for generating long graphs of operation steps by Android terminal

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6067639A (en) * 1995-11-09 2000-05-23 Microsoft Corporation Method for integrating automated software testing with software development
CN101242621A (en) * 2008-01-21 2008-08-13 中兴通讯股份有限公司 An automatic testing method and system based on interface
CN102314386A (en) * 2011-09-05 2012-01-11 百度在线网络技术(北京)有限公司 Method and equipment for testing mobile terminal
JP2012103869A (en) * 2010-11-09 2012-05-31 Internatl Business Mach Corp <Ibm> Software development support method, software development support device and software development support program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6067639A (en) * 1995-11-09 2000-05-23 Microsoft Corporation Method for integrating automated software testing with software development
CN101242621A (en) * 2008-01-21 2008-08-13 中兴通讯股份有限公司 An automatic testing method and system based on interface
JP2012103869A (en) * 2010-11-09 2012-05-31 Internatl Business Mach Corp <Ibm> Software development support method, software development support device and software development support program
CN102314386A (en) * 2011-09-05 2012-01-11 百度在线网络技术(北京)有限公司 Method and equipment for testing mobile terminal

Cited By (44)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104008047A (en) * 2013-02-27 2014-08-27 腾讯科技(深圳)有限公司 Intelligent terminal program testing method and system
CN103226445A (en) * 2013-05-10 2013-07-31 广东国笔科技股份有限公司 Handwriting input method, system and terminal
CN104239202A (en) * 2013-06-09 2014-12-24 刘伟 Non-Root testing method and system of interactive intelligent equipment
CN103365779A (en) * 2013-07-09 2013-10-23 广东欧珀移动通信有限公司 Software test method and system
CN103365779B (en) * 2013-07-09 2016-11-09 广东欧珀移动通信有限公司 Software Testing Method and System
CN104346276A (en) * 2013-08-08 2015-02-11 腾讯科技(深圳)有限公司 Method and device for software tests
WO2014169565A1 (en) * 2013-08-21 2014-10-23 中兴通讯股份有限公司 Terminal testing method and device
CN104424089A (en) * 2013-08-21 2015-03-18 中兴通讯股份有限公司 Terminal testing method and device
US9317413B2 (en) 2013-11-12 2016-04-19 Institute For Information Industry Testing device and testing method thereof
TWI510913B (en) * 2013-11-12 2015-12-01 Inst Information Industry Test device and test method thereof
CN104866384A (en) * 2014-02-20 2015-08-26 纬创资通股份有限公司 Method and system for rapidly testing and detecting mobile device
TWI510918B (en) * 2014-02-20 2015-12-01 Wistron Corp Method and system for quickly testing and detecting mobile devices
CN104899132A (en) * 2014-03-05 2015-09-09 腾讯科技(深圳)有限公司 Application software test method, apparatus and system
CN104899132B (en) * 2014-03-05 2018-09-25 腾讯科技(深圳)有限公司 Application software testing method, apparatus and system
CN103928038A (en) * 2014-04-29 2014-07-16 广东欧珀移动通信有限公司 Electronic equipment test recording and playing back method
CN103928038B (en) * 2014-04-29 2017-06-30 广东欧珀移动通信有限公司 The test recording of electronic equipment and back method
CN103995718A (en) * 2014-05-08 2014-08-20 百度在线网络技术(北京)有限公司 Method and device for collecting program information
CN103995718B (en) * 2014-05-08 2017-05-10 百度在线网络技术(北京)有限公司 Method and device for collecting program information
CN105320595A (en) * 2014-07-31 2016-02-10 腾讯科技(深圳)有限公司 Application test method and device
CN105335283A (en) * 2014-08-01 2016-02-17 阿里巴巴集团控股有限公司 Application testing method and device in terminal equipment
CN105653438A (en) * 2014-11-12 2016-06-08 成都鼎桥通信技术有限公司 Method and device for cross-process automated testing of Android device
CN105653438B (en) * 2014-11-12 2018-11-09 成都鼎桥通信技术有限公司 The striding course automated testing method and device of Android device
CN104407980B (en) * 2014-12-17 2017-07-11 用友网络科技股份有限公司 Mobile solution automatic test device and method
CN104407980A (en) * 2014-12-17 2015-03-11 用友软件股份有限公司 Mobile application automated testing device and method
WO2016115801A1 (en) * 2015-01-21 2016-07-28 中兴通讯股份有限公司 Method and device for replaying user operation
CN105868083A (en) * 2015-01-21 2016-08-17 中兴通讯股份有限公司 User operation playback method and apparatus
CN104699607A (en) * 2015-03-06 2015-06-10 惠州Tcl移动通信有限公司 Automation testing method and system for mobile terminal
CN104679631A (en) * 2015-03-23 2015-06-03 重庆蓝岸通讯技术有限公司 Testing method and system for equipment based on Android system
CN104679631B (en) * 2015-03-23 2018-02-23 重庆蓝岸通讯技术有限公司 Method of testing and system for the equipment based on android system
WO2017008744A1 (en) * 2015-07-13 2017-01-19 西安中兴新软件有限责任公司 Automation script acquisition method and device, and automation script application method and device
CN105183654A (en) * 2015-09-18 2015-12-23 厦门美图移动科技有限公司 Android automatic testing screen recording mechanism and system disengaged from PC
CN105451077A (en) * 2015-12-02 2016-03-30 Tcl集团股份有限公司 Key processing method and system based on module TV
CN105451077B (en) * 2015-12-02 2019-01-29 Tcl集团股份有限公司 A kind of button processing method and system based on module TV
CN105930265A (en) * 2016-04-11 2016-09-07 武汉卡比特信息有限公司 Image recognition based software test method
CN107491386A (en) * 2016-06-13 2017-12-19 富士通株式会社 The method and apparatus for recording test script
CN106980575A (en) * 2017-04-01 2017-07-25 深圳天珑无线科技有限公司 A kind of event-handling method and device
CN108733555A (en) * 2017-04-25 2018-11-02 中移信息技术有限公司 A kind of application testing method and device
CN108182131A (en) * 2017-12-13 2018-06-19 东软集团股份有限公司 Monitor method, apparatus, storage medium and the electronic equipment of application operation state
CN108182131B (en) * 2017-12-13 2021-11-26 东软集团股份有限公司 Method and device for monitoring application running state, storage medium and electronic equipment
CN109550232A (en) * 2018-11-02 2019-04-02 北京硬壳科技有限公司 Touch control device and its response method, device
CN111143200A (en) * 2019-12-12 2020-05-12 广州华多网络科技有限公司 Method and device for recording and playing back touch event, storage medium and equipment
CN111881054A (en) * 2020-08-04 2020-11-03 携程计算机技术(上海)有限公司 User interface automation test method, system, equipment and storage medium
CN111881054B (en) * 2020-08-04 2023-12-22 携程计算机技术(上海)有限公司 User interface automatic test method, system, equipment and storage medium
CN113157186A (en) * 2021-05-20 2021-07-23 读书郎教育科技有限公司 Method and equipment for generating long graphs of operation steps by Android terminal

Also Published As

Publication number Publication date
CN102841845B (en) 2015-02-11

Similar Documents

Publication Publication Date Title
CN102841845B (en) Automatic testing method of Android device software
CN109960642B (en) Automatic test method and device
CN103365779B (en) Software Testing Method and System
US8645912B2 (en) System and method for use in replaying software application events
US8732529B2 (en) Mobile communication terminal capable of testing application and method thereof
CN103338290B (en) A kind of method of automatic test Android phone touch screen performance
CN102521118B (en) Automatic testing method of Android program
US20140258989A1 (en) Method and system for automating a scene-based test
US8402431B2 (en) System and method for communicating with a microcontroller
CN107135390A (en) Automatic testing method and system for television application
CN104331373A (en) Monkey test system and method
CN105740144B (en) A kind of automated testing method and system of Android mobile terminal
TWI653528B (en) Computer system and detection method
CN201392526Y (en) On-board test system for mobile applications
TW201518933A (en) Test device and test method thereof
CN104424094A (en) Method and device for obtaining abnormal information and intelligent terminal device
US20130138381A1 (en) Handheld electronic device testing method
US9372770B2 (en) Hardware platform validation
Wang et al. Automatic Android GUI traversal with high coverage
CN103729294A (en) Method and device for testing performance script of application software
CN113268416A (en) Application program testing method and device, storage medium and terminal
CN101030160B (en) Tester and method for testing unified series interface command
CN115494335A (en) Wearable device function testing method and device, computer device and storage medium
CN113568833A (en) Test case determination method, apparatus, computer equipment and readable storage medium
CN108984380A (en) A kind of server test method, device and medium based on linux system

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
CP01 Change in the name or title of a patent holder

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

CP01 Change in the name or title of a patent holder
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150211

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