软件测试学习笔记丨 Pytest 编写插件—为第三方插件添加命令行参数
本文转自测试人社区,原文链接:https://ceshiren.com/t/topic/31489
在 hookspec.py 文件中找到 pytest_addoption 函数

在 conftest.py 文件中重写 pytest_addoption 函数
复制代码

通过定义 fixture 拿到定义好的参数,并针对传入的不同参数完成不同的逻辑处理(例如测试环境和开发环境)
复制代码

通过在测试用例中获取 fixture 修饰的函数,实现新增命令行参数的传递

软件测试开发免费视频教程分享

版权声明: 本文为 InfoQ 作者【测试人】的原创文章。
原文链接:【http://xie.infoq.cn/article/4d47307f3ef25c77850979d79】。文章转载请联系作者。
评论