iOS单元测试和UI测试全面解析(13)

发表于:2017-03-31来源:51CTO作者:朱先忠点击数: 标签:单元测试iOS
letdataTask=sessionUnderTest.dataTask( with :url!){data,response,error in // then ifleterror=error{ XCTFail( Error:\(error.localizedDescription) ) return } else ifletstatusCode=(response as ?HTTPURLRe
  let dataTask = sessionUnderTest.dataTask(with: url!) { data, response, error in 
  •     // then 
  •     if let error = error { 
  •       XCTFail("Error: \(error.localizedDescription)"
  •       return 
  •     } else if let statusCode = (response as? HTTPURLResponse)?.statusCode { 
  •       if statusCode == 200 { 

    原文转自:http://mobile.51cto.com/iphone-535758.htm