JPOX uses JUnit for unit testing. Because JDO has many aspects we use a "scenario" testing strategy. By this we mean that we separate our unit tests into what they test. When developing anything, the unit tests should be the guiding light as to whether you should be checking anything in to CVS. If your change breaks things, you shouldn't check things in.
There are currently 4 scenarios
Because the last 2 scenarios are very similar in nature, we often use the same classes for testing, but specify different MetaData, meaning that the class is persisted in different ways. The way this is done is by providing jdoa (application id) and jdod (datastore id) MetaData files. These are standard MetaData files, but with a different suffix to define which applies where. This is then interpreted by the testing process and copied across to the testing area with suffix jdo. The tests to run in each scenario are defined in the file test.properties.
The testing process with Maven operates via a Maven jpoxtest plugin. This provides the functionality necessary for a scenario to be tested. It operates as follows
The results of the tests are stored under target/test-reports-{scenario name}. To run the unit tests with Maven you use the following goals
maven jpoxtest-general
maven jpoxtest-schema
maven jpoxtest-datastore
maven jpoxtest-application
The Ant process operates similarly to Maven, using Ant scripts. To run Ant, you need to use the following Ant targets : test.general, test.schema, test.datastore, test.application, test.Enhancer to run the different test scenarios. The results of the tests are stored under tests/results/.
ant test.general
ant test.datastore
ant test.application
ant test.schema
ant test.Enhancer
In addition, you can run the Ant target test to run all test scenarios : general, schema, datastore, application and Enhancer.
ant test
If you want run independent tests cases with Ant, use the following command :
ant test.case -Dtest.suite.case=Test -Dtest.suite.case.identity=scenario
ant test.case -Dtest.suite.case=**/RelationshipTest.class -Dtest.suite.case.identity=datastore
ant test.case -Dtest.suite.case=**/RelationshipTest.class -Dtest.suite.case.identity=application
Where you feel that our unit tests do not adequately cover functionality, you should add a test. Please follow the following process
The SCO collection unit tests sit in their own area (org.jpox.sco) and are all related, in the same way as all java Collections are related. Each collection type has its own subdirectory containing helper classes and elements to be persisted. In addition there is one test class for each SCO collection class. The test class tests Normal and Inverse operation of the collection class. |