xcode - XCTestSuite of XCTestCase for ios -


i need test uiviewcontroller behavior depends on parameters given (controls dynamically instantied in viewdidload based on webservice call).

i able run same xctestcase derived class , inject testing context. thought use xctestsuite not case xctestsuite suite of xctest , not xctestcase.

basically do:

xctestcasesuite* suite = [[xctestcasesuite alloc] init]; (condition* condition in conditions) {   mytestcase* case = [[mytestcase alloc] initwithcondition:condition];   [suite addtestcase:case]; } [suite runtest]; 

is there way this? thanks!

i able achieve wanted looking @ code of https://github.com/michalkonturek/xcparameterizedtestcase

specifically replicated mechanism put in place in https://github.com/michalkonturek/xcparameterizedtestcase/blob/master/source/xcparameterizedtestcase.m , able wanted.

one drawback of method instances of same test reported same way , there no way know particular instance failing example. circumvent that, added dynamic class creation inherits base xctestcase class:

// create dynamic class reporting nsstring* testclassname = [nsstring stringwithformat:@"%@test", [condition.description capitalizedstring]]; class testclass = objc_allocateclasspair([mytestcase class], [testclassname utf8string], 0); objc_registerclasspair(testclass); 

then can instantiate each test case class with

xctestcase *test = [[nsclassfromstring(testclassname) alloc] initwithinvocation:invocation                                                                     forcondition:condition]; 

i going try implement in generic xcparameterizedtestcase class...


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -