问个 iOS test 的问题

2014-08-04 00:16:35 +08:00
 airbob
目前team的UI test是用的KIF framework,想写以下的一个test不知道可行么

1. select一些tableview cell, swipe delete
2. call view controller, update一些data, 然后reload tableview
3. 继续其它的一些UI test

code大致如下:

-(void)testReloadTableView
{
//step1 UI tests.....

//step2 tests....
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
self.vc = [storyboard instantiateViewControllerWithIdentifier:@"tableviewController"];
[self.vc performSelectorOnMainThread:@selector(loadView) withObject:nil waitUntilDone:YES];
[self.vc addData] //a method to add some data
[self.vc.tableview reloadData];

//go on with step3 tests...
}


1,3都没有问题,现在卡在2,试了下都没有实现想要的效果(比如上面的code只是create了view controller的instance,并不是同在UI里正在run 的view controller)。

请问做过iOS测试的,有没有可能的实现方法? 还是这是一个bad test practise, 违背了test原则。
2570 次点击
所在节点    问与答
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/125953

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX