TS 69 JavaFX Sanity
Sanity Tests Specification
Author: Alexandr Scherbatiy
Version: 1.3
Last update: 03 August 2010
Introduction:
Comments:
Contents |
Test suite: Installation
Purpose:
Setup:
- Install JavaFX Script plugin via installer
- Download the NetBeans with JavaFX Script.
- Install it.
- EXPECTED RESULT: NetBeans with JavaFX Script Plugin should be installed without errors.
- EXPECTED RESULT: It is possible to crate a JavaFX Script project.
- Uninstall JavaFX Script plugin
- Run the NetBeans with JavaFX Script plugin.
- Invoke 'Tools|Plugins' from the main menu bar.
- Go to Installed tab.
- Type javafx in the Search text field.
- Select JavaFX Kit, JavaFX SDK for Linux/OpenSolaris/Mac/windows, JavaFX Weather Sample modules.
- Press Uninstall
- Uninstall the plugins.
- Restart the IDE.
- EXPECTED RESULT: It is not possible to crate a JavaFX Script project.
- EXPECTED RESULT: NetBeans installation dir does not contain javafx2 cluster.
- Install JavaFX Script plugin via Update Center
- Download NetBeans (JavaSE, Ruby, PHP or All).
- Install it.
- Run the NetBeans with JavaFX Script plugin.
- Invoke 'Tools|Plugins' from the main menu bar.
- Go to Available Plugins tab.
- Type javafx in the Search text field.
- Select JavaFX Source Debug, JavaFX 1.0, JavaFX SDK, JavaFX Weather Sample modules.
- Install the plugins.
- Restart the IDE.
- EXPECTED RESULT: JavaFX Script Plugin should be installed without errors.
- EXPECTED RESULT: It is possible to crate a JavaFX Script project.
Test suite: Project
Purpose:
Setup:
- Create New Application
- Invoke 'File | New Project...' from the main menu bar.
- Under Categories, select JavaFX.
- Under Projects, select JavaFX Application.
- Click Next.
- In the Project Name field, type JavaFXApp.
- Click Finish.
- EXPECTED RESULT: JavaFXApp should be created in the Projects window.
- Check Main file
- EXPECTED RESULT: Main JavaFX file should be opened.
- EXPECTED RESULT: Check that the Main file contains code:
import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.text.Text; import javafx.scene.text.Font; /** * @author author */ Stage { title: "Application title" width: 250 height: 80 scene: Scene { content: [ Text { font : Font { size : 16 } x: 10 y: 30 content: "Application content" } ] } }
- Create Empty JavaFX File
- Select javafxapp package under the project.
- Right-click and invoke New|Empty JavaFX File....
- Type MyFile for name.
- Press Finish.
- EXPECTED RESULT: Empty MyFile JavaFX Script file should be created.
- EXPECTED RESULT: The file should contain javafxapp package.
- Create Package
- Select Source Packages node under the project.
- Right-click and invoke New|Java Package....
- Type test for name.
- Press Finish.
- EXPECTED RESULT: test package should be created.
- Create JavaFX Class
- Select test package under the project.
- Right-click and invoke New|JavaFX Class....
- Type MyClass for name.
- Press Finish.
- EXPECTED RESULT: JavaFX Class MyClass should be created
package test; public class MyClass { }
- Create Nested Package
- Select test package under the project.
- Right-click and invoke New|Java Package....
- Type nested for name.
- Press Finish.
- EXPECTED RESULT: test.nested package should be created.
- Create JavaFX Stage
- Select test.nested package under the project.
- Right-click and invoke New|JavaFX Stage....
- Type MyStage for name.
- Press Finish.
- EXPECTED RESULT: MyStage JavaFX Script file should be created
import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.text.Text; import javafx.scene.text.Font; /** * @author author */ Stage { title: "Application title" width: 250 height: 80 scene: Scene { content: [ Text { font : Font { size : 16 } x: 10 y: 30 content: "Application content" } ] } }
- Create Java Class
- Select test.nested package under the project.
- Right-click and invoke New|Java Class....
- Type MyClass for name.
- Press Finish.
- EXPECTED RESULT: MyClass Java classshould be created
package test.nested; public class MyClass { }
- Rename JavaFX Class
- Select test.MyClass JavaFX class under the project.
- Right-click and invoke Rename....
- Type RenamedClass for new name.
- Press OK.
- EXPECTED RESULT: The class should be renamed to RenamedClass.
- Delete JavaFX Class
- Select test.RenamedClass JavaFX class under the project.
- Right-click and invoke Delete....
- Press Yes on Confirm Object Deletion dialog.
- EXPECTED RESULT: The class should be deleted from the project.
Test suite: Editor
Purpose:
Setup:
- Type Code in Editor
- Type the following code in the JavaFX editor:
var radius = 10; function sqr(a:Number):Number{ return a * a; }
- EXPECTED RESULT: The code should be typed without any exception.
- Highlighting
- EXPECTED RESULT: The import statement should be highlighted
- EXPECTED RESULT: The var statement should be highlighted
- EXPECTED RESULT: The function statement should be highlighted
- EXPECTED RESULT: The name of radius variable should be highlighted
- EXPECTED RESULT: The name of sqr function should be highlighted
- Templates
- Type sout in the editor.
- Type Press Tab key.
- EXPECTED RESULT: java.lang.System.out.println(""); line should appear in the editor.
- EXPECTED RESULT: There should not be any error in the editor.
- Build Project
- Invoke 'Build Project' on the project node.
- EXPECTED RESULT: The JavaFX application should build without errors.
- Run Project
- Invoke 'Run Project' on the project node.
- EXPECTED RESULT: The JavaFX application should build without errors.
- Preview
- Save the JavaFX file (Ctrl+S).
- Enable the Preview.
- Wait a few seconds.
- EXPECTED RESULT: The image of JavaFX application should be shown in the preview panel.
- Javadoc
- Create Contact JavaFX class:
class Contact{ var firstName: String; var lastName: String; var eMailAddress: String[]; public override function toString():String { "{firstName} {lastName}" } }
- Invoke 'Generate Javadoc for Project' on the project node.
- EXPECTED RESULT: The Javadoc should appear in a browser.
- EXPECTED RESULT: The Javadoc should contain Contact class.
- EXPECTED RESULT: The Contact class should contain firstName,lastName and eMailAddress attributes.
- EXPECTED RESULT: The Contact class should contain toString function.
- Palette
- Drag and drop Applications|Stage component from the Palette to the editor.
- Drag and drop Basic Shapes|Circle component from the Palette to the Scene content.
- Run the project
- EXPECTED RESULT: Frame with circle should appear.
- Navigator
- Create a new Empty JavaFX file.
- Type in the editor:
var a = 10; var b = true; var c = 20.0; var d = 30s; var seq = ["1","2","3"]; var f : function(a:Number,b:String):Boolean; class A{}
- EXPECTED RESULT: There should be a:Integer node in the Navigator
- EXPECTED RESULT: There should be b:Boolean node in the Navigator
- EXPECTED RESULT: There should be c:Float node in the Navigator
- EXPECTED RESULT: There should be d:javafx.lang.Duration node in the Navigator
- EXPECTED RESULT: There should be f:function(:Float,:String):Boolean node in the Navigator
- EXPECTED RESULT: There should be seq:java.lang.String[] node in the Navigator
- EXPECTED RESULT: There should be A node in the Navigator
- Go to Declaration
- Create a new Empty JavaFX file.
- Type code:
var a = 10; var b = a + 20; class C{ var attr: Number; function func(){}; } var c = C{} c.attr = 10; c.func();
- Hold Ctrl and click mouse a in var b = a + 20; line.
- {{{1}}}
- Go to Source
- Type code:
import javafx.animation.Timeline; var timeline = Timeline{};
- Hold Ctrl and click mouse Timeline.
- EXPECTED RESULT: Timeline.fx class should be open.
- Fix Imports
- Create a new Empty JavaFX file.
- Type code:
Stage { title: "Application title" width: 250 height: 80 scene: Scene { content: Circle { centerX: 100, centerY: 100 radius: 40 fill: Color.BLACK } } }
- Fix imports (Invoke Fix Imports popup menu or press Ctrl+Shift+I)
- EXPECTED RESULT: Imports should be fixed.
- EXPECTED RESULT: Code should be compilable.
- Code Formatting
- Type code:
import javafx.stage.*; import javafx.scene.*; import javafx.scene.paint.*; import javafx.scene.shape.*; Stage { title: "Application title" width: 250 height: 80 scene: Scene { content: Circle { centerX: 100, centerY: 100 radius: 40 fill: Color.BLACK } } }
- Format code (Invoke Format popup menu or press Alt+Shift+F)
- EXPECTED RESULT: Code should be formatted.
- EXPECTED RESULT: Code should be compilable.
- Code Completion
- Type code:
import javafx.animation.Timeline; var timeline = Timeline{};
- Press Ctrl+Space
- Select timeline variable from the list.
- Type . after the timeline variable.
- Press Ctrl+Space
- Select play() function from the list.
- EXPECTED RESULT: Code Completion should work.
- EXPECTED RESULT: Code should be compilable.
Test suite: Debug
Purpose:
Setup:
- Debug Project
- Create a JavaFX Script project.
- Press Debug Main Project button.
- Press Finish Debugger Session button.
- EXPECTED RESULT: Debugger should start.
- EXPECTED RESULT: Debugger should stop.
- 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.
- 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.
- Local Variables Window
- Create a JavaFX Script project.
- Copy the code to the Main file:
var a = 10; var b = 20.5; var c = true; class D{ var attr: Number; } var d = D{ attr: 22 } println(d);
- Set breakpoints for println(d); line
- Debug the project (press <Ctrl+F5>).
- Go to Locale Variables window.
- EXPECTED RESULT: There should be a
- EXPECTED RESULT: There should be b
- EXPECTED RESULT: There should be c
- EXPECTED RESULT: There should be d
- EXPECTED RESULT: There should be attr
- 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 Call Stack window.
- EXPECTED RESULT: The current program call stack should be shown.
- 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 set berakpoints.
- 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.
Test suite: Profile
Purpose:
Setup:
- CPU mode
- Create a JavaFX Script project that contains a Stage.
import javafx.stage.*; import javafx.scene.*; import javafx.scene.text.*; import javafx.scene.paint.*; import javafx.scene.effect.*; Stage { title: "Hello World" width: 250 height: 80 scene: Scene { content: Text { x: 10 y: 30 font: Font { size: 24 } fill: Color.BLUE effect: DropShadow{ offsetX: 3 offsetY: 3} content: "Hello World!" } } }
- Press Profile Main Project... toolbar button.
- Press OK on Enable Profiling dialog if it appears.
- Select CPU.
- Press Run.
- EXPECTED RESULT: The application should start.
- Close the application.
- EXPECTED RESULT: The application should stop.
- Live results
- Profile the Project from test case 5.1 (Do not close it).
- Press Live Results button on the Profiler Control Panel in NetBeans.
- Type run in the filter text field.
- Select javafxapplication.Main.javafx$run$(com.sun.javafx.runtime.sequence.Sequence) method and invoke Go to source.
- EXPECTED RESULT: Main.fx file should open.
- Take Snapshot
- Profile the Project from test case 5.1 (Do not close it).
- Press Take Snapshot button on the Profiler Control Panel in NetBeans.
- Select Main.main(String[]) method and invoke Go to source.
- Check Call Tree, Hot Spots, Compined and Info tabs.
- EXPECTED RESULT: Main.fx file should open.
- Memory mode
- Create a JavaFX Script project.
- Press Profile Main Project... toolbar button.
- Press OK on Enable Profiling dialog if it appears.
- Select Memory.
- Press Run.
- EXPECTED RESULT: The application should start.
- Close the application.
- EXPECTED RESULT: The application should stop.
- Monitor mode
- Create a JavaFX Script project.
- Press Profile Main Project... toolbar button.
- Press OK on Enable Profiling dialog if it appears.
- Select Monitor.
- Press Run.
- EXPECTED RESULT: The application should start.
- Close the application.
- EXPECTED RESULT: The application should stop.
- Threads
- Profile the Project in CPU mode.
- Press Threads button on the Profiler Control Panel in NetBeans.
- Press the icon to enable threads on the Threads window.
- EXPECTED RESULT: Threads should be shown on the Threads window
- VM Telemetry
- Profile the Project in CPU mode.
- Press VM Telemetry button on the Profiler Control Panel in NetBeans.
- EXPECTED RESULT: The VM Telemetry window should open.
Test suite: Deployment
Purpose:
Setup: Check that JRE plugin is installed in FireFox (Ubuntu and others OSes)
- Browser
- Invoke Properties on project node.
- Select Run under categories.
- Select Run in Browser check box.
- Press OK .
- Invoke Run Project on the project node.
- EXPECTED RESULT: Applet should be started in Browser.
- Java Web Start
- Invoke Properties on project node.
- Select Run under categories.
- Select Web Start Execution check box.
- Press OK .
- Invoke Run Project on the project node.
- EXPECTED RESULT: Application should be started under Java Web Start.
- Mobile Emulator (Windows and Mac only)
- Invoke Properties on project node.
- Select Run under categories.
- Select Run in Mobile Emulator check box.
- Press OK .
- Invoke Run Project on the project node.
- EXPECTED RESULT: Application should be started in the Mobile Emulator.
- TV Emulator (Only supported Vide cards)
- Invoke Properties on project node.
- Select Run under categories.
- Select Run in TV Emulator check box.
- Press OK .
- Invoke Run Project on the project node.
- EXPECTED RESULT: Application should be started by the TV Emulator.
- Applet parameters
- Invoke Properties on project node.
- Select Application under categories.
- Set width to 450.
- Set height to 450.
- Set Draggable Applet check box.
- Select Run under categories.
- Select Run in Browser check box.
- Press OK .
- Invoke Run Project on the project node.
- Click <Alt> and drag the applet from a browser (Works only with Firefox 3.0 and JDK 6u12 or later).
- EXPECTED RESULT: Applet should be started in Browser.
- EXPECTED RESULT: Applet should be dragged from Browser (Works only with Firefox 3.0 and JDK 6u12 or later).
- Self Signed Jar
- Invoke Properties on project node.
- Select Application under categories.
- Set Self Signed Jar check box.
- Select Run under categories.
- Select Run in Browser check box.
- Press OK .
- Invoke Run Project on the project node.
- EXPECTED RESULT: Applet should be started in Browser.
- Pack200 Compression
- Invoke Properties on project node.
- Select Application under categories.
- Set Pack200 Compression check box.
- Select Run under categories.
- Select Run in Browser check box.
- Press OK .
- Invoke Run Project on the project node.
- EXPECTED RESULT: Applet should be started in Browser.
Test suite: Samples
Purpose:
Setup:
- WeatherFX Application
- Invoke 'File | New Project...' from the main menu bar.
- Select Samples|JavaFX under Categories.
- Select JavaFX Weather Application sample.
- Run the sample.
- EXPECTED RESULT: The sample should start.
- Best Practices
- Invoke 'File | New Project...' from the main menu bar.
- Select Samples|JavaFX|Building Blocks under Categories.
- Select a sample.
- Run the sample.
- EXPECTED RESULT: The sample should start.
- SDK Samples
- Invoke 'File | New Project...' from the main menu bar.
- Select Samples|JavaFX under Categories.
- Select a sample.
- Run the sample.
- EXPECTED RESULT: The sample should start.
- Meadi Box Samples
- Invoke 'File | New Project...' from the main menu bar.
- Select Samples|JavaFX under Categories.
- Select Media Box sample.
- Run the sample.
- EXPECTED RESULT: The Media Box sample should show a movie.