airbob
V2EX  ›  问与答

问个 iOS test 的问题

  •  
  •   airbob · Aug 4, 2014 · 3379 views
    This topic created in 4314 days ago, the information mentioned may be changed or developed.
    目前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原则。
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   950 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 20:03 · PVG 04:03 · LAX 13:03 · JFK 16:03
    ♥ Do have faith in what you're doing.