Skip to content
This repository was archived by the owner on Nov 16, 2018. It is now read-only.

Console Colours

aslakhellesoy edited this page Aug 13, 2010 · 23 revisions

The console output for Cucumber colours steps according to how execution went. In addition to that, matched step variables are highlighted. Here is an example of how a single step gets printed:

Given I have 487 cucumbers in my belly # features/vegetable_features.feature:49

You can tweak the colours by defining a $CUCUMBER_COLORS variable in your shell, very much like you can tweak the colours of the familiar POSIX command ls with
$LSCOLORS or $LS_COLORS.

The colours that you can change are:

Key Default colours
undefined yellow (v0.2.0 and up)
pending yellow
pending_param yellow,bold
failed red
failed_param red,bold
passed green
passed_param green,bold
skipped cyan
skipped_param cyan,bold
comment grey
tag blue (v0.2.0 and up)

For instance, if your shell has a black background and a green font (like the
“Homebrew” settings for OS X’ Terminal.app), you may want to override passed
steps to be white instead of green. Examples:

export CUCUMBER_COLORS=passed=white
export CUCUMBER_COLORS=passed=white,bold:passed_param=white,bold,underline

Aslak likes to highlight all parameters in magenta, so he uses this:

export CUCUMBER_COLORS=pending_param=magenta:failed_param=magenta:passed_param=magenta:skipped_param=magenta

(If you’re on Windows, use SET instead of export).
To see what colours and effects are available, just run this in your shell:

ruby -e "require 'rubygems'; require 'term/ansicolor'; puts Term::ANSIColor.attributes"

Although not listed in the output, you can also use grey.

Clone this wiki locally