xctester 0.3.0

xctester 0.3.0

测试已测试
语言语言 SwiftSwift
授权 MIT
发布上次发布2016年5月
SPM支持 SPM

Boris Bügling 维护。



xctester 0.3.0

xctester

Swift 的命令行测试运行器。

安装

$ brew tap neonichu/formulae
$ brew install xctester

注意:这需要 Xcode 7.0

使用方法

创建烦人的 Xcode 项目仅为了运行测试真的是令人讨厌。使用 xctester,您不再需要这样做。

考虑以下测试用例

import XCTest

class MyTests : XCTestCase {
  func testAdd() {
    let result = add(3, 5)
    XCTAssertEqual(result, 8, "")
  }

  func testAddFail() {
    XCTAssertTrue(false, "lol")
  }

  func testThrows() {
    NSException.raise("Exception", format:"#yolo", arguments: getVaList([]))
  }
}

简单地运行 xctester 将执行测试并给出结果

MyTests

✅  -[MyTests testAdd]
❌  -[MyTests testAddFail]
    XCTAssertTrue failed - lol
❌  -[MyTests testThrows]
    failed: caught "Exception", "#yolo"

 Executed 2 tests, with 1 failures (1 unexpected) in 0.001 seconds

授权

xctester 依据 MIT 授权协议授权。更多信息请参阅 LICENSE