This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 139818 - Debugging Rake Tasks needs to honor breakpoints starting at class scope methods
Summary: Debugging Rake Tasks needs to honor breakpoints starting at class scope methods
Status: NEW
Alias: None
Product: ruby
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@ruby
URL:
Keywords:
: 182344 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-13 21:01 UTC by esmithbss
Modified: 2011-01-28 20:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description esmithbss 2008-07-13 21:01:04 UTC
When debugging a rake task (and possibly other tasks), if the class has precursor operations like "fixture :all" or
"before_xxxx :something", that are breakpointed by the developer, the debugger must stop at the class scoped operations
instead of at the first method.
Comment 1 Martin Krauskopf 2008-07-15 09:30:34 UTC
Could you provide more detailed scenario, where you put the breakpoint on which the debugger did not stopped. E.g.
following scenario works for me:

  class Hi

    def hey
      puts 'hey'
    end
    module_function :hey # breakpoint here

  end

Thanks.
Comment 2 Martin Krauskopf 2008-07-15 09:35:42 UTC
Or simple Rakefile or the snipped would be helpful. Debugger does not recognize whether it runs Rails, Rake or simple
script. All is treated the same way.
Comment 3 esmithbss 2008-07-16 04:02:31 UTC
This is my tarantula test generated for the tarantula plugin from thinkrelevance.com

require "#{File.dirname(__FILE__)}/../test_helper"
require "relevance/tarantula"

class TarantulaTest < ActionController::IntegrationTest
  fixtures :all

  def test_tarantula_admin
    club = Club.find_by_subdomain('myclub')
    p club.name
    post '/signin', :username => 'testadmin', :password => 'nimdatset'
#    assert_response :redirect
#    assert_redirected_to '/'
    follow_redirect!
    t=tarantula_crawl(self)
#    t.handlers << Relevance::Tarantula::TidyHandler.new
    t.crawl '/'
  end

  def test_tarantula_user
    club = Club.find_by_subdomain('myclub')
    p club.name
    post '/signin', :username => 'testuser', :password => 'resutset'
    assert_response :redirect
    assert_redirected_to '/'
    follow_redirect!
    t=tarantula_crawl(self)
    t.handlers << Relevance::Tarantula::TidyHandler.new
    t.crawl '/'
  end
end


In this specific case, 

"fixtures :all" 

launches a process to load the fixtures into the test database; however, I am unable to break on this line, or anywhere
within the processes this line invokes.  The first line I am able to debug/break on is 

"club = Club.find_by_subdomain('myclub')"

within test_tarantula_admin
Comment 4 Martin Krauskopf 2008-07-16 07:17:42 UTC
I see. First what comes to my mind is that the Test Runner 'steals' the interpretation from the debugger and debugger
does not get it into the game until the tests are loaded. Just a guess (CCing Erno).
Comment 5 Martin Krauskopf 2008-08-12 14:55:26 UTC
Debugging Rake::TestTask does not work since the task forks execution with Kernel#system call (see Rake::TestTask#define
method in Rake source). Will try to find how can be workarounded in NetBeans or whether the patch to Rake is needed.

Strange is that you said that you can hit breakpoint inside your test methods. How do you actually trigger the test
case, you wrote:

> When debugging a rake task (and possibly other tasks), if the class has
> precursor operations like "fixture :all" 

The TarantulaTest had to be loaded by some task. Are you using standard:

  require 'rake/testtask'

If yes, you should not be able to stop on any breakpoint when running through Rake Runner -> test task. Or do you have
your own?
Comment 6 esmithbss 2008-08-13 05:31:02 UTC
I used the Debug Rake Task menu option and selected to debug the Tarantula test task.

Since Tarantula is designed to run the TarantulaTest I included above, I put breakpoints in the class methods and
launched the task for debug.  The key is I needed to start with the fixtures :all and step into the underlying calls for
that task to debug a fixture loading issue.

Unfortunately, the breakpoint on fixtures :all was skipped.

The system did, however, stop on the breakpoint I placed on the first line of the first test method.
Comment 7 Erno Mononen 2010-03-26 13:43:52 UTC
*** Bug 182344 has been marked as a duplicate of this bug. ***
Comment 8 Erno Mononen 2010-04-22 13:03:52 UTC
This will have to wait still, likely needs changes in the test task itself to be able to hook the debugger when the execution is forked.