Using test assertions in classes outside of test cases

In my XCTest setup, I have a helper class with some boilerplate methods with assertions that I can use across different test cases. When I call those assertions from test cases, I see the following warning:


Questionable API usage: creating XCTestExpectation for test case -[MyTestFixtures (null)] which is not the currently running test case


And the test cases do not fail even if the assertions fail. The test runner just reports that Assertion Failure occurred and continue running the test cases. What's the right way to share assertions across multiple test cases?


I've seen this article but I'm not sure what's the best way to do this in Objective-C. MyTestFixtures subclasses XCTestCase and an instance is created in each test suite. In the comments it's recommended to turn the helper class into an extension. So should I turn MyTestFixtures into a category of XCTestCase, since I'm using Objective-C?

Using test assertions in classes outside of test cases
 
 
Q