How to use User Defined TestResult Class

B

bala

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top