Using Cucumber in a Continuous Integration (CI) environment is relatively straightforward.

The cucumber executable will exit with an exit status different from 0 if one or more scenarios are failing. This is all your CI server needs to know.

First, you have to make sure your CI server executes Cucumber. Most CI setups invoke some kind of build tool. Common build tools are:

We recommend executing Cucumber from one of these on a CI server.

Rake

If your CI server is using Rake, make sure that Rake executes your Cucumber task.

Ant JUnit output

Many CI servers can interpret XML files produced by the Ant JUnit task and display them as HTML. Some can even create reports over time.

If you’re using such a CI server, we recommend you use Cucumber with the JUnit formatter.

To get started using Cucumber in Jenkins, add a build step running cucumber -f junit --out WORKSPACE and then check the ‘Publish JUnit test result report’, and enter \*.xml in the ‘Test report XMLs’ field. Save and run. (Later improve by using a Rake task and placing your output in a subfolder).

If you’re using Ant, you can run Cucumber with the exec task.

Jenkins

A Jenkins plugin is available that produces beautiful Cucumber reports.

Follow the install instructions for Cucumber Reports plugin.

Overview Page:

jenkins Cucumber report

Report Page:

jenkins Cucumber report

You can help us improve this documentation. Edit this page.