简体   繁体   English

Flask 中的硒测试优先级

[英]Selenium test priority in Flask

I have a use case in selenium in which the priority of test functions are important.我在 selenium 中有一个用例,其中测试功能的优先级很重要。 I'm using LiveServerTestCase in flask for tests.我在烧瓶中使用LiveServerTestCase进行测试。 In Java, there is a decorator @Test(priority=0) for defining test priorities.在 Java 中,有一个装饰器@Test(priority=0)用于定义测试优先级。 My question is what is the equivalent in Flask?我的问题是 Flask 中的等价物是什么?

This may not answer your question as I have no knowledge nor experience with LiveServerTestCase, I am more of a pytest guy, and if you ever go down the pytest path, look up这可能无法回答你的问题,因为我对 LiveServerTestCase 一无所知,也没有经验,我更像是一个 pytest 人,如果你走上 pytest 的道路,请查看

https://github.com/ftobia/pytest-ordering/blob/develop/docs/source/index.rst 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

Having said that, I looked at flask-testing documentation (I am assuming you are using this extension), it supports nose collector and test runner.话虽如此,我查看了烧瓶测试文档(我假设您正在使用此扩展程序),它支持鼻子收集器和测试运行器。

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

And as per nose documentation, the tests run in the order they are defined in the test module file.根据鼻子文档,测试按照它们在测试模块文件中定义的顺序运行。

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

You can leverage the nose test runner.您可以利用鼻子测试运行器。 Again, my apologize this post does not help you.再次,我很抱歉这篇文章没有帮助你。

测试函数根据其名称(字母顺序)执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM