TS 74 MultiThreadedDebugging

Multi Threaded Debugging Specification for NetBeans 7.4

Author: Jiří Kovalský based on earlier versions from Dhawal Saiya, Peter Píš, Filip Zamboj and Vojtěch Sígler.
Version: 1.0
Lastupdate: 2013/08/21
Introduction: This document describes test specification for testing of debuggerjpda module in NetBeans IDE focused on multithreaded debugging.
Comments: There are used test projects MemoryView.

Contents


Test suite: Debugging view

Purpose: Tests of debugging view existence and persistence
Setup: Start NetBeans IDE with clear userdir

  1. Debugging
    1. Invoke Window | Debugging | Debugging
    • EXPECTED RESULT: Debugging view (tab) is opened in area next to Projects and Files explorer
  2. View persistence - restart IDE
    1. Make sure that Debugging view is opened.
    2. Restart IDE
    • EXPECTED RESULT: Ensure that Debugging view is opened and arranged as before restart.
    • Teardown: Close Debugging view.


Test suite: Debugging - filters

Purpose: Verifies the functionality of debugging view
. Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project.

  1. Debugging sessions
    1. Make sure that Debugging view is opened.
    2. Invoke Debug | Debug Project (MemoryView) action from the main menu.
    3. Select MemoryView project node and repeat the previous step again.
    • EXPECTED RESULT: In the top of Debugging view there is a combo box for sessions which should have 2 sessions. Try to switch between them.
  2. Debugging thread list
    1. Make sure that Debugging view is opened.
    • EXPECTED RESULT: In the middle of Debugging view there is a list of threads. When there is no application being debugged this component should be empty.
    • Teardown: Stop both debugged applications via Debug | Finish Debugger Session from main menu.
  3. Debugging toolbar
    1. Make sure that Debugging view is opened.
    • EXPECTED RESULT: Following buttons (with hint) are visible: Show less (suspended and current threads only), Show thread groups, Show suspend/resume table (which is checked), Show system threads, Show monitors, Show qualified names, Sort by suspended/resumed state, Sort by name (which is checked) and Sort by default.
  4. Debug Application
    1. Select ThreadSuspending1.java and invoke Debug File from its popup menu.
    • EXPECTED RESULT: Sessions output window shows test.ThreadSuspending1 and there are three running threads listed in the Debugging view: Thread-1 running, Thread-2 running and Thread-3 running. The Debugger Console of Output view should print Listening on <port> User program running.
  5. Show thread groups
    1. Push Show thread groups button in the toolbar of Debugging view.
    • EXPECTED RESULT: system root group node should be show with main group underneath.
  6. Show suspend/resume table
    1. Push Show suspend/resume table button in the tooolbar of Debugging view 2 times.
    • EXPECTED RESULT: The column with thread controls is displayed by default. By clicking the button it should disappear and appear again after second click. All 3 threads should have Suspend thread button available - thread are in unsuspended state.
  7. Show system threads
    1. Push Show system threads button in toolbar of Debugging view.
    • EXPECTED RESULT: Another running threads should be added into the list of threads: Signal Dispatcher, Finalizer, Reference Handler and DestroyJavaVM.
  8. Show suspended and current threads only
    1. Invoke Make Current from the popup menu on Thread-1.
    2. Push the Suspend thread button next to Thread-2.
    3. Push Show Less (suspended and current threads only) button in the toolbar of Debugging view.
    • EXPECTED RESULT: The only threads shown are Thread-1 running (show in bold) and Thread-2 suspended at Thread.sleep (with orange icon).
    • Teardown: Switch off Show Less (suspended and current threads only) option.
  9. Show monitors
    1. Push Show monitors toolbar button in Debugging view.
    • EXPECTED RESULT: In this case nothing will be changed.
  10. Show qualified names
    1. Push Show qualified names toolbar button in Debugging view.
    • EXPECTED RESULT: Make sure that fully qualified name is shown/hidden (package location for method where the thread is suspended) when Show qualified names is toggled on and off. In this case UI toggles between java.lang.Thread.sleep and only Thread.sleep in the Thread-2 tree.
  11. Sort by suspended/resumed state
    1. Push Sort by suspended/resumed state toolbar button in Debugging view.
    • EXPECTED RESULT: All threads should be sorted by suspended/resumed state. If sorting is turned on, suspended threads should go first, running then.
  12. Sort by name
    1. Push Sort by name toolbar button in Debugging view.
    • EXPECTED RESULT: All threads should be sorted by name alphabetically if the sorting is turned on.
  13. Sort by default
    1. Push Sort by default toolbar button in Debugging view.
    • EXPECTED RESULT: All threads should be sorted by default if they were sorted either by name or state before.
    • Teardown: Invoke Debug | Finish Debugger Session from main menu.

Test suite: Resume/Suspend threads.

Purpose: Verifies the functionality of threads table buttons
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project.

  1. Suspend running thread
    1. Make sure that Debugging view is opened.
    2. Select ThreadSuspending1.java, invoke Debug File from its popup menu and switch to Debugging view.
    3. Make sure that Show suspend/resume table button is turned on and Show system threads button is turned off.
    4. 3 threads should be running.
    5. Select Thread-1, invoke Make Current from its popup menu and push SUSPEND button.
    • EXPECTED RESULT: Thread-1 should be suspended. This thread also should be marked as Current Thread by green bar in the left. Its title should be changed to Thread-1 suspended at Thread.sleep. Appropriate node for this thread should expandable (+). There should be shown thread frame where the thread was suspended. The Debugger Console tab of Output view prints Thread Thread-1 stopped at Thread.java.sleep. The left icon (with SUSPEND) next to node should be orange. The button for this thread should change to RESUME
  2. Resume suspended thread
    1. Make sure that Debugging view is opened.
    2. Make sure that Show suspend/resume table button is turned on and Show system threads button is off.
    3. Push RESUME button next to suspended Thread-1 suspended at Thread.sleep in Debugging view.
    • EXPECTED RESULT: Thread-1 should be running. The Debugger Console tab of Output view prints User Program running. Its title should be changed back to Thread-1. Now the left icon (without SUSPEND) next to node should be green. The button for this thread should change to SUSPEND
  3. Suspend running thread - popup menu
    1. Make sure that Debugging view is opened.
    2. Switch to Debugging view.
    3. 3 threads should be running.
    4. Select Thread-1 thread and invoke Suspend popup menu action. (Make Current item has to be disabled and Suspend and Interrupt items have to be enabled)
    • EXPECTED RESULT: Thread-1 should be suspended. This thread also should be marked as Current Thread by green bar in the left. Its title should be changed to Thread-1 suspended at Thread.sleep. Appropriate node for this thread should expandable (+). There should be shown thread frame where the thread was suspended. The Debugger Console tab of Output view prints Thread Thread-1 stopped at Thread.java.sleep. The left icon (with SUSPEND) next to node should be orange. The button for this thread should change to RESUME
  4. Resume suspended thread - popup menu
    1. Make sure that Debugging view is opened.
    2. Select suspended Thread-1 suspended at Thread.sleep in Debugging view and invoke Resume popup menu action. (Make Current and Interrupt items have to be disabled)
    • EXPECTED RESULT: Thread-1 should be running. The Debugger Console tab of Output view prints User Program running. Its title should be changed back to Thread-1. Now the left icon (without SUSPEND) next to node should be green. The button for this thread should change to SUSPEND
  5. Multiple selection
    1. Select more than 1 thread and invoke popup menu.
    • EXPECTED RESULT: For threads in running state there should be Interrupt and Suspend actions enabled. For threads in suspended state there should be Resume action enabled only. For threads in different state (suspended and running) all action should be disabled.
  6. Set Current Thread
    1. Suspend All Threads
    2. Make Thread 3 current as described in Test suite: Debugging application, point 3 of this document
    3. Invoke Debug from main menu
    4. Choose Set Current Thread option
    5. Choose Thread 2
    6. Confirm by enter
    • EXPECTED RESULT: Thread should be highlighted and set as current.
    • Teardown: Stop debugged application - invoke Debug | Finish Debugger Session from main menu.


Test suite: Debugging application

Purpose: Verifies breakpoints usage
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project.

  1. Stopping at breakpoints
    1. Open ThreadSuspending1.java file and put breakpoints to 28, 47, and 63 lines (line contains i++;)
    2. Invoke Debug File from its popup menu and switch to Debugging view.
    • EXPECTED RESULT: In a moment Thread-1, Thread-2 and Thread-3 should be suspended annotated with orange icon with red rectagle. For each application thread there should be RESUME button available. Thread-1 has to be marked as Current Thread by green bar. Thread-2 and Thread-3 have to be suspended - yellow bar. Application threads must be expandable (+). Ensure that each thread was suspended on appropriate line as defined in step 1. In the bottom of Debugging view another panel should appear. Verify that New Breakpoint Hits (2) and bold arrow are present in the bottom of Debugging view. Scroll down BOLD ARROW: Thread-2 stopped at LineBreakPoint ThreadSuspending1.java:47 and Thread-3 stopped at LineBreakPoint ThreadSuspending1.java:63 have to be there. Debugger Console of Output there has to be
Listening on port <portnumber>
User program running
LineBreakPoint ThreadSuspending1.java : 28 successfully submitted. 
LineBreakPoint ThreadSuspending1.java : 47 successfully submitted.
LineBreakPoint ThreadSuspending1.java : 63 successfully submitted.
Breakpoint hit at line 28 in class tests.ThreadSuspending$1 by thread Thread-1.
Thread Thread-1 stopped at ThreadSuspendin.java:28.
Breakpoint hit at line 47 in class tests.ThreadSuspending$2 by thread Thread-2.
Breakpoint hit at line 63 in class tests.ThreadSuspending$3 by thread Thread-3.
  1. Resuming threads
    1. Switch to Debugging view
    2. Select all application threads. (Thread-1, Thread-2 and Thread-3) and invoke Resume popup menu action.
    • EXPECTED RESULT: Application threads should be resumed and suspended afterwards immediately.
  2. Change Current Thread
    1. Switch to Debugging view and select non current thread which encountered breakpoint.
    2. Invoke Make Current popup menu action.
    • EXPECTED RESULT: This thread should be marked as current (Thread title should be ) with green bar, highlighted breakpoint (green line in editor) belongs to current thread now. New Breakpoint Hits decreases by 1.
  3. Change Current Thread II
    1. Switch to Debugging view
    2. Double click non current suspended thread - it is current thread now.
    3. Text of current thread name should be bold.
    4. Expand current thread node.
    • EXPECTED RESULT: This thread should be marked as current (method of suspended thread is printed in BOLD only, collapsing thread node should make thread's name bold again) with green bar, highlighted breakpoint (green line in the editor) belongs to current thread now. New Breakpoint Hits decreases by 1.
    • Teardown: Stop debugged application via Debug | Finish Debugger Session from main menu.
  4. Current Thread Chooser
    1. Invoke Debug File from popup menu of ThreadSuspending1.java file.
    2. In a while all application threads should be suspended.
    3. Invoke Debug | Set Current Thread... from main menu. Thread selector shows up.
    4. Holding both ALT and SHIFT key and pushing T key should switch among all suspended threads. This does not work on Mac OS X.
    • EXPECTED RESULT: Verify the functionality of choosing current thread. Chosen thread should be also indicated in Debugging view by green bar next to current thread.
    • Teardown: Stop debugged application via Debug | Finish Debugger Session from main menu.
  5. Deadlock detection
    1. Select DeadlockTest.java and choose Debug File from its popup menu.
    2. Make sure that Thread-0 and Thread-1 are running in Debugging view.
    3. Suspend both threads.
    • EXPECTED RESULT: Over the Debugging toolbar there should appear yellow panel with Deadlock detected label.
  6. Monitors
    1. Continue with the previous Deadlock detection test case.
    2. Toggle Show monitors button from the toolbar of Debugging view.
    • EXPECTED RESULT: Monitors for each thread should be shown/hidden for appropriate line in thread frame of Debugging view depending on the state of Show monitors button.
    • Teardown: Stop debugged application via Debug | Finish Debugger Session from main menu.

Test suite: Compile on Save debugging

Purpose: Verifies automatic code changes integration
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView, invoke Properties on the MemoryView project node and check Compile on Save in Build -> Compiling. Next invoke Tools > Options from main menu, select Java > Java Debugger, General category and check Apply code changes after save (in "Compile on Save" mode only). Click OK button.

  1. Uncompilable source
    1. Open ClazzOne.java file and put breakpoints to line 27 (new ClazzTwo().doit();)
    2. Make sure JDK sources are not checked for debugging in Sources output window.
    3. Make the code of doit() method uncompilable (replace it with
      x//System.out.println("I do nothing");
      ) and save the file.
    4. Invoke Debug File from popup menu of ClazzOne.java file and watch Debugger Console.
    5. Confirm the One or more projects were compiled with errors. dialog by clicking Run Anyway button.
    6. Push F7 three times.
    • EXPECTED RESULT: "Debugger Console" should print "Debugger stopped on uncompilable source code." at line 39.
  2. Automatic pop
    1. Now correct the code (remove
      x//
      ) and save the file.
    • EXPECTED RESULT: Current thread should backtrack to line 27.
    • Teardown: Stop debugged application via Debug | Finish Debugger Session from main menu.

Test Suite: Debugging view - Other Options

Purpose: To Verify Go To Source and Copy Stack Option
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView.

  1. Go To Source
    1. Open ThreadSuspending1.java
    2. Start debugging ThreadSuspending1.java
    3. Make sure that Debugging window is opened and you see running threads (Thread-1, Thread-2 and Thread-3)
    4. Debugger stops at breakpoint on line 28
    5. Each thread has to be expandable
    6. Expand all threads.
    7. Thread 2 is current running thread indicated by bold font.
    8. Select ThreadSuspending1$1.run:28 in Call Stack output window.
    9. Choose Go To Source from its popup menu.
    • EXPECTED RESULT: Caret will move to last executed code of selected thread, eventually to the breakpoint where thread was suspended. Debugging continues from last breakpoint NOT from caret position.
  2. Copy Stack
    1. Continue with the previous Go To Source test case.
    2. Select ThreadSuspending1$1.run:28 in Call Stack output window.
    3. Choose Copy Stack from its popup menu.
    • EXPECTED RESULT: The copy of current thread stack location should be copied to clipboard. Try to paste the clipboard somewhere to verify this.
  3. Suspend All Threads
    1. Continue with the previous Copy Stack test case.
    2. Invoke popup menu from Debugging View without selecting any of threads and choose Suspend All Threads.
    • EXPECTED RESULT: All threads should be suspended. Suspended threads are indicated by red circle and pause sign over. Stopped threads before committing this action are marked by stop sign over the circle.
  4. Resume All Threads
    1. Continue with the previous Suspend All Threads test case.
    2. Invoke popup menu from Debugging View without selecting any of threads and choose Resume All Threads.
    • EXPECTED RESULT: All threads will resume. Running threads are indicated by green circle. Stopped threads before committing this action are marked by stop sign over the red circle.
    • Teardown: Stop debugged application via Debug | Finish Debugger Session from main menu.
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