Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Add duration value to json formatter #204

wants to merge 2 commits into from

2 participants


Added new method that is called from the after_step in Cucumber. Duration value is appended to the result hash.


Where is append_duration called from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 16, 2012
  1. @fcbeyer
Commits on Oct 22, 2012
  1. @fcbeyer
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/gherkin/formatter/json_formatter.rb
11 lib/gherkin/formatter/json_formatter.rb
@@ -61,6 +61,17 @@ def match(match)
def result(result)
@current_step_or_hook['result'] = result.to_hash
+ def append_duration(timestamp)
+ #check to make sure result exists (scenario outlines do not have results yet)
+ if !@current_step_or_hook['result'].nil?
+ #convert to nanoseconds
+ timestamp = timestamp * 1000000000
+ rshash = @current_step_or_hook['result'].to_hash
+ rshash['duration'] = timestamp.to_i
+ @current_step_or_hook['result'] = rshash
+ end
+ end
def before(match, result)
add_hook(match, result, "before")
Something went wrong with that request. Please try again.