iOS单元测试和UI测试全面解析(25)
发表于:2017-03-31来源:51CTO作者:朱先忠点击数:
标签:单元测试iOS
letdataTask=controllerUnderTest?.defaultSession.dataTask( with :url!){ data,response,error in //ifHTTPrequest is successful,callupdateSearchResults(_:)whichparsestheresponsedata into Tracks ifleterror
let dataTask = controllerUnderTest?.defaultSession.dataTask(with: url!) {
data, response, error in
// if HTTP request is successful, call updateSearchResults(_:) which parses the response data into Tracks
if let error = error {
print(error.localizedDescription)
} else if let httpResponse = response as? HTTPURLResponse {
if httpResponse.statusCode == 200 {
原文转自:http://mobile.51cto.com/iphone-535758.htm