单元测试 UnitTest

2017-04-12  本文已影响13人  EdenChow
一个网络测试例子 (参考AFN项目的测试用例)
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
    
    AFHTTPSessionManager *_mag = [AFHTTPSessionManager manager];
    [_mag
     GET:@"https://api.douban.com/v2/book/1220562" parameters:nil
     progress:nil
     success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        XCTAssertNotNil(responseObject);
         [expectation fulfill];
    }
    failure:nil];
    
    [self waitForExpectationsWithTimeout:3.0 handler:nil];
上一篇 下一篇

猜你喜欢

热点阅读