
pytest
xinyuebaihe
这个作者很懒,什么都没留下…
展开
-
pytest补充
1.pytest配置文件pytest.ini : pytest的主配置文件,可以改变pytest的默认行为。也可以自定义参数。conftest.py : 把公共代码写在里面.主要为把hook函数与fixture写在里面。作用于本目录的用例与子目录的用例__init__.py:可以避免不同目录下有相同的模块名。没有这个,运行时报错。建议在测试用例的每个目录都有此文件。2.查看ini文件。pytest --help.可知道pytest目录支持哪些参数。也可以在conftest.py中写hoo原创 2020-05-31 22:48:59 · 193 阅读 · 0 评论 -
pytest传参的两种方式
#test_param.pyimport pytestclass TestParam: ''' pytest参数化 1. 在测试用例上加注解@pytest.mark.parametrize("loginame,password",[(值1,值2),(值1,值2)]) 2. fixture传参。 1)在测试用例上加注解@p...原创 2020-03-26 18:15:46 · 3478 阅读 · 0 评论