All Projects → JohnSundell → Assert

JohnSundell / Assert

Licence: mit
A collection of convenient assertions for Swift testing

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Assert

Strikt
An assertion library for Kotlin
Stars: ✭ 310 (+349.28%)
Mutual labels:  test, assertions, assert
Kotest
Powerful, elegant and flexible test framework for Kotlin with additional assertions, property testing and data driven testing
Stars: ✭ 3,234 (+4586.96%)
Mutual labels:  test, testing-tools, assertions
Karate
Test Automation Made Simple
Stars: ✭ 5,497 (+7866.67%)
Mutual labels:  testing-tools, assertions
Pandera
A light-weight, flexible, and expressive pandas data validation library
Stars: ✭ 506 (+633.33%)
Mutual labels:  testing-tools, assertions
Httptest
Qiniu httptest utilities
Stars: ✭ 571 (+727.54%)
Mutual labels:  test, testing-tools
Testfx
MSTest V2 framework and adapter
Stars: ✭ 391 (+466.67%)
Mutual labels:  test, testing-tools
Tparse
CLI tool for analyzing and summarizing go test output. Pipe friendly. CI/CD friendly.
Stars: ✭ 445 (+544.93%)
Mutual labels:  test, testing-tools
Vue Testing Library
🦎 Simple and complete Vue.js testing utilities that encourage good testing practices.
Stars: ✭ 567 (+721.74%)
Mutual labels:  test, testing-tools
Faker
Faker is a pure Elixir library for generating fake data.
Stars: ✭ 673 (+875.36%)
Mutual labels:  test, testing-tools
Cypress
Fast, easy and reliable testing for anything that runs in a browser.
Stars: ✭ 35,145 (+50834.78%)
Mutual labels:  test, testing-tools
Mts
Project of Multi-protocol Test Tool opensourced by Ericsson
Stars: ✭ 34 (-50.72%)
Mutual labels:  test, testing-tools
Enzyme
JavaScript Testing utilities for React
Stars: ✭ 19,781 (+28568.12%)
Mutual labels:  test, assertions
Atrium
A multiplatform assertion library for Kotlin
Stars: ✭ 359 (+420.29%)
Mutual labels:  assertions, assert
Mocha
☕️ simple, flexible, fun javascript test framework for node.js & the browser
Stars: ✭ 20,986 (+30314.49%)
Mutual labels:  test, testing-tools
Zora
Lightest, yet Fastest Javascript test runner for nodejs and browsers
Stars: ✭ 356 (+415.94%)
Mutual labels:  test, testing-tools
Carina
Carina automation framework: Web, Mobile, API, DB
Stars: ✭ 549 (+695.65%)
Mutual labels:  test, testing-tools
Testify
A unit testing framework written in bash for bash scripts
Stars: ✭ 45 (-34.78%)
Mutual labels:  test, assert
Bluepill
Bluepill is a reliable iOS testing tool that runs UI tests using multiple simulators on a single machine
Stars: ✭ 3,080 (+4363.77%)
Mutual labels:  xcode, test
Haskell Hedgehog
Release with confidence, state-of-the-art property testing for Haskell.
Stars: ✭ 584 (+746.38%)
Mutual labels:  test, testing-tools
Should Enzyme
Useful functions for testing React Components with Enzyme.
Stars: ✭ 41 (-40.58%)
Mutual labels:  test, assertions

Assert

Swift Package Manager Twitter: @johnsundell

This repo contains a collection of assertion functions that you can use in your tests, as a complement to the assertions provided by XCTest, or other testing frameworks. This collection will likely grow over time, and you are more than welcome to contribute your own custom assertion functions as a pull request! 🚀

What's in the box?

Here is what you can currently assert using the functions that Assert provides:

That an expression threw a given error:

assert(try myFunction(), throwsError: MyError.anError)

That a closure threw a given error:

assertErrorThrown(MyError.anError) {
    try myFunction()
}

That a closure didn't throw an error:

assertNoErrorThrown {
    try myFunction()
}

That two objects are the same instance:

assertSameInstance(objectA, objectB)

Usage

Swift Package Manager

Add the following dependency to your Package.swift file:

.package(url: "https://github.com/johnsundell/assert", from: "1.0.0")

Then, you can import Assert in your tests, like this:

import Assert

Manually

You can also simply clone the repo, and drag the file Sources/Assert.swift into your Xcode project and add it to your test target.

Contributing

To work on Assert in Xcode, first generate an Xcode project through the Swift Package Manager:

$ swift package generate-xcodeproj

Then, make your changes to Assert.swift, and submit a pull request with your changes.

Questions or feedback?

Feel free to open an issue, or find me @johnsundell on Twitter.

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].