求助:python执行未打印每个测试方法
请问设置verbosity=2执行后为什么没有打印出每个测试方法呢?import unittest
import requests
class TestHttp(unittest.TestCase):
def testHttp1(self):
r = requests.get('http://www.baidu.com')
print(r)
def testHttp2(self):
r = requests.get('http://bbs.51testing.com')
print(r)
if __name__ == "__main__":
suite = unittest.TestLoader().loadTestsFromTestCase(TestHttp)
unittest.TextTestRunner(verbosity=2).run(suite)
def testHttp1(self): 修改为 def test_Http1(self):
def testHttp2(self): 修改为def test_Http2(self): 试了,不行哈 你只是requests.get,。试试print(r.text) print是打印出来了,想打印出是用例的执行结果,如:testHttp1.....pass
页:
[1]