Monday, October 04, 2004

Sometimes, a unit test does not fail but does not succeed entirely: making it fail is too extreme and on the other hand, letting him succeed would make you miss the issue. Therefore, MbUnit now supports warnings:

  • A warning can be emited in any test case using Assert.Warning methods,
  • A warning does not make test fail,
  • Warnings are recorded in the test report (in the Html report, they are displayed right after the fixture summary),
  • Multiple warnings can be outputed per test

QuickStart

This fixture shows 2 tests with warnings:

using System;

using MbUnit.Core.Framework;

using MbUnit.Framework;

namespace MbUnit.Demo

{

[TestFixture]

public class WarningTest

{

[Test]

public void Warning()

{

Assert.Warning("Be wary");

}

[Test]

public void Warning2()

{

Assert.Warning("Something weird happened");

}

}

}

The corresponding html report looks like this:

posted on Tuesday, October 05, 2004 12:42:00 AM UTC  #    Comments [3]
Tracked by:
"liguria it" (online) [Trackback]
"gilligan island" (online) [Trackback]
Monday, June 06, 2005 5:24:29 PM UTC
Is this functionality available in build <a title="TestDriven.NET" href="http://www.testdriven.net" target="_blank">TestDriven.NET</a>-0.9.670-RC1.msi?
serdnago
Monday, June 06, 2005 5:24:29 PM UTC
Sorry forgot to mention that. It is available in build <a title="TestDriven.NET" href="http://www.testdriven.net" target="_blank">TestDriven.NET</a>-1.0.738d.msi (see AutomatedBuilds page)
Jonathan de Halleux
Monday, June 06, 2005 5:24:29 PM UTC
Wow, superb!
<br>Thanks.
Diana
Comments are closed.