【发布时间】:2019-03-04 17:42:57
【问题描述】:
我的设置
CoreExtensions.Host.InitializeService();
package = new TestPackage(pathToTestDll);
builder = new TestSuiteBuilder();
suite = builder.Build(package);
并运行(注意测试是从套件中检索到的 NUnitTestMethods 的有效列表
foreach (NUnitTestMethod t in tests)
{
try
{
var res = t.RunTest();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
我把它当作异常堆栈:
在 System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target) 在 System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfoculture) 在 System.Reflection.RuntimeMethodInfo.Invoke( System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) 在 NUnit.Core.Reflect.InvokeMethod(MethodInfo method, Object fixture, Object [] args) 在 NUnit.Core.TestMethod.RunTestMethod() 在 NUnit.Core.TestMethod.RunTestCase(TestResult testResult)
注意 t.RunTest();不会失败,而是测试只是在运行时失败并且设置了 HasError 标志...
我的测试包和运行器包中的 nunit.core 和 nunit.core.interfaces 是相同的文件
【问题讨论】: