forked from emmapersky/one-click-orgs
-
Notifications
You must be signed in to change notification settings - Fork 12
Debug techniques
andrewblack edited this page Jan 8, 2012
·
3 revisions
Chris and I (Andrew Black) were discussing how to get a cucumber test to stop and get into debug (or irb). I have come up with two different ways by googling. It would be nice to choose the better one (or combine them) and get this into the app.
- Place a step called cucumber
- Add a tag @stop to the step you want to debug
- Add a call to debugger in the ruby code you want to
- call rdb (ruby debugger)
- call irb (interactive ruby)
- call pry ( suggestion by Chris Adams - not tried yet)
When "debugger" do
debugger
end
# Usage:
# @wip @stop
# Scenario: change password
# ........................
# $ cucumber -p wip
# Comes from :
# http://railsdog.com/blog/2011/02/22/cucumber-testing-tips/
#
# orinal jhad
# ... scenario.failed? && scenario.source_tag_names.include?("@wip") &&
After do |scenario|
if scenario.source_tag_names.include?("@stop")
puts "Scenario failed. You are in rails console becuase of @stop. Type exit when you are done"
require 'irb'
require 'irb/completion'
ARGV.clear
IRB.start
end
end