【发布时间】:2016-12-17 22:19:50
【问题描述】:
我有一个内部调用 API 的方法。该方法没有任何完成处理程序。
-(void) methodToBeTested{
[self callAPIWithCompletionHandler:^(NSArray *data,NSError *error)
{
//Here I get the response and sets the models.
}];
}
现在我需要测试API调用后设置的模型的方法“methodToBeTested”基础。
有什么建议吗?
【问题讨论】:
-
老实说,这看起来更像是一个集成测试。对于单元测试,如果需要为其他测试组件做准备,通常会存根此方法并返回模拟数据。
标签: ios objective-c asynchronous objective-c-blocks xctest