Clojure的BDD测试框架

时间:2014-03-16 14:12:55

标签: clojure bdd

谷歌搜索显示了过去几年中这个问题的答案,我在github上看过的一些项目已经很长时间没有提交了。目前有人正在做任何事情吗?我很感兴趣。还做什么并行测试?我是Clojure的新手,但似乎缺少的一件事是测试框架和ScalaTest一样好。

4 个答案:

答案 0 :(得分:3)

我认为speclj仍然有效。

答案 1 :(得分:1)

https://github.com/zenmodeler/spexec是一个相对较新的东西,致力于BDD。

答案 2 :(得分:1)

https://github.com/cucumber/cucumber-jvm也有clojure支持,clojure目录中有一个可运行的示例;其使用的扩展示例如下:https://github.com/gphilipp/bdd-guide-clojure

答案 3 :(得分:1)

Eggplant是一个令人兴奋的新BDD开源库,用于Clojure。您还可以阅读here

例如:

(defspec multiplying-two-numbers
  (specification
   {:given "a input of :a and :b"
    :when  "we #* :c"
    :then  "we expect :result"
    :data {:a 3 :b 4 :result 12}}))

(defspec change-a-string-to-uppercase
 (specification
  {:given "a input of :a"
   :when  "we #clojure.string/upper-case"
   :then  "we expect :result"
   :data {:a "hello" :result "HELLO"}}))

(defspec finding-the-max-of-two-numbers
 (specification
  {:expect "the #max of :a and :b"
   :where  {:a 2 :b 3 :expected 3}}))

"简单是关键"

五个关键词:

  • 给予
  • 然后
  • 期望
  • ,其中

https://github.com/perkss/eggplant

专注于数据驱动开发,并通过示例使用人类可读形式对其进行测试,该形式随着测试的增长而维护规范文档。

标准clojure.test将运行这些与任何IDE和构建工具兼容。

开发人员可以在很短的时间内编写一个快速易于遵循的BDD测试。