我是 python 新手,我正在尝试创建自己的测试套件。
主要目的是在不同的浏览器上执行相同的测试,这就是我使用变量 browser 的原因,它在测试中用于调用 webdriver。
我有这个:
def test_01(自我,浏览器):
def test_02(自我,浏览器):
我的套房:
def suite():
test_suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(Test01))
return test_suite
主要的:
if __name__ == "__main__":
suite1 = unittest.TestSuite()
self = Test01()
suite1.addTest(Test01.test_01(self, 'firefox'))
suite1.addTest(Test01.test_02(self, 'firefox'))
unittest.TextTestRunner(verbosity=2).run(suite())
当我尝试执行该脚本时,第一个测试已执行,第二个未执行,并且出现以下错误:
回溯(最后一次调用):文件“SuiteWebMail.py”,第 138 行,在 suite1.addTest(Test01.test_01(self, 'firefox')) 文件“c:\Python34\lib\unittest\suite.py”,第 50 行,在 addTest raise TypeError("{} is not callable".format(repr(test))) TypeError: None is not callable
先感谢您
C