Swiftest Swift 的 BDD 测试框架

程序名称:Swiftest

授权协议: 未知

操作系统: OS X

开发语言: Swift

Swiftest 介绍

Swiftest 是 Swift 编程语言一个 BDD 风格的规范框架。

示例代码

import Swiftest

// create a class that inherits from SwiftestSuite (it's just NSObject)
// and define the 'spec' member property of that class using `describe`
// be sure to use `let` and not `var` here!

class SampleSpec : SwiftestSuite {
  let spec = describe("Swiftest") {
    it("adds 1 + 1!") {
      expect(1 + 1).toEqual(2)
    }

    it("kNows true from false!") {
      expect(true).toBeTrue()
      expect(true).not().toBeFalse()
    }

    example("comparing letters of the alphabet!") {
      expect("abc").toEqual("abc")
    }

    it("kNows what stuff is NOT other stuff!") {
      expect(2 + 2).not().toEqual(5)
    }

    describe("arrays!") {
      example("special assertions for array types!") {
        expect([1, 2, 3]).toEqual([1, 2, 3])

        expect([1, 2, 3]).toContain(1)
        expect([1, 2, 3]).toContain(1, 3)
      }
    }

    it("does nifty stuff with closures") {
      var a = 0

      expect({ a += 1 }).tochange({ a }).to(1)
      expect({ a += 1 }).tochange({ a }).from(1).to(2)
      expect({ a += 2 }).tochange({ a }).by(2)
    }

    example("dictionaries have special assertions too!") {
      expect([ "key" : "val" ]).toEqual([ "key" : "val"])
      expect([ "key" : "val" ]).toHaveKey("key")
      expect([ "key" : "val" ]).toHaveValue("val")
    }

    example("your own classes!") {
      // Person is a class that implements Comparable
      let person1 = Person(name: "Bob")
      let person2 = Person(name: "Alice")

      expect(person1).not().toEqual(person2)
    }
  }
}

Swiftest 官网

https://github.com/bppr/Swiftest

相关编程语言

提到 EclEmma 首先就要说到著名的 Java 覆盖测试工具...
Solex是一个WEB应用测试用的Eclipse插件。Solex可以...
Apache为我们提供了一个强大的工具 Cactus!它是一套...
Google C Testing Framework是Google公司用来在各种...
JdbcProxy 是 SourceForge 上一个开源的 Java 项目,...
Ripplet是一款负载测试工具,特征如下: 1)基于Apa...