NUnit Test Run Order

前端 未结 16 1322
名媛妹妹
名媛妹妹 2020-12-02 11:44

By default nunit tests run alphabetically. Does anyone know of any way to set the execution order? Does an attribute exist for this?

16条回答
  •  -上瘾入骨i
    2020-12-02 12:21

    Regardless of whether or not Tests are order dependent... some of us just want to control everything, in an orderly fashion.

    Unit tests are usually created in order of complexity. So, why shouldn't they also be run in order of complexity, or the order in which they were created?

    Personally, I like to see the tests run in the order of which I created them. In TDD, each successive test is naturally going to be more complex, and take more time to run. I would rather see the simpler test fail first as it will be a better indicator as to the cause of the failure.

    But, I can also see the benefit of running them in random order, especially if you want to test that your tests don't have any dependencies on other tests. How about adding an option to test runners to "Run Tests Randomly Until Stopped"?

提交回复
热议问题