上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 96 下一页
摘要: unittest Python内置的单元测试框架,跟pytest类似 setup/teardown 在用例执行之前执行setup 接着执行用例本身 最后,执行teardown setupclass/teardownclass 在类中,所有用例执行之前执行setupclass 执行用例本身 当所有的用 阅读全文
posted @ 2020-01-29 18:16 干it的小张 阅读(140) 评论(0) 推荐(0) 编辑
摘要: import unittestimport osif __name__ == '__main__': base_dir = os.path.dirname(os.path.abspath(__file__)) # 写法一: suite = unittest.TestLoader().discover 阅读全文
posted @ 2020-01-29 18:13 干it的小张 阅读(277) 评论(0) 推荐(0) 编辑
摘要: import unittestclass TestCase2(unittest.TestCase): def test_case_01(self): self.assertTrue(1) def test_case_02(self): self.assertTrue(0) def test_case 阅读全文
posted @ 2020-01-29 18:11 干it的小张 阅读(151) 评论(0) 推荐(0) 编辑
摘要: import unittestimport requests# 版一:class MyTestCase(unittest.TestCase): def setUp(self): print("初始化") def tearDown(self): print("收尾") def xxxTest(self 阅读全文
posted @ 2020-01-29 18:10 干it的小张 阅读(156) 评论(0) 推荐(0) 编辑
摘要: About unittest是Python内置的单元测试框架(模块),不仅可以完成单元测试,也适用于web自动化测试中。 unittest提供了丰富的断言方法,判断测试用例是否通过,然后生成测试结果报告。 必要的准备与注意事项 首先,我们准备这样一个目录: M:\tests\ # 我的是M盘的tes 阅读全文
posted @ 2020-01-28 12:41 干it的小张 阅读(308) 评论(0) 推荐(0) 编辑
上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 96 下一页