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

XCUITest 類拆解不會(huì)刪除應(yīng)用程序.但是如果它的實(shí)

XCUITest Class teardown isnt deleting the app. But works if its instance teardown. What am I doing wrong?(XCUITest 類拆解不會(huì)刪除應(yīng)用程序.但是如果它的實(shí)例拆解就可以了.我究竟做錯(cuò)了什么?) - IT屋-程序員軟件開
本文介紹了XCUITest 類拆解不會(huì)刪除應(yīng)用程序.但是如果它的實(shí)例拆解就可以了.我究竟做錯(cuò)了什么?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

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

我有一個(gè)試圖刪除應(yīng)用程序的類拆解,但它無法識(shí)別 app.terminate().

I have a class teardown which is trying to remove the app, but it doesn't recognize app.terminate().

class DeviceSettingsUtilities : UITestUtilities {
func removeApp(productName:String){
        print("in teardown")
        let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
        XCUIApplication().terminate() // this does nothing
        XCUIApplication(bundleIdentifier: "com.xxx.xxxx").terminate()//this does nothing too, but this works when called as an instance teardown
        sleep(5)
        springboard.activate()
        let icon = springboard.icons.matching(identifier: productName).firstMatch
// icon.exists is false when called as a class teardown
// icon.exists is true when called as an instance teardown
        if icon.exists {
            let iconFrame = icon.frame
            let springboardFrame = springboard.frame
            icon.press(forDuration:1.3)
            springboard.coordinate(withNormalizedOffset: CGVector(dx: ((iconFrame.minX + 3) / springboardFrame.maxX), dy:((iconFrame.minY + 3) / springboardFrame.maxY))).tap()
            sleep(5)
            springboard.buttons["Delete"].firstMatch.tap()
            sleep(5)
        }
        XCUIApplication().terminate()
    }

}

這是在測(cè)試用例類拆解方法中調(diào)用的,如下所示

This is being called in the test case class teardown method as shown below

override class func tearDown() {
    super.tearDown()
    let deviceSettings = DeviceSettingsUtilities()
    deviceSettings.removeApp(productName: ProductName.rawValue)
}

這只是不會(huì)刪除應(yīng)用程序,但是如果我將類 func tearDown() 更改為 func tearDown() ,它會(huì)毫無問題地刪除應(yīng)用程序.不知道我錯(cuò)過了什么.有什么建議嗎?

This just doesnt delete the app, But if i change class func tearDown() to func tearDown() , it deletes the app with no problem. Not sure what i am missing. Any suggestions ?

推薦答案

這似乎是最新 Xcode 10 中的一個(gè)錯(cuò)誤.當(dāng)聲明為 class 時(shí),XCUIApplication.terminate() 似乎在 tearDown() 中不起作用.

This seems like a bug in latest Xcode 10. XCUIApplication.terminate() doesn't seem to work in tearDown() when declared as class.

這可以通過兩種方式解決:

This can be solved in two ways:

第一個(gè)選項(xiàng)是使用:

override func tearDown() {
    XCUIApplication().terminate()
    super.tearDown()
}

代替:

override class func tearDown() {…} 

或者,以不同的方式終止應(yīng)用程序(按主頁按鈕,打開不同的應(yīng)用程序...).但是,我會(huì)使用第一種方式.

Or, terminate the app differently (press home button, open different app...). However, I would use the first way.

還可以考慮向 Apple 報(bào)告此問題,以便他們解決.

Also consider reporting this to Apple, so they can fix it.

這與應(yīng)用程序狀態(tài)(XCUIApplication().state.rawValue)無關(guān),因?yàn)樗跍y(cè)試和 tearDown() 中是相同的(4 = 運(yùn)行前臺(tái)).另外 - 官方文檔說 .terminate() 將終止應(yīng)用程序,該應(yīng)用程序與 Xcode 有一個(gè)調(diào)試會(huì)話,但調(diào)試會(huì)話在 tearDown() 中也處于活動(dòng)狀態(tài).所以這很可能是 Xcode 中的一個(gè)錯(cuò)誤.

This has nothing to do with app state (XCUIApplication().state.rawValue), since it is same in test and in tearDown() (4 = running foreground). Also - official documentation says that .terminate() will terminate app, which has a debug session with Xcode, but the debug session is active in tearDown() as well. So it is really probably a bug in Xcode.

這篇關(guān)于XCUITest 類拆解不會(huì)刪除應(yīng)用程序.但是如果它的實(shí)例拆解就可以了.我究竟做錯(cuò)了什么?的文章就介紹到這了,希望我們推薦的答案對(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)用程序)
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)用程序?)
How to get root view controller?(如何獲取根視圖控制器?)
How to order test cases for Spoon Automated Testing in Android?(如何在 Android 中為 Spoon 自動(dòng)化測(cè)試訂購(gòu)測(cè)試用例?)
主站蜘蛛池模板: 国产午夜在线 | 91精品免费视频 | 成人免费毛片果冻 | 欧美一级做性受免费大片免费 | 中国av在线播放 | 一区二区三区四区在线视频 | 日韩中文字幕在线观看 | 久久免费精品 | 精品国产视频 | 国产亚洲久一区二区 | 国产小视频在线观看 | 国产一区二区在线观看视频 | 激情综合网五月 | 视频一区二区在线观看 | 一级片观看 | 中国一级黄 | 国产盗摄一区二区三区 | 偷拍福利视频 | 亚洲成人福利 | 国产欧美日韩在线观看 | 色综合天天综合网国产成人网 | 欧美在线播放 | 国产精品一区二区久久 | 91看片淫黄大片 | www.婷婷| 国产精品久久久久久久久久久久午夜片 | 手机在线看片1024 | www.中文字幕 | 国产香蕉视频 | 久久久久久久久久久国产 | 日本韩国欧美中文字幕 | 亚洲一区二区精品视频 | 激情久久久 | 欧美日韩大片 | 欧美资源在线 | 亚洲一区二区免费视频 | 国产精品亚洲综合 | 日韩欧美中文 | 动漫av在线| a级片在线| 激情导航 |