A Nose plugin to specify the order of unit test execution

前端 未结 2 984
时光取名叫无心
时光取名叫无心 2020-12-17 10:58

I have a desire to use Nose for an over the wire integration test suite. However, the order of execution of some of these tests is important.

That said, I thought I

相关标签:
2条回答
  • 2020-12-17 11:11

    From the documentation:

    [...] nose runs functional tests in the order in which they appear in the module file. TestCase-derived tests and other test classes are run in alphabetical order.

    So a simple solution might be to rename the tests in your test case:

    class Foo(unittest.TestCase):
    
        def test_01_foo(self):
            pass
    
        def test_02_boo(self):
            pass
    
    0 讨论(0)
  • 2020-12-17 11:35

    I found a solution for it using PyTest ordering plugin provided here.

    Try py.test YourModuleName.py -vv in CLI and the test will run in the order they have appeared in your module (first test_foo and then test_bar)

    I did the same thing and works fine for me.

    Note: You need to install PyTest package and import it.

    0 讨论(0)
提交回复
热议问题