mercredi 30 septembre 2015

XCTestSuite of XCTestCase

I need to test a UIViewController which behavior depends on parameters given to it (controls are dynamically instantied in viewDidLoad based on a webservice call).

I would to be able to run the same XCTestCase derived class and inject testing the context. I thought I would use XCTestSuite for that but this is not the case as XCTestSuite is a suite of XCTest and not XCTestCase.

Basically I would like to do:

XCTestCaseSuite* suite = [[XCTestCaseSuite alloc] init];
for (Condition* condition in conditions) {
  MyTestCase* case = [[MyTestCase alloc] initWithCondition:condition];
  [suite addTestCase:case];
]
[suite runTest];

Is there any way to do this? Thanks!

Aucun commentaire:

Enregistrer un commentaire