ios - XCUITest: Assertions in called test functions not working -


is possible call testfunction testcase working xctest assertions ?

-(void)testexample {      xcuiapplication *app = [[xcuiapplication alloc] init];      testloginmethod *loginmodule = [[testloginmethod alloc] init:app];     [loginmodule testexamplelogin]; } 

i want write test modules easy reuse or call them in different order. xctassert in called function not aborting test if false.

- (void)testexamplelogin { xcuielement *passwordsecuretextfield = app.securetextfields[@"passwordaadsfs"]; xctasserttrue([passwordsecuretextfield exists]); xctasserttrue([passwordsecuretextfield ishittable]); 

in called function, xctasserttrue skipped although textfield doesn't exist.

rather putting shared logic tests, factor out logic non-test functions, ie:

- (void) login {     // login     xctassert(yes); }  - (void) testlogin {     [self login]; }  - (void) testexample {    [self login];    // other stuff    xctassert(yes); } 

xcode runs issues when call functions prepended test other tests, doesn't care if have common test logic in non-test functions.


Comments