TS 74 MultiThreadedDebugging

(Difference between revisions)
m (Test suite: Debugging - filters)
(Minor formatting.)
Line 35: Line 35:
#* {{result|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'''.}}
#* {{result|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'''.}}
# {{testcase|Debug Application}}  
# {{testcase|Debug Application}}  
-
##Select ''ThreadSuspending1.java'' and invoke '''Debug File''' from its popup menu.
+
## Select ''ThreadSuspending1.java'' and invoke '''Debug File''' from its popup menu.
#* {{result|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''.}}
#* {{result|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''.}}
# {{testcase|Show thread groups}}  
# {{testcase|Show thread groups}}  
-
##Push ''Show thread group'' button from with ''Debugging'' view toolbar.
+
## Push ''Show thread groups'' button in the toolbar of ''Debugging'' view.
-
#* {{result|EXPECTED RESULT: ''system'' root group node should be show with ''main'' group under. }}
+
#* {{result|EXPECTED RESULT: ''system'' root group node should be show with ''main'' group underneath. }}
-
# {{testcase|Show Suspended/Resumed table}}  
+
# {{testcase|Show suspend/resume table}}  
-
##Push ''Show suspended/resumed table'' button from with ''Debugging'' view toolbar 2 times.
+
## Push ''Show suspend/resume table'' button in the tooolbar of ''Debugging'' view 2 times.
-
#* {{result|EXPECTED RESULT: This column is displayed by default. By clicking the button it should disappear and appear again after second click. All four threads should have SUSPEND button available - thread are in unsuspended state. }}
+
#* {{result|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.}}
# {{testcase|Show system threads}}  
# {{testcase|Show system threads}}  
-
##Push ''Show system threads'' button from with ''Debugging'' view toolbar.
+
## Push ''Show system threads'' button in toolbar of ''Debugging'' view.
-
#* {{result|EXPECTED RESULT: Another running threads should be added into the list of threads:
+
#* {{result|EXPECTED RESULT: Another running threads should be added into the list of threads: '''Signal Dispatcher''', '''Finalizer''', '''Reference Handler''' and '''DestroyJavaVM'''.}}
-
:#* Signal Dispatcher
+
-
:#* Finalizer
+
-
:#* Reference Handler
+
-
:#* Destroy JavaVM
+
-
:#* Attach Listener}}
+
# {{testcase|Show suspended and current threads only}}  
# {{testcase|Show suspended and current threads only}}  
##Invoke '''Make Current''' from the popup menu on ''Thread-1''
##Invoke '''Make Current''' from the popup menu on ''Thread-1''

Revision as of 21:04, 21 August 2013

Multi Threaded Debugging Specification for NetBeans 7.2

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 button next to Thread-2
    3. Push Show suspended and current threads only button from with Debugging view toolbar.
    • EXPECTED RESULT: The only threads shown:
    • Thread-1 (show in bold)
    • Thread-2 (suspended - orange icon)%
    • Teardown: Switch off "Show suspended and current threads only" option.
  1. Show monitors
    1. Push Show monitors button from with Debugging view toolbar.
    • EXPECTED RESULT: In this case nothing will be changed.
  2. Show qualified names
    1. Put some break point into debugging file. Wait the breakpoint is hit.
    2. Push Show qualified names button from with Debugging view toolbar.
    3. Expand frame that hit the breakpoint.
    • EXPECTED RESULT: Make sure that qualified name is shown/hidden (package location for method where the thread is suspended) while Show qualified names is toggled on and off.
  3. Sort by suspended/resumed state
    1. Push Sort by suspended/resumed state button from with Debugging view toolbar.
    • EXPECTED RESULT: All threads should be sorted by suspended/resumed state.
  4. Sort by name
    1. Push Sort by name button from with Debugging view toolbar.
    • EXPECTED RESULT: All threads should be sorted by name.
  5. Sort by default
    1. Push Sort by default button from with Debugging view toolbar.
    • EXPECTED RESULT: All threads should be sorted by default.
    • Teardown: Close Debugging view and invoke Run

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 "ThreadSuspending1.java" popup menu action 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 "ThreadSuspending1.java" popup menu action 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 ThreadSuspendin.java:47 and Thread-3 stopped at LineBreakPoint ThreadSuspendin.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 - invoke Run
  4. Current Thread Chooser
    1. Invoke Debug ThreadSuspending1.java popup menu action.
    2. In a while all application threads should be suspended.
    3. Press ALT+SHIFT+T - "Current Thread Chooser" dialog should be shown.
    4. Holding both ALT and SHIFT key and pushing T key should switch among all suspended threads.
    • EXPECTED RESULT: Verify the functionality of choosing current thread. Chosen thread should be also indicated in
      Debugging
      view by green bar next to it.
    • Teardown: Stop debugged application - invoke Run
  5. Monitors
    1. Edit ThreadSuspending1.java. Surround i++; line with synchronized (this) {} and make sure that breakpoints are set for lines increasing variable i
    2. Invoke Debug ThreadSuspending1.java popup menu action.
    3. In a while all application threads should be suspended.
    4. Push Show monitors button from the toolbar of Debugging view.
    • EXPECTED RESULT: Monitors for each thread should be shown for appropriate line in thread frame of Debugging view.
    • Teardown: Stop debugged application - invoke Run
  6. Deadlock detection
    1. Select DeadlockTest.java and Debug DeadlockTest.java popup menu action.
    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.
    • Teardown: Stop debugged application - invoke Run


Test suite: Compile on Save debugging

Purpose: Verifies automatic code changes integration
Setup: Start NetBeans IDE with clear userdir. Open project MemoryView and set it as main project. Invoke Properties on the MemoryView node and check Compile on Save in Build -> Compiling. Next invoke Tools -> Options -> Java -> Java Debugger and check Apply code changes after save.

  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 view.
    3. Make the code of doit() method uncompilable (replace the with
      "x//System.out.println("I do nothing");"
      ) and save the file.
    4. Invoke Debug "ClazzOne.java" popup menu action and watch Debugger Console.
    5. Confirm the dialog that pops up (One or more projects were compiled with errors...).
    6. Push F7 - choose "doit()" method.
    7. Push F7 again.
    • 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 pops back to line 27.
    • Teardown: Stop debugged application - invoke Run


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 and set it as main project.

  1. Go To Source
    1. Open ThreadSuspending1.java
    2. Start debugging ThreadSuspending1.java
    3. Make sure that Debugging window is open 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 Thread 1 Call Stack Frame
    9. choose Go To Source from popup options
    • {{result|EXPECTED RESULT: Caret will move to last exectued code of selected thread, eventually to the breakpoint where thread was suspended. Debugging continue from last breakpoint NOT from caret position.
  2. Copy Stack
    1. Open ThreadSuspending1.java
    2. Start debugging ThreadSuspending1.java
    3. Make sure that Debugging window is open 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 Thread 1 Call Stack Frame
    9. choose Copy Stack from popup options
    • {{result|EXPECTED RESULT: The copy of Call Stack Frame message should be copied to clipboard.
  3. Suspend All Threads
    1. Open ThreadSuspending1.java
    2. Start debugging ThreadSuspending1.java
    3. Make sure that Debugging window is open and you see running threads (Thread-1, Thread-2 and Thread-3)
    4. Debugger stops at breakpoint on line 28
    5. invoke popup window from Debugging View without selecting any of threads
    6. choose Suspend All Threads
    • {{result|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. Open ThreadSuspending1.java
    2. Start debugging ThreadSuspending1.java
    3. Make sure that Debugging window is open and you see running threads (Thread-1, Thread-2 and Thread-3)
    4. Debugger stops at breakpoint on line 28
    5. invoke popup window from Debugging View without selecting any of threads
    6. choose Resume All Threads
    • {{result|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 - invoke Run | 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