NUnit控制台不运行测试,参数化测试用例属性 [英] nunit-console does not run tests parameterized with TestCase attribute

查看:686
本文介绍了NUnit控制台不运行测试,参数化测试用例属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图运行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\")"

这篇关于NUnit控制台不运行测试,参数化测试用例属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆