samedi 19 septembre 2015

iOS : Kiwi testing random behaviour

I am trying to establish Kiwi for testing my iOS project.

My current setup : OS X 10.11 beta / Xcode 7 with iOS 9

I have downloaded Kiwi with Carthage and correctly added the framework to the test target.

Cartfile:

github "kiwi-bdd/Kiwi"

I have a very simple test that looks like this :

SPEC_BEGIN(Test)

describe(@"Download", ^{

    context(@"Download test request ", ^{

        it(@"check values are returned", ^{

            __block NSArray *entries = nil;

            [[Service sharedManager] getData:^(NSDictionary *data, NSError *error) {

                entries = [data allValues];

            }];

            [[theValue(entries) shouldEventually] haveCountOf:5];

        });

    });

});

SPEC_END

Service is making a request and executing the provided block when request completes.

Now when I run this test for the first time I can observe the required behaviour - the test is being run and if I put a breakpoint it gets hit, or if I put a NSLog statement it gets executed. However, when I make a subsequent run of the test, neither the breakpoint nor the NSLog gets hit on and the test simply passes without actually calling the getData: method. Sometimes the test gets executed properly but mostly it just says "Test succeeded" and thats it. Why does this happen ? Is there a bug with Kiwi ? Is there something else that I might have missed ?

I have the most basic setup possible - just a template Xcode iOS project and the Kiwi framework added manually(framework created with Carthage).

Any help is appreciated !

Aucun commentaire:

Enregistrer un commentaire