Skip to content

Instantly share code, notes, and snippets.

@avdyushin
Created February 5, 2019 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avdyushin/fdc1a176b18539ab45cae159bbb75757 to your computer and use it in GitHub Desktop.
Save avdyushin/fdc1a176b18539ab45cae159bbb75757 to your computer and use it in GitHub Desktop.
Unit Tests in Swift Playground
class Tests: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
super.tearDown()
}
}
class TestObserver: NSObject, XCTestObservation {
func testCase(_ testCase: XCTestCase,
didFailWithDescription description: String,
inFile filePath: String?,
atLine lineNumber: Int) {
assertionFailure(description, line: UInt(lineNumber))
}
}
let testObserver = TestObserver()
XCTestObservationCenter.shared.addTestObserver(testObserver)
Tests.defaultTestSuite.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment