pytest用例失敗重跑的方法


Test_Login:
    (==)
    (=)
    ():
        test.Primary.driver.get()
        bool_success = LoginSystem(test.Primary.driver).login_openiot()
        bool_success

用例失敗重跑的方法

  1. 在用例上添加裝飾器@pytest.mark.flaky(reruns=2, reruns_delay=4)  reruns爲次數,reruns_delay間隔時間,單位s

  2. 安裝pytest-rerunfailures依賴包,在pytest.ini文件中addopts = 添加參數–reruns n (n:爲重試的次數)(有待測試)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章