Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/perkss/eggplant
A behaviour driven development (BDD) library for Clojure. Simplicity is key.
https://github.com/perkss/eggplant
bdd bdd-framework bdd-specs bdd-style bdd-tests bddocs clojure data-driven spec specification specification-by-example
Last synced: about 2 months ago
JSON representation
A behaviour driven development (BDD) library for Clojure. Simplicity is key.
- Host: GitHub
- URL: https://github.com/perkss/eggplant
- Owner: perkss
- License: apache-2.0
- Created: 2016-12-27T13:52:52.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2023-08-22T20:16:32.000Z (over 1 year ago)
- Last Synced: 2024-10-18T09:21:08.032Z (2 months ago)
- Topics: bdd, bdd-framework, bdd-specs, bdd-style, bdd-tests, bddocs, clojure, data-driven, spec, specification, specification-by-example
- Language: Clojure
- Homepage: https://perkss.github.io/#/clojure#text-body
- Size: 56.6 KB
- Stars: 21
- Watchers: 2
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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. The power of Clojure maps will be our friend!
[Blog Post on eggplant](https://perkss.github.io/#/clojure#text-body)
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.## How to use:
Please work from the examples below. Basically two forms the give or the expect.
Then provide the text and the keyword names making sure to use : before for example :a.
On the providing of the function under test name please provide namespace unless in core and prefix it with #
to symbolize a function call standard for Clojure anonymous functions. Then provide the map of data in the :data
or :where map as appropriate and make sure all keywords provided in the BDD text are mapped appropriately.
## Examples``` clojure
[eggplant.core :refer :all](defspec multiplying-two-numbers
(specification
{:given "a input of :a and :b"
:when "we #*"
: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}}))```
## ContributeAlways looking for contribution so please reach out and take some of the issues or create new ones. Beginner friendly.
## DependencyAvailable: [![Clojars Project](https://img.shields.io/clojars/v/eggplant.svg)](https://clojars.org/eggplant)
#### Leiningen/Boot
```
[eggplant "0.2.0"]
```
#### Gradle
```
compile "eggplant:eggplant:0.2.0"
```
#### Maven
```
eggplant
eggplant
0.2.0
```
## ContributorsMany thanks to those who have contributed to Eggplant:
- Stuart Perks @perkss
- Dan Nicolici @dannicolici