Archived community.zenoss.org | full text search
Skip navigation
Currently Being Moderated

TestGen4Web-Python: Single-Source Unit Test

VERSION 1 
Created on: Sep 14, 2009 11:16 AM by Noel Brockett - Last Modified:  Apr 20, 2010 4:00 PM by Matt Ray

Running unit tests with python's unittest module is very easy. We do need to set the filename on the test case object, though, so there are a few extra steps involved:

 

import unittest

from testgen.zopeunit import TestBrowserUnitTest

filename = 'tests/TestGen4Web/testLoginLogout.xml'
loader = unittest.TestLoader()
test = TestBrowserUnitTest
test.sourceFilename = filename
suite = loader.loadTestsFromTestCase(test)
suite = unittest.TestSuite(suite)
unittest.TextTestRunner().run(suite)
Comments (0)