[IronPython] Descriptive reports in unittest module

Michael Foord fuzzyman at gmail.com
Thu Dec 18 16:09:52 CET 2008

2008/12/18 Yash Ganthe <yashgt at gmail.com>

> I am using the unittest module in IronPython 2.0.
> My TestClass has a function named testLoginWithInvalidUsername. I would
> like to attach a string to this function so that if the test fails, the
> string would be printed as:
> Failed : Testing the login functionality with invalid user name
> I am not asking for something that will automatically figure out the string
> to be printed. I am looking for a way for me to attach an attribute to the
> test function so that the string in the attribute gets printed.
> Is there something readily avaliable for doing this?

Most unittest assert methods take an optional message parameter - where the
message is the failure message. e.g.

self.assertEquals('foo', 'bar', 'foo is not equal to bar')


> Currently my test report comes out as:
> testDateDiffWeek (PI.GetMessages.GetMessagesTestClass) ... ok
> testGetMessageGUIDnull (PI.GetMessages.GetMessagesTestClass) ... FAIL
> Thanks,
> Yash
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081218/c2ae106f/attachment.html>

More information about the Ironpython-users mailing list