Hi All,
i have dozen of test cases in different folders. In the root directory there is a test runner.
unittest\
package1\
test1.py
test2.py
package2\
test3.py
test4.py
testrunner.py
Currently I added the four test cases manually into a test suite
import unittest
from package1.test1 import Test1
from package1.test2 import Test2
from package2.test3 import Test3
from package2.test4 import Test4
suite = unittest.TestSuite()
suite.addTests(unittest.makeSuite(Test1))
suite.addTests(unittest.makeSuite(Test2))
suite.addTests(unittest.makeSuite(Test3))
suite.addTests(unittest.makeSuite(Test4))
result = unittest.TextTestRunner(verbosity=2).run(suite)
if not result.wasSuccessful():
sys.exit(1)
How to let test runner test all test cases automatically? Such as:
for testCase in findTestCases():
suite.addTests(testCase)