Asynchronous unit testing Core Data with Xcode 6

The WordPress for iOS project had a number of unit tests using Core Data and a custom asynchronous test helper. The helper used a semaphore in a global scope and a bit of method swizzling to give a wait/notify mechanism. The problem with this solution was the global semaphore and poorly written tests causing a conflict. Tests would call the ending wait and previous tests running Core Data would fire off notifies causing a mismatch between the original test and the recipient of the message to pass by the current semaphore. ...

August 6, 2014 · 4 min · Aaron