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

Print | posted @ Tuesday, February 24, 2009 12:23 PM

Comments on this entry:

Gravatar # re: MS-Test DeploymentItem Attribute........Aaaaaaaagh!
by Mark Greene at 1/30/2009 6:36 PM

Hey Pete, your blog has lost it's skin.<br /><br />This is why we're using NUnit with the new stuff :)
Gravatar # re: MS-Test DeploymentItem Attribute........Aaaaaaaagh!
by Stefan Steinegger at 4/24/2009 12:45 AM

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:

Title:
Name:
Email:
Website:
 
Italic Underline Blockquote Hyperlink
 
 
Please add 1 and 1 and type the answer here: