I am unable to run the following sample Unit test using Appium on Windows machine.
I have the emulator turned on in eclipse and Appium also detects it but it would not install the apk and the only message i see on the appium console is Logcat capture failed: spawn ENOENT
Java
public class AndroidTest {
private AppiumDriver driver;
@Before
public void setUp() throws Exception {
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "../../../apps/ApiDemos/bin");
File app = new File(appDir, "ApiDemos-debug.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","Nexus4");
capabilities.setCapability("platformVersion", "4.3");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "io.appium.android.apis");
capabilities.setCapability("appActivity", ".ApiDemos");
driver = new AndroidDriver(new URL("http://ift.tt/1eWSHgW"), capabilities);
}
@After
public void tearDown() throws Exception {
driver.quit();
}
@Test
public void apiDemo(){
WebElement el = driver.findElement(By.name("Animation"));
assertEquals("Animation", el.getText());
el = driver.findElementByClassName("android.widget.TextView");
assertEquals("API Demos", el.getText());
el = driver.findElement(By.name("App"));
el.click();
List<WebElement> els = driver.findElementsByClassName("android.widget.TextView");
assertEquals("Activity", els.get(2).getText());
}
}
Appium Server Logs
> info: Console LogLevel: debug
> info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"C:\\Tools\\WorkSpace\\AppiumTest\\..\\..\\..\\apps\\ApiDemos\\bin\\ApiDemos-debug.apk","appPackage":"io.appium.android.apis","appActivity":".ApiDemos","platformName":"Android","deviceName":"Nexus4","platformVersion":"4.3"}}
> info: Client User-Agent string: Apache-HttpClient/4.3.6 (java 1.5)
> info: [debug] Using local app from desired caps: C:\apps\ApiDemos\bin\ApiDemos-debug.apk
> info: [debug] Creating new appium session aed8845d-f962-46a7-b655-087af50b2a50
> info: Starting android appium
> info: [debug] Getting Java version
> info: Java version is: 1.7.0
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Checking whether app is actually present
> info: [debug] Checking whether adb is present
> warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
> info: [debug] executing cmd: where adb
> info: [debug] Using adb from C:\Tools\AndriodSDK\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe
>
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: "C:\Tools\AndriodSDK\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe" devices
> info: [debug] 2 device(s) connected
> info: Found device emulator-5554
> info: [debug] Setting device id to emulator-5554
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: "C:\Tools\AndriodSDK\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe" -s emulator-5554 wait-for-device
> info: [debug] executing cmd: "C:\Tools\AndriodSDK\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ready'"
> info: [debug] Starting logcat capture
> error: Logcat capture failed: spawn ENOENT
> info: [debug] Stopping logcat capture
Aucun commentaire:
Enregistrer un commentaire