我正在尝试NUnit
使用RemoteTestRunner
. 我们的一些测试从app.config
(VS 2010 变成MyTestPackage.dll.config
)加载配置信息。我似乎无法RemoteTestRunner
加载这个配置文件(测试就像没有配置文件一样运行)。我尝试过设置和不设置package.ConfigurationFile
,以及有/没有package.BasePath
。任何帮助将非常感激。
public TestResult runTest(TestDefinition testDefinition)
{
NUnit.Core.CoreExtensions.Host.InitializeService();
RemoteTestRunner remoteTestRunner = new RemoteTestRunner();
TestPackage package = new TestPackage(@"C:\Test\MyTestPackage.dll");
package.ConfigurationFile = @"C:\Test\MyTestPackage.dll.config";
remoteTestRunner.Load(package);
TestResult testResult = remoteTestRunner.Run(new NullListener(), new TestNameFilter(testDefinition.TestName), false, LoggingThreshold.Error);
NUnit.Util.XmlResultWriter writer = new NUnit.Util.XmlResultWriter(@"C:\Temp\TestResult.xml");
writer.SaveTestResult(testResult);
return testResult;
}