OJB JUnit Test Suite
Introduction
Building an Object/Relational mapping tool with support for multiple API's is really error prone. To create a solid and stable software, the most awful thing in programmers life has to be done - Testing.
Quality assurance taken seriously! OJB and provide specific tests for each supported API. Currently more than 600 test cases for regression tests exist. As testing framework JUnit was used.
How to run the Test Suite
If the platform depended settings are done, the test suite can be started with the ant target:
ant junit
If compiling of the sources should be skipped use
ant junit-no-compile
If you did not manage to set up the target database with the ant prepare-testdb you can use
ant junit-no-compile-no-prepare
to run the testsuite without generation of the test database (and without compiling).
After running the regression tests you should see a console output as follows:
junit-no-compile-no-prepare: [junit] Running org.apache.ojb.broker.AllTests [junit] Tests run: 382, Failures: 0, Errors: 0, Time elapsed: 50,843 sec [junit] Running org.apache.ojb.odmg.AllTests [junit] Tests run: 193, Failures: 0, Errors: 0, Time elapsed: 16,243 sec [junit] Running org.apache.ojb.soda.AllTests [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 8,392 sec [junit] Running org.apache.ojb.otm.AllTests [junit] Tests run: 79, Failures: 0, Errors: 0, Time elapsed: 21,871 sec junit-no-compile: junit: BUILD SUCCESSFUL Total time: 3 minutes 58 seconds
We aim at shipping that releases have no failures and errors in the regression tests! If the Junit tests report errors or failures something does not work properly! There may be several reasons:
- You made a mistake in configuration (OJB was shipped with settings pass all tests). See platform, OJB.properties, repository file, .
- Your database doesn't support specific features used by the tests
- Evil hex
- Bug in OJB
JUnit writes a log-file for each tested API. You can find the logs under [db-ojb]/target/test. The log files named like tests-XXX.txt. The test logs show in detail what's going wrong.
In such a case please check again if you followed all the above steps. If you still have problems you might post a request to the OJB user mailinglist.
What about known issues?
All major known issues are listed in the release-notes
file.
The tests reproduce open bugs will be skipped on released OJB versions. It is possible to enable
these tests to see all failing test cases of the shipped version by changing a
flag in [db-ojb]/build.properties file:
### # If 'true', junit tests marked as known issue in the junit-test # source code (see OJBTestCase class for more detailed info) will be # skipped. Default value is 'true'. For development 'false' is recommended, # because this will show unsolved problems. OJB.skip.issues=true
Donate own tests for OJB Test Suite
Details about donate own test to OJB you can find here.
by Armin Waibel, Thomas Mahler