Latest 0.2.0
Homepage https://github.com/azu/XCTestCase-RunAsync
License MIT
Platforms ios 6.0, requires ARC
Dependencies NSRunLoop+PerformBlock
Frameworks XCTest
Authors

Version
License
Platform

This library is wrapper for ishkawa/NSRunLoop-PerformBlock.

You can write async testcase by Mocha‘s done style.

Usage

@interface ExampleTests : XCTestCase
@end

@implementation ExampleTests

- (void)testExample{
    [self runAsyncWithBlock:^(AsyncDone done) {
      // async function
        double delayInSeconds = 2.0;
        dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
        dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
        dispatch_after(popTime, queue, ^(void){
            done();// => done async test
        });
    }];
}
@end

API

typedef void(^AsyncDone)();

@interface XCTestCase (RunAsync)
- (void)runAsyncWithBlock:(void (^)(AsyncDone done)) runTestCode;

- (void)runAsyncWithBlock:(void (^)(AsyncDone done)) runTestCode timeout:(NSTimeInterval) timeout;
@end

Installation

XCTestCase+RunAsync is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "XCTestCase-RunAsync"

License

XCTestCase+RunAsync is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "XCTestCase-RunAsync",
    "version": "0.2.0",
    "summary": "[iOS] write async testcase by Mocha's done style.",
    "homepage": "https://github.com/azu/XCTestCase-RunAsync",
    "license": "MIT",
    "authors": {
        "azu": "[email protected]"
    },
    "source": {
        "git": "https://github.com/azu/XCTestCase-RunAsync.git",
        "tag": "0.2.0"
    },
    "social_media_url": "https://twitter.com/azu_re",
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true,
    "source_files": "Classes/**/*.{h,m}",
    "dependencies": {
        "NSRunLoop+PerformBlock": []
    },
    "frameworks": "XCTest"
}

Pin It on Pinterest

Share This