繁体   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