The TiniUnit Unit Testing Framework is intended to be used for automated unit testing of Java code for the TINI board. It is similar in intent to the JUnit Java unit testing framework, but it does not depend on reflection. Therefore, it is suitable for use on a TINI board running version 1.0x of the TINI OS.
As supplied, the tests work with TINI OS 1.02d (the latest revision) and will require modification to run correctly on earlier versions of the TINI OS.
For further information:
The core classes are contained in the package
particular, the classes
TestSuite are of particular interest.
These two classes follow the composite pattern, so a
TestSuite is a collection
of instances of
To write a test, extend
TestCase and provide an implementation for
To indicate that the test has failed, throw an exception from within
In TiniUnit, tests must be grouped into a
TestSuite, so extend
TestSuite and in
the constructor, call
addTest() for every test to be added to the
TestSuite. To allow the tests to be run, write a main method that calls
In practice, I often write each
TestCase as an inner class within a
TestSuite in the
nz.co.invensysenergy.test.comm provide some examples of how to write tests. In
this case, the tests test certain aspects of the TINI OS behaviour that happen
to have caused problems for me at some stage in the past.
To try these tests compile and run
or use Ant to run the "test.pc" or "test.tini" targets.
Not all tests will pass on any known version of TINI OS 1.0x.
Ant is a cross platform Java build process. Download Ant. The FTP tasks are optional extensions that should be downloaded at the same time from the same location. The FTP extensions require NetComponents.jar. This build file also uses TiniAnt: Ant extensions for TINI to allow TiniConversion.
This is a utility program to FTP files to the TINI and to run them from within Ant. It reports an error code on exit if any tests within the test suite failed, and it can also detect if the TINI failed to run the test suite due to insufficient contiguous heap.
An alternative to TiniTest is to use NetComponents to FTP and Telnet from within Ant itself, however to my knowledge this approach is less flexible.
* TiniUnit Unit Testing Framework for the Dallas Semiconductors TINI Board * http://tiniunit.sourceforge.net/ * * Invensys Energy Systems (NZ) Ltd * Christchurch, New Zealand * http://www.invensys-energy.com/new_zealand/ * Contact: Gavin Kingsley
* * Copyright (c) 2000, 2001, Invensys Energy Systems (NZ) Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of Invensys Energy Systems (NZ) Ltd nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL INVENSYS ENERGY SYSTEMS (NZ) LTD OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://www.opensource.org/licenses/bsd-license.html