Liking cljdoc? Tell your friends :D

eggplant

Behaviour Driven Development (BDD) Library for Clojure

BE PREPARED A BIG REWRITE IS HAPPENING!! BE EXCITED

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.

Blog: https://perkss.github.io/#/clojure#text-body

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.

Runs the same as clojure.test so will work in any IDE and with any driver such as lein test displaying the same differences between expected and actual.

Features:

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

Examples

[eggplant.core :refer :all]

(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}}))

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>

Contributors

Many thanks to those who have contributed to Eggplant:

  • Stuart Perks @perkss
  • Dan Nicolici @dannicolici

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, perkss & Stuart Perks
Edit on GitHub

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

× close