I have unit test project called “MyClassTest” in TeamTest. This project has three TestMethods. Each method needs its own test initialization steps. But when I apply TestInitializeAttribute to three initialization methods, it says the attribute should not be used more than once. Then what should be the attribute to be used to initialize each test method in Visual Studio Team Test?
Reference:
According to MSDN the
TestInitializeAttribute:TestInitializeAttribute.So, my suggestion is to create the Test Initialize Methods without the
TestInitializeattribute. Then in the uniqueTestInitializemethod check which is the current executedTestMethodand call the appropriate initialize method: