Swiftest Swift 的 BDD 测试框架

我要开发同款
匿名用户2014年07月01日
112阅读

技术信息

授权协议
未知

作品详情

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

示例代码:

import Swiftest// create a class that iherits from SwiftestSuite (it's just NSObject)// ad defie the 'spec' member property of that class usig `describe`// be sure to use `let` ad ot `var` here!class SampleSpec : SwiftestSuite {  let spec = describe("Swiftest") {    it("adds 1 + 1!") {      expect(1 + 1).toEqual(2)    }    it("kows true from false!") {      expect(true).toBeTrue()      expect(true).ot().toBeFalse()    }    example("comparig letters of the alphabet!") {      expect("abc").toEqual("abc")    }    it("kows what stuff is NOT other stuff!") {      expect(2 + 2).ot().toEqual(5)    }    describe("arrays!") {      example("special assertios for array types!") {        expect([1, 2, 3]).toEqual([1, 2, 3])        expect([1, 2, 3]).toCotai(1)        expect([1, 2, 3]).toCotai(1, 3)      }    }    it("does ifty stuff with closures") {      var a = 0      expect({ a += 1 }).toChage({ a }).to(1)      expect({ a += 1 }).toChage({ a }).from(1).to(2)      expect({ a += 2 }).toChage({ a }).by(2)    }    example("dictioaries have special assertios too!") {      expect([ "key" : "val" ]).toEqual([ "key" : "val"])      expect([ "key" : "val" ]).toHaveKey("key")      expect([ "key" : "val" ]).toHaveValue("val")    }    example("your ow classes!") {      // Perso is a class that implemets Comparable      let perso1 = Perso(ame: "Bob")      let perso2 = Perso(ame: "Alice")      expect(perso1).ot().toEqual(perso2)    }  }}

功能介绍

Swiftest 是 Swift 编程语言一个 BDD 风格的规范框架。 示例代码: import Swiftest

// create a class that inherits from ...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论