Flask 中的 Selenium 测试优先级
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
话虽如此,我查看了 flask-testing 文档(我假设您正在使用此扩展),它支持鼻子收集器和测试 运行ner。
https://flask-testing.readthedocs.io/en/latest/#with-nose
并且根据 nose 文档,测试 运行 按照它们在测试模块文件中定义的顺序排列。
https://nose.readthedocs.io/en/latest/writing_tests.html#writing-tests
您可以利用鼻子测试 运行ner。再次抱歉,post 对您没有帮助。
测试函数按照名称(字母顺序)执行。
我在 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
话虽如此,我查看了 flask-testing 文档(我假设您正在使用此扩展),它支持鼻子收集器和测试 运行ner。
https://flask-testing.readthedocs.io/en/latest/#with-nose
并且根据 nose 文档,测试 运行 按照它们在测试模块文件中定义的顺序排列。
https://nose.readthedocs.io/en/latest/writing_tests.html#writing-tests
您可以利用鼻子测试 运行ner。再次抱歉,post 对您没有帮助。
测试函数按照名称(字母顺序)执行。