A pure-Swift BDD Framework
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/Swiftest
.gitignore
LICENSE
Package.swift
README.md
wercker.yml

README.md

Swiftest  

Current Version: 0.1.9.

Note: Swiftest is not being updated further in favor of Speck

A 100% pure Swift BDD framework for Mac and Linux.

Features

  • runs on Linux and Mac (note: only the open-source Swift is supported, sorry XCode users)
  • familiar syntax inspired by RSpec and Jasmine
  • natural, readable assertions for most Swift core types
  • works with Swift protocols (compatible with objects implementing Equatable or Comparable)
  • free of dependencies (except LibC)
  • before/after suite / spec hooks
  • command-line client
  • extensible
  • customizable formatters
  • multiple formatters

To see all the available assertions and features available, check out the example project.

Installation

Swiftest can be installed using the Swift package manager. Add this line to your Package.swift file to install the latest version.

.Package(url: "https://github.com/bppr/Swiftest.git", Version(0,1,9))

Configuration

Create a spec target that depends on the module under test. In your main.swift file of your spec target, register your spec classes.

import Swiftest

Swiftest.register([
  MyFirstSpec.self,
  MySecondSpec.self
])

try Swiftest.run()

Use

Once your tests are registered and your runner is configured, you can simply build your test project (swift build) and run your tests

.build/Specs/Specs

Or run a single test

.build/Specs/Specs Sources/Specs/SomeIndividualSpec.swift

Or run with a different formatter ("progress" is built in, but it's easy to add custom formatters).

.build/Specs/Specs -l progress

(right now the test-to-filename matching uses fnmatch under the hood, and can use many more improvements, but this works for now)

For further instructions on installing and configuring Swiftest, see the wiki page.