I am in a bigger project that uses the Cedar framework for Unit Tests. I am writing unit tests for a view that contains a UITableView.
Initialization:
subject = [[ControllerWithTableView alloc] initWithParams:params];
navigationController = [[UINavigationController alloc] initWithRootViewController:subject];
Then I set up some things and call:
[subject: viewWillAppear:NO];
In the test I can ask for cells at indexPaths etc. The main idea behind this is that it runs without letting the UI much time to set up.
In some tests I had to add:
[subject.view layoutIfNeeded];
and then it worked.
But in the current test I am adding a new tableViewRow with the same method that is called during runtime. But I can't get the test to reload the UITableView to create the new row and cell and so to test it.
Here is suggested to use:
#define tickRunLoop (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, false))
It works. But sometimes it crashes. Not just fails one test but crashes the process of running the unit tests. So all other tests are not run to the end. I can't push unstable code to the customer's repo so that is not an option...
I am using XCode 8.3.3 if that's relevant.
What else can I do to force a refresh?