目录
7. --maxfail 只要存在max个失败用例则停止执行
1. -s 表示输出调试信息,包括print打印信息
D:\demo>pytest -s ./pytest_1
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 1 item
pytest_1\test_login.py 登录1
.
================================================================ 1 passed in 0.07s =================================================================
或
pytest.main(['-s', './pytest_1/test_login.py'])
2. -v 表示输出用例执行详细信息
D:\demo>pytest -v ./pytest_1
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 1 item
pytest_1/test_login.py::TestLogin::test_08_loogin1 PASSED [100%]
================================================================ 1 passed in 0.03s =================================================================
或
pytest.main(['-v', './pytest_1/test_login.py'])
3. -vs 表示既输出调试信息同时输出执行详细信息
D:\demo>pytest -vs ./pytest_1
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 1 item
pytest_1/test_login.py::TestLogin::test_08_loogin1 登录1
PASSED
================================================================ 1 passed in 0.03s =================================================================
或
pytest.main(['-vs', './pytest_1/test_login.py'])