久久久久久久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ì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

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

我正在考慮使用 XCUITest 對(duì)我的 iOS 應(yīng)用程序進(jìn)行 UI 測(cè)試.看起來 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í)行打開 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)用程序中的異步代碼中,例如等待打開 URL.但是,如果您遇到特定問題,請(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)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Using Instruments to test an iOS app without having source code to the application(在沒有應(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)用程序以找出罕見 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ò)誤“無法從 sw_vers 輸出檢測(cè) Mac OS X 版本:10.12來自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(無法更改 Xcode 4.5 中的目標(biāo)成員身份可見性)
主站蜘蛛池模板: 国产精品一区二区三区免费 | 精品一区二区三区三区 | 特级淫片裸体免费看 | 狠狠干天天 | 国产在线一区二区 | 中文字幕免费观看视频 | 深夜福利在线播放 | 欧美精品99久久久 | 国产二三区 | 亚洲www啪成人一区二区麻豆 | 国产精品久久久久永久免费看 | 欧美一区二区免费 | 91丨porny丨成人蝌蚪 | av久久久 | 中文字幕黄色片 | 免费一级黄色录像 | 日韩在线欧美 | 国产免费一区二区三区在线观看 | 欧美精品一区在线观看 | av手机在线观看 | 波多野结衣一区二区三区在线观看 | 青青青草视频 | 影音先锋国产精品 | 国产寡妇亲子伦一区二区三区四区 | 国产福利视频在线 | 亚洲视频免费 | 激情做爰呻吟视频舌吻 | 欧美日韩亚洲另类 | 在线免费黄色网址 | 亚洲性网站| 三级av在线 | 99久久综合 | 久久精品欧美一区二区三区不卡 | 日韩精品免费视频 | 日韩精品一区二区三区四区 | 特黄aaaaaaaaa真人毛片 | 国产精品久久久久久久久 | 欧美黄色精品 | 久久久久久中文字幕 | 91人人爽| 国产吃瓜黑料一区二区 |