How to use User Defined TestResult Class

bala blk at
Wed Dec 10 07:01:06 CET 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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list