TS 74 JPDAdbg Functionality

Debugger Test Specification for NetBeans 7.2 Part II - Functionality

Author: Jiří Kovalský, based on earlier versions by Emanuel Hučka, Petr Cyhelský, Filip Zamboj and Vojtěch Sigler.
Version: 1.0
Lastupdate: 2012/05/02
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


Important!! Setup Before You Start Testing

Purpose: Set up your Netbeans before you start testing. Please set up your netbeans in this way before each test!

  1. Setup Debugger Sources (Since version 7.0 M2 there should JDK sources enabled by default. Uncheck them)
    1. Invoke from main panel Window > Debugging > Sources
    2. uncheck <JAVA_HOME>/src.zip


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.

  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. Invoke Continue
    2. After a while, debugger will stop on line 101 again
    3. Place your caret on line 96
    4. 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 I
    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 684 of file Integer.java.
    • Teardown: Finish debugging session and uncheck java sources for debugging
  17. Run Into Method - JDK method II
    • Setup:Restart NetBeans with clear userdir and ignore initial setting of Debugger Sources
    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. Place your caret on line 193 between 56th and 64st character (text intValue)
    6. Invoke Run Into Method action from editor popup menu
    • EXPECTED RESULT: Debugger will stop on line 684 of file Integer.java.
    • Teardown: Finish debugging session and uncheck java sources for debugging
  18. 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
  19. 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.
  20. More Projects Sources View
    1. Open project MemoryView
    2. Open Project FreeForm
    3. Invoke Debug Project action from popup menu on both projects, wait until debugger sessions and application are started
    4. Make sure Debugging view is open
    5. Invoke Window | Debugging | Sources
    • EXPECTED RESULT: In the Debugging view there is a combo box containing all the projects you are debugging. When you change the selected project in this combo box, the Sources view should show sources assigned to the selected project. When examples.advanced.MemoryView is selected, the Sources view should display <path_to_jdk>/src.zip and <project_dir>/MemoryView/src (Project MemoryView). When freeform is selected, the Sources view should display <path_to_jdk>/src.zip and <project_dir>/freeform/src (Project freeform).



Test suite: Apply Code Changes

Purpose: To verify a Fix and Continue functionality
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView. 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: Apply Code Changes II

Purpose: To verify a Fix and Continue on save
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView. Open file FixAndContinue.java in editor.

  1. Apply Code Changes After Save
    1. Verify that you are running project in compile on save mode. You can do so in Project Properties -> Build -> Compile
    2. Invoke the Options dialog, in Miscellaneous | Java Debugger | General check Apply code changes after save checkbox
    3. Repeat all steps from test suite Apply Code Changes BUT EXCEPT pressing button Apply Code Changes just save the document
    • EXPECTED RESULT: Debugger should accept all changes right after you save the document.


Test suite: Evaluate expression

Purpose:
Comments: 80735 92045
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView. Open file MemoryView.java in editor. Toggle line breakpoint on line 107 (text: text.invalidate();) and invoke Debug project action.

  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)} is not valid. Dialog with text "Malformed Expression: "(ERROR)"" and a button OKshould appear.
  2. Variables
    1. Invoke Debug | Evaluate Expression action
    2. To expression field write
      return text.getText();
    3. Press Evaluate button
    • EXPECTED RESULT: Result list will contain result with name return text.getText() of type String and empty String value "Used <number> bytes of <another number> allocated memory"
  3. Condition I
    1. Invoke Debug | Evaluate Expression action
    2. To expression field copy&paste
int temp = status.getValue();
switch (temp) { 
  case (1234): return true;
  default: return false; 
}
    1. Press Evaluate button
    • EXPECTED RESULT: Result of evaluation should be of type boolean with a value false
  1. Condition II
    1. Invoke Debug | Evaluate Expression action
    2. To expression field copy&paste
boolean temp = false; 
if (taken < 10) { 
  temp = false; 
} 
else if (taken <= 100) { 
  temp = false; 
} 
else if (taken > 100) { 
  temp = true; 
} 
else {
  temp = false; 
} 
return temp;
    1. Press Evaluate button
    • EXPECTED RESULT: Result of evaluation should be of type boolean with a value true
  1. Evaluate after Fix&Continue
    1. Invoke Debug | Evaluate Expression action
    2. To expression field copy&paste
boolean temp = false;
if (taken < 100) {
  temp = false;
} else if (taken < 1000) {
  temp = false;
} else if (taken == total - free) {
  temp = true;
} else {
  temp = false;
}
return temp;
    1. Press Evaluate button
    • EXPECTED RESULT: Result of evaluation should be of type boolean with a value true
  1. Fix&Continue & Iterate through collection
    1. Invoke Debug | Evaluate Expression action
    2. To expression field copy&paste
int n = 0;
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(10);
list.add(taken);
list.add(n);
list.add(status.getValue());
String result = "";
while(!list.isEmpty()) {
   result = result + " + " + list.get(0).toString();
   list.remove(0);
}
return result;
    1. Add following import declaration to MemoryView.java file import java.util.ArrayList;
    2. Press Apply Code Changes
    3. Press Evaluate button
    • EXPECTED RESULT: Result of the evaluation should be String with a value similar to + 10 + 263314 + 0 + 26331
  1. Perform changes
    1. Invoke Debug | Evaluate Expression action
    2. To expression field write
      txtTime.setText("???:");
    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 ???:. The result of expression evaluator should be of void type and value as well.
  2. History
    1. Push Show evaluator result inside Variables view button in the left toolbar of the Variables output view.
    2. Switch to newly opened Evaluation Result view next to Variables view.
    3. Expand the History Node in Evaluation Result view.
    4. Right click some old expression and invoke Paste To Evaluator action from its popup menu.
    • EXPECTED RESULT: Paste To Evaluator action on any result under History node or double-clicking results should pasted them to the Evaluate Expression view.
  3. Evaluate Expression Results Window
    1. Verify that all results were shown in Evaluation Result output window
    • EXPECTED RESULT: All used expressions must be listed under History node.
  4. Evaluate Expression Shown in Variables window
    1. Select Variables View
    2. Click on pink diamond icon i.e. Show evaluator result inside Variables view button above the blue diamond icon.
    • EXPECTED RESULT: The last result of evaluation should be shown in Variables view distinguished by pink diamond icon.

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. 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 Method "stop" called on a null object. will be shown


Test suite: Attach Debbuger

Purpose:
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView. Open file MemoryView.java in editor. Open console and cd to a <local_project_directory>/build/classes

  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
    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 debugger 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
    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. 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. 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. 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. Variables view contains Before call to '<init>' with subnode Arguments which contains subnode total. The icon next to Before call to '<init>' and Arguments nodes is a smaller version of the icon on Step Over Expression button in the Debug toolbar.
  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. Variables view contains Before call to '<init>' node with subnodes Arguments and Return values history. Arguments node contains subnode free and node Return values history contains return <init>() subnode. The icon next to Before call to '<init>' and Arguments nodes is a smaller version of the icon on Step Over Expression button in the Debug toolbar. Return values history and its subnodes have an icon with a grey rectangle and a grey triangle. The Type column is empty and the Value column shows null. 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. Variables view contains Before call to format node with subnodes Arguments and Return values history. Arguments node contains a subnode new Object[[ | ]]{new Long(total),new Long(free),new Integer(taken)} containing 3 subnodes of all array items. The Return values history node contains 3 return <init>() subnodes. The icon next to Before call to 'format' and Arguments nodes is a smaller version of the icon on Step Over Expression button in the Debug toolbar. Return values history and its subnodes have an icon with a grey rectangle and a grey triangle. 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. Variables view contains Before call to setText() node with subnodes Arguments and Return values history. Arguments node contains a node msgMemory.format(new Object[[ | ]]{new Long(total),new Long(free),new Integer(taken)}) of String type. Node Return values history contains 3 return <init>() subnodes and String node return format(). The icon next to Before call to 'setText()' and Arguments nodes is a smaller version of the icon on Step Over Expression button in the Debug toolbar. Return values history and its subnodes have an icon with a grey rectangle and a grey triangle. All constructors in the expression are underlined.
    • Teardown: Finish debugger session, delete all breakpoints


Test suite: Debugging During Source Indexing

Purpose: Verify that scanning of sources does not block stepping through code.
Setup: Clone NetBeans main Hg repository (hg clone http://hg.netbeans.org/main/). Start NetBeans IDE with clear userdir. Open MemoryView project and open file MemoryView.java in Editor.

  1. Step Over When Opening Project
    1. Toggle line breakpoint at line 52 and hit Ctrl+F5 to start debugging MemoryView project.
    2. When the breakpoint at line 52 is hit invoke File > Open Project... from main menu.
    3. Navigate to your cloned NetBeans sources, select debugger.jpda.ui project, uncheck Open Required Projects and push Open Project button.
    4. NetBeans opens JPDA Debugger UI project and start scanning its sources.
    5. Press F8 key three times.
    • EXPECTED RESULT: Debugger normally steps over the code and stops at line 55 before scanning of JPDA Debugger UI project is finished.
    • Teardown: Finish debugger session, remove line 52 breakpoint and close both projects.


Test suite: Visual Debugging

Purpose: Test that it's possible to debug applications with graphical user interface.
Setup: Open your NetBeans with empty userdir and create new AnagramGame project.

  1. Take GUI Snapshot
    Snapshot of GUI application
    1. Make sure that AnagramGame is opened as your main project
    2. Press Ctrl+F5 to start debugging main project
    3. Invoke Debug > Take GUI Snapshot from main menu
    4. Click Guess button
    • EXPECTED RESULT: Snapshot of "Anagrams" tab gets opened in Editor showing actual GUI state of the debugged application. Navigator view shows components tree of the Anagrams window, guessButton [JButton] is selected and Properties panel shows properties of this JButton component.
  2. Saving GUI Snapshot
    1. Click diskette icon in the Editor toolbar.
    2. Browse to suitable directory, append for example gui_snapshot.png as File Name and click OK button.
    • EXPECTED RESULT: Make sure that the image was really saved into desired location and that it really contains the screenshot of the GUI.
  3. Component Listeners
    Events tab in output window
    1. Right click guessLabel [JLabel] component node in Navigator
    2. Invoke Show Listeners action from its popup menu
    3. Right click Event Log node in Events output tab and invoke Set Logging Events... action
    4. Select java.awt.event.MouseListener and click OK button
    5. Focus Anagrams window and hover over Your Guess: text with your mouse
    • EXPECTED RESULT: Events tab in Output window now contains four rows: guessLabel [JLabel] "Your Guess:", Custom Listeners, Internal AWT/Swing Listeners and Event Log. Last two are expandable. Event Log node will contain two expandable subnodes: mouseEntered (java.awt.event.MouseEvent) and mouseExited (java.awt.event.MouseEvent) both containing Called From... subtree with stacktraces.
    • Teardown: Finish debugging session.
  4. Hierarchy Changes
    1. Invoke Tools > Options, select Java category, click Java Debugger and select Visual Debugging category.
    2. Check Track locations of component hierarchy changes option and press OK.
    3. Invoke Debug > Debug Project and after a while Debug > Take GUI Snapshot action.
    4. Right click Guess button and invoke Go To Hierarchy Addition action from its popup menu.
    • EXPECTED RESULT: Anagrams.java gets opened in Editor with cursor at line 184 where guessButton is added to buttonsPanel parent container.
  5. Component Declaration
    1. Right click Guess button and invoke Go to Component Declaration action from its popup menu.
    • EXPECTED RESULT: Anagrams.java file is opened in Editor with cursor at line 279 where guessButton is declared.
  6. Component Source
    1. Right click Guess button and invoke Go to Component Source action from its popup menu.
    • EXPECTED RESULT: JButton.java file is opened in Editor with cursor at line 78 where implementation of JButton object begins.
    • Teardown: Finish debugging session.
  7. Snapshot Zooming
    1. Invoke Debug > Debug Project and after a while Debug > Take GUI Snapshot action.
    2. Click + button in Editor toolbar twice to double size of the snapshot.
    3. Click 1:1 button to zoom to original size.
    4. Click Fit in Window to maximally enlarge the snapshot.
    5. Click - button to make it smaller again.
    6. Select 75% value from zooming pull down menu and click Guess button.
    • EXPECTED RESULT: Navigator shows guessButton as selected and Properties window displays all properties of the button. It must be possible to zoom snapshot of any graphical application.
  8. Saving GUI Snapshot
    1. Click Save button (diskette icon) in the toolbar of the GUI snapshot.
    2. Type gui_snapshot.png as File Name in the Save dialog and click OK button.
    • EXPECTED RESULT: The gui_snapshot.png file containing the GUI snapshot is created in your Home directory.
  9. Properties and Create Fixed Watch actions
    1. Right click Guess button and invoke Create Fixed Watch action from the popup menu.
    2. Right click Guess button and invoke Properties action from the popup menu.
    • EXPECTED RESULT: The guessButton[JButton] "Guess" - Properties dialog is opened containing a table with properties like Component Name, Component Type etc. In addition to that guessButton[JButton] "Guess" fixed watch entry is created in Variables output view.
    • Teardown: Finish debugging session and close AnagramGame project.
  10. Component Breakpoints
    Snapshot of IDE upon component breakpoint was hit
    1. Download Memory Monitor project and extract it to some directory.
    2. Invoke File > Open Project... and open the Memory Monitor project.
    3. Right click MemoryMonitor project and invoke Debug action from its popup menu.
    4. After the application is started, invoke Debug > Take GUI Snapshot from main menu.
    5. Right click the graph area and invoke Toggle Component Breakpoint from the popup menu.
    6. Switch to MemoryMonitor application and click on the Memory Monitor border title.
    • EXPECTED RESULT: Debugger is suspended and MemoryMonitor.java is opened in Editor at line 58, where MemoryMonitor$Surface component is removed from its container. There is Component Breakpoint surf [MemoryMonitor$Surface] en‏try in Breakpoints output view.
    • Teardown: Finish debugging session, remove component breakpoint created for surf component and close all JDK demo projects.
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