Date: 2004-07-19T07:48:47
   Editor: AdamJack <[EMAIL PROTECTED]>
   Wiki: Gump Wiki
   Page: GumpDevelopment
   URL: http://wiki.apache.org/gump/GumpDevelopment

   Information on adding unit tests

Change Log:

------------------------------------------------------------------------------
@@ -18,7 +18,7 @@
 
   [http://brutus.apache.org/gump/pydoc/ Gump PyDoc]
 
-See als othe code documentation at '''GumpCode'''.
+See also the code documentation at '''GumpCode'''.
 
 = Debugging =
 
@@ -43,3 +43,17 @@
   python gump/test/pyunit.py 
 
 One can run a single test (or set of tests) by passing a wildcarded (filename-like 
not regexp) expression. e.g. *Nag for all nag tests. This matches the method (test) 
name, not test suite name.
+
+
+== Adding Unit Tests ==
+
+First, create a sub-class of UnitTestSuite (in pyunit.py) and implement 
{{{__init__()}}}, and the {{{setUp()}}} and/or {{{tearDown()}}} as with any other 
*unit style (e.g. junit). Then create methods {{{testXXX()}}} that either raise 
exceptions (if they fail) or use {{{self.assertXXX()}}} style methods (which raise 
exception when assertions fail).
+
+Second (ugly) add a segment like like this to pyunit.py, to register the new suite:
+
+{{{
+    from gump.test.xxx import XXXTestSuite  
+    runner.addSuite(XXXTestSuite())
+}}}
+
+Basically, when pyunit runs it walks through all test suites attempting to match all 
{{{testXXX()}}} methods to the provided pattern (or * for all) and when it finds them, 
it runs them (with {{{setUp() and tearDown()}}} run before/after). Any failure 
(exception) is caught and reported later.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to