Debug and Run your tests!
From here it is a matter of testing your test code and running it against
your target board. You can also make a stand alone “runner” ... that will
enable you to do testing of your unit under test outside of the Eclipse
We need to enter the “debug perspective” and then launch (and use) a
Enter the debug perspective by choosing “Window” → “Open Perspective” →
Click on the down arrow next to the Debug Icon ()
on the tool bar and select “Debug Configurations...”
The only tab you need to modify is “Test” ... the others can stay with
the default values.
Creating a Junit 4 Test Runner session and JAR file
Once a series of tests has been debugged they can be exported into a
stand along JAR file that can be run outside the Eclipse environment.
Click on the arrow next to the Run Icon and
In the Run Configurations dialog double click Java Application to bring up its tabbed windows. Type "RunAsJarFile" after
Name and leave all the other tabbed windows to
Click the Apply button to save. Now either clicking the debug
button in this window or simply clicking the Run icon
the Java Browsing perspective will start the tests running.
Click the Run icon, the Console view should now show the output of the TestRunner as
it runs main() in src\BoardTest\<Board>.java which invokes the TestRunner
run the tests the <Board> class contains.
In the Java Browser : Project Explorer view highlight <Board>_JunitBoardTest.
select File → Export.
In the Export dialog that appears select Java - Runnable JAR File and click
In the Runnable Jar File Export dialog, select
Launch Configuration : RunAsJarFile - <Board>_JunitBoardTest (created in step
Export Destination : (use the browse button to select it's name, typically
<Board>_BT.jar, and where to put jar file) Then click
In the Runnable JAR File Export popup window stating that it will be
repacking referenced libraries (junit-5.5.jar and MacraigorApi.jar) click
the OK button. The jar file then gets created.
To run the JAR file open a msdos command or linux shell window, your current PATH environmental variable should include
c:\cygwin\usr\local\bin (WINDOWS) or /usr/local/bin (LINUX). "Cd"-ing to the directory containing the JAR file and entering :
RunJarFileAndWait <Board>_BT.jar will run the application's test runner.