TS 73 Debugger Sanity

Debugger Sanity Test Specification for NetBeans IDE 7.3

Authors: Jiri Kovalsky
Version: 1.0
Last update: 2013/01/17
Description: This test suite contains test cases for sanity testing basic functionality of NetBeans Debugger. New bugs please report against debugger product and Java, Code or Ant component.
Comments: There are used the following test projects: Ant based MemoryView project, Maven based MemoryView project and JSPExamples in this test specification.

Contents


Java Debugger Sanity Test Specification

Necessary Setup Before You Start Testing

Purpose: Set up your NetBeans before you start sanity testing NetBeans Debugger to avoid stepping into standard Java source code. Setup Debugger Sources

  1. Open MemoryView testing project
  2. Invoke from main panel Window > Debugging > Sources
  3. Uncheck <JAVA_HOME>/src.zip source root

Java Debugger General Options

Java Debugger General Options

Purpose: Verify that general debugger options are available.
Setup: Start NetBeans with clear userdir and install JUnit library once asked.

  1. Java Debugger Options
    1. Invoke Tools > Options > Java > Java Debugger
    • EXPECTED RESULT: There are 4 categories for various settings of Java Debugger: General, Step Filters, Variable Formatters and Visual Debugging.

Basic functionality

Purpose: Verify that very basic debugger functionality like starting and stopping debugging session or stepping functions is not broken.
Setup: Open MemoryView project as your main project and open MemoryView.java file in editor.

  1. Breakpoint
    1. Place your caret at line 101
    2. Press Ctrl+F8 to toggle a breakpoint at line 101
    3. Press Ctrl+F5 to start debugging session
    • EXPECTED RESULT: Debugger will be started and after a while it will stop at line 101
  2. Continue
    1. Press F5 to continue debugging MemoryView application
    • EXPECTED RESULT: The Memory View window should appear and debugger should stop again at breakpoint at line 101
    • Teardown: Invoke Debug > Toggle Line Breakpoint from main menu to remove the breakpoint at line 101
  3. Run to cursor
    1. Place your caret at line 96
    2. Press F4 to run debugger to the cursor
    • EXPECTED RESULT: Debugger will run for a while and stop at line 96
    • Teardown: Press Shift+F5 to finish the debugging session
  4. Run to cursor - start debugging
    1. Place your caret at line 101
    2. Invoke Debug > Run to Cursor action from menu
    • EXPECTED RESULT: Debugger will get started and stop at line 101
    • Teardown: Invoke Debug > Finish Debugger Session from main menu
  5. Step Into - start debugging
    1. Press F7 action from menu or toolbar
    • EXPECTED RESULT: Debugger will get started and stop at the first line of MemoryView.main() method
    • Teardown: Press red square button from debugger toolbar to finish the debugging session
  6. Step Into
    1. Place your caret at line 58
    2. Invoke Debug > Toggle Line Breakpoint action from editor's popup menu
    3. Invoke Debug Project (MemoryView) action from toolbar
    4. Wait till debugger stops at line 58
    5. Invoke Step Into action from toolbar
    • EXPECTED RESULT: Debugger will stop at line 86
  7. Step Out
    1. Invoke Step Out action from toolbar
    • EXPECTED RESULT: Debugger will stop at line 60
    • Teardown: Finish debugging session
  8. Step Over
    1. Invoke Debug Project (MemoryView) action from toolbar
    2. Wait till debugger stops at line 58
    3. Press F8 to step over updateStatus() method call
    • EXPECTED RESULT: Debugger will stop at line 60
  9. Step Over Expression
    1. Toggle line breakpoint at line 101
    2. Invoke Continue action from toolbar
    3. Wait till debugger stops at line 101
    4. Invoke Step Over Expression action from the toolbar five times
      Variables view after stepping over expression
    • EXPECTED RESULT: Debugger will step over all methods of the expression and stop at line 101. Method setText is selected by a green colour. 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>() void 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 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 debugging session and delete breakpoints at lines 58 and 101
  10. Run Into Method
    1. Toggle line breakpoint at line 53
    2. Invoke Debug Project (MemoryView) action from toolbar
    3. Wait till debugger stops at line 53
    4. Place your caret at line 62 between 17th and 29st character (text updateStatus)
    5. Invoke Run Into Method action from editor popup menu
    • EXPECTED RESULT: The application will run for a second and after that debugger will stop at line 86.
    • Teardown: Finish debugging session and remove breakpoint

Expression Evaluator

Evaluate Code box

Purpose: Verify that expression evaluator works.
Setup: Open MemoryView project as your main project and open MemoryView.java file in editor.

  1. Evaluate Code
    1. Toggle line breakpoint at line 106
    2. Invoke Debug > Debug Project (MemoryView) from main menu
    3. Invoke Debug > Evaluate Expression... from main menu
    • EXPECTED RESULT: Make sure that Evaluate Code box appeared between Editor and Task panels. There must be a Show lastly evaluated code fragments button (grey triangle pointing down) and Evaluate code fragment button (green arrow-like shape)
  2. Primitive types
    1. Type (int)(total-free) to Evaluate Code box
    2. Press Evaluate code fragments button
    • EXPECTED RESULT: (int)(total-free) variable of int type will be created in Variables view and its value will be equal to value of taken variable.
  3. Objects
    1. Type return text.getText(); to Evaluate Code box
    2. Press Evaluate code fragments button
    • EXPECTED RESULT: return text.getText(); variable of String type will be created in Variables view and its value will be "Used ... bytes of ... allocated memory"
  4. Evaluation Result view
    Evaluation Result view
    1. Type "Hello" to Evaluate Code box
    2. Press Evaluate code fragments button twice
    3. Click Show evaluator result inside Variables view (violet diamond) button
    • EXPECTED RESULT: The violet diamond button gets unchecked and a separate view titled Evaluation Result opens. The view contains a violet node with the latest evaluation result and an expandable History node which contains all previous expressions: (int)(total-free), return text.getText(); and "Hello".
    • Teardown: Finish debugging session and delete the breakpoint at line 106.

Apply Code Changes

Purpose: Verify that it's possible to change debugged code on the fly.
Setup: Open MemoryView project as your main project and open FixAndContinue.java in editor.

  1. Apply code changes
    Output view reflects modified code
    1. Toggle line breakpoint at line 26 of the file FixAndContinue.java
    2. Invoke Debug File action from editor popup menu
    3. Change method call at line 30 to afterFix();
    4. Press Apply Code Changes button in toolbar
    5. Press F8 to step over the next line of code
    • EXPECTED RESULT: Output window will contain two messages: Before code changes followed by After code changes
    • Teardown: Finish debugging session, delete breakpoint in FixAndContinue.java file at line 26 and revert method call at line 30 back to beforeFix();

Visual debugger

Purpose: Test that it's possible to debug applications with graphical user interface.
Setup: Open your NetBeans with empty userdir and either create new or open an existing 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. 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.
  3. Hierarchy Changes
    1. Invoke Debug > Debug Project (AnagramGame) and after a while Debug > Take GUI Snapshot action.
    2. 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.
    • Teardown: Close AnagramGame project.
  4. 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.

Variables view

Purpose: Verify that variables view allows inspecting watches, variables and expressions.
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project. Open file MemoryView.java in editor.

  1. Local variables
    Variables view with local variables
    1. Put caret at line 91
    2. Invoke Debug > Run To Cursor from main menu
    • EXPECTED RESULT: Debugger will start and then stop at line 91. Variables tab will get opened next to Output tab. It will contain nodes this, r, free and total. Nodes this and r should be expandable.
  2. Member variables
    1. Expand node this
    • EXPECTED RESULT: timer, Static, Inherited and other nodes will show up under node this.
  3. Static variables
    1. Expand node Static
    • EXPECTED RESULT: msgMemory, bundle and other nodes will show up under node Static.
  4. Inherited variables
    1. Expand node Inherited
    • EXPECTED RESULT: Nodes of variables from javax.swing.JFrame like defaultCloseOperation or transferHandler will be under node Inherited.
  5. Go to source
    1. Close file MemoryView.java in editor
    2. Select node jPanel1 and invoke Go to Source from its popup menu
    • EXPECTED RESULT: File MemoryView.java will be opened in editor. Caret will be at line 223.
    • Teardown: Finish debugging session.

Watches view

Purpose: Verify that it's possible to work with watches.
Setup: Do this test suite with standalone Watches view as well as when it is integrated in the Variables view. Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project.

  1. Primitive filter
    1. Invoke Window > Debugging > Watches from main menu.
    2. Open file LineBreakpoints.java in editor.
    3. Toggle line breakpoint at line 200.
    4. Invoke Debug File action from Editor's context menu.
    5. Invoke Debug > New Watch... from main menu.
    6. Type n as Watch Expression and push OK button.
    7. Right click the watch n and test Display As > ... action
    • EXPECTED RESULT: The value will be displayed in these formats:
      • Decimal - 50
      • Hexadecimal - 0x32
      • Octal - 062
      • Binary - 110010
      • Character - '2'
      • toString() column will change in primitive types as display type changes.
    • Teardown: Get the value displayed back as Decimal.
  2. Value based filter
    1. Create new watch string
    2. Right click the value 50 of watch n and invoke Show only rows where > action
    • EXPECTED RESULT: You should have several possibilities to filter watches:
      • Value == 50 shows only n watch
      • Value <> 50 shows only string watch
      • Value > 50 shows no watch (note: to remove the filter invoke popup menu somewhere in the value column and select Show only rows where > No Filter )
      • Value < 50 shows only string watch
      • Value >= 50 shows only n watch
      • Value <= 50 shows only n and string watch
      • No filter shows both watches
    • Teardown: Delete both watches and finish debugging session.


For other test cases see old Watches view test suite for NetBeans IDE 6.8.

Breakpoints view

Purpose: Verify that it's possible to manage debugger breakpoints.

Please execute test cases from old Breakpoints view test suite for NetBeans IDE 6.8.

Threads view

Purpose: Verify that threads view allows basic single thread debugging operations.

Please execute test cases from old Threads view test suite for NetBeans IDE 6.8.

Multi-thread breakpoints

Purpose: Verify that breakpoints work in multi-thread applications.

Please execute test cases from old Line breakpoints test suite for NetBeans IDE 6.8.

Sessions view

Purpose: Verify that sessions view allows (thread/language) sessions separated debugging.

Please execute test cases from old Sessions view test suite for NetBeans IDE 6.8.

Multi-thread debugging

Purpose: Verify that debugging of multi-thread applications is working.

Please execute test cases from old Multi-thread debugging application test suite and old Resume/Suspend threads test suite for NetBeans IDE 6.8.

Ant Debugger Sanity Test Specification

Basic functionality

Purpose: Verify that basics of Ant debugger is not broken.

Please execute test cases from old Operations (Ant) test suite for NetBeans IDE 6.8.

Breakpoints

Purpose: Verify that breakpoints in Ant debugger are working.

Please execute test cases from old Breakpoints (Ant) test suite for NetBeans IDE 6.8.

Variables

Purpose: Verify that Ant debugger allows inspecting Ant watches and variables.

Please execute test cases from old Breakpoints (Ant) test suite for NetBeans IDE 6.8.

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