pytest --collectonly 收集测试案例

pytest --collectonly 是一条命令行指令,用于在运行 pytest 测试时仅收集测试项而不执行它们。它会显示出所有可用的测试项列表,包括测试模块、测试类和测试函数,但不会执行任何实际的测试代码。

这个命令对于查看项目中的测试结构和确保所有的测试项都能被正确识别非常有用。通过检查收集到的测试项,你可以确保你的测试代码被正确组织,并且所有的测试都被识别出来。

请注意,pytest --collectonly 命令不会运行任何测试代码,它只是用来收集测试项的元数据信息。如果你想要执行实际的测试,可以使用 pytest 命令,或者添加其他选项和标志来指定运行的测试范围。

复制代码
import pytest

if __name__ == '__main__':
    # pytest.main(['-v', '--emoji', './case', '--html=./report/report.html', '--self-contained-html'])
    pytest.main(['-s',  '--collectonly', './case'])
相关推荐
X1A0RAN18 小时前
自动化流水线提效·微观篇:pytest 执行顺序优化
自动化·pytest
久久学姐8 天前
Python+Playwright+Pytest+BDD,用FSM打造高效测试框架
python·pytest·bdd·playwright·fsm
小白上线*^_^*9 天前
Pytest 自动化测试框架速通指南(二)
软件测试·pytest·python测试框架·ai测试基础
Logintern0910 天前
pytest的AST 断言重写
pytest
Tinyfacture10 天前
接口自动化之添加商品(pytest)
python·测试工具·自动化·pytest
ji_shuke12 天前
从零深入:基于 Playwright + Pytest + Allure 的企业级 Web 端到端自动化测试框架实战
前端·自动化测试·docker·jenkins·pytest·allure·playwright
祉猷并茂,雯华若锦14 天前
Selenium+Pytest自动化测试框架实战
selenium·测试工具·pytest
祉猷并茂,雯华若锦15 天前
Pytest+Selenium自动化测试:失败自动截图集成Allure报告
selenium·测试工具·pytest
我的xiaodoujiao18 天前
API 接口自动化测试详细图文教程学习系列32--Allure测试报告2
python·学习·测试工具·pytest
一孤程22 天前
Pytest+Selenium搭建自动化框架-保姆级实战教程
selenium·自动化·pytest