【问题标题】:Running Test Cases Separately Nunit Console Runner单独运行测试用例 Nunit Console Runner
【发布时间】:2018-05-01 11:32:24
【问题描述】:

我正在使用 Nunit3 开发测试,并且针对一种方法有多个测试用例。我想使用 Nunit 控制台运行程序单独运行测试用例。我怎样才能做到这一点?

[TestCase(12,3,4)]
[TestCase(12,2,6)]
[TestCase(12,4,3)]
public void DivideTest(int n, int d, int q)
{
  Assert.AreEqual( q, n / d );
}

这样的事情最终会运行所有的测试用例。

nunit3-console.exe --test=DivideTest(12,3,4) path/to/your/test.dll

【问题讨论】:

    标签: nunit-3.0 nunit-console


    【解决方案1】:

    命名测试用例提供了我正在寻找的解决方法:

    [TestCase(12,3,4 TestName="foo"))]
    public void DivideTest(int n, int d, int q)
    {
      Assert.AreEqual( q, n / d );
    }
    
    nunit3-console.exe --test=foo path/to/your/test.dll
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-25
      • 1970-01-01
      相关资源
      最近更新 更多