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

Xcode 7:應用程序測試和 UI 測試之間的鴻溝是不可

Xcode 7: is chasm between app tests and UI tests unbridgeable?(Xcode 7:應用程序測試和 UI 測試之間的鴻溝是不可逾越的嗎?)
本文介紹了Xcode 7:應用程序測試和 UI 測試之間的鴻溝是不可逾越的嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

Xcode 7? 提供了一種直接測試 UI 的新方法,包括新的測試目標iOS UI Testing Bundle"(或OS X").

Xcode 7? has a new way to test your UI directly, including a new testing target "iOS UI Testing Bundle" (or "OS X").

在 UI 測試目標中,似乎沒有對構成您的應用的模型或類的內置訪問.例如.[UIApplication sharedApplication] 不能從您的 UI 測試中調用.這意味著應用程序測試"和UI 測試"存在于一個可能無法逾越的鴻溝中.

In the UI testing target, it appears there's no built-in access to the model or classes that comprise your App. E.g. [UIApplication sharedApplication] would not be callable from your UI tests. This implies that "app tests" and "UI tests" exist across a possibly unbridgeable chasm.

如上所述這里:

問題是 Xcode 的 UI 測試不允許訪問實際的應用程序.

The problem is that Xcode’s UI testing does not allow access to the actual app.

問題:

  1. 這個鴻溝可以彌合嗎?如果是這樣,詳細說明如何使用構建和鏈接器設置以及可能在 github 上工作的 xcodeproj.
  2. 可以在 Apple 文檔中的何處找到關于這種分歧的明確聲明.

<小時>

? 在撰寫本文時,測試版軟件.


? At the time of writing, beta software.

推薦答案

黑盒測試

UI 測試是一個黑盒測試框架.您不必對正在測試的代碼的實現有任何了解.

UI Testing is a black-box testing framework. You shouldn't have to know anything about the implementation of the code you are testing.

例如,您應該只關心標簽上的值發生變化,而不是控制器將正確的數據傳遞給視圖.您可以從應用用戶的角度來考慮 UI 測試.她不在乎您的 ItemsViewController 是如何工作的(甚至它是否存在),那么為什么要進行 UI 測試呢?

For example, you should only care that the value on a label changes, not that the controller passed the right data to the view. You can think of UI Testing from the user of your app's perspective. She doesn't care how your ItemsViewController works (or even that it exists), so why should the UI Tests?

讓它工作"

話雖如此,我理解你的沮喪.如果您可以啟動一個視圖控制器,然后使用 UI 測試并做出斷言,那就太好了.但是,從 Beta 5 開始,這是不可能的.

That being said, I understand your frustration. It would be great if you could spin up a view controller and then tap around with UI Testing and making assertions. However, as of Beta 5 this is not possible.

有趣的是,您可以在 UI 測試頂部使用簡單的 @testable import ModuleName 創建應用對象的實例.請注意,您實際上無法通過類似 .tap() 的方法與它進行交互,因為它是一個 UI* 類,而不是 XCUI* 一個.

What's interesting is that you can, however, create instances of your app's objects with a simple @testable import ModuleName at the top of your UI Tests. Note that you can't actually interact with it via the .tap()-like methods, as it's a UI* class, not a XCUI* one.

Donut 視為應用程序的模塊名稱.

Consider Donut to be the application's module name.

import XCTest
@testable import Donut

class DonutUITests: XCTestCase {
    let app = XCUIApplication()

    override func setUp() {
        continueAfterFailure = false
        app.launch()
    }

    func testItemsViewController() {
        let controller = ItemsViewController()
        controller.addItemButton.tap() // <---- UIButton does not respond to tap()!
    }
}

這篇關于Xcode 7:應用程序測試和 UI 測試之間的鴻溝是不可逾越的嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Using Instruments to test an iOS app without having source code to the application(在沒有應用程序源代碼的情況下使用 Instruments 測試 iOS 應用程序)
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 中的目標成員身份可見性)
iOS 5 SDK is gone after upgrade to Xcode 4.5(升級到 Xcode 4.5 后,iOS 5 SDK 消失了)
主站蜘蛛池模板: 久久久123| 亚洲国产网 | 日韩五月天| 精品三级在线观看 | 日韩中文一区二区三区 | h在线免费观看 | 精品自拍视频 | 日本一区二区不卡 | 亚洲欧美成人在线 | 亚洲精品在线免费观看视频 | 69堂永久69tangcom | 色婷婷综合久久久中文字幕 | 久久蜜桃资源一区二区老牛 | 在线观看av网站 | 99久久久久国产精品免费 | 欧美福利视频一区 | 精品一区二区三区不卡 | 在线看片福利 | 男人视频网站 | 免费观看成人av | 欧美xxxx网站 | 欧美三级久久久 | 日韩高清一区 | 欧美日韩中文字幕 | 一区二区三区日 | 欧美精品在线一区二区三区 | 久久专区 | 一区二区三区在线播放 | 国产精品99久久久久久大便 | 国产精品18hdxxxⅹ在线 | 日韩欧美在线一区 | 国产精品色 | 日韩电影免费观看中文字幕 | 欧美激情视频一区二区三区在线播放 | 狠狠干狠狠插 | 国产精品久久久久久久久久 | 狠狠爱综合 | 91极品尤物在线播放国产 | 亚洲高清一区二区三区 | 日本三级电影免费 | 男女羞羞视频在线看 |