[rspec-users] [cucumber] how to debug cucumber with netbeans?

Ben Mabey ben at benmabey.com
Fri May 8 22:10:08 EDT 2009


Jean-Michel Garnier wrote:
> 3 months ago, I submitted a patch to cucumber so I could run cucumber from a
> ruby script and use the debugger in netbeans
> (https://rspec.lighthouseapp.com/projects/16211/tickets/128-running-feature-from-ruby-script)
>
> It worked well at the time but I can't make it work with cucumber 0.3.2.
> Here is the stacktrace:
> ruby script/cucumber_netbeans_runner.rb 
> cucumber features/_admin/projects.feature  --profile default 
> /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require': no such file to load -- lib/active_merchant
> (MissingSourceFile)
> Failed to load
> ./vendor/plugins/active_merchant/lib/support/gateway_support.rb	from
> /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `polyglot_original_require'
> 	from /Library/Ruby/Gems/1.8/gems/polyglot-0.2.5/lib/polyglot.rb:54:in
> `require'
> 	from
> /Users/jeanmichel/Projects/betterplace/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in
> `require'
> 	from
> /Users/jeanmichel/Projects/betterplace/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in
> `new_constants_in'
> 	from
> /Users/jeanmichel/Projects/betterplace/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in
> `require'
> 	from ./vendor/plugins/active_merchant/lib/support/gateway_support.rb:3
> 	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> 	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `polyglot_original_require'
> 	 ... 8 levels...
> 	from
> /Library/Ruby/Gems/1.8/gems/cucumber-0.3.2/lib/cucumber/cli/main.rb:20:in
> `execute'
> 	from script/cucumber_netbeans_runner.rb:29:in `run'
> 	from script/cucumber_netbeans_runner.rb:21:in `run_feature'
> 	from script/cucumber_netbeans_runner.rb:37
>
> And the script:
>
> require 'rubygems'
> require 'cucumber/cli/main'
>
> module Cucumber
>   module Netbeans
>     class Runner
>       def initialize(cucumber_opts=nil)
>         @argv = []
>         @cucumber_opts = cucumber_opts || " --profile default"
>       end
>
>       def run_scenario(line_number)
>         @cucumber_opts << " --line #{line_number}"
>         run
>       end
>
>       def run_feature(feature)
>         @argv << "#{feature}"
>         run
>       end
>
>       protected
>
>       def run                
>         @argv << @cucumber_opts
>         puts %Q{cucumber #{@argv.join(' ')} \n}
>         Cucumber::Cli::Main.execute(@argv)
>       end
>     end
>   end
> end
>
> Cucumber::Netbeans::Runner.new().run_feature
> "features/_admin/projects.feature"
>
> I wonder if fellow netbeans on cucumber users will have an idea ...
> Ironically, debugging that script with netbeans crashes the debugger at
> Library/Ruby/Gems/1.8/gems/polyglot-0.2.5/lib/polyglot.rb:54 
>
> For the time being, I am using the "old school" ruby-debug which works
> pretty well ...
>
> JM
>   


So, you can run the feature fine without the debugger?  What is 
confusing is that "lib/active_merchant" is showing up in the backtrace 
saying it can't be found... What if you try to run the feature with the 
debugger from outside of Netbeans?  Just trying to get an idea of who 
the culprit really is here.

-Ben


More information about the rspec-users mailing list