随笔分类 - python接口自动化
摘要:1 import pytest 2 3 4 @pytest.mark.order(index=3,before='test_third') #啥都不填默认最后执行,使用index,before插入到原来的3前执行 也可以设置after 5 def test_bar(): 6 assert True
阅读全文
摘要:conftest.py 通过yield分隔执行前和执行后运行 session:整个用例执行前后 module:py文件执行前后 class:类前后执行 function:每个方法前后 conftest.py 的文件名称是固定的, pytest 会自动识别该文件,我们可以理解成一个专门存放 fixtu
阅读全文
摘要:setup_module() teardown_module() 模块级别(py文件) setup_class() teardown_class() 类级别 setup_function() teardown_function() 函数级别(不在类中的用例) setup_method() teard
阅读全文
摘要:pytest --collect-only 搜集要运行的测试用例,不运行 匹配表达式 -k D:\tools\pycharm\autotest>pytest -k "test_create_article or test_article_edit_alias" --collect-only 匹配包含
阅读全文
摘要:创建任务 中午12点 H/5 * * * 代表5分钟一次 cd /var/jenkins_home/workspace/autotest 代表进入jenkins从git拉取到的项目路径,这个项目路径下有个文件test_ruall.py import pytestpytest.main(["-v",f
阅读全文