【发布时间】:2013-08-13 14:10:46
【问题描述】:
在使用 /include 或 /exclude 语句时,我正在阅读有关类别表达式的 this link。我希望能够仅包含运行测试以用完两个可用测试或运行所有测试但使用 /include:A+B 或 /exclude:A。但是,由于某种原因,它显示了错误的要运行和/或不运行的测试数量。这是为什么?
谁能给我一个关于如何分类表达式(通过操作源代码)并添加如何在控制台中运行命令的示例?
基本上我所做的是:
using System;
using NUnit;
using NUnit_Application;
using NUnit.Framework;
namespace NUnit_Application.Test
{
[TestFixture]
[Category("MathS")]
public class TestClass
{
[TestCase]
[Category("MathA")]
public void AddTest()
{
MathsHelper helper = new MathsHelper();
int result = helper.Add(20, 10);
Assert.AreEqual(40, result);
}
[TestCase]
[Category("MathB")]
public void SubtractTest()
{
MathsHelper helper = new MathsHelper();
int result = helper.Subtract(20, 10);
Assert.AreEqual(10, result);
}
}
}
我的命令行语句是 nunit-console /framework:net-4.0 /run:NUnit_Application.Test.TestClass.AddTest C:~\NUnit_Application\NUnit_Application\NUnit_Application.Test\bin\Debug\NUnit_Application.Test.dll /include:"MathA"
问题是,控制台熟悉命令的含义,并且说它包含数学 A 类别。但是,它显示零测试已运行且零测试尚未运行。
我正在运行控制台运行程序 NUnit 2.6.2。
【问题讨论】:
标签: c# nunit nunit-console