A quick breakdown of the Team Test attributes compared to NUnit attributes with a few examples.
All Team Test attributes are found in the following namespace:Microsoft.VisualStudio.QualityTools.UnitTesting.Framework
Attribute Quick List
AssemblyInitalize and AssemblyCleanup are new. There are no equivalent attributes in NUnit. These attributes run at AppDomain load and dispose.
[ AssemblyInitialize ]public static void AssemblyInitialize(){ }[ AssemblyCleanup ]public static void AssemblyCleanup(){ }
Acting just like the NUnit TestFixtureSetUp and TestFixtureTearDown with the only one minor difference. Both methods have to be static and the ClassInitialize takes in one parameter. ClassInitialize will execute before any TestInitialize and TestMethod after the AssemblyInitialize while ClassCleanup executes after the TestMethod and TestCleanup but before the AssemblyCleanup.
[ ClassInitialize ]public static void ClassInitialize(TestContext t){ }[ ClassCleanup ]public static void ClassCleanup(){ }
TestInitialize executes before each test and TestCleanup executes after each test for every TestMethod.
[ TestInitialize ]public void TestInitalize(){ }[ TestCleanup ]public void TestCleanup(){ }
Powered by: newtelligence dasBlog 2.3.9074.18820
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
E-mail
Theme design by Jelle Druyts