Androidã®èªåãã¹ããã¼ã«ãä»(2013å¹´)ãã使ããªãä½ãããã®ã
ãããã
Androidã®ãã¹ããèªååãããã®ã§ããã¹ããã¼ã«ã®é¸å®ããã¦ã¿ãããæã®è¨äºããããããäºãå¤ããä½ã使ãã°ããã®ãããããããã
ã¨ã¯ãã£ã¦ããæ確ã«ãã©ããªãã¹ããããããã¨ããæ¹éããªããã¨ã£ãããã¨ãã¦ã©ããªãã¼ã«ããã£ã¦ã©ã®ãããçãä¸ãã£ã¦ãã®ããç¥ãããã£ãã
ç°å¢
- Windows 7
- AndroidDeveloperTools Build: v21.1.0-569685
ã¨ãããã Win ã¡ã¤ã³ã§ã
ã¨ã£ããã
ãã¸ãã¯ã¾ããã®ãã¹ã
ãã¸ãã¯çãªãã®ã¯ã JUnit æ¡å¼µã® TestCase ã¯ã©ã¹ã使ãã°ä½ã¨ãæ¸ãããã¨ããã®ã¯ããã£ãã
2011 å¹´ã®è¨äºã ãã©ã JUnit ã§æ¸ãã¨ãã大åæã¯å´©ãã¦ããªãã¯ãâ¦ã
ç»é¢é·ç§»ãGUIã¾ããã®ãã¹ã
å°ã£ãã®ã¯ãã£ã¡ãã©ãæ¸ãã°ãããã ããã
ãAndroid èªåãã¹ã ãã¼ã«ã ã¨ãã§èª¿ã¹ã¦ã¿ãçµæã以ä¸ã®ãããªè¨äºãå¼ã£æãã£ãã
ããã 2011 å¹´ã®è¨äºã ãããã®ä¸ã§ã¯ NativeDriver
, robotium
, Scirocco
ã® 3 ãã¼ã«ã§ã¯æçµçã« NativeDriver
ã«éç´ããã¦ããã ããã¨ããçµè«ã«ãªã£ã¦ããã
â¦ãã 2013 å¹´ç¾å¨ã«ããã¦ãæ¬å½ã«ãããªã®ãï¼
çµè«
2013 å¹´ 08 æã®æç¹ã§ã¯ãããªæãã
ãã¼ã« | ã½ã¼ã¹ | Android | iOS | ãã¹ãè¨è¿°å¯è½ãªè¨èª | åè |
---|---|---|---|---|---|
NativeDriver | svn | - | - | - | éçºçµäº |
robotium | GitHub | 1.6 ä»¥ä¸ | Java |
||
Scirocco | GitHub | - | - | - | 2012/09 ã§æ´æ°ãæ¢ã¾ã£ã¦ãã |
Monkeyrunner | sdkå | â |
Java Python |
Jython ã§å®è¡ / Plugin 㯠Java ã§æ¸ãã / ä»åã¯ãã¾ãåãããªãã£ã | |
Appium | GitHub | 4.2 ä»¥ä¸ | â |
Node.js Python PHP Ruby Java |
Windows ç㯠beta / iOS ãã¡ã¤ã³ï¼ ãã¡ã¤ã«ç½®å ´ |
Spoon | GitHub | 4.1 ä»¥ä¸ | Java |
Maven å®è¡æ¨å¥¨ï¼ | |
Selenroid | GitHub | â |
Java |
Windows çã¯ç¾ç¶æªãµãã¼ã / Ruby ã§ããã¹ãæ¸ããï¼ | |
uiautomator | sdkå | 4.1 ä»¥ä¸ | Java |
ä»åã¯ãã¾ãåãããªãã£ã |
Android / iOS æ¬ã® â
ã¯å
¬å¼ã§åãã¨è¬³ã£ã¦ãããã詳ãããã¼ã¸ã§ã³ã¾ã§è¦ã¤ããããªãã£ããã®ã«è¨å
¥ã
- ä»ã§ãããæ¤ç´¢ã«å¼ã£ããã
NativeDriver
ã¯ã¨ã£ãã«éçºçµäºããã¦ãã - æ°é( 2013 ã)ãã¼ã«ã¯ä¾¿å©ãªæ©è½ãå¤ãå°è±¡ã ãã Windows ã«æªãµãã¼ãã®ãã®ãå¤ã(ãã°è¸ãã§ãæ³£ããªã)
- Windows 使ããªã
robotium
ãããã«è¡ãã®ãè¯ãï¼
以ä¸ãã²ã¨ã¤ãã¤è¦ã¦ã¿ãã
ãã¹ããã¼ã«
NativeDriver - éçºçµäº
å ¬å¼ nativedriver - Native application GUI automation with extended WebDriver API - Google Project Hostingã³ããããã°æ¥ä» 2011-04-25 - 2011-08-08- 2012å¹´ Googleã®ã¹ããã¢ããªèªåãã¹ããã¼ã«NativeDriveräºå§ãï¼ããã£ãã¨ãã - Vermee81ã®æ¥é²
- 2012å¹´ Androidã®ãã¹ããã¼ã«Nativedriverã使ã£ã¦ã¿ã - yyhayashi303âs diary
Selenium WebDriver ã®æºæµã«ãªã£ã¦ãã WebDriver (Google謹製 / 2009å¹´) ã®æµããããã§ããããã¤Android, iOS対å¿ã¨ããç¾å¨ã®ä¸»æµãªã®ãã¨æã£ããã2011å¹´ã§æ´æ°ãæ¢ã¾ã£ã¦ããï¼
â NativeDriver
ã¯ãã§ã« éçºçµäº ãã¦ãããä¸é¨ Selenium 2(WebDriver çµ±å)ã«éå
ããã¦å¤©ã«å¬ããã模æ§ã
ä¸è¨ã®ãã©ã¼ã©ã ã§ã NativeDriver
ã¦ã¼ã¶ã¯ã©ãããã°ãããä»å¾ã®æ¹éãè¿°ã¹ããã¦ããã
Android Instrumentation
ã®ãããªå ¬å¼ãã¼ã«ã使ãrobotium
ã®ãããªãµã¼ããã¼ãã£ãã¼ã«ã使ã- (
NativeDriver
ãå¼ãç¶ã使ããªã)èªåèªèº«ã§ Hack ããããè¯ããã¦ã¿ã
ã¨ãããã¨ããããã¨ããããã§ã2013å¹´ã®æç¹ã§ã¯åè£ããé¤å¤ããæ¹ããããã
(ã¯ã¼ãã«ãããã) ã°ã°ãã¨é«ç¢ºçã§ãããä¸ä½ã«ããã£ã¦ããã®ã§ãããªããªä½¿ããã¦ããã®ãã¨æã£ãããæ£å¼ã«åçµã声æããè¨è¿°ãè¦ã¤ãã£ãã®ã§å®å¿ã
robotium
- å
¬å¼ robotium - The worldâs leading Android? test automation framework - Google Project Hosting
- ã³ããããã°æ¥ä» 2009-12-10 - 2013-08-25
- 2013å¹´ androidã§robotiumã使ã£ã¦ç»é¢é·ç§»ããã¹ããã â« tech-tec
- 2012å¹´ Robotiumã触ã£ã¦ã¿ã(Androidèªåãã¹ããã¼ã«) - ãã®ã£ãµã(knnfm)
- 2010å¹´ Robotiumã§Androidã¢ããªã®ã·ããªãªãã¹ããèªååãã - é¥ãã¸ã®ã¹ãã¼ãã©ã³ãã¼
ãã®ä¸ã§ã¯ä¸çªããã¸ã§ã¯ãã®æ´å²ãå¤ãã2013å¹´ã«å ¥ã£ã¦ãç²¾åçã«ã³ããããªããã¦ããã
This project is neither affiliated with Google nor with OpenQA (Selenium).
ãGoogle ããã¸ã§ã¯ãã§ã Selenium ããã¸ã§ã¯ãã§ããªããã¨ããäºã§ãéå ¬å¼ Selenium çãªæãã®æ§åã
- Android 1.6 以ä¸ããµãã¼ã
- apk ãã¡ã¤ã«ã®ã¿ã§ããã¹ãå¯
- ããªã¤ã³ã¹ãã¼ã«ããã端æ«ã§ããã¹ãå¯
- ãã¤ããªããã¢ããªããã¹ãå¯è½(
robotium
4.0 ãã)
ããã¯ã¡ãã£ã¨ Hello World ãã¦ã¿ããã
åæºå
å
¬å¼ãã¼ã¸ãã Jar File ããã¦ã³ãã¼ããç¾å¨ã®ææ°ç㯠robotium-solo-4.2.jar
ããã TESTPROJECT/libs/
ã«å
¥ããã libs ãã£ã¬ã¯ããªã«å
¥ããã¨ã Eclipse ã® Package Explorer ã§è¦ãã¨ãã« Android Dependencies
ä¸ã« robotium
ã® jar ãè¦ããã¯ãã
è¦ããªããã°ããããã£ãã追å ã testing - Android Robotium NoClassDefFoundError - Stack Overflow
ã·ããªãªä½æ
åºæ¬çã«ã¯ JUnit ã®ãã¹ãã±ã¼ã¹ä½æã¨åãè¦é ã§é²ãã
é©å½ãªãã°ã¤ã³ç»é¢ã®ãã°ã¤ã³ãã¿ã³æ¼ãã¦ãæ»ãã ãã®ãã¹ãã±ã¼ã¹ LoginActivityTest.java
// robotium ã¤ã³ãã¼ã
import com.jayway.android.robotium.solo.Solo;
(ç¥)
// æ¢åã®JUnitãã¹ãã¯ã©ã¹
public class LoginActivityTest
extends ActivityInstrumentationTestCase2<LoginActivity> {
(ç¥)
// ã« robotium ã使ã£ããã¹ãã追å
public void testMove() throws Exception {
Solo solo = new Solo(getInstrumentation(), getActivity());
// 座æ¨æå®ãã¦ã¯ãªãã¯
solo.clickOnScreen(200, 600);
// ç»é¢ããå¼æ°ã«æå®ããããã¹ããè¦ã¤ãã¦ï¼ã¯ãªãã¯
solo.clickOnText("Hoge");
// ãã°ã¤ã³ã¨æ¸ããããã¿ã³ãè¦ã¤ãã¦ã¯ãªãã¯
solo.clickOnButton("ãã°ã¤ã³");
solo.assertCurrentActivity("次ã®ç»é¢ã¸", MainActivity.class);
// "/sdcard/Robotium-Screenshots/" ã«ã¹ã¯ãªã¼ã³ã·ã§ããä¿å
solo.takeScreenshot();
// ã¢ã¯ãã£ããã£æ»ã
solo.goBack();
solo.assertCurrentActivity("æ»ã£ã¦ãã", LoginActivity.class);
}
(ç¥)
solo.clickOnButton("ãã°ã¤ã³")
ã§ãã¿ã³ãä¸æ°ã«æ¼ãã¦ãããã®ãé常ã«ä¾¿å©ã«æããã
(ãã¿ã³ã®åå¾ã®ä»æ¹ã¨ãã¯ãä»ã®ã¨ãã findViewById ã§ã¨ã£ã¦ãã Button button = (Button) activity.findViewById(com.example.testapp.R.id.login_button)
æ¹æ³ãããããªãã®ã§)
ã¾ããã¹ã¯ãªã¼ã³ã·ã§ããæ©è½ãªã©ãå®è£ ããã¦ãããã¡ã½ãããå¼ã³åºãã ãã§SDã«ã¼ãã«å ¥ãã¦ãããï¼ä¾¿å©ï¼
Scirocco - ç¾Scirocco for WebDriver
å ¬å¼ scirocco - A UI Test Automation Tool for Android - Google Project Hostingã³ããããã°æ¥ä» 2011-05-14 - 2011-12-06
- å
¬å¼ Open Source Libraryï½Sonix / Scirocco
- ã³ããããã°æ¥ä» 2012-07-31 - 2012-09-27
- 2012å¹´ Scirocco éçºã¡ã¢ï½Android Wiki for Developers
- 2012å¹´ sciroccoã触ã£ã¦ã¿ãã(Androidèªåãã¹ããã¼ã«) - ãã®ã£ãµã(knnfm)
- 2011å¹´ Androidã®UIèªåãã¹ããã¼ã« Scirocco 触ã£ã¦ã¿ãã - ããããããããã°ã©ã ä½ããï¼
â» Google Project Hosting ç㯠Development Discontinued ã¨ããã¦ãããä»ã¯ã½ããã¯ã¹ã管çãã¦ããã¿ãããã¾ããæ§ç㯠Scirocco
, ã½ããã¯ã¹ç㯠Scirocco WebDriver
ã¨ãªã£ã¦ããã¢ã¼ããã¯ãã£ãå¤ãã£ã¦ãããããã
robotium
, scirocco plug-in
, scirocco TestManagementSystem
ããæãç«ã¤ãã¹ããã¼ã«ã
åºæ¬çã«ã¯ robotium
ã«æ©è½ããã©ã¹ããããã¼ã«ãªãã ããããã¹ãã®ã¬ãã¼ããã¹ã¯ãªã¼ã³ã·ã§ãããã¨ãã模æ§ã(åè¿°ã®ã¨ããã ã¹ã¯ãªã¼ã³ã·ã§ãã㯠robotium
ã§ã(ä»ã¯ï¼)ã§ããæ§å)
ãã©ã robotium
ãççã«æ´æ°ããã¦ããä¸æ¹ã§ããã£ã¡ã¯æ´æ°ãæ¢ã¾ã£ã¦ãã(é
ãã¦ããï¼)ãããªã®ã§ã Scirocco
ã¯æ·±è¿½ãããããã§çµããã
MonkeyRunner
- AndroidSDKã«å梱ããã¦ãã (
SDK_ROOT\sdk\tools\monkeyrunner.bat
)- 2012å¹´ ããæ°ã¶æãMonkeyRunnerãä»äºã§ä½¿ã£ã¦ã¿ã¦æã£ãã㨠- è¦ç¿ãããã°ã©ãã¼ã®ä¿®è¡æ¥è¨
- 2012å¹´ ãªããMonkeyRunnerï¼ãã®1ï¼ - ReDo
- 2011å¹´ Androiod端æ«ã®ãã¹ããã¼ã«ãmonkeyrunnerã-åºæ¬-
- 2011å¹´ monkeyrunnerèªååè¨ç»(1): 16åã®11æå
- 2010å¹´ Y.A.M ã® éè¨å¸³: Androidãmonkeyrunner ã訳ãã¦è©¦ãã¦ã¿ãã
ããã ãä»ã®ãã¼ã«ã¨ã¡ãã£ã¨æ¯è²ãéãæããããã
Pythonã§æ¸ãããç»é¢ã®ãã¿ã³é¸æãªã©ã¯ 座æ¨æå® ã(座æ¨ã調ã¹ãäºèªä½ãããã©ãããè¤æ°ç«¯æ«ããã¨ç«¯æ«åã¹ã¯ãªããä½ããªãããããªãï¼)
ç»é¢ã®ãããããªã¨ããããã¿ããã«ã½ã¡ã½ã¡ãããã¹ããã§ããã
ã¡ãã£ã¨ä½¿ã£ã¦ã¿ãããâ¦ã¨æã£ããã©ãªãããã¡ã ã£ãã
åæºå
ã¾ãã SDK_ROOT\sdk\tools\monkeyrunner.bat
ãå®è¡ãã¦ã¿ãã Jython ã§å®è¡ãããããªã®ã§ Java (ã¯å
¥ã£ã¦ããã¨æãã) 㨠Python ãå¿
è¦ï¼
$ monkeyrunner.bat
Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_17
>>>
ã·ããªãªä½æ
ä¸è¨ã® Simple monkeyrunner Program ããã®ã¾ã¾æµãè¾¼ãã§ã¿ããã¨æã£ããã ãã©ã2è¡ç®ã§ã¨ã©ã¼â¦ã
$ monkeyrunner.bat
Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_17
>>> from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
>>> device = MonkeyRunner.waitForConnection()
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] Adb rejected adb port forwarding command: cannot bind socket
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.AdbCommandRejectedException: cannot bind socket
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.AdbHelper.createForward(AdbHelper.java:545)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.Device.createForward(Device.java:481)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.chimpchat.adb.AdbChimpDevice.createManager(AdbChimpDevice.java:126)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.chimpchat.adb.AdbChimpDevice.<init>(AdbChimpDevice.java:72)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.chimpchat.adb.AdbBackend.waitForConnection(AdbBackend.java:122)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.chimpchat.ChimpChat.waitForConnection(ChimpChat.java:91)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.monkeyrunner.MonkeyRunner.waitForConnection(MonkeyRunner.java:75)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.lang.reflect.Method.invoke(Method.java:601)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyObject.__call__(PyObject.java:381)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyObject.__call__(PyObject.java:385)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.pycode._pyx2.f$0(<stdin>:1)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.pycode._pyx2.call_function(<stdin>)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyCode.call(PyCode.java:18)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.Py.runCode(Py.java:1197)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.Py.exec(Py.java:1241)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:147)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:89)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:70)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:46)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.util.InteractiveConsole.push(InteractiveConsole.java:110)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:90)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:60)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.monkeyrunner.ScriptRunner.console(ScriptRunner.java:193)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:73)
130828 20:34:40.534:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
at com.android.chimpchat.adb.AdbChimpDevice.<init>(AdbChimpDevice.java:74)
at com.android.chimpchat.adb.AdbBackend.waitForConnection(AdbBackend.java:122)
at com.android.chimpchat.ChimpChat.waitForConnection(ChimpChat.java:91)
at com.android.monkeyrunner.MonkeyRunner.waitForConnection(MonkeyRunner.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
java.lang.NullPointerException: java.lang.NullPointerException
adb kill-server
ãã¦ã¿ã¦ã¯ï¼ã¨ããè¨äºã¯è¦ã¤ãããã©ç¹ã«å¤ãããâ¦ã
Appium
- å
¬å¼ Appium: Mobile App Automation Made Awesome.
- ã³ããããã°æ¥ä» 2013-06-03 - 2013-08-07
- ãã¡ã¤ã«ç½®å ´ https://bitbucket.org/appium/appium.app/downloads
- 2013å¹´ Appiumã使ã£ã¦ã¹ãã¼ããã©ã³ã¢ããªã®ãã¹ããèªååãã - Pythonç·¨ - Qiita [ãã¼ã¿]
- 2013å¹´ Android - Appiumã使ã£ã¦ã¹ãã¼ããã©ã³ã¢ããªã®ãã¹ããèªååãã - æ¦è¦ç·¨ - Qiita [ãã¼ã¿]
- 2013å¹´ Appiumã§iOSãèªåã§åãå ¥ããã¹ã Rspecã§ãã¹ãã§ãããï¼ - ã³ã³ã¦ã¦ã¡ã¢
Selenium ã©ã¤ã¯ã§ iOS, Android ä¸¡æ¹ ã®ãã¹ããä½æã§ããã
ã¾ããã¹ãã³ã¼ã㯠Node.js, Python, PHP, Ruby, Java ãªã©ã§æ¸ããããã ã
ãã ãã以ä¸ã®ãããªä¾åãããã
Requirements
General:
- Mac OS X 10.7 or higher, 10.8 recommended (Linux OK for Android-only; support for Windows is in âbetaâ)
- Node and npm (brew install node) (Node must be >= v0.8)
For iOS automation:
For Android automation:
ä»ã®ã¨ãã Windows 㯠beta ç ã®ãããªã®ã§ãä»åã¯è©¦ç¨è¦éããã㨠Android API 17 以ä¸(= 4.2以ä¸) ã¨ããã®ãæå¤ã¨ãã¼ãã«ãé«ãã
iOSãã¡ã¤ã³ã§ãAndroidããã¹ãã§ãã¾ãããçãªæããªã®ããã
Spoon
- å
¬å¼ Spoon
- ã³ããããã°æ¥ä» 2012-07-10 - 2013-07-08
- 2013å¹´ Androidã®å®æ©ãã¹ããç°¡åã«ãããSpoonãã使ã£ã¦ã¿ã-Sampleç·¨- - hentekoã®devæ¥è¨
Android 4.1 以ä¸å¿ é ãå®è¡ã« maven æ¨å¥¨ã
æ¥æ¬èªã®æ å ±ã¯å°ãªãã
Selendroid
- å
¬å¼ Selendroid
- ã³ããããã°æ¥ä» 2013-01-07 - 2013-08-22
- 2013å¹´ SelendroidãAndroidèªåãã¹ããã¼ã«ã®ãã¹ã±ã¼ã©ããªãã£ã¼ - ã¤ãã¥ããªãã¾ã¾ã«ã
- 2013å¹´ Android ã®ãèªåãã¹ããã¼ã« - ã¤ãã¥ããªãã¾ã¾ã«ã
Selenium for Android Apps ã¨ããäºã§ Android ãã¤ãã£ãã¢ããªã Web ãã¥ã¼ã®ãã¹ãã Selenium ã§æ¸ããï¼
Mac ã Linux ã§åä½ç¢ºèªã Windows ç㯠not offially supported ã§ããã¤ãåé¡ããã
æ¥æ¬èªã®æ å ±ã¯å°ãªãã
uiautomator
ã¯ã¦ãã³ã¡ã³ãã Twiter ã«ã¦è¨åããã ããã®ã§èª¿æ»ãæãã¦ããã®ã¯ãåç´ã«ç¥ããªãã£ãããã§ãâ¦ã
- AndroidSDKã«å梱ããã¦ãã (
SDK_ROOT\sdk\tools\uiautomatorviewer.bat
)- 2013å¹´ 2.11. ãã¹ã ã» mixi-inc/AndroidTraining Wiki ã» GitHub
- 2012å¹´ uiautomatorã試ãã¦ã¿ã #android_tec - ãããªã¤ã«ï¼
- 2012å¹´ [Android] ã¯ããã¦ã®uiautomator - adakoda
- 2012å¹´ Android APIã¬ãã«17ãã使ããããªãUI Automator Testã«ã¤ãã¦èª¿ã¹ã¦ã¿ã(ãã®ï¼) - Hack the World!
Monkeyrunner
ã¨åãå ´æã«å
¥ã£ã¦ããã
- AndroidSDK 21 ã§ãµãã¼ãããã
- Android 4.1 以éã§åä½ï¼(ãµãã¼ãããã¦ããã®ã 4.1 以éï¼)
- ããã¯
adb shell
ãããããæãã®ãã¼ã«ã¿ãã
ã¡ãã£ã¨ããã£ã¦ã¿ããã¨æã£ããããããããªãè¦æ¦ãããæå¥åãããªãã¨ããã
AndroidSDK ã«å梱ããã¦ãããã¼ã«ã¯ä¸çç¸ã§åããªããªãã
åæºå
- ãã¹ãç¨ããã¸ã§ã¯ãå³ã¯ãªãã¯ãã
Properties -> Java Build Path -> Add External JARs
ããSDK_ROOT\sdk\platforms\android-17\uiautomator.jar
ã追å ãã - ãã¹ãã¯ã©ã¹ã
UIAutomatorTestCase
㧠extend ãã
ã·ããªãªä½æ
UIxxx ã¯ã©ã¹ã§ç«¯æ«ãæä½ãã¦ãããä¸è¨ã®ãµã¤ããåèã«â¦ã
public class LoginActivityUITest extends UiAutomatorTestCase {
public void testHelloWorld() throws Exception {
getUiDevice().pressHome();
UiObject allAppsButton = new UiObject(new UiSelector().description("ã¢ããª"));
allAppsButton.clickAndWaitForNewWindow();
UiObject appsTab = new UiObject(new UiSelector().text("ã¢ããª"));
appsTab.click();
}
}
å®è¡
ãã JUnit å®è¡ããã°ããã£ã¦ãããããªãããããçµæ§ããã©ãã
ãã«ããã
SDK_ROOT\sdk\tools\
ä¸ã«ãã android.bat
ã使ã£ã¦ãã«ãã
$ android.bat create uitest-project -n hoge -t x -p .
ããããã®å¼æ°ã¯ããã
Options:
-p --path : The new project's directory. [required]
-n --name : Project name.
-t --target : Target ID of the new project. [required]
--target
㯠android.bat list
ã³ãã³ãã§åå¾ã§ããã(ãã£ã¨ API ã¬ãã«ã®ãã¨ã ã¨æã£ã¦ 17 ã¨ãæå®ãã¦ããã Error: Target id is not valid. Use 'android.bat list targets' to get the target ids.
ã¨ã©ã¼ã§æ»ãã§ã)
$ android list
Available Android targets:
----------
(ç¥)
----------
id: 6 or "android-17"
Name: Android 4.2.2
Type: Platform
API level: 17
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
ABIs : armeabi-v7a
Available Android Virtual Devices:
Name: test
Path: C:\USER_PROFILE\.android\avd\test.avd
Target: Android 3.2 (API level 13)
ABI: armeabi
Skin: 480x854
Snapshot: true
å®è¡ãã㨠build.xml
ãã§ããã
$ android.bat create uitest-project -n hoge -t 6 -p C:\hoge
Added file C:\hoge\build.xml
ant build
ã㦠bin
ä¸ã«ã§ãã jar ãã¡ã¤ã«ãååãã
$ C:\apache-ant-1.9.2\bin\ant build
Buildfile: C:\hoge\build.xml
-check-env:
[checkenv] Android SDK Tools Revision 21.1.0
[checkenv] Installed at SDK_ROOT\sdk
-build-setup:
[echo] Resolving Build Target for hoge...
[getuitarget] Project Target: Android 4.2.2
[getuitarget] API level: 17
[echo] ----------
[echo] Creating output directories if needed...
-pre-compile:
compile:
-post-compile:
-dex:
[dex] input: C:\hoge\bin\classes
[dex] Converting compiled files and external libraries into C:\hoge\bin\classes.dex...
-post-dex:
-jar:
[jar] Building jar: C:\hoge\bin\hoge.jar
-post-jar:
build:
BUILD SUCCESSFUL
Total time: 4 seconds
転éãã¦ãã¹ãå®è¡
次㯠adb
ã³ãã³ã㧠ä»ä½ã£ã jar ãã¡ã¤ã«ã端æ«ã«è»¢éããã
$ pwd
SDK_ROOT\sdk\platform-tools
$ adb.exe push C:\hoge\hoge.jar /data/local/tmp
463 KB/s (4271 bytes in 0.009s)
ããã¦å®è¡â¦ã ãã© permission denied ï¼ï¼
$ adb.exe shell uiautomator runtest hoge.jar -c com.example.test
uiautomator: permission denied
権éã¨ãããç¹ã«ééã£ã¦ãªãã¿ãããªãã ãã©â¦ã
$ ls -l /data/local/tmp/*.jar
ls -l /data/local/tmp/*.jar
-rw-rw-rw- shell shell 4271 2013-09-02 20:58 hoge.jar
ã¨ãããããç¨æãç¸å½ããã©ãããã¨ãããã¨ã¯ããã£ãã
ãããè£ã£ã¦ä½ããã API ãæä¾ããã¦ããã®ã ãããâ¦ã
ãã¾ã
Android API ã¬ãã«ã¨OSã¨ãªãªã¼ã¹æ¥ã®å¯¾å¿ã®ã¡ã¢ãè£ãã¨ãã®ãããã©ãã®ã§ãã¾ããªã®ã§ã Wikipedia æ
å ±ãå
¨é¢çã«ä¿¡é ¼ããã
OS | API ã¬ãã« | ã³ã¼ããã¼ã | ãªãªã¼ã¹ |
---|---|---|---|
Android 4.3 | 18 | JellyBean | 2013/07/24 |
Android 4.2 | 17 | JellyBean | 2012/11/13 |
Android 4.1 | 16 | JellyBean | 2012/06/27 |
Android 4.0.3 - 4.0.4 | 15 | IceCreamSandwich | 2012/03/28(4.0.4) |
Android 4.0 - 4.0.2 | 14 | IceCreamSandwich | 2011/10/18 |
Android 3.2 | 13 | Honeycomb | 2011/07/15 |
Android 3.1 | 12 | Honeycomb | 2011/05/10 |
Android 3.0 | 11 | Honeycomb | 2011/02/22 |
Android 2.3.3 - 2.3.7 | 10 | Gingerbread | 2011/09/20(2.3.7) |
Android 2.3 - 2.3.2 | 9 | Gingerbread | 2010/12/06(2.3) |
Android 2.2 | 8 | Froyo | 2010/05/21 |
Android 2.1 | 7 | Eclair | 2010/01/12 |
Android 2.0.1 | 6 | Eclair | 2009/12/03 |
Android 2.0 | 5 | Eclair | 2009/10/26 |
Android 1.6 | 4 | Donut | 2009/09/15 |
Android 1.5 | 3 | Cupcake | 2009/04/30 |
Android 1.1 | 2 | - | 2009/02/09 |
Android 1.0 | 1 | - | 2008/09/23 |