Giter Club home page Giter Club logo

cucumber-jvm-clojure's Introduction

Cucumber-Clojure

Maven Central

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.

Installation

Maven

To use cucumber-jvm-clojure in your project, add the following dependency to your pom.xml:

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-clojure</artifactId>
    <version>2.0.1</version>
    <scope>test</scope>
</dependency>

Running

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

  • lein-cucumber
  • JunitRunner

lein-cucumber

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 [com.siili/lein-cucumber "1.0.7"] to :plugins in your project.clj. This allows you to run all Cucumber features with lein cucumber

JUnitRunner

The instructions for the JUnitRunner can be found here

Miscellaneous

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

Contributions are most welcome.

cucumber-jvm-clojure's People

Contributors

aslakhellesoy avatar hiredman avatar brasmusson avatar rplevy-draker avatar mpkorstanje avatar cedric-lamalle avatar nilswloka avatar dkowis avatar mlvandijk avatar shaolang avatar dorzey avatar tychobrailleur avatar rferraz avatar rapaul avatar nhajratw avatar mva avatar kopa avatar duey-sonian avatar punkisdead avatar duck1123 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.