运行NUnit的个人编程测试 [英] Running individual NUnit tests programmatically

查看:218
本文介绍了运行NUnit的个人编程测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要运行单独的C#NUnit的测试编程。我发现另一个帖子那是在显示效果非常有帮助我如何编程方式运行一整套测试的,但我需要能够选择单个测试。

I need to run individual C# NUnit tests programmatically. I found another post that was very helpful in showing me how to run an entire set of tests programmatically, but I need to be able to select individual tests.

我认为建立一个NameFilter会做的伎俩,但在RemoteTestRunner似乎只认为有在我的套房一测试时,有超过五十人。难道真的结块单个DLL所有的测试到一个庞大的考验吗?有没有一种方法,我可以将它们分离出来,单独运行测试用例?

I thought that setting up a NameFilter would do the trick, but the RemoteTestRunner only seems to think that there's one test in my suite when there are over fifty. Is it really lumping all tests in a single DLL into one gargantuan test? Is there a way that I can separate them out and run individual test cases?

推荐答案

我不得不使用SimpleNameFilter,并传递给它的构造单元测试我想跑的名称。下面是我有:

I had to use a SimpleNameFilter and pass to its constructor the name of the unit test I wanted to run. Here's what I have:

SimpleNameFilter filter = new SimpleNameFilter("Google.Maps.Test.Integrations.GeocodingServiceTests.Empty_address");
TestResult testResult = remoteTestRunner.Run(new NullListener(), filter, false, LoggingThreshold.Error);

您可以通过两种完全合格的测试名称从测试本身或通过寻找计算出来在NUnit的程序测试的属性。

You can get the fully-qualified test name by either figuring it out from the test itself or by looking at your test's Properties in the NUnit program.

这篇关于运行NUnit的个人编程测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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