All Projects β†’ BinaryBirds β†’ spec

BinaryBirds / spec

Licence: MIT license
Unit testing Vapor 4 applications through declarative specifications.

Programming Languages

swift
15916 projects
Makefile
30231 projects

Projects that are alternatives of or similar to spec

Js Unit Testing Guide
πŸ“™ A guide to unit testing in Javascript
Stars: ✭ 1,346 (+4106.25%)
Mutual labels:  tdd, unit-test
automock
A library for testing classes with auto mocking capabilities using jest-mock-extended
Stars: ✭ 26 (-18.75%)
Mutual labels:  tdd, unit-test
Entwine
Testing tools and utilities for Apple's Combine framework.
Stars: ✭ 306 (+856.25%)
Mutual labels:  xctest, unit-test
Quiz App
A repository reflecting the progress made on the "How to Build iOS Apps with Swift, TDD & Clean Architecture" YouTube series, by Caio & Mike.
Stars: ✭ 230 (+618.75%)
Mutual labels:  tdd, xctest
mocha-cakes-2
A BDD plugin for Mocha testing framework
Stars: ✭ 44 (+37.5%)
Mutual labels:  tdd
solidity-tdd
Solidity Test Driven Development Boilerplate Project
Stars: ✭ 27 (-15.62%)
Mutual labels:  tdd
kata
TDD, Refactoring kata in many languages
Stars: ✭ 14 (-56.25%)
Mutual labels:  tdd
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Stars: ✭ 3,019 (+9334.38%)
Mutual labels:  unit-test
Build-A-Laravel-App-With-TDD
It's time to take the techniques we learned in Laravel From Scratch, and put them to good use building your first real-world application. Together, we'll leverage TDD to create Birdboard: a minimal Basecamp-like project management app. This series will give us a wide range of opportunities to pull up our sleeves and test our Laravel chops. As al…
Stars: ✭ 36 (+12.5%)
Mutual labels:  tdd
baserepo
Base repository
Stars: ✭ 71 (+121.88%)
Mutual labels:  tdd
kmpapp
πŸ‘¨β€πŸ’» Kotlin Mobile Multiplatform App (Android & iOS). One Code To Rule Them All. MVVM, DI (Kodein), coroutines, livedata, ktor, serialization, mockk, detekt, ktlint, jacoco
Stars: ✭ 34 (+6.25%)
Mutual labels:  unit-test
VCore
VCore is a Swift collection containing objects, functions, and extensions that I use for my projects
Stars: ✭ 32 (+0%)
Mutual labels:  unit-test
aria-vue
Testing tools for Vue components
Stars: ✭ 21 (-34.37%)
Mutual labels:  unit-test
Peasy
A pure Swift mock server for embedding and running directly within iOS/macOS UI tests. Easy peasy.
Stars: ✭ 32 (+0%)
Mutual labels:  xctest
java-8-matchers
Hamcrest Matchers for Java 8 features
Stars: ✭ 23 (-28.12%)
Mutual labels:  tdd
utest
Lightweight unit testing framework for C/C++ projects. Suitable for embedded devices.
Stars: ✭ 18 (-43.75%)
Mutual labels:  tdd
ginkgo4j
A Java BDD Testing Framework (based on RSpec and Ginkgo)
Stars: ✭ 25 (-21.87%)
Mutual labels:  tdd
ViewControllerPresentationSpy
Unit test presented and dismissed iOS view controllers, including alerts and action sheets
Stars: ✭ 117 (+265.63%)
Mutual labels:  xctest
TestIt
Generate unit testing boilerplate from kotlin files.
Stars: ✭ 32 (+0%)
Mutual labels:  unit-test
bdd-for-all
Flexible and easy to use library to enable your behavorial driven development (BDD) teams to easily collaborate while promoting automation, transparency and reporting.
Stars: ✭ 42 (+31.25%)
Mutual labels:  tdd

Spec

Unit testing Vapor 4 applications through declarative specifications.

Install

Add the repository as a dependency:

.package(url: "https://github.com/binarybirds/spec.git", from: "1.2.0"),

Add Spec to the target dependencies:

.product(name: "Spec", package: "spec"),

Update the packages and you are ready.

Usage example

Api

@testable import App
import Spec

final class BlogApiTests: XCTestCase {
    
    func testLogin(_ app: Application) throws {

        struct UserLoginRequest: Content {
            let email: String
            let password: String
        }
        struct UserTokenResponse: Content {
            let id: String
            let value: String
        }

        let userBody = UserLoginRequest(email: "[email protected]", password: "foo")
        
        var token: String?

        try app
            .describe("Login request should return ok")     // describe spec
            .post("/api/user/login")                        // post to endpoint
            .header("accept", "application/json")           // add header
            .body(userBody)                                 // add content body
            .expect(.ok)                                    // status code
            .expect(.json)                                  // media type
            .expect("content-length", ["81"])               // expect header
            .expect(UserTokenResponse.self) { content in    // expect content
                token = content.value                       // retrieve content
            }
            .test(.inMemory)                                // test in memory

        _ = try XCTUnwrap(token)

    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].