MS-Test DeploymentItem Attribute........Aaaaaaaagh!

We have a policy of using MS-Test, although that is overdue for a serious review.

So it turns out you can use the deployment item attribute....

[TestMethod]

[DeploymentItem("UnitTest.MyProject.TestData.xml")]

public void GetAllStatuses() {...}

....As long as you don’t provide a constant...

public const string XMLCONFIGFILE = "UnitTest.MyProject.TestData.xml";

[TestMethod]

[DeploymentItem(TestHelper.XMLCONFIGFILE)]

public void GetAllStatuses() {...}

It just ignores it.....Genius! Now my tests have to be littered with this string literal.

Makes you wonder how they are implementing this stuff.

Pete

posted @ Thursday, January 22, 2009 1:05 PM

Print

Comments on this entry:

# re: MS-Test DeploymentItem Attribute........Aaaaaaaagh!

Left by Mark Greene at 1/30/2009 6:36 PM
Gravatar
Hey Pete, your blog has lost it's skin.

This is why we're using NUnit with the new stuff :)

# re: MS-Test DeploymentItem Attribute........Aaaaaaaagh!

Left by Stefan Steinegger at 4/24/2009 1:45 AM
Gravatar
Yes, just had the same. DeploymentItems are really unpredictable. Sometimes they are derived from baseclasses, sometime you need to redeclare them. It's just a mess.

Your comment:



 (will not be displayed)


 
 
 
Please add 4 and 2 and type the answer here:
 

Live Comment Preview: