python +unittest 测试报告的生成

当我们写完所有的接口用例后,执行完后,我们就要生成测试报告。

今天写这篇博客的内容,主要是要注意两个地方:

1,报告的位置。

报告不要再写成:C:UsersAdministratorDesktopshuixininterfacepythontestprojectshuixin_interface eport eport.html

这样写的话,上传到git后,别人无法访问你的报告。

使用from pathlib import Path

import os 

这样别人就可以访问你的报告地址了。

 2,HTMLTestRunner   的修改内容后,以适应python3

以前是写成:runner=HTMLTestRunner .HTMLTestRunner (..........)

现在直接写成:runner=HTMLTestRunner (............)

原文地址:https://www.cnblogs.com/star12111/p/15147814.html