TestFixtureSetUp and TestFixtureTearDown
MbUnit now supports TestFixtureSetUp and TestFixtuteTearDown attribute to mark methods to be executed at the beginning of a fixture test case execution and at the end.
[TestFixture] public class Fixture { [TestFixtureSetUp] public void TestFixtureSetUp() {...} ... [TestFixturteTearDown] public void TestFixtureTearDown() {...} }
AssemblyCleanUp, SetUp and TearDown
MbUnit also support test assembly setup and teardown. Those methods should be enclosed in a class that is feeded to the AssemblyCleanUpAttribute (Assembly attribute, thanks Omer), They must be public and static. The setup method must be tagged with SetUpAttribute, and the teardown method with TearDownAttribute:
[assembly: AssemblyCleanUp(typeof(AssemblyCleaner))] ... public class AssemblyCleaner { [SetUp] public static void SetUp() { Console.WriteLine("Setting up {0}", typeof(AssemblyCleanUp).Assembly.FullName); } [TearDown] public static void TearDown() { Console.WriteLine("Cleaning up {0}", typeof(AssemblyCleanUp).Assembly.FullName); } }
Page rendered at Thursday, September 02, 2010 3:19:58 PM (Pacific Daylight Time, UTC-07:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.