Unit testing Parse framework iOS

后端 未结 3 719

I am attempting to write unit tests for an iOS application which makes use of the Parse backend framework, and after much experimentation seem to be failing at writing succe

3条回答
  •  悲哀的现实
    2020-12-18 09:55

    With the macro WAIT_WHILE(, ) in https://github.com/hfossli/AGAsyncTestHelper/ you can write

    - (void)testSaveUser
    {
        __block BOOL saved = NO;
        [PFUser saveUser:userModelMock withBlock:^(BOOL success, NSError *error) {
            saved = YES;
        }];
        WAIT_WHILE(!saved, 10.0, @"Failed to save user within 10 seconds timeframe);
    }
    

提交回复
热议问题