繁体   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