TS 61 RubyDebugger

Ruby Debugger Test Specification for NetBeans 6.1

Author: Tomas Musil, Jiri Skrivanek
Version: 2.0
Estimated time: ??
Default IZ component(s): ruby/debugger
Last update: 9-th April 2008
Introduction: This tests basic scenarios of ruby debugger.
Comments: Documentation can be found here http://wiki.netbeans.org/RubyDebugging

Contents


Test suite: Ruby Debugging

Purpose: To test Ruby debugger.
Setup: ruby-debug-ide version 0.4.1 or later installed (https://rubyforge.org/projects/debug-commons/)

  1. Setup and run Ruby debugger
    1. Create a new Ruby project with JRuby platform
    2. Copy the following code inside:
def fib(n) if n<2 then return n else return fib(n-1) + fib(n-2) end end 5.times do |i| puts fib(i) end
    1. Toggle breakpoint at puts
    2. Start debugger (Ctrl+F5), check debugger is started and stopped at breakpoint
    3. Finish debugger (Shift+F5)
    4. Open project properties and select native ruby platform in Run category
    5. Open Tools|Ruby Gems
    6. Select the native ruby platform
    7. Uninstall fast debugger (ruby-debug-base) and close Ruby Gems dialog box
    8. Start debugger and in 'Fast Debugger Installation' dialog press Continue
    9. Check debugger is started
    10. Finish debugger
    11. Start debugger again and now click Install Fast Debugger button
    12. Finish installation and check debugger is started
    13. Finish debugger
    14. Repeat the following test suites both with built-in JRuby and native Ruby platform.
    • EXPECTED RESULT: Everything works as expected.
  1. Debug single file
    1. Let main.rb open and breakpoint at puts
    2. Call context menu Debug in editor
    3. Check debugger is started and stopped at breakpoint
    4. Click toolbar button to finish debugger
    5. Select main.rb node
    6. Call main menu Run|Run File|Debug "main.rb"
    7. Check debugger is started and stopped at breakpoint
    8. Click red button in output tab to finish debugger
    9. Select main.rb node
    10. Press Ctrl+Shift+F5
    11. Check debugger is started and stopped at breakpoint
    12. Click x button in progress bar and confirm 'Cancel Running Task' to finish debugger
    • EXPECTED RESULT: Debugger starts and stops as expected and no process remains unfinished.
  2. Debug tests
    1. Remove all breakpoints in main.rb
    2. Create a new Ruby Unit Test main_test.rb
    3. Toggle breakpoint at assert in main_test.rb
    4. Call context menu Debug in editor
    5. Finish debugger when it stops at breakpoint
    6. Select main.rb node
    7. Call main menu Run|Run File|Debug Test for "main.rb"
    8. Finish debugger when it stops at breakpoint
    9. Select main.rb node
    10. Press Ctrl+Shift+F6
    11. Finish debugger when it stops at breakpoint
    • EXPECTED RESULT: Debugger starts and stops as expected and no process remains unfinished.
  3. More debugging sessions
    1. Remove all breakpoints
    2. Open main.rb
    3. Toggle breakpoint at puts
    4. Start debugger and wait until it stops at breakpoint
    5. Press F7 to step into fib method
    6. Start debugger again and wait until it stops at breakpoint
    7. Open 'Window|Debugging|Sessions' and check there are two sessions
    8. Double-click not active session and check green annotation in editor was changed
    9. Look also at Local Variables and Call Stack view. They should be changed if active session changes
    10. Press F7 several times and switch sessions repeatedly
    11. Call 'Finish All' in Sessions view and check both debugger sessions were finished
    • EXPECTED RESULT: Everything works as expected.
  4. Step over
    1. Start debugger and wait until it stops at breakpoint
    2. Press F8 to step over
    3. Click toolbar button to step over
    4. Call 'Run|Step Over' main menu item
    5. Finish debugger
    • EXPECTED RESULT: Debugger doesn't step into fib method.
  5. Step into and step out
    1. Start debugger and wait until it stops at breakpoint
    2. Press F7 to step into and check debugger steps into fib method
    3. Press Ctrl+F7 to step out and check debugger left fib method and stopped at breakpoint
    4. Click toolbar button to step into and check debugger steps into fib method
    5. Click toolbar button to step out and check debugger left fib method and stopped at breakpoint
    6. Call 'Run|Step Into' main menu item and check debugger steps into fib method
    7. Call 'Run|Step Out' main menu item and check debugger left fib method and stopped at breakpoint
    • EXPECTED RESULT: Everything works as expected.
  6. Run to cursor, continue and baloon evaluation
    1. Start debugger and wait until it stops at breakpoint
    2. Put cursor at if keyword
    3. Press F4 to run to cursor and check debugger stops at cursor
    4. Press F5 to continue and check debugger continues and stops at breakpoint
    5. Put cursor at if keyword
    6. Click toolbar button to run to cursor and check debugger stops at cursor
    7. Click toolbar button to continue and check debugger continues and stops at breakpoint
    8. Put cursor at if keyword
    9. Call 'Run|Run to Cursor' and check debugger stops at cursor
    10. Call 'Run|Continue' main menu item and check debugger continues and stops at breakpoint
    11. Place mouse over i variable and there should appear a tooltip like i = 3
    12. Select fib(i), place mouse over selection and check tooltip is fib(i) = 2
    13. Finish debugging
    • EXPECTED RESULT: Everything works as expected.
  7. Local Variables, Watches Call Stack views
    1. Start debugger and wait until it stops at breakpoint
    2. Check Watches, Local Variables, Call stack and Breakpoints views are opened (issue 126927)
    3. Switch to Watches view
    4. Call 'New Watch' popup menu in view, type i in the Watch Expression text field and click OK
    5. Call 'Run|New Watch' main menu item, type i in the Watch Expression text field and click OK
    6. Check i shows value while n is unknown for now
    7. Switch to Local Variables view
    8. Check there is i variable and Global Variables
    9. Expand Global Variables node and check variables like $0 are available
    10. Press F7 to step into fib method and check
    11. Check variable n is shown
    12. Switch to Watches and check variable n shows value while variable i is unknown now
    13. Switch to Call Stack view and double-click second row (should be 'main.rb:10)
    14. Switch to Watches and check variable i shows value while variable n is unknown now
    15. Switch to Local Variables view and check variable i is shown
    16. Switch to Call Stack view and double-click first row
    17. Check all views refreshed to previous state
    18. Switch to Watches view
    19. Call 'Customize' popup menu in view, type i+1 and click OK
    20. Check value is changed according to expression
    21. Call 'Delete' popup menu in view
    22. Call 'Delete All' popup menu in view
    • EXPECTED RESULT: Everything works as expected.
  8. Breakpoints view
    1. Switch to Breakpoints view
    2. While having green annotation in if statement toggle breakpoint on that line in editor
    3. Two breakpoints should be in the Breakpoints view
    4. Double-click each breakpoint and check cursor is placed to appropriate source in editor
    5. Perform continue that debugger stops at puts
    6. Disable breakpoint at if and check annotation is greyed
    7. Perform continue and check debugger skips disabled breakpoint and stops again at breakpoint at puts
    8. Enable breakpoint again, perform continue and check debugger stops at breakpoint at if
    9. Call 'Disable All' and check all breakpoints are disabled
    10. Call 'Enable All' and check all breakpoints are enabled
    11. Select both two breakpoints and call 'Set Group Name' on it
    12. Type something in the textfield and click OK
    13. Check breakpoints are grouped together
    14. Call 'Set Group Name' again and let text field empty
    15. Check group is avoided
    16. Call 'Customize' on one breakpoint, change line number and check changes in editor
    17. Call 'Delete' on one breakpoint and check it is deleted
    18. Call 'Delete All' in view and check all breakpoints are deleted
    19. Perform continue action in debugger and check debugger didn't stop at any breakpoint and finished the session
    • EXPECTED RESULT: Everything works as expected.
  9. Debugging with Detailed Logging
    1. Call 'Tools|Options' main menu item. On Ruby tab enable 'Enable Detailed Logging' and 'Enable Detailed Logging for Debugger' and click OK
    2. Put a breakpoint somewhere
    3. Start debugging
    4. When the debugging is done, call 'View|IDE Log' main menu item and check the IDE log for detailed Debugger log
    • EXPECTED RESULT: Debugging finishes, detailed Debugger log is opened in Output window.
  10. Remote debugging
    1. In CLI go to the ruby-debug-ide location and run "ruby rdebug-ide -p 7000 --stop -- `which gem` list --local"
    2. In Netbeans call 'Debug' -> 'Attach Debugger...' menu item and choose Ruby Debugger
    3. Toggle breakpoint in opened .rb file. Check debugger is started and stopped at breakpoint
    4. Repeat doable actions from cases 5 - 9 using remote debugging
    • EXPECTED RESULT: Everything works as expected.


Test suite: Rake Debugging

Purpose: To test Rake debugging.
Setup:

  1. Debug rake task
    1. Edit Rakefile to contain some task. You can inspire in Ruby and Rails test specification
    2. Toggle breakpoint inside task in Rakefile
    3. Call 'Debug Rake Task|default' on ruby project root node
    4. Check debugger is started and stopped at breakpoint
    5. Continue and check debugger is finished
    • EXPECTED RESULT: Everything works as expected.


Test suite: Rails Debugging

Purpose: To test Rails debugging.
Setup: Prepare Rails application as described in Ruby and Rails test specification.

  1. Debug Rails project
    1. Open 'Controllers|myapp_controller.rb', type e.g. puts "myview" into myview method definition and toggle breakpoint on it
    2. Open 'Views|myapp|myview.html.erb' and toggle breakpoint at some line
    3. Call 'Debug' popup in editor and wait until WEBrick server is started and debugger stops at breakpoint in myapp_controller.rb
    4. Continue and check debugger stops at breakpoint in myview.html.erb
    5. Continue and check page is opened in browser
    6. Finish debugger and check debugger session is close and WEBrick server is stopped (issue 129049)
    • EXPECTED RESULT: Everything works as expected.


Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo