Sample Java Test Code

First, make sure you get your “import” statements correct. The hamcrest CoreMatchers are the statements that allow you to specify tests in somewhat normal English form using keywords such as “is” and “isnot”

Examples of JUnit board test projects are included in this download and will be found ...

Windows: ... \Program Files\Macraigor Systems\EclipseDemos\Ganymede\<manufacturer>\<board>
Linux: /usr/local/macraigor/EclipseDemos/Ganymede/<manufacturer>/<board>


Next, declare any global variables that will be useful in your testing.

In order to run the test outside the Eclipse environment, you will need a “runner” in a “main” as shown here:

There is not much that needs to be done before or after the tests are run. The before class needs to create the MacraigorAPI class and that is done with a single statement. In a similar manner, the after class needs only one statement, that one to terminate the connection with the target CPU, again via the MacraigorAPI.

It is a good idea to test the JTAG scan chain before going any further. This is shown in the code below. It starts with setting up the hardware connection, i.e.: how the PC is attached to the target under test.






Download an application onto the board. Single step, then run it after setting hardware and software breakpoints. Examine memory and registers and compare against expected values.