第一个unittest case运行成功,值得记录下:
1、unittest 用file模块,无法导入,不能用,可以改成 fp =open(filepath,"wb") 但是一定要记住在后面 加上 fp.close() 不然生成的报告内容可能为空
2. TestSuite() 方法运用 .addTest() 里面的参数test 必须得用 函数名包含case名 class(case) ,否则会报错

3. 运行py 文件时 必须配置如下设置,不然无法生成报告,记住文件名中间不能有空格,末尾也是


网友评论