TestGen4Web-Python: Single-Source Unit Test
by
zenoss
—
last modified
2007-06-08 14:47
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)