lundi 30 mars 2015

Unit tests using Nocilla failing randomly

Current Setup : AFNetworking + Kiwi (for unit tests) + Nocilla (Stubbing network calls)


Issue Faced :


Some of the tests that use Nocilla to stub HTTP request fail randomly at times.



__block NSString *fetchedData;
[someData updateDataWithHandler:^(NSString *errorMessage, AFHTTPRequestOperation *operation) {
[[errorMessage should] equal:@"No response."];
fetchedData = (errorMessage) ? @"Failure" : @"Success";
}];

[[expectFutureValue(fetchedData) shouldEventuallyBeforeTimingOutAfter(4)] equal: @"Failure"];`


At times when this method fails, the assertion says



expected subject to equal (NSString) "Failure", got ((null)) (null)



Any ideas into what might be causing these tests to fail randomly ?


Aucun commentaire:

Enregistrer un commentaire