iOS单元测试和UI测试全面解析(24)
发表于:2017-03-31来源:51CTO作者:朱先忠点击数:
标签:单元测试iOS
//使用DHURLSession协议和代理伪造URLSession functest_UpdateSearchResults_ParsesData(){ //given letpromise=expectation(description: Statuscode:200 ) // when XCTAssertEqual(controllerUnderTest?.
//使用DHURLSession协议和代理伪造URLSession
func test_UpdateSearchResults_ParsesData() {
// given
let promise = expectation(description: "Status code: 200")
// when
XCTAssertEqual(controllerUnderTest?.searchResults.count, 0, "searchResults should be empty before the data task runs")
let url = URL(string: "https://itunes.apple.com/search?media=music&entity=song&term=abba")
原文转自:http://mobile.51cto.com/iphone-535758.htm