簡體   English   中英

為什么Alamofire在單元測試中使用30秒的超時預期?

[英]Why does Alamofire use 30 seconds for the timeout expectations on Unit Tests?

我在研究如何Alamofire執行單元測試NSOperation秒。 這是其他測試使用的基本測試類。 任何想法為什么它會使用30秒的timeout預期?

import Alamofire
import Foundation
import XCTest

class BaseTestCase: XCTestCase {
    let timeout: NSTimeInterval = 30.0

    func URLForResource(fileName: String, withExtension: String) -> NSURL {
        let bundle = NSBundle(forClass: BaseTestCase.self)
        return bundle.URLForResource(fileName, withExtension: withExtension)!
    }
}

我們使用30秒作為標准超時。 現在,這比在本地運行時所需的時間更長,但在諸如Travis-CI之類的CI環境中,事情總是運行得更慢。 因此,我們提高了默認超時,以便讓較慢的計算機有更多時間來處理測試。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM