NUnit控制台不运行测试,参数化测试用例属性测试、控制台、属性、参数

2023-09-06 16:47:49 作者:你算whatら

试图运行NUnit的测试参数与TestCase的属性。事情是这样的:

Trying to run Nunit tests parameterized with TestCase attribute. Something like this:

[TestFixture]
public class MyClass
{
    [Test]
    [TestCase("option1")]
    [TestCase("option2")]
    public void Test1(string id)
    {

    }
}

当我试图运行使用此测试NUnit的控制台

And when I am trying to run this tests using nunit console

NUnit的-console.exe MyProject.dll /run:MyNamespace.MyClass.Test1

它工作正常。但在尝试运行参数:

it works fine. But at attempt to run it parameterized:

NUnit的-console.exe MyProject.dll /run:MyNamespace.MyClass.Test1("option1)

这只是表明:

测试运行:0,错误:0,失败:0,不确定的:0,时间:0.0269838秒   不运行:0,无效:0,忽略:0,跳过:0 的

Tests run: 0, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0.0269838 seconds Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0

推荐答案

从它需要被引用有点不同我记得;

From what I remember it needs to be quoted a bit differently;

nunit-console.exe MyProject.dll /run:"MyNamespace.MyClass.Test1(\"option1\")"
 
精彩推荐
图片推荐