Skip to content
Robert Cochran edited this page Oct 1, 2013 · 2 revisions

The preferred way to use cuke_sniffer is through the command line. This page will discuss the different ways to use this gem.

Note for JRuby: Make sure you have your JRUBY_OPTS=--1.9


Cuke_sniffer can be ran from any location. If no arguments are supplied cuke_sniffer defaults to executing against the directory in which it was invoked from and printing the results to the console.

cd <your_features_folder>
cuke_sniffer

If you want to run from another location than the project you can specify the target location using the -p or --project argument with a folder path immediately following.

cuke_sniffer -p C:\ruby\my_cucumber_project
cuke_sniffer --project C:\ruby\my_cucumber_project

The same is to be said against the different cucumber sections:

-f  | --features
-s  | --step_definitions
-hk | --hooks

If you ever forget there is always the explanation in -h and --help

You also have the ability to prevent step definitions from being cataloged (You would do this if you do not care about dead steps and the times step_definitions are called). This being turned on will have an impact on the html outputs.

-nc | --no_catalog

Output

If you want to take advantage of the different output formats you can use -o and --out followed by the format type and file name. If no file name is supplied it will print out to the invoked location your file with the default name of 'cuke_sniffer_result' in the desired format.

Supported formats:

html
min_html
xml

If you supply a name that lacks an extension, one will be added for you. Examples:

cuke_sniffer -o xml
cuke_sniffer --out html 20130813_cuke_sniffer_report.html
cuke_sniffer --out min_html

Complex examples:

cuke_sniffer -s features/step_definitions -o xml step_definitions
cuke_sniffer -s features/step_definitions -f features/scenarios/login_screen -hk features/support/ --out html
Clone this wiki locally