Pytest運行多個py文件


創建兩個test_XX.py文件分別測試桌面和服務器

test_desktop.py

import pytest


@pytest.mark.Desktop_Professional
@pytest.mark.特性1
def test_1():
    print('執行了桌面專業版特性1用例')
    assert True


@pytest.mark.Desktop_Professional
@pytest.mark.特性2
def test_2():
    print('執行了桌面專業版特性2用例')
    assert False
test_server.py

import pytest


@pytest.mark.Server_e
@pytest.mark.特性1
def test_3():
    print('執行了服務器歐拉版特性3用例')
    assert False

我們現在需要測試桌面版,終端輸入:

pytest -v   test_desktop.py

測試桌面版和服務器,終端輸入:

pytest -v test_server.py  test_desktop.py

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM