unittest基本原理: ♦整个平台的搭建使用的是python的unittest测试框架,这里简单介绍下unittest模块的简单应用. ♦unittest是python的标准测试库,相比于其他测试框架是python目前使用最广的测试框架. ♦unittest有四个比较重要的概念是test fixture, test case, test suite, test runner, . ♦test fixture:The test fixture is everything we need to…
接上一篇doCleanups说明,这次介绍下另一个很好用的函数:addCleanup 还是老规矩,看官方文档说明: addCleanup(function, *args, **kwargs)¶ Add a function to be called after tearDown() to cleanup resources used during the test. Functions will be called in reverse order to the order they are a…
找出要测试的testcase,并加入到Testsuite,运行Testsuite并把结果给TestResult1.创建TestSuite实例对象suite = unittest.TestSuite() 2.构建suite a. suite = unittest.TestLoader().discover("文件夹名或者包名") suite = unittest.TestLoader().discover("xxx文件夹") b. suite = unittest.T…