当前位置:网站首页>unittest.TextTestRunner不生成txt测试报告
unittest.TextTestRunner不生成txt测试报告
2022-07-02 06:22:00 【bthtth】
suite = unittest.TestSuite()
loader = unittest.TestLoader()
suite.addTest(loader.loadTestsFromTestCase(CasesLogin))
with open('result_unittest.txt', 'w+', encoding='utf-8') as file:
runner = unittest.TextTestRunner(file, descriptions="asdf", verbosity=2)
runner.run(suite)代码片段如上.
问题描述:用例执行成功了,pycharm的项目栏不生成result_unittest.txt文件.尝试手动创建,再次执行,执行通过后,文件还是为空

解决方法:
1\ 在pycharm中用unittest框架运行,不能生成测试报告.应该用python运行.参考博文
2\ 如此设置还是不行.但是我发现从"我的文档"中访问报告路径,生成了测试文件,并且记录了测试结果.于是找到下面的方法:
检查当前项目的状态是否为"排除在外"Exclude.
file -setting

project structure - 项目 - excluded - 取消-确定

边栏推荐
- Hydration failed because the initial UI does not match what was rendered on the server. One of the reasons for the problem
- CUDA中的函数执行空间说明符
- Generic classes and parameterized classes of SystemVerilog
- Redis - cluster data distribution algorithm & hash slot
- TensorRT的功能
- Detailed explanation of BGP message
- The difference between session and cookies
- 一口气说出 6 种实现延时消息的方案
- Detailed definition of tensorrt data format
- Golang--map扩容机制(含源码)
猜你喜欢

Find the highest value of the current element Z-index of the page

In depth understanding of JUC concurrency (II) concurrency theory

Pbootcms collection and warehousing tutorial quick collection release

Invalid operation: Load into table ‘sources_ orderdata‘ failed. Check ‘stl_ load_ errors‘ system table

Redis - grande question clé

Sentinel Alibaba open source traffic protection component

深入了解JUC并发(二)并发理论

Invalid operation: Load into table ‘sources_orderdata‘ failed. Check ‘stl_load_errors‘ system table

自学table au

BGP中的状态机
随机推荐
10 erreurs classiques de MySQL
MySQL的10大经典错误
Hydration failed because the initial UI does not match what was rendered on the server.问题原因之一
深入了解JUC并发(二)并发理论
TensorRT的命令行程序
FE - Weex 使用简单封装数据加载插件为全局加载方法
Invalid operation: Load into table ‘sources_orderdata‘ failed. Check ‘stl_load_errors‘ system table
BGP 路由优选规则和通告原则
数据科学【九】:SVD(二)
Pbootcms collection and warehousing tutorial quick collection release
链表(线性结构)
日期时间API详解
Sudo right raising
CUDA中的存储空间修饰符
Redis——大Key问题
CUDA中内置的Vector类型和变量
Kotlin - 验证时间格式是否是 yyyy-MM-dd HH:mm:ss
FE - Eggjs 结合 Typeorm 出现连接不了数据库
MySql索引
CUDA中的Warp matrix functions