使用pytest执行特定测试

问题描述 投票:0回答:1

有没有办法在pytest中为测试添加属性,例如“冒烟测试”或“回归”,然后只运行那些测试?

python pytest
1个回答
3
投票

是的,您可以使用标记。

"Marking test functions and selecting them for a run"

基本上,您将使用@pytest.mark.smoke“标记”一些测试,然后使用$ pytest -m smoke等命令启动它们。

© www.soinside.com 2019 - 2024. All rights reserved.