実際のデバイスで自動化テストを実行したいのですが、以前はエミュレーター (API>17) でこれを実行しましたが、同じテストを Appium で selendroid モードで実行しようとして失敗しました。
以下は、appiumがselendroidモードで実行されるように構成した機能です。
Appium バージョン: 1.0 Selendroid バージョン: 0.10
ポート番号:6001およびブートストラップポート:4001でappiumを実行し、デフォルトポート:8080でselendroidサーバーを実行します
private static String url = "http://localhost:"
+ System.getProperty("appium_port") + "/wd/hub";
private AppiumDriver driver;
private static DesiredCapabilities capabilities;
capabilities = new DesiredCapabilities();
File app = new File("en-android.apk");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Selendroid");
capabilities.setCapability(CapabilityType.PLATFORM, "ANDROID");
capabilities.setCapability("device", "Selendroid");
capabilities.setCapability("platformVersion", "4.1.2");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("app-activity",
"testapp.android.gui.WelcomeActivity");
capabilities.setCapability("app-package",
"testapp.android");
driver = new AppiumDriver(new URL(url), capabilities);
以下は Appium サーバーのログです。
アピウム ログ:
error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.
info: Stopping logcat capture
debug: Logcat terminated with code null, signal SIGTERM
info: Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
info: Cleaning up android objects
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.
info: Error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.
at /home/priyankpshah/.linuxbrew/lib/node_modules/appium/lib/devices/android/android.js:263:17
at /home/priyankpshah/.linuxbrew/lib/node_modules/appium/lib/devices/android/adb.js:630:7
at /home/priyankpshah/.linuxbrew/lib/node_modules/appium/lib/devices/android/adb.js:154:5
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.)","origValue":"Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device."},"sessionId":null}
POST /wd/hub/session 500 7269ms - 400b
Tests run: 4, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 8.198 sec <<< FAILURE! - in TestSuite
setUp(com.ishisystems.enigma.EnigmaLaunchTest) Time elapsed: 8.084 sec <<< FAILURE!
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7.41 seconds
Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
System info: host: 'ishiahm-lt113', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-24-generic', java.version: '1.7.0_55'
Driver info: io.appium.java_client.AppiumDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:76)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:41)
at TestUtility.automationInit(TestUtility.java:41)
at LaunchTest.setUp(LaunchTest.java:33)
実際のデバイスで selendroid モードで appium テストを実行するには、特定の変更を加える必要があることをお知らせください。
ありがとう、プリヤンク・P・シャー