|
@@ -15,8 +15,8 @@ The jMonkeyEngine SDK supports the JUnit testing framework. It is a good practic
|
|
|
|
|
|
=== Creating Tests
|
|
|
|
|
|
-. Right-click a Java file in the Projects window and choose Tools > Create JUnit Tests.
|
|
|
-. Click OK. The jMonkeyEngine SDK creates a JUnit test skeleton in the Test Package directory.
|
|
|
+. btn:[RMB] click a Java file in the Projects window and choose menu:Tools[Create JUnit Tests].
|
|
|
+. btn:[LMB] click OK. The jMonkeyEngine SDK creates a JUnit test skeleton in the Test Package directory.
|
|
|
. The body of each generated test method is provided solely as a guide. In their place, you need to write your actual test cases!
|
|
|
. You can use tests such as `assertTrue(), assertFalse(), assertEquals()`, or `assert()`.
|
|
|
** The following example assertions test an addition method: `assert( add(1, 1) == 2); assertTrue( add(7,-5) == add(-5,7) )…`
|
|
@@ -32,8 +32,8 @@ Use the Navigate menu to jump from a test to its tested class, and back!
|
|
|
=== Running Tests
|
|
|
|
|
|
. Run one or all tests:
|
|
|
-** Right-click the class in the Projects window and Choose Test File, or
|
|
|
-** Right-click the project and select Test to run all tests.
|
|
|
+** btn:[RMB] click the class in the Projects window and Choose "`Test File`", or
|
|
|
+** btn:[RMB] click the project and select "`Test`" to run all tests.
|
|
|
|
|
|
. Check the Test window to see successful tests (green) and failures (red).
|
|
|
. If a test fails that has succeeded before, you know that your latest changes broke something!
|
|
@@ -53,14 +53,14 @@ In the jMonkeyEngine SDK, you have access to a debugger to examine your applicat
|
|
|
|
|
|
. First, you set breakpoints and/or watches before the problematic lines of code where you suspect the bug.
|
|
|
** If you want to watch a variable's value: Right-click on a variable and select New Watch from the context menu.
|
|
|
-** If you want to step through the execution line by line: Right-click on a line and choose Toggle Line Breakpoint; a pink box appears as a mark.
|
|
|
+** If you want to step through the execution line by line: btn:[RMB] click on a line and choose "`Toggle Line Breakpoint`"; a pink box appears as a mark.
|
|
|
|
|
|
. Choose menu:Debug[Debug Main Project] to start a debugger session for the whole project. Or, btn:[RMB] click a file and select "`Debug File`" to debug only one file.
|
|
|
. The application starts running normally. If you have set a breakpoint, the execution stops in this line. Debugger windows open and print debugger output.
|
|
|
. You can do many things now to track down a bug:
|
|
|
** Inspect the values of local variables.
|
|
|
** Use the Step buttons in the top to step into, out of, and over expressions while you watch the execution.
|
|
|
-** Navigate through your application's call stack. Right-click on threads to suspend or resume them.
|
|
|
+** Navigate through your application's call stack. btn:[RMB] click on threads to suspend or resume them.
|
|
|
** Choose menu:Debug[Evaluate Expression] from the menu to evaluate an expression.
|
|
|
** Move the mouse pointer over a variable to inspect its value in a tooltip.
|
|
|
** Inspect the classes loaded on the heap and the percentage and number of object instances. btn:[RMB] click a class in the Loaded Classes window and choose Show in Instances view (JDK 6 only).
|
|
@@ -77,10 +77,10 @@ The profiler tool is used to monitor thread states, CPU performance, and memory
|
|
|
|
|
|
If you do not see a Profiler menu in the jMonkeyEngine SDK, you need to download the Profiler plugin first.
|
|
|
|
|
|
-. Open the Tools > Plugins menu, and got to the “Available plugins tab
|
|
|
-. Find the “Java Profiler plugin (“Java SE category) and check the Install box.
|
|
|
+. Open the menu:Tools[Plugins] menu, and got to the "`Available`" plugins tab
|
|
|
+. Find the "`Java Profiler`" plugin ("`Java SE`" category) and check the Install box.
|
|
|
. Click the install button and follow the instructions.
|
|
|
-. When you start the profiler for the first time, you are prompted to run a calibration once. Click OK in the “Profiler integration dialog to complete the installation process.
|
|
|
+. When you start the profiler for the first time, you are prompted to run a calibration once. Click OK in the "`Profiler`" integration dialog to complete the installation process.
|
|
|
|
|
|
|
|
|
=== Monitoring and Analyzing
|
|
@@ -91,13 +91,13 @@ If you do not see a Profiler menu in the jMonkeyEngine SDK, you need to download
|
|
|
** *Analyze CPU Performance* – Collect detailed data on application performance, including the time to execute methods and the number of times the method is invoked.
|
|
|
** *Analyze Memory Usage* – Collect detailed data on object allocation and garbage collection.
|
|
|
|
|
|
-. Click Run. Your application starts and runs normally.
|
|
|
+. btn:[LMB] click Run. Your application starts and runs normally.
|
|
|
. Use the Profiling window to track and collect live profiling results while you application is running.
|
|
|
|
|
|
|
|
|
=== Comparing Snapshots
|
|
|
|
|
|
-Click the Take Snapshot button to capture the profiling data for later!
|
|
|
+btn:[LMB] click the "`Take Snapshot`" button to capture the profiling data for later!
|
|
|
|
|
|
* You can store and view snapshots in the Profiling window.
|
|
|
* Choose Compare Snapshots from the profiler window to compare two selected snapshots
|
|
@@ -107,7 +107,7 @@ Click the Take Snapshot button to capture the profiling data for later!
|
|
|
|
|
|
Profiling points are similar to debugger breakpoints: You place them directly in the source code and they can trigger profiling behaviour when hit.
|
|
|
|
|
|
-* Open a class in the browser, right-click in a line, and select Profiling > Insert Profiling Point to add a profiling point here.
|
|
|
+* Open a class in the browser, btn:[RMB] click in a line, and select menu:Profiling[Insert Profiling Point] to add a profiling point here.
|
|
|
* Use Profiling points if you need a trigger to reset profiling results, take a snapshot or heap dump, record the timestamp or execution time of a code fragment, stop and start a load generator script (requires the load generator plugin).
|
|
|
* Open the Profiling Points window to view, modify and delete the Profiling Points in your projects.
|
|
|
|