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) } } }
我正在研究像SpecFlow这样的BDD解决方案,并查看了各种示例,我看到了对其他TDD框架的引用,比如我熟悉的MsTest和NUnit。我理解Specflow和BDD提供的内容的价值。我在某处读到Specflow和BDD“包装”了您的单元测试。那么,对于Specflow来说,“步骤定义”是否与MsTest或Nunit一样起到同样的作用,而这些其他框架只是用来代替步骤定义的选项?
我检查了serenity文档中提取的测试结果,下面是代码,它不起作用 结果格式格式 = 结果格式.XML;TestOutcomes results = TestOutcomeLoader.loadTestOutcomes().inFormat(format) 尝试使用以下代码及其工作原理, OutcomeFormat format = OutcomeFormat。JSONTestOutcomeLo
我正在使用Cucumber结合Serenity框架编写一些BDD自动化测试。在我的BDD测试中,我需要一些超时机制,这样如果cucumber场景或Serenity中的一个步骤花费的时间太长,它就会超时,测试就会失败。 我在下面的链接中发现了一些信息:https://groups.google.com/forum/#!topic/cukes/QaPvVMnqDvE 因此,对于Cucumber,步骤定
我想知道是否有任何用于Python的BDD风格的“Description-it”单元测试框架可以维护并准备好生产。我已经找到了Description,但它似乎没有被维护,也没有文档。我还发现它达到了1.0,但它似乎只是添加了语法糖,而不是编写断言。我真正需要的是类似于RSpec和Jasmine的东西,它使我能够设置测试套件。descripe-it语法允许测试一个函数的多个情况。而传统的断言结构对每
我使用Mocha作为测试框架来测试我的Node.js项目。我希望遵循BDD风格来组织我的测试/规范。 我曾经使用cucumber编写一些测试,cucumber使用BDD样式,比如givity-when-then子句。但对于摩卡来说,它使用了不同的语言来“描述”规范。您可以使用嵌套的Description语句来描述规范。我想知道命名摩卡测试的最佳做法是什么。谢了。
测试框架工具 Karma Intern NightWatch.js
null 谢了。