Command line tool to build and run tests written using the Spectre Swift BDD testing framework.
Add the spectre-build dependency to your SPM test dependencies in Package.swift:
import PackageDescription
let package = Package(
name: "Person",
testDependencies: [
.Package(url: "https://github.com/kylef/spectre-build.git", majorVersion: 0),
]
)
Create some tests, and place them into the "Tests" directory:
import Spectre
import Person
func describePerson() {
describe("a person") {
let person = Person(name: "Kyle")
$0.it("has a name") {
try expect(person.name) == "Kyle"
}
$0.it("returns the name as description") {
try expect(person.description) == "Kyle"
}
}
}
describePerson()
Then simply build and run your tests:
$ swift build
$ .build/debug/spectre-build
-> a person
-> has a name
-> returns the name as description
2 passes and 0 failures