TS 69 JavaFX Debugger

(Difference between revisions)
({{testcase|Watches Window}})
({{testcase|Set Breakpoints}})
 
(7 intermediate revisions not shown)
Line 1: Line 1:
==Debugger==
==Debugger==
'''Author:''' [mailto:sunflower@netbeans.org Alexandr Scherbatiy] <br>
'''Author:''' [mailto:sunflower@netbeans.org Alexandr Scherbatiy] <br>
-
'''Version:''' 1.1 <br>
+
'''Version:''' 1.2 <br>
-
'''Last update:''' 25 September 2009 <br>
+
'''Last update:''' 04 August 2010 <br>
'''Introduction:'''  <br>
'''Introduction:'''  <br>
'''Comments:'''  <br>
'''Comments:'''  <br>
Line 34: Line 34:
** {{result|EXPECTED RESULT:  Debugger should stop on each breakpoint.  }}
** {{result|EXPECTED RESULT:  Debugger should stop on each breakpoint.  }}
** {{result|EXPECTED RESULT:  Debugger should stop after end of the project.  }}
** {{result|EXPECTED RESULT:  Debugger should stop after end of the project.  }}
 +
 +
 +
=== {{testcase|Conditional Breakpoint}} ===
 +
*  Create a JavaFX Script project.
 +
*  Copy the code to the Main file:
 +
<pre>       
 +
var a = 10;
 +
var b = 20.5;
 +
var c = a + b;
 +
</pre> 
 +
*  Set breakpoints (click on the Glyph  Gutter in the editor) for the c variable
 +
* Right-click on the breakpoint and select Breakpoint->Properties
 +
* Select 'Condition' on the _Breakpoint Properties_ dialog
 +
* Type 'c < 50'
 +
* Press OK
 +
*  Debug the project (press &lt;Ctrl+F5&gt;).
 +
** {{result|EXPECTED RESULT:  Debugger should stop on the breakpoint.  }}
 +
* Right-click on the breakpoint and select Breakpoint->Properties
 +
* Select 'Condition' on the _Breakpoint Properties_ dialog
 +
* Type 'c > 50'
 +
* Press OK
 +
*  Debug the project (press &lt;Ctrl+F5&gt;).
 +
** {{result|EXPECTED RESULT:  Debugger should not stop on the breakpoint.  }}
=== {{testcase|Add new line before a breakpoint}} ===
=== {{testcase|Add new line before a breakpoint}} ===
Line 73: Line 96:
=== {{testcase|Step Out}} ===
=== {{testcase|Step Out}} ===
-
## Create a JavaFX Script project.  
+
* Create a JavaFX Script project.  
-
## Copy the code to the Main file:
+
* Copy the code to the Main file:
  <pre>
  <pre>
function a (){
function a (){
Line 86: Line 109:
b();   
b();   
</pre>
</pre>
-
##  Set a breakpoint for the '''b()''' call on the last line  
+
* Set a breakpoint for the '''b()''' call on the last line  
-
##  Debug the project (press &lt;Ctrl+F5&gt;).  
+
* Debug the project (press &lt;Ctrl+F5&gt;).  
-
##  Press ''Step Into'' button (press <F7>) on the toollbar.
+
* Press ''Step Into'' button (press <F7>) on the toollbar.
-
##  Press ''Step Out'' button (press <Ctrl+F7>) on the toollbar.
+
* Press ''Step Out'' button (press <Ctrl+F7>) on the toollbar.
-
#* {{result|EXPECTED RESULT:  The green line should point to the ''b()'' call on the last line  not the ''a'' function body. }}
+
** {{result|EXPECTED RESULT:  The green line should point to the ''b()'' call on the last line  not the ''a'' function body. }}
Line 119: Line 142:
<br>
<br>
-
====Variables====
+
==Variables Window ==
        
        
-
# {{testcase|Variables Window}}
+
=== {{testcase|Variables types}} ===
-
## 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 i = 3;
var i = 3;
var num = 3.0;
var num = 3.0;
Line 151: Line 174:
var f = function(a:Number, b:String):Boolean { true };
var f = function(a:Number, b:String):Boolean { true };
-
var seqf = function(a:A[[ | ]], b:String[[ | ]]):Boolean[[ | ]] { [] };
+
var seqf = function(a:A[], b:String[]):Boolean[] { [] };
var seq = ["1","2","3" ];
var seq = ["1","2","3" ];
-
 
println("");
println("");
       </pre>
       </pre>
-
## Set a breakpoint for  last line
+
* Set a breakpoint for  last line
-
## Debug the project (press &lt;Ctrl+F5&gt;).  
+
* Debug the project (press &lt;Ctrl+F5&gt;).  
-
## Go to Variables window.
+
* Go to Variables window.
-
#* {{result|EXPECTED RESULT:  Each variable should be shown in the Variables window  }}
+
*{{result|EXPECTED RESULT:  Each variable should be shown in the Variables window  }}
-
#* {{result|EXPECTED RESULT:  Each variable should have the type and the default value  }}
+
*{{result|EXPECTED RESULT:  Each variable should have the type and the default value  }}
-
#* {{result|For example:  There should be ''i|Number|3'' line }}                 
+
*{{result|For example:  There should be ''i|Number|3'' line }}                 
          
          
-
<br>
+
=== {{testcase| Show variable value as toString() }} ===
-
====Breakpoints Window====
 
-
# {{testcase|Breakpoints Window}}  
+
 
-
##  Create a JavaFX Script project.  
+
==Breakpoints Window==
-
##  Copy the code to the Main file: <pre>
+
 
 +
=== {{testcase|Breakpoints Window}} ===
 +
Create a JavaFX Script project.  
 +
Copy the code to the Main file:  
 +
<pre>
          
          
var a = 10;
var a = 10;
Line 181: Line 206:
  
  
</pre>
</pre>
-
##  Set breakpoints for '''a''', '''b''' and '''c''' variables  
+
Set breakpoints for '''a''', '''b''' and '''c''' variables  
-
##  Debug the project (press &lt;Ctrl+F5&gt;).  
+
Debug the project (press &lt;Ctrl+F5&gt;).  
-
##  Go to ''Breakpoints'' window
+
Go to ''Breakpoints'' window
-
#* {{result|EXPECTED RESULT:  The  ''Breakpoints'' window should show the set berakpoints }}
+
*{{result|EXPECTED RESULT:  The  ''Breakpoints'' window should show the set berakpoints }}
-
<br>
 
-
 
+
==Call Stack Window==
-
 
+
-
====Call Stack Window====
+
                        
                        
-
# {{testcase|Call Stack}}
+
=== {{testcase|Call Stack}} ===
-
## 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;
-
var c = a + b;
+
var c = a + b;
-
 
+
</pre>   
</pre>   
-
## Set breakpoints for ''a'', ''b'' and ''c'' variables   
+
* Set breakpoints for ''a'', ''b'' and ''c'' variables   
-
## Debug the project (press &lt;Ctrl+F5&gt;).  
+
* Debug the project (press &lt;Ctrl+F5&gt;).  
-
## Go to the ''Call Stack'' window
+
* Go to the ''Call Stack'' window
-
#* {{result|EXPECTED RESULT:  The current program call stack should be shown.  }}
+
** {{result|EXPECTED RESULT:  The current program call stack should be shown.  }}
-
               
+
-
               
+
 
-
               
+
==Loaded Classes Window==
-
<br>
+
                     
 +
=== {{testcase|Loaded Classes}} ===
 +
*  Create a JavaFX Script project.
 +
*  Copy the code to the MyClass JavaFX file:
 +
<pre>        
 +
public class MyClass {
 +
 
 +
}
 +
 
 +
public function run() {
 +
    println("run...");
 +
   
 +
   
 +
    var myClass = MyClass{};
 +
   
 +
    println(myClass);
 +
}
 +
</pre> 
 +
*  Set breakpoints for ''println(myClass);'' line 
 +
*  Debug the project (press &lt;Ctrl+F5&gt;).
 +
*  Open ''Loaded Classes'' window (Window-Debugging->Loaded Classes)
 +
** {{result|EXPECTED RESULT:  The 'Loaded Classes'' window should be shown.  }}

Current revision as of 08:56, 5 August 2010

Debugger

Author: Alexandr Scherbatiy
Version: 1.2
Last update: 04 August 2010
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.


Conditional Breakpoint

  • 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 the c variable
  • Right-click on the breakpoint and select Breakpoint->Properties
  • Select 'Condition' on the _Breakpoint Properties_ dialog
  • Type 'c < 50'
  • Press OK
  • Debug the project (press <Ctrl+F5>).
    • EXPECTED RESULT: Debugger should stop on the breakpoint.
  • Right-click on the breakpoint and select Breakpoint->Properties
  • Select 'Condition' on the _Breakpoint Properties_ dialog
  • Type 'c > 50'
  • Press OK
  • Debug the project (press <Ctrl+F5>).
    • EXPECTED RESULT: Debugger should not stop on the breakpoint.

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

  • 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.
  • 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 Window

Variables types

  • Create a JavaFX Script project.
  • 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("");
       
  • Set a breakpoint for last line
  • Debug the project (press <Ctrl+F5>).
  • 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


Show variable value as toString()

Breakpoints Window

Breakpoints Window

  • 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 for a, b and c variables
  • Debug the project (press <Ctrl+F5>).
  • Go to Breakpoints window
    • EXPECTED RESULT: The Breakpoints window should show the set berakpoints


Call Stack Window

Call Stack

  • 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 for a, b and c variables
  • Debug the project (press <Ctrl+F5>).
  • Go to the Call Stack window
    • EXPECTED RESULT: The current program call stack should be shown.


Loaded Classes Window

Loaded Classes

  • Create a JavaFX Script project.
  • Copy the code to the MyClass JavaFX file:
         
public class MyClass {

}

public function run() {
    println("run...");
    
    
    var myClass = MyClass{};
    
    println(myClass);
} 		
  • Set breakpoints for println(myClass); line
  • Debug the project (press <Ctrl+F5>).
  • Open Loaded Classes window (Window-Debugging->Loaded Classes)
    • EXPECTED RESULT: The 'Loaded Classes window 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