-
Notifications
You must be signed in to change notification settings - Fork 72
Command Line
Starting with version 0.2.1, Cuke4Duke has a standalone command line. This is handy if you don’t want to use Ant or Maven.
The cuke4duke
command line is a gem with an executable script. There are several ways to install this:
After you have installed JRuby, install the cuke4duke gem:
jruby -S gem install cuke4duke
If you don’t need or want a full system-wide JRuby installation you can use Ant or Maven, which will set up JRuby and Cuke4Duke in their own separate location.
Now you should be able to run cuke4duke
from the command line:
cuke4duke --version cuke4duke --help
As you see, you have the same command line options as cucumber
. (Since you’re running on JRuby you also have a new option: --jars
that is explained below).
Since you’re using cuke4duke you probably have some jar files that need to be on the CLASSPATH. These can be specified with the --jars
option. The argument passed to the --jars
option must be a directory, and not a jar file. (cuke4duke will require
each jar file. You may specify this option several times if you have jar files scattered around.
If you are using cuke4duke with Scala or Java you will also have compiled .class
files that need to be loaded. Use --require
to load these. IMPORTANT: The argument given to --require
must be the parent directory of your package hierarchy. (cuke4duke will add each directory file to the $CLASSPATH
ruby constant). Dynamic programming languages that are supported by cuke4duke shouldn’t have to use this option if the step definition files are under features/step_definitions
.
For example, if you want to run the Java examples, try this command:
cuke4duke --jars lib --require target/test-classes features
Or the Javascript ones:
cuke4duke --jars lib features
If you need to pass Java system properties, you can invoke with jruby
using -J
and -S
. See jruby --help
for details. Example:
jruby -J-Dcuke4duke.objectFactory=cuke4duke.internal.jvmclass.SpringFactory \ -S cuke4duke --jars lib --require target/test-classes features