NUnit Test Run Order

前端 未结 16 1370
名媛妹妹
名媛妹妹 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条回答
  •  囚心锁ツ
    2020-12-02 12:33

    NUnit 3.2.0 added an OrderAttribute, see:

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

    Example:

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

提交回复
热议问题