Java Board Test from Macraigor Systems LLC

JUnit ...

“JUnit is a simple framework for writing and running automated tests. As a political gesture, it celebrates programmers testing their own software.”
JUnit was designed with software testing in mind. Most of the documentation talks about testing units of software that have been written and continuing to test them during system design and regression testing.

We have adapted JUnit for hardware testing. Using and applying the same exact concepts, we test hardware in stages and continue to test them as development continues. Additionally, we use JUnit in production line test to assure that our UUT (Unit Under Test) is identical to our original test fixture.

A quick “JUnit is 60 seconds” introduction is here.
You can see the JUnit “official” faq here.
The rest is here.

Show me what it does for me ...

JUnit allows you to write simple code to test a “unit” as you develop it or as a regression test. It allows you to add something like this to your code (JUnit calls are shown in green):

* Scan Chain Analysis
* This test will check to see if the JTAG scan chain
* appears to be working in the most basic form. You need
* to know what chips you expect to see and how many.
* If there are failures here, nothing else will work.

public void ScanChainAnalysis()
int id;
int expected_chip_id = 0x3F0F0F0F;

// First do a SetConnection to tell the tester the device connected to the target
assertTrue("Set Connection", MacraigorApiJni.SetConnection("UsbWiggler", "USB0", ""));

// Run the Scan Chain Analyzer at a speed that should work
// This may fail if the speed setting is too fast for the hardware configuration

assertTrue("Analyze scan chain", MacraigorApiJni.AnalyzeJtagScanChain(4));

// Find the number of devices found on the chain
// Check that the correct number of chips were found
// This example checks that the device count is 1

assertThat("Number of chips found", MacraigorApiJni.JtagScanChainDeviceCount(), is(1) ) ;

// Check that the chips found are the expected chips
// Read the JTAG 32-bit ID of the first (and only) chip, index 0

id = MacraigorApiJni.JtagScanChainJtagID(0);
assertThat("JTAG Chip ID", id, is(expected_chip_id)) ;
// This could have been done in a single call:
assertThat("JTAG Chip ID", MacraigorApiJni.JtagScanChainJtagID(0), is(expected_chip_id)) ;

// Verify the JTAG Instruction Register (IR) length found is correct
// An optional test, the information is available from the Analyze call
// This example checks that the IR length is 4

assertThat("IR length", MacraigorApiJni.JtagScanChainIRLength(), is(4));

} //ScanChainAnalysis