Provides a set of JUnit tests which check the validity of the initial state of the base repository with respect to assumptions that are external to the database storage itself.

A good example of such an assumption is the assumption that all initial vendor orders are consistent with the initial STP/Website schedule.

Running the Validation Tests

Assuming you have properly checked out and configured a copy of the base project...

The base validation tests are part of the junit test suite, which can be invoked by ant in the base directory by running:

ant junit-all

If you prefer to run only the validation tests, you may invoke them by calling ant like so:

ant junit-one -Dtestname=edu.cmu.radar.base.tests.validation.AllTests

Why Validation Tests?

Any assumptions made about the world state which are not encoded in the database need to be checked in other ways. If left unchecked, inconsistent data could cause hard-to-find bugs. Checking the data up front is an easy way to ensure that the data fits any assumptions that a component or agent makes about it. Your component/agent may have a need for validation tests! Some examples:

Writing Your Own Tests

Validation tests are Java classes in the edu.cmu.radar.base.tests.validation package. They extend the JUnit TestCase class, and use the edu.cmu.radar.base.HibernateUtil singleton class to get database access (either using Hibernate, or simply to get a connection).

A good place to start is to take a look at the VendorOrderTest.java file in the base/src/edu/cmu/radar/base/tests/validation/ directory, copy it's contents to your own file, change the class name and documentation, then write your own test methods.

testVendorEventCaptions() is a good example of a test which uses Hibernate only to access the database.

testVendorEventDetails() is a good example of a test which simply gets a database connection from Hibernate, then operates directly on the database.

Choose a method which works for you, but please add tests to check the validity of the data in base. You will be helping the test team and the evaluation team, but you will also be saving yourself later debugging headaches.