ネイティブの Objective-C アプリケーションをテストする場合、Instruments で自動化を実行するために、Appium は有効な .app パッケージ、または .zip アーカイブされた .app パッケージを必要とします。
しかし、Appium が実際に iOS エミュレーターで実行できる有効な .app パッケージを作成しようとして、私はひどく間違ったことをしており、レンガの壁にぶつかっています。
自動化を Java で作成し、JUnit を使用しています。
現在、Xcode で「iOS デバイス」用の .xarchive ファイルを生成し、Xcode オーガナイザーを使用して .xarchive ファイルが配置されている場所を表示しています。このアーカイブを見つけたら、「パッケージの内容を表示」を使用して .xarchive をドリルダウンし、xarchive 内で test.app パッケージを見つけます。これはグレー表示され、.app アイコンに円/スラッシュが表示されます (はい、私は知っています、トラブル...)。.xarchive から test.app パッケージを取得し、書き込み権限が 777 のディレクトリに配置します。
私の Java コード (Eclipse IDE を使用する Maven プロジェクト) では、次のように機能を記述し、test.app パッケージへのフル パスを指定します。
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...
}
}
このコードを実行すると、Appium インターフェイスで test.app パッケージに「アプリ パス」が指定されているかどうかに関係なく (上記と同様)、Appium コンソールに次のエラーが表示されます。
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'
次に、同じ test.app パッケージを取得して圧縮し、コードを次のように変更します。
cap.setCapability("app", "/Users/wulf/Library/Developer/Xcode/Archives/2013-05-31/Story/Products/Applications/test.app.zip");
Appium コンソールに次のエラーが表示されます。
error: Failed to start an Appium session, err was: Error: ENOENT, stat '/Users/wulf/Library/Developer/Xcode/Archives/2013-05-31/test.app.zip'
そして、同じ圧縮された test.app アーカイブをサーバー (Ubuntu、Apache) に配置し、コードを次のように変更すると:
cap.setCapability("app", "http://10.xxx.xxx.100/var/www/myGitRepo/myProject/test.app.zip");
Appium コンソールに次のエラー ダイアログが表示されます。
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?
私は一体何を間違っているのですか?
私のアプリケーションをiOSエミュレーターに適切にインストールする方法はありますか(私はすでにこれをうまく行うことができます)、AppiumにInstrumentsに既にインストールされているアプリケーションを起動するように指示する方法はありますか? もしそうなら、これは私の機能コードブロックでどのように指定されますか?
拡張子が .ipa のパッケージを生成してから、それに何か手を加える必要がありますか?
明らかに、私は Xcode で .app パッケージを構築することに関してはまったくの初心者であり、ここの善良な魂が提供できるあらゆる支援を実際に利用できます。Appium に iOS エミュレーターで fricken アプリを起動させることができれば、私は金です!
フィードバックをお寄せいただきありがとうございます。
ウルフ