How to Order NUnit Tests

前端 未结 5 1477
猫巷女王i
猫巷女王i 2020-12-20 11:17

More than once the question has been asked on SO. But the only answers that are given read \"you should not need to order your unit tests, it is bad because\" or \"you can

5条回答
  •  失恋的感觉
    2020-12-20 11:52

    Update for NUnit 3.2.0 - now it support OrderAttribute.

    The OrderAttribute may be placed on a test method to specify the order in which tests are run. Example:

    public class MyFixture
    {
        [Test, Order(1)]
        public void TestA() { ... }
    
    
        [Test, Order(2)]
        public void TestB() { ... }
    
        [Test]
        public void TestC() { ... }
    }
    

    https://github.com/nunit/docs/wiki/Order-Attribute

提交回复
热议问题