Running individual NUnit tests programmatically

前端 未结 2 1790
渐次进展
渐次进展 2021-02-09 23:10

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

2条回答
  •  悲&欢浪女
    2021-02-09 23:38

    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);
    

    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.

提交回复
热议问题