TS 69 JavaFX Debugger

(Difference between revisions)
(Breakpoints)
(Watches)
Line 95: Line 95:
<br>
<br>
-
====Watches====
+
==Watches==
-
# {{testcase|Watches Window}}  
+
=== {{testcase|Watches Window}} === 
-
## Create a JavaFX Script project.  
+
* Create a JavaFX Script project.  
-
## Copy the code to the Main file: <pre>
+
* Copy the code to the Main file:  
 +
<pre>
var a = 10;
var a = 10;
var b = 20.5;
var b = 20.5;
Line 105: Line 106:
print(c);
print(c);
</pre>
</pre>
-
## Set breakpoints for ''print(c);'' line
+
* Set breakpoints for ''print(c);'' line
-
## Debug the project (press &lt;Ctrl+F5&gt;).  
+
* Debug the project (press &lt;Ctrl+F5&gt;).  
-
##  Go to ''Watches'' window.
+
Go to ''Watches'' window.
-
## Right-click and select ''New Watch...''
+
* Right-click and select ''New Watch...''
-
## Type ''a + 10''  for the watch expression.
+
* Type ''a + 10''  for the watch expression.
-
## Right-click and select ''New Watch...''  
+
* Right-click and select ''New Watch...''  
-
## Type ''c * 2''  for the watch expression.
+
* Type ''c * 2''  for the watch expression.
-
#* {{result|EXPECTED RESULT:  There should be ''20'' value for the ''a + 10''  expression.  }}
+
*{{result|EXPECTED RESULT:  There should be ''20'' value for the ''a + 10''  expression.  }}
-
#* {{result|EXPECTED RESULT:  There should be ''61.0'' value for the ''c * 2'' expression.  }}
+
* {{result|EXPECTED RESULT:  There should be ''61.0'' value for the ''c * 2'' expression.  }}
            
            
<br>
<br>
-
 
====Variables====
====Variables====

Revision as of 08:26, 23 June 2010

Debugger

Author: Alexandr Scherbatiy
Version: 1.1
Last update: 25 September 2009
Introduction:
Comments:


Contents


Project

  1. Debug Project
    1. Create a JavaFX Script project.
    2. Press Debug Main Project button
    3. Press Finish Debugger Session button.
    • EXPECTED RESULT: Debugger should start.
    • EXPECTED RESULT: Debugger should stop.


Breakpoints

Set Breakpoints

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
         
var a = 10;
var b = 20.5;
var c = a + b;
  • Set breakpoints (click on the Glyph Gutter in the editor) for a, b and c variables
  • Debug the project (press <Ctrl+F5>).
  • Continue debug the project (press <F5>) for each variable.
    • EXPECTED RESULT: Debugger should stop on each breakpoint.
    • EXPECTED RESULT: Debugger should stop after end of the project.

Add new line before a breakpoint

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
         
var a = 10;
  • Set breakpoints (click on the Glyph Gutter in the editor) to a variable
  • Debug the project (press <Ctrl+F5>).
  • Finish debuger
  • Add a new line before the a variable
// new line 
var a = 10;
  • Debug the project (press <Ctrl+F5>).
    • EXPECTED RESULT: Debugger should stop on the breakpoint.

Step Into

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
function a (){
    println("a");
}

function b(){
    a();
}

b();   
  • Set a breakpoint for the b() call on the last line
  • Debug the project (press <Ctrl+F5>).
  • Press Step Into button (press <F7>) on the toollbar.
    • EXPECTED RESULT: The green line should point to the b function body.


Step Out

    1. Create a JavaFX Script project.
    2. Copy the code to the Main file:
function a (){
    println("a");
}

function b(){
    a();
}

b();   
    1. Set a breakpoint for the b() call on the last line
    2. Debug the project (press <Ctrl+F5>).
    3. Press Step Into button (press <F7>) on the toollbar.
    4. Press Step Out button (press <Ctrl+F7>) on the toollbar.
    • EXPECTED RESULT: The green line should point to the b() call on the last line not the a function body.



Watches

Watches Window

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
var a = 10;
var b = 20.5;
var c = a + b;
print(c);
  • Set breakpoints for print(c); line
  • Debug the project (press <Ctrl+F5>).
  • Go to Watches window.
  • Right-click and select New Watch...
  • Type a + 10 for the watch expression.
  • Right-click and select New Watch...
  • Type c * 2 for the watch expression.
    • EXPECTED RESULT: There should be 20 value for the a + 10 expression.
  • EXPECTED RESULT: There should be 61.0 value for the c * 2 expression.



Variables

  1. Variables Window
    1. Create a JavaFX Script project.
    2. Copy the code to the Main file:
var i = 3; var num = 3.0; var b = true; var c = "2".charAt(0); var byte:Byte = 1; var short:Short = 2; var long:Long = 3; var float:Float = 5.0; var double:Double = 10.0; var date = 3h; var void = function():Void{}; var str = "Hello!"; class A{} var a = A{}; var f = function(a:Number, b:String):Boolean { true }; var seqf = function(a:A[[ | ]], b:String[[ | ]]):Boolean[[ | ]] { [] }; var seq = ["1","2","3" ]; println("");
    1. Set a breakpoint for last line
    2. Debug the project (press <Ctrl+F5>).
    3. Go to Variables window.
    • EXPECTED RESULT: Each variable should be shown in the Variables window
    • EXPECTED RESULT: Each variable should have the type and the default value
    • For example: There should be i



Breakpoints Window

  1. Breakpoints Window
    1. Create a JavaFX Script project.
    2. Copy the code to the Main file:
var a = 10; var b = 20.5; var c = a + b;
    1. Set breakpoints for a, b and c variables
    2. Debug the project (press <Ctrl+F5>).
    3. Go to Breakpoints window
    • EXPECTED RESULT: The Breakpoints window should show the set berakpoints



Call Stack Window

  1. Call Stack
    1. Create a JavaFX Script project.
    2. Copy the code to the Main file:
               
      
var a = 10; var b = 20.5; var c = a + b;
    1. Set breakpoints for a, b and c variables
    2. Debug the project (press <Ctrl+F5>).
    3. Go to the Call Stack window
    • EXPECTED RESULT: The current program call stack should be shown.




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