Python HTMLTestRunner库安装过程解析
安装 HTMLTestRunner 库的方法非常简单,直接 pip 就可以了
pip install html-testRunner
在 https://pypi.org/ 中可以直接搜索到,并且官方还提供了详细的文档,操作起来非常的简单
官方示例代码:
import HtmlTestRunnerimport unittestclass TestStringMethods(unittest.TestCase): def test_upper(self): self.assertEqual(’foo’.upper(), ’FOO’) def test_error(self): ''' This test should be marked as error one. ''' raise ValueError def test_fail(self): ''' This test should fail. ''' self.assertEqual(1, 2) @unittest.skip('This is a skipped test.') def test_skip(self): ''' This test should be skipped. ''' passif __name__ == ’__main__’: unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output=’example_dir’))
这是运行后,生成的 HTML 网页

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持好吧啦网。
相关文章:
1. Java形参和实参的实例之Integer类型与Int类型用法说明2. java ArrayBlockingQueue的方法及缺点分析3. PHP组合模式Composite Pattern优点与实现过程4. asp.net web api2设置默认启动登录页面的方法5. Python3.8 + Tkinter: Button设置image属性不显示的问题及解决方法6. JSP动态网页开发原理详解7. 基于Python爬取51cto博客页面信息过程解析8. 使用python采集Excel表中某一格数据9. Ajax对xml信息的接收和处理操作实例分析10. 写一个Python脚本自动爬取Bilibili小视频

网公网安备