简体   繁体   English

使用pytest执行特定测试

[英]Executing specific tests using pytest

pytest中是否有一种方法可以向测试添加属性,例如说“烟雾测试”或“回归”,然后仅运行那些测试?

Yes, you can use Markers for that. 是的,您可以为此使用标记。

See "Marking test functions and selecting them for a run" 请参阅“标记测试功能并选择运行”

Essentially, you will "mark" some of your tests with @pytest.mark.smoke and then launch them with a command like $ pytest -m smoke . 本质上,您将使用@pytest.mark.smoke “标记”一些测试,然后使用$ pytest -m smoke这样的命令启动它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM