Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to use User Defined TestResult Class

Thread Tools

How to use User Defined TestResult Class

Posts: n/a
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)
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM
I want to know to create our own TestResult Class bala Python 0 12-04-2003 08:09 AM
How to log the TestResult in the Excel or Notepad.... bala Python 0 12-04-2003 05:56 AM
How to use TestResult Class bala Python 0 12-03-2003 01:34 PM