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

XCUITest:以協(xié)調(diào)的方式跨兩個(gè)應(yīng)用程序運(yùn)行測(cè)試

XCUITest: Running tests across two apps in a coordinated fashion(XCUITest:以協(xié)調(diào)的方式跨兩個(gè)應(yīng)用程序運(yùn)行測(cè)試)
本文介紹了XCUITest:以協(xié)調(diào)的方式跨兩個(gè)應(yīng)用程序運(yùn)行測(cè)試的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

我正在考慮使用 XCUITest 對(duì)我的 iOS 應(yīng)用程序進(jìn)行 UI 測(cè)試.看起來(lái) XCUITest 具有廣泛的功能,包括使用多個(gè)應(yīng)用程序的能力.但是,多應(yīng)用支持似乎有些受限.

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 啟動(dòng)另一個(gè)應(yīng)用程序,甚至可以監(jiān)控它的狀態(tài).但是,我想做的是能夠?yàn)閮蓚€(gè)具有緊密交互的應(yīng)用程序運(yùn)行協(xié)調(diào)測(cè)試(例如,一個(gè)應(yīng)用程序?qū)α硪粋€(gè)應(yīng)用程序執(zhí)行打開(kāi) URL,執(zhí)行一些 UI 操作,然后返回到第一個(gè)應(yīng)用程序).

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,還是我需要一些更高級(jí)別的工具?(我認(rèn)為有一些工具可以做到這一點(diǎn),但如果可能的話,我更愿意繼續(xù)使用 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)

理想情況下,我會(huì)將所有代碼放在一個(gè)文件中,以便在兩個(gè)應(yīng)用程序中執(zhí)行 UI 操作.但如果這是不可能的,我愿意編寫單獨(dú)的測(cè)試應(yīng)用程序,這些應(yīng)用程序有效地相互移交,在輪到"時(shí)執(zhí)行操作.但我不確定如何協(xié)調(diào)這兩個(gè)測(cè)試應(yīng)用程序.

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.

推薦答案

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

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

我發(fā)現(xiàn)最簡(jiǎn)單的方法是創(chuàng)建一個(gè)包含您的兩個(gè)應(yīng)用程序的工作區(qū).在包含您的 UI 測(cè)試代碼的應(yīng)用程序項(xiàng)目中,以執(zhí)行這兩個(gè)應(yīng)用程序,確保這兩個(gè)應(yīng)用程序都列在您的 UI 測(cè)試目標(biāo)的目標(biāo)依賴項(xiàng)下:

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:

現(xiàn)在只需在測(cè)試的設(shè)置函數(shù)中啟動(dòng)這兩個(gè)應(yīng)用程序,使用它們的包標(biāo)識(shí)符:

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()

(應(yīng)用程序是我的測(cè)試類的實(shí)例成員,var app1: XCUIApplication!)

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

現(xiàn)在一切就緒.像這樣對(duì)兩個(gè)應(yīng)用程序運(yùn)行測(cè)試:

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
}

至于您提到的等待或異步挑戰(zhàn):我想其中大多數(shù)也存在于單個(gè)應(yīng)用程序中的異步代碼中,例如等待打開(kāi) URL.但是,如果您遇到特定問(wèn)題,請(qǐng)發(fā)布您正在嘗試和失敗的特定事情.

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.

這篇關(guān)于XCUITest:以協(xié)調(diào)的方式跨兩個(gè)應(yīng)用程序運(yùn)行測(cè)試的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Using Instruments to test an iOS app without having source code to the application(在沒(méi)有應(yīng)用程序源代碼的情況下使用 Instruments 測(cè)試 iOS 應(yīng)用程序)
KIF: How to auto-run/stress test an iOS app to find the cause of a rare UI bug?(KIF:如何自動(dòng)運(yùn)行/壓力測(cè)試 iOS 應(yīng)用程序以找出罕見(jiàn) UI 錯(cuò)誤的原因?)
How to provide login credentials to an automated android test?(如何為自動(dòng)化的 android 測(cè)試提供登錄憑據(jù)?)
How to fix error quot;Could not detect Mac OS X Version from sw_vers output: #39;10.12 #39;quot; from Appium(如何修復(fù)錯(cuò)誤“無(wú)法從 sw_vers 輸出檢測(cè) Mac OS X 版本:10.12來(lái)自Appium)
How do you test an Android application across multiple Activities?(如何跨多個(gè)活動(dòng)測(cè)試 Android 應(yīng)用程序?)
Can#39;t change target membership visibility in Xcode 4.5(無(wú)法更改 Xcode 4.5 中的目標(biāo)成員身份可見(jiàn)性)
主站蜘蛛池模板: 一级毛片黄片 | 亚洲综合伊人 | 一区二区三区在线 | 在线一区二区三区 | 欧美色综合一区二区三区 | 性天堂网 | 韩国理论电影在线 | 亚洲综合资源 | 一区二区视屏 | 欧美日韩亚洲二区 | 国产91精品久久久久久久网曝门 | 欧美成人第一页 | 美女网站视频免费黄 | 欧美free性| 久久黄色网 | 日韩在线小视频 | 日韩av一区二区在线观看 | 欧美高清视频在线观看 | 亚洲精品v| 99热这里有精品 | 羞羞视频在线观免费观看 | 日韩一区二区三区四区五区六区 | 亚洲欧美视频一区二区 | 免费亚洲视频 | 91五月天 | 亚洲精品欧美一区二区三区 | 欧美福利影院 | 亚洲欧美一区二区三区在线 | 毛片链接 | 欧美日韩高清 | 亚洲中午字幕 | 成人网视频| 亚洲色图综合 | 日日操日日舔 | 天天爽夜夜操 | 国产一区二区三区在线视频 | 狠狠干天天干 | 欧美日韩大片 | 欧美精品三区 | 国产91在线精品 | 免费av一区二区三区 |