Cucumber step definition for debugging

Building on a previous post about debugging cucumber tests with ruby-debug, here’s a simple cucumber step definition you can use in your cucumber scenario in order to debug it:

Then /^I debug$/ do
  breakpoint
  0
end

Use it as follows:

Feature: Debug a cucumber scenario
  As a test writer
  In order to make my life easier
  I want to be able to debug

  Scenario: Calling the debugger in the middle of a test
    Given some condition
    Then I debug #this will call the debugger
    And I do something subsequent to debugging

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>