2013-10-22 155 views
0

我試圖使用appium設置自動化測試環境,但是我遇到了麻煩。我看到的問題是,appium正在提取包含.app目錄的zip文件,但後來聲稱找不到.app文件。我的平臺是mac。下面的確切的錯誤是:Appium iOS測試未運行

info: Unzipping /var/folders/0s/0kz_6kb13f35wxwjxkff9sdw0000gn/T/appium-app113922-2258-1ap6o7i.zip 
info: Testing zip archive: /var/folders/0s/0kz_6kb13f35wxwjxkff9sdw0000gn/T/appium-app113922-2258-1ap6o7i.zip 
info: Zip archive tested clean 
info: Unzip successful 
info: Got configuration error, not starting session 
error: Failed to start an Appium session, err was: App zip unzipped OK, but we couldn't find a .app bundle in it. Make sure your archive contains the .app package and nothing else 
info: Responding to client with error: {"status":6,"value":{"message":"A session is either terminated or not started","origValue":"App zip unzipped OK, but we couldn't find a .app bundle in it. Make sure your archive contains the .app package and nothing else"},"sessionId":null} 

我不知道如果我做錯事在我的代碼,下面是我的設置()方法(它基本上是從官方的例子複製)的內容。

DesiredCapabilities capabilities = new DesiredCapabilities(); 
capabilities.setCapability("device", "8b0949a1d3fe5d7283cc46ca5470acd67d6c5d7b"); 
File app = new File("/Users/user/path/to/zip"); 
capabilities.setCapability("version", "7.0"); 
capabilities.setCapability("app", app.getAbsolutePath()); 
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), 
      capabilities); 
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); 

回答

0

對於任何有類似問題的人:我通過指定.app文件解決了這個問題,但是在運行appium而不是在測試代碼中時,在命令行指定了設備的UDID。我認爲指定'設備'功能會導致錯誤(可能會使appium認爲它是Android測試,儘管寫出它正在尋找.app)

0

需要考慮的事情:

  1. 您的.zip應該只包含的.app
  2. 的。應用程序應建在與正在設備上使用相同的開發證書的XCode(iPhone )

對我來說,它的工作原理是這樣的:我在源代碼中創建了一個.app並上傳到設備。然後在Appium中,我剛剛指定了應用程序的Bundle ID(在XCode窗口>管理器>應用程序中,如果我記得的話)。