I'm trying write some simple test cases for a project I am working on. I have a simple method that takes an input and returns true/false depending on the outcome of an operation on that input. base case unit test right? In java, I can use a framework called TestNG which allows me to inject data into the test so that each data input would be considered a separate test. What I found in Objective-C is that it models something similar to JUnit where something like this isn't possible. What I have to do instead is create an array in setup or somewhere and then loop through the array manually to run the test. This ends up being seen as a single test of X input values, and not X tests of X input values.
Is what I am asking not currently possible in Objective-C? I am using the latest XCode and coding with iOS8.
Thanks in advance! --Michael
my guess is that the XCTesting framework is built up to be exactly like jUnit, meaning than answer to my question is NO. I thought I'd ask in case I am wrong.
I think the basic answer is no, that's not how XCTestCase
works. Although the failures should allow you to see which case it's failing on. If your goal is just for the unit test to not stop running after it fails the first time though, you can override invokeTest
as discussed in this StackOverflow thread.