Commit 276dc82

mo k <mo@mokhan.ca>
2012-08-11 16:03:54
rename feature from deploy to navigation.
1 parent c42f113
config/cucumber.yml
@@ -1,4 +1,4 @@
 # config/cucumber.yml
 ##YAML Template
 ---
-default: --no-source --format pretty --require features/step_definitions features
+default: --no-source --format pretty -S --require features/step_definitions features
doc/cucumber_help
@@ -0,0 +1,96 @@
+Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+
+
+Examples:
+cucumber examples/i18n/en/features
+cucumber @rerun.txt (See --format rerun)
+cucumber examples/i18n/it/features/somma.feature:6:98:113
+cucumber -s -i http://rubyurl.com/eeCl
+
+    -r, --require LIBRARY|DIR        Require files before executing the features. If this
+                                     option is not specified, all *.rb files that are
+                                     siblings or below the features will be loaded auto-
+                                     matically. Automatic loading is disabled when this
+                                     option is specified, and all loading becomes explicit.
+                                     Files under directories named "support" are always
+                                     loaded first.
+                                     This option can be specified multiple times.
+        --i18n LANG                  List keywords for in a particular language
+                                     Run with "--i18n help" to see all languages
+    -f, --format FORMAT              How to format features (Default: pretty). Available formats:
+                                       debug       : For developing formatters - prints the calls made to the listeners.
+                                       html        : Generates a nice looking HTML report.
+                                       json        : Prints the feature as JSON
+                                       json_pretty : Prints the feature as prettified JSON
+                                       junit       : Generates a report similar to Ant+JUnit.
+                                       pretty      : Prints the feature as is - in colours.
+                                       progress    : Prints one character per scenario.
+                                       rerun       : Prints failing files with line numbers.
+                                       stepdefs    : Prints All step definitions with their locations. Same as
+                                                     the usage formatter, except that steps are not printed.
+                                       usage       : Prints where step definitions are used.
+                                                     The slowest step definitions (with duration) are
+                                                     listed first. If --dry-run is used the duration
+                                                     is not shown, and step definitions are sorted by
+                                                     filename instead.
+                                     Use --format rerun --out features.txt to write out failing
+                                     features. You can rerun them with cucumber @rerun.txt.
+                                     FORMAT can also be the fully qualified class name of
+                                     your own custom formatter. If the class isn't loaded,
+                                     Cucumber will attempt to require a file with a relative
+                                     file name that is the underscore name of the class name.
+                                     Example: --format Foo::BarZap -> Cucumber will look for
+                                     foo/bar_zap.rb. You can place the file with this relative
+                                     path underneath your features/support directory or anywhere
+                                     on Ruby's LOAD_PATH, for example in a Ruby gem.
+    -o, --out [FILE|DIR]             Write output to a file/directory instead of STDOUT. This option
+                                     applies to the previously specified --format, or the
+                                     default format if no format is specified. Check the specific
+                                     formatter's docs to see whether to pass a file or a dir.
+    -t, --tags TAG_EXPRESSION        Only execute the features or scenarios with tags matching TAG_EXPRESSION.
+                                     Scenarios inherit tags declared on the Feature level. The simplest
+                                     TAG_EXPRESSION is simply a tag. Example: --tags @dev. When a tag in a tag
+                                     expression starts with a ~, this represents boolean NOT. Example: --tags ~@dev.
+                                     A tag expression can have several tags separated by a comma, which represents
+                                     logical OR. Example: --tags @dev,@wip. The --tags option can be specified
+                                     several times, and this represents logical AND. Example: --tags @foo,~@bar --tags @zap.
+                                     This represents the boolean expression (@foo || !@bar) && @zap.
+                                     
+                                     Beware that if you want to use several negative tags to exclude several tags
+                                     you have to use logical AND: --tags ~@fixme --tags ~@buggy.
+                                     
+                                     Positive tags can be given a threshold to limit the number of occurrences.
+                                     Example: --tags @qa:3 will fail if there are more than 3 occurrences of the @qa tag.
+                                     This can be practical if you are practicing Kanban or CONWIP.
+    -n, --name NAME                  Only execute the feature elements which match part of the given name.
+                                     If this option is given more than once, it will match against all the
+                                     given names.
+    -e, --exclude PATTERN            Don't run feature files or require ruby files matching PATTERN
+    -p, --profile PROFILE            Pull commandline arguments from cucumber.yml which can be defined as
+                                     strings or arrays.  When a 'default' profile is defined and no profile
+                                     is specified it is always used. (Unless disabled, see -P below.)
+                                     When feature files are defined in a profile and on the command line
+                                     then only the ones from the command line are used.
+    -P, --no-profile                 Disables all profile loading to avoid using the 'default' profile.
+    -c, --[no-]color                 Whether or not to use ANSI color in the output. Cucumber decides
+                                     based on your platform and the output destination if not specified.
+    -d, --dry-run                    Invokes formatters without executing the steps.
+                                     This also omits the loading of your support/env.rb file if it exists.
+    -a, --autoformat DIR             Reformats (pretty prints) feature files and write them to DIRECTORY.
+                                     Be careful if you choose to overwrite the originals.
+                                     Implies --dry-run --format pretty.
+    -m, --no-multiline               Don't print multiline strings and tables under steps.
+    -s, --no-source                  Don't print the file and line of the step definition with the steps.
+    -i, --no-snippets                Don't print snippets for pending steps.
+    -q, --quiet                      Alias for --no-snippets --no-source.
+    -b, --backtrace                  Show full backtrace for all errors.
+    -S, --strict                     Fail if there are any undefined or pending steps.
+    -w, --wip                        Fail if there are any passing scenarios.
+    -v, --verbose                    Show the files and features loaded.
+    -g, --guess                      Guess best match for Ambiguous steps.
+    -l, --lines LINES                Run given line numbers. Equivalent to FILE:LINE syntax
+    -x, --expand                     Expand Scenario Outline Tables in output.
+        --[no-]drb                   Run features against a DRb server. (i.e. with the spork gem)
+        --port PORT                  Specify DRb port.  Ignored without --drb
+        --dotcucumber DIR            Write metadata to DIR
+        --version                    Show version.
+    -h, --help                       You're looking at it.
features/step_definitions/navigation_steps.rb
@@ -0,0 +1,30 @@
+$:.unshift(File.dirname(__FILE__) + '/../../spec')
+require 'spec_helper'
+
+Given /the plateau is (\d+) by (\d+)/ do |x,y|
+  @terrain = Terrain.new({:x => x, :y => y})
+end
+
+Given "the starting position is '(\d+) (\d+) N'" do |x,y|
+  @rover = @terrain.deploy_rover_to('N', {:x => x, :y => y})
+end
+
+Given /I move '(.*)'/ do |instructions|
+  instructions.split(//).each do |instruction|
+    case(instruction)
+    when 'M'
+      @rover.move_forward(terrain)
+    when 'R'
+      @rover.turn_right
+    when 'L'
+      @rover.turn_left
+    end
+  end
+end
+
+When /I tell the rover to travel/ do |op|
+end
+
+Then /the result should be '1 3 N' on the screen/ do
+  @rover.to_s.should == '1 3 N'
+end
features/step_definitions/rover_steps.rb
@@ -1,19 +0,0 @@
-$:.unshift(File.dirname(__FILE__) + '/../../spec')
-require 'spec_helper'
-
-Given /^the terrain is (.*) by (.*)$/ do |x,y|
-  @rover = Rover.new
-end
-Given "the starting position is '1 2 N'" do
-
-end
-Given /I move 'LMLMLMLMM'/ do
-
-end
-Then /the result should be '1 3 N' on the screen/ do
-
-end
-
-When /I press play/ do |op|
-  puts 'blah'
-end
features/deploy.feature
@@ -1,11 +0,0 @@
-Feature: Deployment
-  In order to deploy a rover to mars
-  As a deployment guy
-  I want to be able to told the final coordinates
-
-  Scenario Outline: Deploy a rover
-    Given the terrain is 5 by 5
-    And the starting position is '1 2 N'
-    And I move 'LMLMLMLMM'
-    When I press play
-    Then the result should be '1 3 N' on the screen.
features/navigation.feature
@@ -0,0 +1,12 @@
+Feature: Navigation
+  A squad of robotic rovers are to be landed by NASA on a plateau on Mars.
+  This plateau, which is curiously rectangular, must be navigated by the
+  rovers so that their on-board cameras can get a complete view of the
+  surrounding terrain to send back to Earth.
+
+  Scenario Outline: Navigate a rover
+    Given the plateau is 5 by 5
+    And the starting position is '1 2 N'
+    And I move 'LMLMLMLMM'
+    When I tell the rover to travel
+    Then the rovers final positions should be '1 3 N' on the screen.