読者です 読者をやめる 読者になる 読者になる

つれづれなるままに。

webテストの自動化について備忘録のつもりで書いています

Selendroid 0.5.1 にバージョンアップ

細かくバージョンアップしていました。

実行をざっくりしているのでどこが回収されたのか全く確認できないのですが。。。

$ java -jar selendroid-standalone-0.5.1-with-dependencies.jar -app jp.co.yahoo.android.yfiler-1.apk
2013/09/07 22:46:10 io.selendroid.SelendroidLauncher main
???: ################# Selendroid #################
2013/09/07 22:46:11 io.selendroid.SelendroidLauncher lauchServer
???: Starting selendroid-server port 5555
2013/09/07 22:46:11 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt remove /Users/Dolias/Devroom/selendroid_test/jp.co.yahoo.android.yfiler-1.apk META-INF/MANIFEST.MF
2013/09/07 22:46:11 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt remove /Users/Dolias/Devroom/selendroid_test/jp.co.yahoo.android.yfiler-1.apk META-INF/CERT.RSA
2013/09/07 22:46:11 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt remove /Users/Dolias/Devroom/selendroid_test/jp.co.yahoo.android.yfiler-1.apk META-INF/CERT.SF
2013/09/07 22:46:11 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt remove /Users/Dolias/Devroom/selendroid_test/jp.co.yahoo.android.yfiler-1.apk META-INF/ANDROIDD.SF
2013/09/07 22:46:11 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt remove /Users/Dolias/Devroom/selendroid_test/jp.co.yahoo.android.yfiler-1.apk META-INF/ANDROIDD.RSA
2013/09/07 22:46:11 io.selendroid.io.ShellCommand exec
???: executing command: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/jarsigner -sigalg MD5withRSA -digestalg SHA1 -signedjar /Users/Dolias/Devroom/selendroid_test/resigned-jp.co.yahoo.android.yfiler-1.apk -storepass android -keystore /Users/Dolias/.android/debug.keystore /Users/Dolias/Devroom/selendroid_test/jp.co.yahoo.android.yfiler-1.apk androiddebugkey
2013/09/07 22:46:13 io.selendroid.builder.SelendroidServerBuilder signTestServer
???: App signing output: 
2013/09/07 22:46:13 io.selendroid.builder.SelendroidServerBuilder signTestServer
???: The app has been signed: /Users/Dolias/Devroom/selendroid_test/resigned-jp.co.yahoo.android.yfiler-1.apk
2013/09/07 22:46:13 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt dump badging /Users/Dolias/Devroom/selendroid_test/resigned-jp.co.yahoo.android.yfiler-1.apk
2013/09/07 22:46:13 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt dump badging /Users/Dolias/Devroom/selendroid_test/resigned-jp.co.yahoo.android.yfiler-1.apk
2013/09/07 22:46:13 io.selendroid.server.model.SelendroidStandaloneDriver initApplicationsUnderTest
???: App jp.co.yahoo.android.yfiler:1.0.6 has been added to selendroid standalone server.
2013/09/07 22:46:13 io.selendroid.android.impl.DefaultDeviceManager initializeAdbConnection
???: has initial list: false
2013/09/07 22:46:13 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/tools/android list avds
2013/09/07 22:46:13 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/tools/android list avds
Adding: HardwareDevice [serial=015d24bc784c1214, model=Nexus 7, targetVersion=ANDROID18]
2013/09/07 22:46:16 io.selendroid.server.model.DeviceStore addEmulators
???: Adding: AndroidEmulator [screenSize=800x1280, targetPlatform=ANDROID17, avdName=Nexus7]
2013/09/07 22:46:16 io.selendroid.server.SelendroidStandaloneServer start
???: selendroid-standalone server has been started on port: 5555

ここまで サーバ起動です。この状態でテストスクリプトを実行します。

require 'rubygems'
require "test/unit"
require 'selenium-webdriver'
require 'json'

class ExampleTest < Test::Unit::TestCase

  def setup
    caps = Selenium::WebDriver::Remote::Capabilities.android
    caps.version = "5"
        caps.platform  = "Nexus7",
    caps.proxy = nil
    caps[:aut]="jp.co.yahoo.android.yfiler:1.0.6"
    caps[:maxInstances]="1"

    client = Selenium::WebDriver::Remote::Http::Default.new
    client.timeout = 120 # seconds

    @driver = Selenium::WebDriver.for(
    :remote, :http_client => client,
    :url => "http://localhost:5555/wd/hub",
    :desired_capabilities => caps)
  end

  def test_size
    assert_equal('abc'.size, 3)
  end

  def teardown
    @driver.quit
  end
end

今回は実機接続は nexs7 です。
が、接続している端末の指定はcapabilitiesでの記述がちょっとラフになってます。
実際に適用される項目の調査もしたのですがそれはまた別途。

しかも、テストを行っていない等適当さ加減・・・・。

2013/09/07 22:46:59 io.selendroid.server.handler.CreateSessionHandler handle
???: new session command with capabilities: {"desiredCapabilities": {
  "aut": "jp.co.yahoo.android.yfiler:1.0.6",
  "browserName": "android",
  "cssSelectorsEnabled": false,
  "javascriptEnabled": false,
  "maxInstances": "1",
  "nativeEvents": false,
  "platform": "[\"NEXUS7\", NIL]",
  "rotatable": true,
  "takesScreenshot": true,
  "version": "5"
}}
2013/09/07 22:46:59 io.selendroid.builder.SelendroidServerBuilder createSelendroidServer
???: create SelendroidServer for apk: /Users/Dolias/Devroom/selendroid_test/resigned-jp.co.yahoo.android.yfiler-1.apk
2013/09/07 22:46:59 io.selendroid.builder.SelendroidServerBuilder init
???: Creating customized Selendroid-server: /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/selendroid-server7676510138896123335.apk
2013/09/07 22:46:59 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt remove /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/selendroid-server7676510138896123335.apk META-INF/CERT.RSA
2013/09/07 22:46:59 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt remove /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/selendroid-server7676510138896123335.apk META-INF/CERT.SF
2013/09/07 22:46:59 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt remove /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/selendroid-server7676510138896123335.apk AndroidManifest.xml
2013/09/07 22:47:00 io.selendroid.builder.SelendroidServerBuilder createAndAddCustomizedAndroidManifestToSelendroidServer
???: Adding target package 'jp.co.yahoo.android.yfiler' to /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/jp.co.yahoo.android.yfiler1378561620006/AndroidManifest.xml
2013/09/07 22:47:00 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt package -M /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/jp.co.yahoo.android.yfiler1378561620006/AndroidManifest.xml -I /Users/Dolias/Devroom/android-sdk/platforms/android-18/android.jar -F /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/jp.co.yahoo.android.yfiler1378561620006/manifest.apk -f
2013/09/07 22:47:00 io.selendroid.builder.SelendroidServerBuilder createAndAddCustomizedAndroidManifestToSelendroidServer
???: 
2013/09/07 22:47:00 io.selendroid.builder.SelendroidServerBuilder createAndAddCustomizedAndroidManifestToSelendroidServer
???: file: /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/jp.co.yahoo.android.yfiler1378561620006selendroid-server.apk
2013/09/07 22:47:00 io.selendroid.io.ShellCommand exec
???: executing command: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/jarsigner -sigalg MD5withRSA -digestalg SHA1 -signedjar /Users/Dolias/Devroom/selendroid_test/selendroid-server-jp.co.yahoo.android.yfiler-0.5.1.apk -storepass android -keystore /Users/Dolias/.android/debug.keystore /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/jp.co.yahoo.android.yfiler1378561620006selendroid-server.apk androiddebugkey
2013/09/07 22:47:01 io.selendroid.builder.SelendroidServerBuilder signTestServer
???: App signing output: 
2013/09/07 22:47:01 io.selendroid.builder.SelendroidServerBuilder signTestServer
???: The app has been signed: /Users/Dolias/Devroom/selendroid_test/selendroid-server-jp.co.yahoo.android.yfiler-0.5.1.apk
2013/09/07 22:47:01 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/platform-tools/adb -s 015d24bc784c1214 shell pm list packages jp.co.yahoo.android.yfiler
2013/09/07 22:47:02 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/platform-tools/adb -s 015d24bc784c1214 uninstall jp.co.yahoo.android.yfiler
2013/09/07 22:47:05 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/platform-tools/adb -s 015d24bc784c1214 install /Users/Dolias/Devroom/selendroid_test/resigned-jp.co.yahoo.android.yfiler-1.apk
2013/09/07 22:47:17 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt dump badging /Users/Dolias/Devroom/selendroid_test/selendroid-server-jp.co.yahoo.android.yfiler-0.5.1.apk
2013/09/07 22:47:17 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/platform-tools/adb -s 015d24bc784c1214 shell pm list packages io.selendroid
2013/09/07 22:47:18 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/platform-tools/adb -s 015d24bc784c1214 uninstall io.selendroid
2013/09/07 22:47:20 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/platform-tools/adb -s 015d24bc784c1214 install /Users/Dolias/Devroom/selendroid_test/selendroid-server-jp.co.yahoo.android.yfiler-0.5.1.apk
2013/09/07 22:47:25 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/build-tools/android-4.2.2/aapt dump badging /Users/Dolias/Devroom/selendroid_test/resigned-jp.co.yahoo.android.yfiler-1.apk
2013/09/07 22:47:25 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/platform-tools/adb -s 015d24bc784c1214 shell am instrument -e main_activity jp.co.yahoo.android.yfiler.YFHandleActivity io.selendroid/.ServerInstrumentation
2013/09/07 22:47:26 io.selendroid.io.ShellCommand exec
???: executing command: /Users/Dolias/Devroom/android-sdk/platform-tools/adb -s 015d24bc784c1214 forward tcp:38080 tcp:8080
2013/09/07 22:47:26 io.selendroid.android.impl.AbstractDevice isSelendroidRunning
???: using url: http://localhost:38080/wd/hub/status
Cleaning up unclosed ZipFile for archive /var/folders/8m/ykwl2br119z5wkzwjsf31ghr0000gn/T/selendroid-server7676510138896123335.apk
2013/09/07 22:47:26 io.selendroid.android.impl.AbstractDevice isSelendroidRunning
???: got response status code: 200
2013/09/07 22:47:26 io.selendroid.android.impl.AbstractDevice isSelendroidRunning
???: got response value: {status: 0, value: {"supportedApps":[],"build":{"browserName":"selendroid","version":"0.5.1"},"os":{"arch":"armeabi-v7a","version":"18","name":"Android"},"supportedDevices":[]}}
2013/09/07 22:47:27 io.selendroid.server.util.HttpClientUtil executeCreateSessionRequest
???: creating session by using url: http://localhost:38080/wd/hub/session
2013/09/07 22:47:28 io.selendroid.server.model.SelendroidStandaloneDriver createNewTestSession
???: Create new session response: {
  "sessionId": "95f33e82-53fb-496c-9bc0-7e6fbc92c940",
  "status": 0,
  "value": {
    "aut": "jp.co.yahoo.android.yfiler:1.0.6",
    "browserName": "android",
    "cssSelectorsEnabled": false,
    "javascriptEnabled": false,
    "maxInstances": "1",
    "nativeEvents": false,
    "platform": "[\"NEXUS7\", NIL]",
    "rotatable": true,
    "takesScreenshot": true,
    "version": "5"
  }
}
new Session URL: http://localhost:5555/wd/hub/session/95f33e82-53fb-496c-9bc0-7e6fbc92c940
2013/09/07 22:47:28 io.selendroid.server.handler.GetCapabilities handle
???: get capabilities command
2013/09/07 22:47:28 io.selendroid.server.handler.DeleteSessionHandler handle
???: delete session command

とりあえず、実機にテストアプリがインストールされ起動するところまでは確認しました。

少しずつ調査を進めます・・・。