Skip to content

crossroadlabs/XCTest3

Repository files navigation

XCTest3

XCTest3

🐧 linux: ready ![🐤 3.0: ready](https://img.shields.io/badge/🐤 3.0-ready-reallyed.svg) Build Status Carthage compatible ![Platform OS X | iOS | tvOS | watchOS | Linux](https://img.shields.io/badge/platform-OS X | iOS | tvOS | watchOS | Linux-orange.svg) ![Swift version](https://img.shields.io/badge/Swift-2.2 | 3.0-blue.svg) ![GitHub license](https://img.shields.io/badge/license-Apache 2.0-lightgrey.svg) 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

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.

Add the following to your Cartfile:

github "crossroadlabs/XCTest3"

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

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.