Debugging in ruby

Hi,
when I run unittest class, with debugger the flow goes into testcase
case class as below.
how can i debug only the testscript instead of going into libraries of
extended clases

Testscript
require “test/unit”

class TestSimpleNumber < Test::Unit::TestCase

def test_simple
assert_equal(“abc”, “abc” )

end

def test_typecheck
assert_equal(“abc”, “abc” )
end

def test_failure
assert_equal(“abc”, “abc” )
end

End

Execution:

C:\ruby>ruby -rubygems -rdebug unittest.rb
Debug.rb
Emacs support available.

unittest.rb:1:require “test/unit”
(rdb:1) b 6
Set breakpoint 1 at unittest.rb:6
(rdb:1) cont
Loaded suite unittest
Started
.Breakpoint 1, test_simple at unittest.rb:6
unittest.rb:6: assert_equal(“abc”, “abc” )
(rdb:1) n
c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:85: begin
(rdb:1) n
c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:86: teardown
(rdb:1) n
c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:94: result.add_run
(rdb:1) n
c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:95: yield(FINISHED,
name)
(rdb:1) n
c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:47:
notify_listeners(channel, value)
(rdb:1)

Please help me in this regard.

Thanks,
Anil

Please help me in this regard.

Briefly, if you write unit tests, you should not need to debug.

I configure the tests to run after I hit one button. (Report your
editor, and
someone might know how to do it. Some, like TextMate, make it hard.)

Then I run them over and over again. Change a statement, predict what
the tests
will do, run the tests, see if your prediction matches. Sometimes, of
course,
use pp @variable to trace what’s going on.

Phlip wrote:

Briefly, if you write unit tests, you should not need to debug.

Oh yes you should. A test never debug; it just point out there are
bugs. To
remove them is still your job.

Urabe S. wrote:

Phlip wrote:

Briefly, if you write unit tests, you should not need to debug.

Oh yes you should. A test never debug; it just point out there are bugs. To
remove them is still your job.

If you use Test-Driven Development, you have the option to use Undo
until the
bug goes away. Try it; you will see what I mean.

On a big project, you might still sometimes need to debug. I have always
used pp
for trace statements, out of selected tests. Running them over and over
again
works so similar to debugging that you won’t miss it.

However, someone here will have experience with the Ruby debugger and
can answer
your actual question. Any port in a storm!

On Monday 20 April 2009 11:25:16 Urabe S. wrote:

Phlip wrote:

Briefly, if you write unit tests, you should not need to debug.

Oh yes you should. A test never debug; it just point out there are bugs.
To remove them is still your job.

Firstly, a test absolutely does help, even after the fact, as a way to
debug.
It provides a concise definition of the bug, and if the test is kept
around, it
will show whether the bug remains fixed.

But I think the point was that if your specs are comprehensive enough to
begin
with, you will not introduce nearly as many bugs. I’m not arrogant
enough to
say “none at all”, but I’ve also never worked on a project which did
Behavior-
Driven Design religiously enough for this to work.