Skip to content

Instantly share code, notes, and snippets.

@DylanLacey
Created September 24, 2013 17:59
Show Gist options
  • Save DylanLacey/6688784 to your computer and use it in GitHub Desktop.
Save DylanLacey/6688784 to your computer and use it in GitHub Desktop.
Hijacking the "Pretty" formatter to tag individual actions for Sauce with the step being executed
require "cucumber/formatter/pretty"
module Sauce
class SauceFormatter < Cucumber::Formatter::Pretty
def initialize(step_mother, io, options)
super
end
def before_step(step)
message = "Cucumber step -- #{step.name}"
::Capybara.current_session.execute_script("sauce:context=#{message}")
super
end
end
end
@smartkiwi
Copy link

Here are comments how to use this code:

You can find the sample at https://gist.github.com/DylanLacey/6688784 and run it with 'cucumber --format Sauce::SauceFormatter. You need to require it before your features run, so the best place to place it is in features/support/sauce_formatter.rb (or similar).

@smartkiwi
Copy link

I've tried this code - it works like a charm.
Thank you

@DylanLacey
Copy link
Author

Oh, sweet, thanks for putting the usage instructions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment