Liking cljdoc? Tell your friends :D

eggplant

Behaviour Driven Development (BDD) Library for Clojure

Details

Eggplant is a behaviour driven development (BDD) library for Clojure. Eggplant's focus is on data driven testing to enable a data driven language such as Clojure to be adequately tested. It will use specifications written in a very simple user friendly language to enforce executable tests that can be automated along with providing living documentation.

Our Motto: "Simplicity is key"

Eggplant just works, it has simple to read phrases and a BDD style test can be written in under 30 seconds, we do not try and over complicate things.

Features:

  1. Simplicity: a key feature we do not want to over complicate things.
  2. Four keywords: given, when-we-process, then-we-expect, then-we-do-not-expect form the BDD style of testing.
  3. Data driven: Data driven testing using data tables with the where clause.

Examples


;; Preferable way of writing user readable
(defspec example-specification-multiplication
         (testing "Example specification showing multiplication given 2 when we process 2 * 2 then we expect 4"
           (given 2 test-data
                  (then-we-expect 4 (when-we-process * 2 test-data)))))

(defspec example-specification-true
         (testing "A full length example specification which is true 4 * 2 = 8"
           (given 4 test-data
                  (then-we-expect 8 (when-we-process * 2 test-data)))))

(defspec example-specification-false
         (testing "A full length example specification which is false 4 * 2 = 6 ! False"
           (given 4 test-data
                  (then-we-do-not-expect 6 (when-we-process * 2 test-data)))))

(defspec example-specification-with-strings
         (testing "String upper case specification"
           (given "tom" test-data
                  (then-we-expect "TOM" (when-we-process str/upper-case test-data)))))

(defspec example-table-test
  (testing "Example table testing + with assertion of ="
    (-> (expect (function-under-test +) (assertion =))
        (where
         (test-data-row [3 3] 6)
         (test-data-row [4 4] 8)
         (test-data-row [2 3] 5)))))

Contribute

Always looking for contribution so please reach out and take some of the issues or create new ones. Beginner friendly.

Dependency

Available: Clojars Project

Leiningen/Boot

    [eggplant "0.1.1"] 

Gradle

    compile "eggplant:eggplant:0.1.1"

Maven

    <dependency>
      <groupId>eggplant</groupId>
      <artifactId>eggplant</artifactId>
      <version>0.1.1</version>
    </dependency>

Thanks

Thanks to some key players in the Clojure space that makes this fun all possible:

Can you improve this documentation? These fine people already did:
egg-plant & Stuart
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close