Testing with Avrora

Testing is an important part of any software project. For embedded systems development, the availability of a high-quality simulator allows regression testing in quick turnaround and the possibility of periodic (e.g. nightly) regression testing. Avrora provides a flexible framework for building testcases both for testing Avrora itself and for testing your programs.

Avrora's source distribution contains a avrora.test package that contains a Java testing harness and a suite of test cases. Each test case is just a text file that contains a small header with a description of what it tests and what the expected results should be. When the -action=test option is specified to Avrora and a list of test files are passed, the testing framework will inspect the first few lines of each file to determine which testing harness should load and execute the test case.

Here is an example from Avrora's test suite. This is a simple program that tests the interpreter's behavior for the adc (add with carry) instruction.




The testing harness considers the first sequence of lines that contain the @ character to contain properties about the test (regardless of what comes before this character--allowing these properties to simply be comments in any language). It inspects the value of the Harness property to determine which testing harness will load and run the test case. In this way, the test loader is independent of the content of the actual test case. This Harness attribute can contain a short name of one of the known testing harness, or the fully qualified class name of your own tester. The testing harness just creates a new specialized test case.

For more information, see avrora.test.TestHarness in the JavaDoc API.