Unit Tests
There are currently two ways to run Chandler unit tests.
Old Way
First the old way, which is also used by Tinderbox clients:
First checkout hardhat directory, which is a sibling of chandler directory. Then:
cd chandler
../hardhat/hardhat.py -t
HardHat searches through all directories below current directory for files of the form "Test*.py". The Test*.py scripts should use the standard Python
unittest framework.
Creating a unittest-based test module consists of writing one or more classes that subclass unittest's
TestCase? class. Within the class define methods whose names start with "test". You can find examples at the
Pyunit website, and in chandler/application/model/tests/.
You can run a single unit test by providing it's path to hardhat.py.
Throw a "-d" before the name of the test file if you want to run against the debug version.
NOTE: Hardhat is a sibling directory to chandler/ and as such it is not normally checked out as part of the Chandler source check out.
- Exporting hardhat from svn:
svn export http://svn.osafoundation.org/chandler/trunk/hardhat hardhat
svn co http://svn.osafoundation.org/chandler/trunk/hardhat hardhat
New Way
cd chandler
./release/RunPython run_tests.py
This will show you how to use run tests. Currently you can run all tests like this:
./release/RunPython -m run_tests application crypto osaf repository
Of course, you may need to change the path to
RunPython? script depending on platform, debug vs release or CHANDLERHOME/CHANDLERBIN settings.