r8 - 07 Feb 2006 - 15:25:17 - LisaDusseaultYou are here: OSAF >  Projects Web  >  DevelopmentHome > TestingChandler > UnitTests

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
  • Anonymous checkout:
    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.

PageInfo
PageType DevDocPage
MaintainedBy none
PageStatus Source of truth -- this page reflects current OSAF thinking? go.png
Trash.CommentsWelcome2 Feel free to contribute comments?, either by adding to the Comments Welcome section of this page, or by posting to the dev list, or by sending mail directly to the person listed as maintaining the page.
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r8 < r7 < r6 < r5 < r4 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.