I am testing that all my data is loaded correctly in UIViewControllerusing UITableView.
The code that loads the data and populates the table is inside myMethod()and its asynchronous call.
func myMethod() {
reloadModel { ... wait for async callback ... }
}
In my test case, I am calling myMethod(), but I do not know how to wait for the completion of the asynchronous call.
func testLoadData() {
let listVC = ListViewController.init(tableView:tableView)
listVC .myMethod()
... here it should wait for the async call...
XCTAssertEqual(...)
}
source
share