久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

XCUITest:以協調的方式跨兩個應用程序運行測試

XCUITest: Running tests across two apps in a coordinated fashion(XCUITest:以協調的方式跨兩個應用程序運行測試)
本文介紹了XCUITest:以協調的方式跨兩個應用程序運行測試的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在考慮使用 XCUITest 對我的 iOS 應用程序進行 UI 測試.看起來 XCUITest 具有廣泛的功能,包括使用多個應用程序的能力.但是,多應用支持似乎有些受限.

I am looking at using XCUITest for UI tests for my iOS apps. It looks like XCUITest has a wide arrange of functionality, including the ability to work with multiple apps. However, the multiple app support seems somewhat limited.

似乎使用 XCUIApplication 我可以使用 Bundle ID 啟動另一個應用程序,甚至可以監控它的狀態.但是,我想做的是能夠為兩個具有緊密交互的應用程序運行協調測試(例如,一個應用程序對另一個應用程序執行打開 URL,執行一些 UI 操作,然后返回到第一個應用程序).

It seems that using XCUIApplication I can start another app using Bundle ID and even monitor its state. However, what I want to do is be able to run a coordinated test for two apps that have tight interaction (for example, one app does an open URL to another app, performs some UI action, and then returns to the first app).

這可能只使用 XCUITest,還是我需要一些更高級別的工具?(我認為有一些工具可以做到這一點,但如果可能的話,我更愿意繼續使用 XCUITest)

Is this possible just using XCUITest, or do I need some higher level tool? (I think some tools exist that can do this but would prefer to stay with XCUITest if possible)

理想情況下,我會將所有代碼放在一個文件中,以便在兩個應用程序中執行 UI 操作.但如果這是不可能的,我愿意編寫單獨的測試應用程序,這些應用程序有效地相互移交,在輪到"時執行操作.但我不確定如何協調這兩個測試應用程序.

Ideally, I would have all the code in a single file that executed the UI actions in the two apps. But if that was impossible, I would be open to writing to separate test apps which effectively hand off to one other, performing actions when it is their 'turn'. But I am not sure how I would work the coordination of the two tests apps.

推薦答案

這實際上在 Xcode 9 中得到了很好的支持.下面是如何設置它:

This is actually supported really nicely in Xcode 9. Here's how to set it up:

我發現最簡單的方法是創建一個包含您的兩個應用程序的工作區.在包含您的 UI 測試代碼的應用程序項目中,以執行這兩個應用程序,確保這兩個應用程序都列在您的 UI 測試目標的目標依賴項下:

I've found the easiest is to create a workspace containing both of your apps. In the app project containing your UI test code to excercise both apps, make sure both apps are listed under Target Dependencies in your UI Test target:

現在只需在測試的設置函數中啟動這兩個應用程序,使用它們的包標識符:

Now it's just a matter of starting both apps in your setup function of your test, using their bundle identifiers:

app1 = XCUIApplication(bundleIdentifier: "no.terje.app1.App1")
app1.launch()
app2 = XCUIApplication(bundleIdentifier: "no.terje.app2.App2")
app2.launch()

(應用程序是我的測試類的實例成員,var app1: XCUIApplication!)

(the apps are instance members of my test class, var app1: XCUIApplication!)

現在一切就緒.像這樣對兩個應用程序運行測試:

Now you're all set up. Run tests against both apps like this:

func testButtonsExist() {
  app1.activate()
  app1.buttons["mybutton"].exists
  app2.activate()
  app2.buttons["myotherbutton"].exists
}

至于您提到的等待或異步挑戰:我想其中大多數也存在于單個應用程序中的異步代碼中,例如等待打開 URL.但是,如果您遇到特定問題,請發布您正在嘗試和失敗的特定事情.

As for the waiting or async challenges you are mentioning: I would imagine most of those exist for async code within a single app too, for example waiting for a URL to open. But do post a specific thing you are trying and failing if you have specific problems.

這篇關于XCUITest:以協調的方式跨兩個應用程序運行測試的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Using Instruments to test an iOS app without having source code to the application(在沒有應用程序源代碼的情況下使用 Instruments 測試 iOS 應用程序)
KIF: How to auto-run/stress test an iOS app to find the cause of a rare UI bug?(KIF:如何自動運行/壓力測試 iOS 應用程序以找出罕見 UI 錯誤的原因?)
How to provide login credentials to an automated android test?(如何為自動化的 android 測試提供登錄憑據?)
How to fix error quot;Could not detect Mac OS X Version from sw_vers output: #39;10.12 #39;quot; from Appium(如何修復錯誤“無法從 sw_vers 輸出檢測 Mac OS X 版本:10.12來自Appium)
How do you test an Android application across multiple Activities?(如何跨多個活動測試 Android 應用程序?)
Can#39;t change target membership visibility in Xcode 4.5(無法更改 Xcode 4.5 中的目標成員身份可見性)
主站蜘蛛池模板: 国产999精品久久久久久 | 狠狠操狠狠干 | 欧美成视频 | av中文字幕在线观看 | 欧美日韩一二三区 | 人人色视频 | 中文字幕11页 | 99精品免费久久久久久久久日本 | 午夜精品一区二区三区在线视 | 国产高清精品网站 | 欧美一级片免费看 | 成人免费大片黄在线播放 | a级毛片毛片免费观看久潮喷 | 人人人人干 | 欧美日本在线观看 | 精品久久久久久久久久久 | 亚洲伦理自拍 | 国产精品一区在线 | 亚洲国产精品自拍 | 亚洲精品福利在线 | 成人免费网站www网站高清 | 日韩精品一区二区三区中文在线 | 久久久青草婷婷精品综合日韩 | 精精国产xxxx视频在线野外 | 日韩视频一区在线观看 | 久久a久久 | 国产精品视频网站 | 亚洲欧美精品久久 | 国产99久久 | a级片在线 | 午夜精品一区二区三区在线视频 | 欧美高清视频一区 | 日韩精品免费在线 | 亚洲精品欧美 | 精品亚洲永久免费精品 | 欧美综合视频在线 | 久久精品国产亚洲一区二区三区 | 成人免费视频网站在线观看 | 一区二区福利视频 | 日韩在线精品 | 国产精品视频一区二区三区四蜜臂 |