簡體   English   中英

Flask 中的硒測試優先級

[英]Selenium test priority in Flask

我在 selenium 中有一個用例,其中測試功能的優先級很重要。 我在燒瓶中使用LiveServerTestCase進行測試。 在 Java 中,有一個裝飾器@Test(priority=0)用於定義測試優先級。 我的問題是 Flask 中的等價物是什么?

這可能無法回答你的問題,因為我對 LiveServerTestCase 一無所知,也沒有經驗,我更像是一個 pytest 人,如果你走上 pytest 的道路,請查看

https://github.com/ftobia/pytest-ordering/blob/develop/docs/source/index.rst

import pytest

@pytest.mark.order2
def test_foo():
    assert True

@pytest.mark.order1
def test_bar():
    assert True

話雖如此,我查看了燒瓶測試文檔(我假設您正在使用此擴展程序),它支持鼻子收集器和測試運行器。

https://flask-testing.readthedocs.io/en/latest/#with-nose

根據鼻子文檔,測試按照它們在測試模塊文件中定義的順序運行。

https://nose.readthedocs.io/en/latest/writing_tests.html#writing-tests

您可以利用鼻子測試運行器。 再次,我很抱歉這篇文章沒有幫助你。

測試函數根據其名稱(字母順序)執行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM