随笔分类 -  Pytest框架

摘要:查看帮忙信息 F:\PycharmProjects\djangotest>pytest --h 查看版本号 F:\PycharmProjects\djangotest>pytest --version F:\PycharmProjects\djangotest>pytest -V 查看mark相关功 阅读全文
posted @ 2023-03-19 19:47 七亿星空 阅读(25) 评论(0) 推荐(0)
摘要:1.默认是从上往下 setup_module->setup_claas->setup_function->testcase->teardown_function->teardown_claas->teardown_module 1)文件之间按照名称的ASCLL码从小到大排序,即数字、大写英文字母、小 阅读全文
posted @ 2023-03-19 19:47 七亿星空 阅读(782) 评论(0) 推荐(0)
摘要:使用方法 @pytest.mark.name_of_the_mark,其中name_of_the_mark是自定义标记的名字,举个例子,下面定义了3个,对方法、函数都可以进行标记 # @File : test_001.py import pytest @pytest.mark.testa class 阅读全文
posted @ 2021-05-19 13:20 七亿星空 阅读(162) 评论(0) 推荐(0)
摘要:一个参数a,依次传入值1,2,3,用列表传值 import pytest @pytest.mark.parametrize('a',[1,2,3]) def testauto(a): assert a==3 两个参数a,b,用元祖传值 import pytest @pytest.mark.param 阅读全文
posted @ 2021-05-13 16:39 七亿星空 阅读(110) 评论(0) 推荐(0)
摘要:使用pytest框架前需要安装两个库 pip install pytest pip install pytest-html 原生态报告 (可执行pytest test_case.py -s --html=report.html 就会在代码同级目录下生成report.html报告,其中-s是把打印的内 阅读全文
posted @ 2021-05-13 15:21 七亿星空 阅读(223) 评论(0) 推荐(0)