【发布时间】:2011-12-21 05:11:03
【问题描述】:
我有一个 NUnit 项目,它创建了一个控制台应用程序来运行测试。入口点如下所示:
class Program
{
[STAThread]
static void Main(string[] args)
{
string[] my_args = { Assembly.GetExecutingAssembly().Location };
int returnCode = NUnit.ConsoleRunner.Runner.Main(my_args);
if (returnCode != 0)
Console.Beep();
}
}
如果我只想运行这个测试,我可以传递什么作为参数:
[TestFixture]
public class EmailNotificationTest
{
[Test]
public void MailerDefaultTest()
{
Assert.IsTrue(false);
}
}
很明显这是支持的,同样很明显我不知道该怎么做。
更新
看起来像 v3+,这可以通过 --test 选项实现,每个 the documentation。
【问题讨论】:
-
我没有使用过 ConsoleRunner,但它可能支持
[Explicit]和[Category]属性。 -
对于那些寻找
nunit3-console.exe的人,请参阅stackoverflow.com/questions/37297838/…