github.com/crossroadlabs/XCTest3

Swift 3.0 compatibility shims for XCTest


License
Apache-2.0

Documentation

XCTest3

XCTest3

🐧 linux: ready 🐤 3.0: ready Build Status Carthage compatible Platform OS X | iOS | tvOS | watchOS | Linux Swift version GitHub license GitHub release

Swift XCTest Shims that mimic Swift 3.0 APIs. For thous who wants to maintain Swift multiple versions compatibility

Goals

XCTest3 library was mainly introduced to fulfill the needs of Swift Express - web application server side framework for Swift. Now it's a part of Crossroad Labs Foundation.

Still we hope it will be useful for everybody else.

Bother less with #if swift(>=3.0) ;)

Getting started

Installation

Package Manager

Add the following dependency to your Package.swift:

.Package(url: "https://github.com/crossroadlabs/XCTest3.git", majorVersion: 0)

Run swift build and build your app. Package manager is supported on OS X, but it's still recommended to be used on Linux only.

Carthage

Add the following to your Cartfile:

github "crossroadlabs/XCTest3"

Run carthage update and follow the steps as described in Carthage's README.

CocoaPods

Add the following to your Podfile:

pod 'XCTest3'

Make sure that you are integrating your dependencies using frameworks: add use_frameworks! to your Podfile. Then run pod install.

Examples

Introduction:

OK, XCTest has changed as well since introduction of Swift 3.0. APIs are different and you either have to use #if swift(>=3.0) excessively or use XCTest3. With XCTest3 you just use Swift 3.0 APIs. You can read more about it in Boilerplate and Foundation3.

Here is an example on how to use XCTest with Swift 3.0 APIs

let expectation = self.expectation(withDescription: "test expectation")
        expectation.fulfill()

self.waitForExpectations(withTimeout: 0)

Absent API?

OK, guys. We wrap XCTest APIs as we encounter them. Want more? We are glad to accept contributions. Let's make Swift 3.0 compatibility layer together.

Keep your tests clean ;)

Contributing

To get started, sign the Contributor License Agreement.

Crossroad Labs by Crossroad Labs