简体   繁体   English

nunit-console不运行使用TestCase属性参数化的测试

[英]nunit-console does not run tests parameterized with TestCase attribute

Trying to run Nunit tests parameterized with TestCase attribute. 尝试运行使用TestCase属性参数化的Nunit测试。 Something like this: 像这样的东西:

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

    }
}

And when I am trying to run this tests using nunit console 当我尝试使用nunit控制台运行此测试时

nunit-console.exe MyProject.dll /run:MyNamespace.MyClass.Test1 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") nunit-console.exe MyProject.dll /run:MyNamespace.MyClass.Test1("option1“)

it just shows: 它只是显示:

Tests run: 0, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0.0269838 seconds Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0 测试运行:0,错误:0,失败:0,不确定:0,时间:0.0269838秒未运行:0,无效:0,忽略:0,跳过:0

从我记忆中,它需要被引用一点点不同;

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM