Question

I am trying to use DynamicTestFactory in MbUnit to generate test suites and test cases on the fly. I also have my own TestLauncher to launch my test from console.

Everything seems good but I am having a problem doing any kind of assertion. For example, if I try to do Assert.Fail when I check that a variable is null, my console program breaks at that point immediately with something like the following:

   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)

Shouldn't Gallio capture all the exceptions which are related to assertions for me? How should I go around this?

Was it helpful?

Solution

I was being dumb. It's just because I am running in debug mode. If I switch to release (or invoke the method using reflection), it won't break at failed assertion like before.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top