This page last changed on Jul 12, 2005 by jflowers.
Summary

Add warning in your tests to highlight problems in the report.

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");        
         }    
     }
 }
Document generated by Confluence on Jun 11, 2007 11:56