I have several versions (IOS, JavaScript, Android) of the same calculator that have to produce the same result on every platform.
I have developed a set of test data, spread across multiple data sets like:
onedigit.json:
{n1: 1, n2: 2, a: 3},
{n1: 4, n2: 5, a: 9}...
twodigit.json
{n1: 32, n2: 11, a: 43},
{n1: 42, n2: 0, a: 42}
...and so on.
I have a simple XCTestCase like:
@interface CalculatorAddTest: XCTestCase
@property NSNumber n1;
@property NSNumber n2;
@property NSNumber a;
@end
@implementation CalculatorAddTest
- (void) setUp{
self.n1 = passedInData.n1;
self.n2 = passedInData.n2;
self.a = passedInData.a;
}
- testAdd{
XCAssert( Calculator.add(self.n1, self.n2) == self.a );
}
- (void) tearDown{
...
}
So, the question is, how to I:
for dataSet in dataSets:
for d in dataSet:
run CalculatorAddTest with d
i.e. how do I pass my data into passedInData
in CalculatorAddTest?
I tried overriding init:, but that didn't even get called (no idea what designated initializer for XCTestCase is and header gives no clues).
Thanks!
ssteinerX