Skip to content


Subversion checkout URL

You can clone with
Download ZIP
branch: master


Cucumber-Clojure is a Cucumber implementation for Clojure.

This document is the reference for features that are specific to Cucumber-Clojure.

Please see the general reference for features that are common to all Cucumber implementations.

Step Definitions

Clojure step definitions are defined by using the provided macros. For example:

(use 'clojure-cukes.core)
(use 'clojure.test)

(Given #"^I have (\d+) big cukes in my belly$" [cukes]
       (println cukes))

You can use a DataTable to define a list:

Given I have a table with its keys in a header row:
  | id | name  | created-at    |
  | 55 | "foo" | 1293884100000 |
  | 56 | "bar" | 1293884100000 |

Simply declare the following:

(Given #"^I have a table with its keys in a header row:$" [data]
  (reset! most-recent (table->rows data)))

In this case, the DataTable is flattened to a vector of hashes

[{:id 55, :name "foo", :created-at 1293884100000}
{:id 56, :name "bar", :created-at 1293884100000}]

before invoking the step definition.


There are several ways to run scenarios with Cucumber-Clojure:

  • lein-cucumber
  • JunitRunner


Leiningen uses clojure.test to run Cucumber. All you need is a single entry point:

(ns clojure-cukes.test.core
  (:use [clojure-cukes.core])
  (:use [clojure.test]))

(deftest run-cukes
  (. cucumber.api.cli.Main (main (into-array ["--plugin" "pretty" "--glue" "test/features/step_definitions" "test/features"]))))

You then need to add [lein-cucumber "1.0.2"] to :plugins in your project.clj. This allows you to run all Cucumber features with lein cucumber


The instructions for the JUnitRunner can be found here


This module needs further documentation. The following examples show supported features:

Contributions are most welcome.

Something went wrong with that request. Please try again.