当前位置:网站首页>pycharm专业版 配置pytest
pycharm专业版 配置pytest
2022-07-30 05:38:00 【gsxdcyy】
前言
我是使用python的一个轻量框架flask,如果有跟我一样是用flask的xd不知道怎么测试的话,强烈建议flask官方文档,不用到处找教程了,看一看官方文档,就知道怎么搞了
配置
我用的是pycharm专业版,默认的测试模块是unittests,所以我们在设置里面修改一下,参考这个文章
点击那个扳手的图标,或者右上角运行图标旁边的,编辑配置都可以,然后在additional arguments这里添加想要添加的参数
我最后的配置是--html=report.html --self-contained-html
--cov=C:/Users/cgy/Desktop/NewWaiMai --cov-report=html
第一个是pytest-html插件,这个会生成一个html报告,–self-contained-html是让他只生成一个html文件
第二个是pytest-cov,是测定覆盖率的插件,也会生成报告,但是是一个文件夹,里面的index.html就是覆盖率的报告了
这是两个插件相关的的文章
pytest-html
pytest-cov
pytest-html的报告没有allure的好看,所以可以下载allurepip install allure-pytest
然后命令行添加--alluredir, results
然后测试运行结束后,输入allure generate results -o reports
这里的results
是存放测试生成的json文件的文件夹,reports
是生成html报告的文件夹
边栏推荐
- ClickHouse data insert, update and delete operations SQL
- 质数(清华大学机试题)(DAY 86)
- 个人博客系统(附源码)
- MySQL user authorization
- Different lower_case_table_names settings for server (‘1‘) and data dictionary (‘0‘) 解决方案
- Thymeleaf简介
- MySQL(4)
- Graphic mirror symmetry (schematic diagram)
- MySql的初识感悟,以及sql语句中的DDL和DML和DQL的基本语法
- 倒计数(来源:Google Kickstart2020 Round C Problem A)(DAY 88)
猜你喜欢
随机推荐
St. Regis Takeaway Project: New dishes and dishes paged query
应用实践 | Apache Doris 在百度智能云计费账单系统的应用实践
MySQL 灵魂 16 问,你能撑到第几问?
Solve the problem that the local nacos is not configured but the localhost8848 connection exception always occurs
腾讯面试居然跟我扯了半小时的CountDownLatch
ezTrack-master使用教程
微信小程序开发学习
Basic syntax of MySQL DDL and DML and DQL
PyCharm usage tutorial (more detailed, picture + text)
Different lower_case_table_names settings for server ('1') and data dictionary ('0') solution
Graphic mirror symmetry (schematic diagram)
[Mysql] CONVERT函数
MySQL user authorization
Ranking of grades (Huazhong University of Science and Technology postgraduate examination questions) (DAY 87)
list(列表)和array(数组)的区别
MySQL fuzzy query performance optimization
MySql模糊查询大全
4、nerf(pytorch)
JVM之GC 调优基础知识(一)
[Koltin Flow (1)] Five ways to create flow