This package provide the JUnit test
framework for Ozone. This version is compatible with JUnit 3.6.
Important Classes
OzoneTestCase
OzoneTestCase is the base for all Ozone TestCase. It includes
access to the database setup by the TestRunner.
The following is an example for to write a OzoneTestCase.
packge com.foo;
import junit.framework.*;
import org.ozoneDB.test.OzoneTestCase;
import org.ozoneDB.test.simple.*;
package FooTestCase extends OzoneTestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(FooTestCase.class);
return suite;
}
public void testCreate() {
// db() provide the access to database setup by TestRunner
Auto auto = (Auto)db().createObject(AutoImpl.class.getName());
assertNotNull(auto);
// Test away!!!
}
}
OzoneTestRunner
Once you have the TestCase written, you will want to run the
Test. OzoneTestRunner provides the environment to run Unit Test for
Ozone.
Usage: ojvm org.ozoneDB.test.OzoneTestRunner {-local | -remote [-host=HOST] [-port=PORT]} [-debug]
- -local: use local database
- -remote: use remote database
- -host=HOST: the database server host
- -port=PORT: the database server port
- -debug: enable the debugging output
Note: The OzoneTestRunner's logging is control by Log4J. You can use the log4j in your
TestCase.
Reference:
|