Quoted from Alex Verhovsky:

there is this RubyForge project called 'breakpoint', 
http://ruby-breakpoint.rubyforge.org/wiki/wiki.pl?HomePage, which opens 
an IRB session inside a running Ruby program. With it, you can do 
something like
test/watir/long_convoluted_test_script.rb
require 'watir'
include Watir
config = load_configuration
database = connect_to_database
ie = IE.start('http:/foo.bar.com/login')
ie.text_field(:id, 'username').set_value('me')
...
...
...
# somewhere in the middle
require 'breakpoint'
breakpoint
...
and this will execute the script until breakpoint and then open an IRB 
session in which the actual values of ie, configuration, database are 
available and even can be modified. As well as any other variable 
visible from the breakpoint location. Exiting the IRB continues the 
program.
This is often the easiest way to get to the state that you want to play 
with. Besides, you can do conditional breakpoints
breakpoint if <some arbitrarily complex condition>
Bottom line: don't leave home without it.
Alex
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general


-- 
Michael Kelly 
Sr. Software Engineer 
Eleven Wireless Inc. - The Possibilities are Wireless 
http://www.elevenwireless.com 
 
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tuyet
Cong-Ton-Nu
Sent: Friday, August 19, 2005 4:18 PM
To: [email protected]
Subject: [Wtr-general] Set Debugging Breakpoint in WATIR/Ruby script?


Is there a way to insert a command inside the ruby script to stop it's
execution so you can debug or set a breakpoint on a certain line of
code.
Kind of like the way Segue's SilkTest allows you to run in debug mode
with all the variables and context available?
It would be great if the script can execute up to a certain line and
then launches irb for debugging.

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to