When testing native Objective-C applications, Appium requires a valid .app package, or a .zip archived .app package, in order to run automation against with Instruments.
But I'm doing something terribly wrong and running up against a brick wall in trying to just CREATE a valid .app package that Appium can actually run in the iOS emulator.
I'm writing my automation in Java and using JUnit.
Currently, in Xcode, I'm generating an .xarchive file for an "iOS Device" and then using the Xcode Organizer to show me where the .xarchive file has been placed. Once I find this archive I'm using "show package contents" to drill down into the .xarchive until I find the test.app package within the xarchive, which is greyed out and shows a circle/slash through the .app icon (yeah, I know, trouble...). I pull the test.app package from the .xarchive, and then place it in a directory with 777 write permissions.
In my Java code (a Maven project using the Eclipse IDE) I write the capabilities like this, giving a full path to the test.app package:
package com.my.appium._webdriver_test_demo;
import java.net.URL;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class AppiumWebDriverTestBVTDemo {
private WebDriver driver;
@Before
public void setup() throws Exception
{
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("device", "iPhone Simulator");
cap.setCapability("app", "/Users/wulf/Library/Developer/Xcode/Archives/2013-05-31/Test/Products/Applications/test.app");
driver = new RemoteWebDriver(new URL("http://localhost:4723/wd/hub"), cap);
}
@After
public void tearDown() throws Exception
{
//Do stuff...
}
}
When running this code, whether or not an "App path" has also been given to the test.app package (just as done above) on the Appium interface, I get the following error in the Appium console:
error: Could not parse plist file at /Users/wulf/Library/Developer/Xcode/Archives/2013-05-31/Story/Products/Applications/test.app/Info.plist
error: Failed to start an Appium session, err was: Error: ENOENT, open '/Users/wulf/Library/Developer/Xcode/Archives/2013-05-31/Story/Products/Applications/test.app/Info.plist'
When I then take the same test.app package and zip it, and then change the code like so:
cap.setCapability("app", "/Users/wulf/Library/Developer/Xcode/Archives/2013-05-31/Story/Products/Applications/test.app.zip");
I get the following error in the Appium console:
error: Failed to start an Appium session, err was: Error: ENOENT, stat '/Users/wulf/Library/Developer/Xcode/Archives/2013-05-31/test.app.zip'
And then when I place the same zipped test.app archive on a server (Ubuntu, Apache) and change my code like so:
cap.setCapability("app", "http://10.xxx.xxx.100/var/www/myGitRepo/myProject/test.app.zip");
I get the following error dialog in the Appium console:
error: Test zip archive threw error Error: Command failed:
error: Stderr: Archive: /var/folders/gg/2_0flj7s51nd88kbtlwmm1qjxw981t/T/appium-app11353-39508-t2rmzq.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /var/folders/gg/2_0flj7s51nd88kbtlwmm1qjxw981t/T/appium-app11353-39508-t2rmzq.zip or
/var/folders/gg/2_0flj7s51nd88kbtlwmm1qjxw981t/T/appium-app11353-39508-t2rmzq.zip.zip, and cannot find /var/folders/gg/2_0flj7s51nd88kbtlwmm1qjxw981t/T/appium-app11353-39508-t2rmzq.zip.ZIP, period.
error: Stdout:
error: Failed to start an Appium session, err was: Error testing zip archive, are you sure this is a zip file?
What the heck am I doing wrong?
Is there any way to simply install my application properly on the iOS emulator (I can already do this just fine) and then have Appium tell Instruments to launch the already installed application? If so, how would this be specified in my capabilities code block?
Do I need to generate a package with an .ipa extension and then do something fancy with that?
Obviously, I'm a total newb when it comes to building .app packages in Xcode and could really use whatever help the good souls here can provide. If I can just get Appium to launch the fricken app on the iOS Emulator, I'm gold!
Thanks in advance for any feedback!
Wulf