Giter Site home page Giter Site logo

quick / spry Goto Github PK

View Code? Open in Web Editor NEW
325.0 15.0 11.0 14.62 MB

A Mac and iOS Playgrounds Unit Testing library based on Nimble.

License: Apache License 2.0

Swift 99.24% Objective-C 0.76%
testing unittest ios macos osx swift nimble quick playground ipad

spry's Introduction

Travis Platforms Xcode Playgrounds iPad Playgrounds License

Spry

Spry is a Swift Playgrounds Unit Testing library based on Nimble.

The best thing about Spry is that the API matches Nimble perfectly. Which means once you've created your code and tests in a Playground, you can copy them directly into your Xcode project without needing to (re)write them again :)

Nimble: The code in this library has been copied directly from the Nimble project. However it is currently a stripped down version.

Download

There are a couple of ways you can download Spry.

Template

You can download a Playground including the latest version of Spry. Consider this a boilerplate template. It includes Spry in the Sources folder of the Playground, so you can simply start writing tests alongside your code in the Playground.

iPad Playgrounds
Xcode Playgrounds

Manual

You can also download or checkout this repo and simply copy the files into your existing Playground manually. Simply copy the entire Spry folder into your Playground's Sources folder. Easy Peasy!

Nimble-esque

Spry is a stripped down (Lite) version of Nimble that includes a subset of Nimble's Matchers.

Note: This is a port of Nimble only, since Quick doesn't really make sense in the context of a Playground.

The following features are NOT supported (since they are a part of Quick):

describe
context
it

The following features are already implemented:

  • expect
  • to
  • beAKindOf
  • beAnInstanceOf
  • beCloseTo
  • beEmpty
  • beginWith
  • beGreaterThan
  • beGreaterThanOrEqualTo
  • beIdenticalTo
  • beLessThan
  • beLessThanOrEqualTo
  • beLogical
  • beNil
  • beVoid
  • containElementSatisfying
  • contain
  • endWith
  • equal
  • haveCount
  • match
  • satisfyAnyOf

The following features are not yet implemented:

  • toEventually
  • async
  • matchError
  • throwError
  • failWithMessage

Usage

Using Spry is as simple as writing an expect case:

func add<T: ExpressibleByIntegerLiteral>(_ x: T, _ y: T) -> T {
    return x + y
}

// Spry test case
expect(add(4, 5)).to(equal(9))

If you're already familiar with Nimble, then you already know how to use Spry.

For full details on how to write your tests with Spry, I suggest reading over the Nimble docs. Keeping in mind that not all features are currently included.

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.