TS 65 JPDAdbg II

Debugger Test Specification for NetBeans 6.5 Part II - Functionality

Author: Emanuel Hucka, NB6.5 revision by Petr Cyhelsky, NB6.5 RC2 revision by Filip Zamboj
Version: 1.5
Lastupdate: 2008/07/23
Introduction: This document describes test specification for testing of debuggerjpda module in NetBeans ide. Debuggerjpda is implementation of most common Java debugger - JPDA. The tests also cover debuggercore module providing basic framework for implementations of all debuggers in IDE.
Comments: There are used test projects MemoryView and freeform in test cases.

Contents

Test suite: Basic functionality

Purpose: Verification of basic debugger funcionality: start, stop, stop on breakpoint, etc
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project.

  1. Start debugger
    1. Invoke Debug Project action from menu or toolbar
    • EXPECTED RESULT: Debugger Console is opened in output. There is written 'Listening on some_port_number' followed by 'User program running' and application is started.
    • Teardown: Close debugged application
  2. Start debugger II
    1. Invoke popup menu above project node in project tree and click menu item Debug
    • EXPECTED RESULT: Debugger Console is opened in output. There is written 'Listening on some_port_number' followed by 'User program running' and application is started.
    • Teardown: Close debugged application
  3. Stop debugged application
    1. Invoke Debug Project action from menu or toolbar, wait until debugger and application are started
    2. Finish debugged application by pressing its Close button
    • EXPECTED RESULT: 'User program finished' message will be shown in the status bar and in Debugger Console.
  4. Kill debugged application
    1. Invoke Debug Project action from menu or toolbar, wait until debugger and application are started
    2. Invoke Finish Debugger Session action from menu or toolbar
    • EXPECTED RESULT: 'User program finished' message will be shown in the status bar and in Debugger Console. The debugged applcation will be closed.
  5. Pause debugging session
    1. Invoke Debug Project action from menu or toolbar, wait until debugger and application are started
    2. Invoke Pause action from menu or toolbar
    • EXPECTED RESULT: 'User program stopped' message will be shown in the status bar and in Debugger Console. The debugged application will stop responding.
  6. Continue debugging session
    • Setup: Process steps from Pause debugging session testcase
    1. Invoke Continue action from menu or toolbar
    • EXPECTED RESULT: 'User program running' message will be shown in the status bar and in Debugger Console and the debugged application will run
    • Teardown: Finish debugging session
  7. Breakpoint functionality
    1. Open file MemoryView.java in editor
    2. Place your caret on line 101
    3. Invoke Toggle Line Breakpoint action from editor's popup menu
    4. Invoke Debug Project action from menu or toolbar
    • EXPECTED RESULT: Debugger will be started and after a while it will stop on line 101
    • Teardown: Remove the breakpoint
  8. Run to cursor
    • Setup: Proceed steps from Breakpoint functionality tescase
    1. Place your caret on line 96
    2. Invoke Run to Cursor action from menu or toolbar
    • EXPECTED RESULT: Debugger will run for a while and stop on line 96.
    • Teardown: Finish debugging session
  9. Run to cursor - start debugging
    1. Open file MemoryView.java in editor
    2. Place your caret on line 101
    3. Invoke Run to Cursor action from menu or toolbar
    • EXPECTED RESULT: Debugger will start and run for a while and stop on line 101.
    • Teardown: Finish debugging session
  10. Step Into - start debugging
    1. Invoke Step Into action from menu or toolbar
    • EXPECTED RESULT: Debugger will be started and stop on the first line of main method.
    • Teardown: Finish debugging session
  11. Step Into
    1. Open file MemoryView.java in editor
    2. Place your caret on line 58
    3. Invoke Toggle Line Breakpoint breakpoint from editor's popup menu
    4. Invoke Debug Project action from menu or toolbar
    5. Wait till debugger stops on line 58
    6. Invoke Step Into action
    • EXPECTED RESULT: Debugger will stop on line 86.
    • Teardown: Finish debugging session
  12. Step Over
    1. Invoke Debug Project action from menu or toolbar
    2. Wait till debugger stops on line 58
    3. Invoke Step Over action
    • EXPECTED RESULT: Debugger will stop on line 60.
    • Teardown: Finish debugging session and delete all breakpoints
  13. Step Over Expression
    1. Toggle line breakpoint on line 101
    2. Invoke Debug Project action from menu or toolbar
    3. Wait till debugger stops on line 101
    4. Invoke Step Over Expression action five times
    • EXPECTED RESULT: Debugger will step on all methods of the expression
    • Teardown: Finish debugging session and delete all breakpoints
  14. Step Out
    1. Toggle line breakpoint on line 58
    2. Invoke Debug Project action from menu or toolbar
    3. Wait till debugger stops on line 58
    4. Invoke Step Into action
    5. Wait till debugger stops on line 86
    6. Invoke Step Out action
    • EXPECTED RESULT: Debugger will stop on line 60.
    • Teardown: Finish debugging session and remove breakpoint
  15. Run Into Method
    1. Toggle line breakpoint on line 53
    2. Invoke Debug Project action from menu or toolbar
    3. Wait till debugger stops on line 53
    4. Place your caret on line 58 between 9th and 21st character (text updateStatus)
    5. Invoke Run Into Method action from editor popup menu
    • EXPECTED RESULT: Debugger will stop on line 86.
    • Teardown: Finish debugging session and remove breakpoint
  16. Run Into Method - JDK method
    1. Place your caret on line 193
    2. Invoke Toggle Line Breakpoint breakpoint from editor's popup menu
    3. Invoke Debug Project action from menu or toolbar
    4. In MemoryView application press Apply button and wait till debugger stops on line 193
    5. Invoke Window|Debugging|Sources
    6. In Sources view check the java sources to be used for debugging (<JAVA_HOME>/src.zip)
    7. Place your caret on line 193 between 56th and 64st character (text intValue)
    8. Invoke Run Into Method action from editor popup menu
    • EXPECTED RESULT: Debugger will stop on line 644 of file Integer.java.
    • Teardown: Finish debugging session and uncheck java sources for debugging
  17. Run Into Method without source
    1. Toggle line breakpoint on line 193
    2. Invoke Debug Project action from menu or toolbar
    3. In MemoryView application press Apply button and wait till debugger stops on line 193
    4. Place your caret on line 193 between 56th and 64st character (text intValue)
    5. Assure in sources view the java sources are not used for debugging
    6. Invoke Run Into Method action from editor popup menu
    • EXPECTED RESULT: Debugger will stop on line 194 of file MemoryView.java.
    • Teardown: Finish debugging session and remove breakpoint
  18. Kill paused debugged application
    1. Invoke Debug Project action from menu or toolbar, wait until debugger and application are started
    2. Invoke Pause action from menu or toolbar
    3. Invoke Finish Debugger Session action from menu or toolbar
    • EXPECTED RESULT: 'User program finished' message will be shown in the status bar and in Debugger Console. The debugged application will be closed.


Test suite: Apply Code Changes

Purpose: To verify a Fix and Continue functionality
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project. Open file FixAndContinue.java in editor.

  1. Change method I
    1. Toggle line breakpoint on line 25 of the file FixAndContinue.java
    2. Invoke Debug File action form context menu of file in Projects view
    3. Invoke Step Over
    4. Change method call on line 30 to afterFix();
    5. Invoke Apply Code Changes
    6. Invoke Step Over
    • EXPECTED RESULT: In output will be two messages: Before code changes followed by After code changes
    • Teardown: Finish debugging session Change method call on line 30 to beforeFix(); Remove brekapoint from line 25
  2. Change method II
    1. Proceed actions from 'Change method I' testcase with the difference action Step Into will be used instead of Step Over
    • EXPECTED RESULT: Watch if debugger steps in correct methods. In output will be two messages: Before code changes followed by After code changes.
    • Teardown: Finish debugging session Change method call on line 30 to beforeFix(); Remove breakpoint form line 25
  3. Add line
    1. Toggle line breakpoint on line 25 of the file FixAndContinue.java
    2. Invoke Debug File action form context menu of file FixAndContinue.java in Projects view
    3. Invoke Step Into until debugger stops on line 26
    4. Insert line before line 30 with code System.out.println("Added line");
    5. Change method call on line 31 to afterFix();
    6. Invoke Apply Code Changes
    7. Invoke Step Into until end of application
    • EXPECTED RESULT: Watch if debugger steps in correct methods. In output will be three messages: Before code changes followed by Added line followed by After code changes.
    • Teardown: Change implementation of method method() to original Remove brekapoint from line 25
  4. Add method
    • Comments: JVM Does not support this scenario
    1. Toggle line breakpoint on line 25 of the file FixAndContinue.java
    2. Invoke Debug File action form context menu of file FixAndContinue.java in Projects view
    3. Invoke Step Over
    4. Change method call on line 30 to afterFix();
    5. Insert line newMethod(); on line 39
    6. Uncomment implementation of method newMethod()
    7. Apply code changes.
    8. Invoke Step Into until end of application
    • EXPECTED RESULT: Debugger should accept all changes.


Test suite: Evaluate expression issue 153401

Purpose:
Comments: 80735 92045
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project. Open file MemoryView.java in editor. Toggle line breakpoint on line 107 and invoke Debug project actgion.

  1. Primitive types
    1. Invoke Debug | Evaluate Expression action
    2. To expression field write
      (int)(total-free)
    3. Press Evaluate button
    • EXPECTED RESULT: The expression
      (int)(total-free)
      will be added to Result list with type int and some non-zero value.
  2. Add Watch - primitive types
    • Setup: Open Window | Debugging | Watches
    1. Press Watch button
    • EXPECTED RESULT: The expression
      (int)(total-free)
      will be added to watches view as watch with the same type (int) and value as in Evaluate Expression dialog
  3. {{{1}}}
    1. Invoke Debug | Evaluate Expression action
    2. To expression field write
      text.getText()
    3. Press Evaluate button
    • EXPECTED RESULT: Result list will contain item text.getText() with type String and value like "Used 1,283,568 bytes of 5,177,344 allocated memory"
  4. Variables - watch
    1. Invoke Debug | Evaluate Expression action
    2. To expression field write
      r.freeMemory()
    3. Press Evaluate button
    4. Press Watch button
    • EXPECTED RESULT: The new watch r.freeMemory() will be created and its value in Watches view will be the same as in Evaluate Expression dialog
  5. Perform changes
    1. Invoke Debug | Evaluate Expression action
    2. To expression field write
      txtTime.setText("Refresh:")
    3. Press Evaluate button
    4. Toggle breakpoint online 107 (delete it)
    5. Press Continue action
    • EXPECTED RESULT: Check the label of refresh time field in window of Memory View application is changed to Refresh:
  6. History
    1. Invoke Debug | Evaluate Expression action
    2. Open combo box list of Expression field
    3. Select an old expression
    • EXPECTED RESULT: All used expsressions must be stored in the combo box. The selected expression is evaluated.
  7. View columns
    1. Click small button next to columns titles
    2. In Change Visible Columns dialog check toString() checkbox
    3. Press OK
    • EXPECTED RESULT: Result list will display another column: toString()

Teardown: Finish debugger session and delete all watches.

Test suite: Tooltip evaluation

Purpose: Verifies expression evaluation functionality in editor
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project. Open file MemoryView.java in editor. Put caret on line 107. Invoke Debug | Run to Cursor action.

  1. Void tootips
    1. Select block of text status.setValue (taken) on line 99
    • EXPECTED RESULT: Tooltip with value void will be shown.
  2. Primitive tooltips
    1. Move your mouse pointer over taken variable on line 96
    • EXPECTED RESULT: Tooltip with the value of taken variable will be shown.
  3. Null tooltips
    1. Move your mouse pointer over the timer variable on line 81
    • EXPECTED RESULT: Tooltip with value null will be shown.
  4. Object tooltips
    1. Move your mouse pointer over the r variable on line 87
    • EXPECTED RESULT: Tooltip with the value of r variable will be shown.
  5. Dot expression tooltips
    1. Move your mouse pointer over the Integer.MAX_VALUE variable on line 91
    • EXPECTED RESULT: Tooltip with value of maximal integer will be shown.
  6. Expression evaluation I
    1. Select block of text total - free on line 96
    • EXPECTED RESULT: Tooltip with value of the expression will be shown. Value type will be long
  7. Expression evaluation II
    1. Select block of text (int) (total - free) on line 96
    • EXPECTED RESULT: Tooltip with value of the expression will be shown. Value type will be int
  8. Expression evaluation III
    1. Select block of text timer.stop () on line 81
    • EXPECTED RESULT: Tooltip with value unknown type "timer.stop" will be shown


Test suite: Attach Debbuger

Purpose:
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project. Open file MemoryView.java in editor.

  1. Socket attach
    1. Start MemoryView application from command prompt via command java -Xdebug -Xrunjdwp:transport=dt_socket,address=localhost:1234,server=y examples.advanced.MemoryView on JDK 1.5
    2. Invoke Debug|Attach Debugger
    3. In Attach dialog set Connector to SocketAttach
    4. Enter Host: value localhost and Port: value 1234
    5. Press OK
    6. When connection is established (message User Program Running is written into degger console and MemoryView application is running) toggle line breakpoint on line 96
    • EXPECTED RESULT: Debugger will stop on the breakpoint.
    • Teardown: Finish debugger session and remove breakpoint
  2. Socket listen
    1. Invoke Debug|Attach Debugger
    2. In Attach dialog set Connector to SocketListen
    3. Enter Host: value localhost and Port: value 1234
    4. Press OK
    5. Start MemoryView application from command prompt via command java -Xdebug -Xrunjdwp:transport=dt_socket,address=localhost:1234,server=n examples.advanced.MemoryView on JDK 1.5
    6. When connection is established (message User Program Running is written into degger console and MemoryView application is running) toggle line breakpoint on line 96
    • EXPECTED RESULT: Debugger will stop on the breakpoint.
    • Teardown: Finish debugger session and remove breakpoint
  3. Shared memory attach
    • Comments: Applicable only on Windows systems
    1. Start MemoryView application from command prompt via command java -Xdebug -Xrunjdwp:transport=dt_shmem,address=aaa,server=y examples.advanced.MemoryView
    2. Invoke Debug|Attach Debugger
    3. In Attach dialog set Connector to SharedMemoryAttach
    4. Enter Name value aaa
    5. Press OK
    6. When connection is established (message User Program Running is written into Debugger console and MemoryView application is running) toggle line breakpoint on line 96
    • EXPECTED RESULT: Debugger will stop on the breakpoint. All debugger views will display correct values.
    • Teardown: Finish debugger session - MemoryView application will be running again. Exit MemoryView applcation. Delete breakpoint
  4. Shared memory listen
    • Comments: Applicable only on Windows systems
    1. Invoke Debug|Attach Debugger
    2. In Attach dialog set Connector to SharedMemoryListen
    3. Enter Name value aaa
    4. Press OK
    5. Start MemoryView application from command prompt via command java -Xdebug -Xrunjdwp:transport=dt_shmem,address=aaa,server=n examples.advanced.MemoryView
    6. When connection is established (message User Program Running is written into degger console and MemoryView application is running) toggle line breakpoint on line 96
    • EXPECTED RESULT: Debugger will stop on the breakpoint. All debugger views will display correct values.
    • Teardown: Finish debugger session - MemoryView application will be exited. Delete breakpoint
  5. Process attach
    • Comments: Applicable only with JDK 1.6 and higher
    1. Start MemoryView application from command prompt via command java -Xdebug -Xrunjdwp:transport=dt_socket,server=y examples.advanced.MemoryView on JDK 1.6
    2. Invoke Debug|Attach Debugger
    3. In Attach dialog set Connector to ProcessAttach
    4. Get PID of MemoryView java process (by 'ps' on unix or Task Manager on windows)
    5. Enter the PID into Process-id(pid) of debugee: in Attach dialog
    6. Press OK
    7. When connection is established (message User Program Running is written into degger console and MemoryView application is running) toggle line breakpoint on line 96
    • EXPECTED RESULT: Debugger will stop on the breakpoint. All debugger views will display correct values.
    • Teardown: Finish debugger session, delete all breakpoints.


Test suite: Reusable editor

Purpose:
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project. Open file MemoryView.java in editor. Close other editor windows.

  1. Reusable Tab
    1. Toggle line breakpoint on line 98
    2. Invoke Debug Project action
    3. Wait till debugger stops on line 98 and invoke Step Over action
    4. Open Windows | Debugging | Sources view and check jdk sources - src.zip file.
    5. Invoke Step Into (F7) action 5 times
    • EXPECTED RESULT: JProgressBar.java window is opened. setMaximum and getModel methods are passed and DefaultBoundedRangeModel.java is opened into the same editor tab as JProgressBar.java. You can navigate through all opened files by Go back and Go forward actions (editor toolbar).
    • Teardown: Finish debugger session, delete all breakpoints.
  2. History List
    • Setup: Continue with test case Reusable Tab
    1. Open submenu of Go back arrow in editor toolbar (small down arrow on the right side of the button). There are JProgressBar.java:3 and MemoryView.java items. Forward arrow button is disabled.
    2. Press Go back arrow button two times.
    3. Reusable tab contains JProgressBar.java opened in method getModel() method. Forward arrow button in editor toolbar is enabled and its submenu list contains JProgressBar.java and DefaultBoundedRangeModel.java items.
    4. Press Go back arrow button two times.
    • EXPECTED RESULT: MemoryView.java editor is selected and cursor is on line 98.


Test suite: Free Form Debugging

Purpose:
Setup: Start NetBeans IDE with clear userdir. Open project freeform and set it as main project. Open file Anagrams.java in editor.

  1. Debug Project
    1. Toggle line breakpoint on line 190
    2. Invoke Debug Project action
    3. Confirm a question dialog: "Do you want to generate the IDE-specific build target now?" by Generate button.
    4. ide-targets.xml file is opened in editor
    5. Invoke Debug Project action again
    6. Press New Word button in the debugged application
    • EXPECTED RESULT: Debugger stops on the line breakpoint.
    • Teardown: Finish debugger session


Test suite: Step Over Expression

Purpose: To test functionality of Step Over Expression feature.
Setup: Start NetBeans IDE with clear userdir using JDK 1.6.0_02 or newer. Open project MemoryView and set it as main project. Open file MemoryView.java in editor.

  1. Arguments
    1. Toggle line breakpoint on line 99
    2. Invoke Debug Project action
    3. Wait till debugger stops on line 99 and invoke Step Over action
    4. Invoke Step Over Expression action
    • EXPECTED RESULT: Debugger will stop on line 102, constructor Long is selected by a green color. Local Variables view contains Arguments to <init> node with subnode total.
  2. Return Values
    1. Invoke Step Over Expression action
    • EXPECTED RESULT: Debugger will stop on line 103, constructor Long is selected by a green color. Local Variables view contains Arguments to <init> node with subnode free and node Return values history with return <init>() subnode. Value of the return value should be the new Long object. The constructor from previous test case is underlined.
  3. Arguments 2
    1. Invoke Step Over Expression action 2 times
    • EXPECTED RESULT: Debugger will stop on line 101, method format is selected by a green color. Local Variables view contains Arguments to format node with subnode new Object[[ | ]]{new Long(total),new Long(free),new Integer(taken)} containing 3 subnodes of all array items. There is node Return values history with 3 return <init>() subnodes. All constructors in the expression are underlined.
  4. Return Values 2
    1. Invoke Step Over Expression action again
    • EXPECTED RESULT: Debugger will stop on line 101, method setText is selected by a green color. Local Variables view contains Arguments to format node with subnode msgMemory.format(new Object[[ | ]]{new Long(total),new Long(free),new Integer(taken)}) of String type. There is node Return values history with 3 return <init>() subnodes and String node return format(). All constructors in the expression are underlined.
    • Teardown: Finish debugger session, delete all breakpoints


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