如何以编程方式确定要在NUnit中运行的测试?即
CoreExtensions.Host.InitializeService();
TestPackage testPackage = new TestPackage(pathToSomeDLL);
// filter by category here??
SimpleTestRunner simpleTestRunner = new SimpleTestRunner();
// or here?
simpleTestRunner.Load(testPackage);
//... maybe here?
testResult = simpleTestRunner.Run(NullListener.NULL);
最佳答案
您可以像这样向SimpleTestRunner
的Run
方法提供其他参数:
var filter = new CategoryFilter("MyCategory");
simpleTestRunner.Run(NullListener.NULL, filter, false, LoggingThreshold.Off);