我正在尝试在MbUnit中使用DynamicTestFactory来动态生成测试套件和测试用例。我也有自己的TestLauncher来从控制台启动我的测试。
一切似乎都很好,但我在做任何断言时都遇到了问题。例如,如果我在检查变量为null时尝试执行Assert.Fail,我的控制台程序会立即断开,如下所示:
at Gallio.Framework.Assertions.AssertionContext.Scope.ThrowFailureAccordingToBehavior(AssertionFailure failure)
at Gallio.Framework.Assertions.AssertionContext.Scope.SubmitFailure(AssertionFailure failure, Boolean noThrow)
at Gallio.Framework.Assertions.AssertionContext.Scope.SubmitFailure(AssertionFailure failure)
at Gallio.Framework.Assertions.AssertionContext.SubmitFailure(AssertionFailure failure)
at Gallio.Framework.Assertions.AssertionHelper.Fail(AssertionFailure failure)
at MbUnit.Framework.Assert.Fail(String messageFormat, Object[] messageArgs)
at Dundas.Dashboard.TestSystem.TestPrograms.DashboardImageCompare.<>c__DisplayClass6.<CreateTestSuiteByDataStore>b__1() in C:\...\test.cs:line 115
at MbUnit.Framework.TestCase.OnExecuteSelf()
at MbUnit.Framework.TestDefinition.<>c__DisplayClass9.<RunDynamicTest>b__8()
at Gallio.Common.Concurrency.ThreadAbortScope.Run(Action action)
at Gallio.Framework.Sandbox.Run(MarkupDocumentWriter markupDocumentWriter, Action action, String description)
Gallio不应该捕获与断言相关的所有异常吗?我该如何解决这个问题呢?
答案 0 :(得分:1)