当前位置:网站首页>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 - 取消-确定
边栏推荐
- Redis---1.数据结构特点与操作
- LeetCode 283. Move zero
- Decryption skills of encrypted compressed files
- BGP 路由优选规则和通告原则
- The Chinese word segmentation task is realized by using traditional methods (n-gram, HMM, etc.), neural network methods (CNN, LSTM, etc.) and pre training methods (Bert, etc.)
- Amazon AWS data Lake Work Pit 1
- 深入学习JVM底层(二):HotSpot虚拟机对象
- CUDA用户对象
- CUDA与Direct3D 一致性
- Use of Arduino wire Library
猜你喜欢
Hydration failed because the initial UI does not match what was rendered on the server. One of the reasons for the problem
加密压缩文件解密技巧
IDEA公布全新默认UI,太清爽了(内含申请链接)
Redis - hot key issues
Shardingsphere JDBC
日期时间API详解
Sentinel 阿里开源流量防护组件
锐捷EBGP 配置案例
Singleton mode compilation
Support new and old imperial CMS collection and warehousing tutorials
随机推荐
CUDA中的线程层次
CUDA中的动态全局内存分配和操作
Hydration failed because the initial UI does not match what was rendered on the server. One of the reasons for the problem
VLAN experiment of switching technology
一起学习SQL中各种join以及它们的区别
深入学习JVM底层(二):HotSpot虚拟机对象
Golang -- map capacity expansion mechanism (including source code)
Browser principle mind map
Introduce two automatic code generators to help improve work efficiency
日志(常用的日志框架)
Common means of modeling: combination
Detailed explanation of BGP message
Cglib agent - Code enhancement test
MySQL的10大經典錯誤
CUDA中的函数执行空间说明符
Redis---1.数据结构特点与操作
Invalid operation: Load into table ‘sources_orderdata‘ failed. Check ‘stl_load_errors‘ system table
Don't use the new WP collection. Don't use WordPress collection without update
记录一次RDS故障排除--RDS容量徒增
LeetCode 83. Delete duplicate elements in the sorting linked list