Code Monkey home page Code Monkey logo

fttestingkit's Introduction

FTTestingKit logo

FTTestingKit

Cocoapods Cocoapods platforms Cocoapods

A set of helpers for simple creation of mockups, random values and testing of asynchronous code.

Installation

When using Swift package manager add this line to your dependencies or install using Xcode 11 or newer:

.package(url: "https://github.com/futuredapp/FTTestingKit.git", from: "0.5.0")

When using CocoaPods add following line to your Podfile:

pod 'FTTestingKit', '~> 0.5'

When using PromiseKit you can use either FTTestingKitPromiseKit target for testing promises or add subspec to your Podfile:

pod 'FTTestingKit', '~> 0.5', subspecs: ['PromiseKit']

Features

Main features of this library are generating mockups, random values, arrays and asynchronous testing.

Mockups

For simple repeated execution the library offers Ruby-like extension on Int type. This is helpful in measurement tests.

10.times {
    doSomething()
}
10.times(doSomething)

This extension can create arrays too:

10.times {
    Int.random()
}
10.times(String.random)

The framework extends some basic types (Date, String) with random generation similar to Int. All these types conform to Mockup protocol which formally describes this functionality.

Date.random()
String.random()
Int.random(count: 10)

Expectations

The framework extends XCTestCase with simple methods to call transactional asynchronous test like this:

expect(within: 0.5) { reply in
    DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
        reply(.success)
    }
}

Extension for PromiseKit builds on this and offers testing promises using so-called belief in promise method:

believe(for: 0.5, in: someFunctionReturningPromise())

Author

Matěj Kašpar Jirásek, [email protected]

License

FTTestingKit is available under the MIT license. See the LICENSE file for more info.

fttestingkit's People

Contributors

mkj-is avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

fttestingkit's Issues

Documentation

  • README
  • File headers
  • Inline documentation
  • Generated documentation

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.