How to use User Defined TestResult Class

bala blk at srasys.co.in
Wed Dec 10 01:01:06 EST 2003


Hi,    I want to store the result in my Own TestResult(ie MyTestResult class).if i run the below testcase,defaultTestResult method not get called..My Requirement is If i run the TestCase, the Result should be stored in MyTestResult Class,i don't want to store in the TestResult class .....Pls give a Solution....With Some UserDefined TestResult class(Not UnitTesting Frame work TestResult Class)import unittest

class MyTestCase(unittest.TestCase):
    def defaultTestResult(self):
        return MyTestResult()

class MyTestResult(unittest.TestResult):
    def __init__(self):
        self.errors_tb = []
        self.failures_tb = []

    def addError(self, test, err):
        self.errors_tb.append((test, err))
        unittest.TestResult.addError(self, test, err)

    def addFailure(self, test, err):
        self.failures_tb.append((test, err))
        unittest.TestResult.addFailure(self, test, err)
Regards,Bala
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20031210/dc8ee818/attachment.html>


More information about the Python-list mailing list