ANNOUNCE: Python Mock Objects 
Author Message
 ANNOUNCE: Python Mock Objects

[This is a repost, since the original seems to have got lost between
me and my ISP. My appologies if you receive it twice.]

I have released to the python and XP communities a small Python module
for creating mock objects.  A mock object can be passed to a class or
method being tested to replace objects that are outside the scope of
the test.

The file has been uploaded to the Extreme Programming mailing list on
yahoo groups, and may be downloaded from:
http://www.*-*-*.com/

The idea is simple.  A mock object created with this class will allow
any method to be invoked on it, with any parameters (including keyword
arguments).  The method calls are stored and can be examined later to
see what parameters were passed.  By default all methods return None,
but the class constructor can take a dictionary of method names and
values to return for those methods.

The zip file contains documentation and a test suite using OmPyUnit,
which should easily be convertible to the other versions of PyUnit.
OmPyUnit can be downloaded from
http://www.*-*-*.com/
http://www.*-*-*.com/

If anyone finds this useful or converts it to other languages then
please let me know.  I believe Smalltalk or Ruby should be easy, but
if
anyone figures out how to do this in Java or C++ then please let
*everyone* know.  8^)

Share and Enjoy

        Dave Kirby

--------------------------------------------------
All great ideas start as heresy and end as dogma.


bigfoot.   My opinions are my own,
com        but I'm willing to share.



Mon, 15 Sep 2003 02:55:48 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Test::Unit::Mock: Mock objects for testing with Test::Unit

2. Unit testing - Using Java Mock Objects in Python?

3. Test-first and mock objects with PyOpenGL

4. Mock object creation by example?

5. ANNOUNCE: quality assurance: another python lint (and python parsing in python)

6. ANNOUNCE: Introducing comp.lang.python.announce

7. ANNOUNCE: Introducing comp.lang.python.announce

8. ANNOUNCE: comp.lang.python.announce mail gateway

9. Exposing Python object running in NT service as COM object

10. cast object of python to java object - problem

11. module to convert Python objects to C objects

12. Mock Morris

 

 
Powered by phpBB® Forum Software