I have a nunit class library containing test cases. I want to programmatically get a list of all the tests in the library, mainly the names of the tests and their test identifiers. Here is what I still have:
var runner = new NUnit.Core.RemoteTestRunner(); runner.Load(new NUnit.Core.TestPackage(Request.PhysicalApplicationPath + "bin\\SystemTest.dll")); var tests = new List<NUnit.Core.TestResult>(); foreach (NUnit.Core.TestResult result in runner.TestResult.Results) { tests.Add(result); }
The problem is that runner.TestResult is null until you start the tests. I obviously do not want to run the tests at the moment, I just want to get a list of tests that are in the library. After that, I will give users the opportunity to select a test and run it individually by passing the test ID to the RemoteTestRunner instance.
So, how can I get a list of tests without actually running all of them?
source share