GithubHelp home page GithubHelp logo

xctest-additions's Introduction

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.

xctest-additions's People

Contributors

designatednerd avatar funroll avatar gbh avatar jmoody avatar scottheaberlin avatar stevenp avatar sveinungkb avatar vincilbishop avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.