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
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/)
- Setup and run Ruby debugger
- Create a new Ruby project with JRuby platform
- 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
- Toggle breakpoint at puts
- Start debugger (Ctrl+F5), check debugger is started and stopped at breakpoint
- Finish debugger (Shift+F5)
- Open project properties and select native ruby platform in Run category
- Open Tools|Ruby Gems
- Select the native ruby platform
- Uninstall fast debugger (ruby-debug-base) and close Ruby Gems dialog box
- Start debugger and in 'Fast Debugger Installation' dialog press Continue
- Check debugger is started
- Finish debugger
- Start debugger again and now click Install Fast Debugger button
- Finish installation and check debugger is started
- Finish debugger
- Repeat the following test suites both with built-in JRuby and native Ruby platform.
- EXPECTED RESULT: Everything works as expected.
- Debug single file
- Let main.rb open and breakpoint at puts
- Call context menu Debug in editor
- Check debugger is started and stopped at breakpoint
- Click toolbar button to finish debugger
- Select main.rb node
- Call main menu Run|Run File|Debug "main.rb"
- Check debugger is started and stopped at breakpoint
- Click red button in output tab to finish debugger
- Select main.rb node
- Press Ctrl+Shift+F5
- Check debugger is started and stopped at breakpoint
- 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.
- Debug tests
- Remove all breakpoints in main.rb
- Create a new Ruby Unit Test main_test.rb
- Toggle breakpoint at assert in main_test.rb
- Call context menu Debug in editor
- Finish debugger when it stops at breakpoint
- Select main.rb node
- Call main menu Run|Run File|Debug Test for "main.rb"
- Finish debugger when it stops at breakpoint
- Select main.rb node
- Press Ctrl+Shift+F6
- Finish debugger when it stops at breakpoint
- EXPECTED RESULT: Debugger starts and stops as expected and no process remains unfinished.
- More debugging sessions
- Remove all breakpoints
- Open main.rb
- Toggle breakpoint at puts
- Start debugger and wait until it stops at breakpoint
- Press F7 to step into fib method
- Start debugger again and wait until it stops at breakpoint
- Open 'Window|Debugging|Sessions' and check there are two sessions
- Double-click not active session and check green annotation in editor was changed
- Look also at Local Variables and Call Stack view. They should be changed if active session changes
- Press F7 several times and switch sessions repeatedly
- Call 'Finish All' in Sessions view and check both debugger sessions were finished
- EXPECTED RESULT: Everything works as expected.
- Step over
- Start debugger and wait until it stops at breakpoint
- Press F8 to step over
- Click toolbar button to step over
- Call 'Run|Step Over' main menu item
- Finish debugger
- EXPECTED RESULT: Debugger doesn't step into fib method.
- Step into and step out
- Start debugger and wait until it stops at breakpoint
- Press F7 to step into and check debugger steps into fib method
- Press Ctrl+F7 to step out and check debugger left fib method and stopped at breakpoint
- Click toolbar button to step into and check debugger steps into fib method
- Click toolbar button to step out and check debugger left fib method and stopped at breakpoint
- Call 'Run|Step Into' main menu item and check debugger steps into fib method
- Call 'Run|Step Out' main menu item and check debugger left fib method and stopped at breakpoint
- EXPECTED RESULT: Everything works as expected.
- Run to cursor, continue and baloon evaluation
- Start debugger and wait until it stops at breakpoint
- Put cursor at if keyword
- Press F4 to run to cursor and check debugger stops at cursor
- Press F5 to continue and check debugger continues and stops at breakpoint
- Put cursor at if keyword
- Click toolbar button to run to cursor and check debugger stops at cursor
- Click toolbar button to continue and check debugger continues and stops at breakpoint
- Put cursor at if keyword
- Call 'Run|Run to Cursor' and check debugger stops at cursor
- Call 'Run|Continue' main menu item and check debugger continues and stops at breakpoint
- Place mouse over i variable and there should appear a tooltip like i = 3
- Select fib(i), place mouse over selection and check tooltip is fib(i) = 2
- Finish debugging
- EXPECTED RESULT: Everything works as expected.
- Local Variables, Watches Call Stack views
- Start debugger and wait until it stops at breakpoint
- Check Watches, Local Variables, Call stack and Breakpoints views are opened (issue 126927)
- Switch to Watches view
- Call 'New Watch' popup menu in view, type i in the Watch Expression text field and click OK
- Call 'Run|New Watch' main menu item, type i in the Watch Expression text field and click OK
- Check i shows value while n is unknown for now
- Switch to Local Variables view
- Check there is i variable and Global Variables
- Expand Global Variables node and check variables like $0 are available
- Press F7 to step into fib method and check
- Check variable n is shown
- Switch to Watches and check variable n shows value while variable i is unknown now
- Switch to Call Stack view and double-click second row (should be 'main.rb:10)
- Switch to Watches and check variable i shows value while variable n is unknown now
- Switch to Local Variables view and check variable i is shown
- Switch to Call Stack view and double-click first row
- Check all views refreshed to previous state
- Switch to Watches view
- Call 'Customize' popup menu in view, type i+1 and click OK
- Check value is changed according to expression
- Call 'Delete' popup menu in view
- Call 'Delete All' popup menu in view
- EXPECTED RESULT: Everything works as expected.
- Breakpoints view
- Switch to Breakpoints view
- While having green annotation in if statement toggle breakpoint on that line in editor
- Two breakpoints should be in the Breakpoints view
- Double-click each breakpoint and check cursor is placed to appropriate source in editor
- Perform continue that debugger stops at puts
- Disable breakpoint at if and check annotation is greyed
- Perform continue and check debugger skips disabled breakpoint and stops again at breakpoint at puts
- Enable breakpoint again, perform continue and check debugger stops at breakpoint at if
- Call 'Disable All' and check all breakpoints are disabled
- Call 'Enable All' and check all breakpoints are enabled
- Select both two breakpoints and call 'Set Group Name' on it
- Type something in the textfield and click OK
- Check breakpoints are grouped together
- Call 'Set Group Name' again and let text field empty
- Check group is avoided
- Call 'Customize' on one breakpoint, change line number and check changes in editor
- Call 'Delete' on one breakpoint and check it is deleted
- Call 'Delete All' in view and check all breakpoints are deleted
- Perform continue action in debugger and check debugger didn't stop at any breakpoint and finished the session
- EXPECTED RESULT: Everything works as expected.
- Remote debugging
- In CLI go to the ruby-debug-ide location and run "ruby rdebug-ide -p 7000 --stop -- `which gem` list --local"
- In Netbeans call 'Debug' -> 'Attach Debugger...' menu item and choose Ruby Debugger
- Toggle breakpoint in opened .rb file. Check debugger is started and stopped at breakpoint
- 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:
- Debug rake task
- Edit Rakefile to contain some task. You can inspire in Ruby and Rails test specification
- Toggle breakpoint inside task in Rakefile
- Call 'Debug Rake Task|default' on ruby project root node
- Check debugger is started and stopped at breakpoint
- 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.
- Debug Rails project
- Open 'Controllers|myapp_controller.rb', type e.g. puts "myview" into myview method definition and toggle breakpoint on it
- Open 'Views|myapp|myview.html.erb' and toggle breakpoint at some line
- Call 'Debug' popup in editor and wait until WEBrick server is started and debugger stops at breakpoint in myapp_controller.rb
- Continue and check debugger stops at breakpoint in myview.html.erb
- Continue and check page is opened in browser
- Finish debugger and check debugger session is close and WEBrick server is stopped (issue 129049)
- EXPECTED RESULT: Everything works as expected.