Latest 0.1.0
Homepage https://github.com/iheartradio/xctest-additions
License MIT
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Frameworks XCTest
Authors

xctest-additions

This repository contains code made publicly available by iHeartRadio to extend and make testing using Apple’s XCTest framework easier.
Feel free to use, copy and modify this code as you wish, maintaining and respecting original copyright notices if present.

XCTAsyncTestCase

XCTest-capable drop-in replacements for GHUnit‘s class for writing asynchronous tests, GHAsyncUnitTestCase.
This class will let you test asynchronous behavior using regular XCTest targets so they can be ran easily from Xcode or Xcode Server.

Drag the files XCTAsyncTestCase.h and XCTAsyncTestCase.m into your project and add them to your iOS tests target.

Example test case on blocks usage, TestAsync.m:

@interface TestAsync : XCTAsyncTestCase

@end

@implementation TestAsync
- (void)testBlockSample
{
    [self prepare];
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(){
        sleep(1.0);
        [self notify:kXCTUnitWaitStatusSuccess];
    });
    // Will wait for 2 seconds before expecting the test to have status success
    // Potential statuses are:
    //    kXCTUnitWaitStatusUnknown,    initial status
    //    kXCTUnitWaitStatusSuccess,    indicates a successful callback
    //    kXCTUnitWaitStatusFailure,    indicates a failed callback, e.g login operation failed
    //    kXCTUnitWaitStatusCancelled,  indicates the operation was cancelled
    [self waitForStatus:kXCTUnitWaitStatusSuccess timeout:2.0];
}

xtestify.sh

Script to automatically convert any old GHUnit test classes to Apple’s new XCTests.
Will search for GHUnit’s assertions and class names and replace them with the corresponding XCTest substitutions.

Latest podspec

{
    "name": "XCTAsyncTestCase",
    "version": "0.1.0",
    "summary": "Asynchronous capable XCTestCase subclass",
    "description": "                   Allows testing of asynchronous APIs using XCTest much like gh-unit.n",
    "homepage": "https://github.com/iheartradio/xctest-additions",
    "license": {
        "type": "MIT",
        "text": "                  n                  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:nn                  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.nn                  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.n"
    },
    "authors": {
        "sveinungkb": "[email protected]"
    },
    "source": {
        "git": "https://github.com/iheartradio/xctest-additions.git",
        "tag": "0.1.0"
    },
    "source_files": "XCTAsyncTestCase.{h,m}",
    "frameworks": "XCTest",
    "requires_arc": true
}

Pin It on Pinterest

Share This