<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Gotchas: MSTest&#8217;s [DeploymentItem] attribute</title>
	<atom:link href="http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/</link>
	<description>Thinking about agile (small 'a') software development, patterns and practices for building Microsoft .NET applications.</description>
	<lastBuildDate>Mon, 06 Sep 2010 05:05:31 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ade Miller</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-1615</link>
		<dc:creator>Ade Miller</dc:creator>
		<pubDate>Tue, 27 Jul 2010 02:41:28 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-1615</guid>
		<description>William,

Thanks... Definitely another gotcha. 

Ade</description>
		<content:encoded><![CDATA[<p>William,</p>
<p>Thanks&#8230; Definitely another gotcha. </p>
<p>Ade</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Garrison</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-1614</link>
		<dc:creator>William Garrison</dc:creator>
		<pubDate>Mon, 26 Jul 2010 16:28:16 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-1614</guid>
		<description>Another one for the list: Don&#039;t place special characters in your DeploymentItem.  If you do, Visual Studio will tell you t hat you did not put the [TestClass] attribute on your class.

Example:
[TestClass]
[DeploymentItem(&quot;MyFolder\MyTestFile.dat&quot;)]
public class MyTest
.
.
.

Did you see it?  The developer forgot the @ before the string!  So that \M produces a special ASCII character!

If you do this, you will get the following error on every method in the test class:
UTA004: Illegal use of attribute on methodname. The TestMethodAttribute can be defined only inside a class marked with the TestClass attribute.</description>
		<content:encoded><![CDATA[<p>Another one for the list: Don&#8217;t place special characters in your DeploymentItem.  If you do, Visual Studio will tell you t hat you did not put the [TestClass] attribute on your class.</p>
<p>Example:<br />
[TestClass]<br />
[DeploymentItem("MyFolder\MyTestFile.dat")]<br />
public class MyTest<br />
.<br />
.<br />
.</p>
<p>Did you see it?  The developer forgot the @ before the string!  So that \M produces a special ASCII character!</p>
<p>If you do this, you will get the following error on every method in the test class:<br />
UTA004: Illegal use of attribute on methodname. The TestMethodAttribute can be defined only inside a class marked with the TestClass attribute.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Visual Studio and MSTest: Deploying Files &#124; David&#39;s Technical Musings</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-1559</link>
		<dc:creator>Visual Studio and MSTest: Deploying Files &#124; David&#39;s Technical Musings</dc:creator>
		<pubDate>Wed, 02 Jun 2010 20:04:02 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-1559</guid>
		<description>[...] Miller wrote a good article on some of the gotchas of using the DeploymentItem attribute. The article is a good read and addresses handling deployment [...]</description>
		<content:encoded><![CDATA[<div style="border-left: #bce1f4 5px solid; padding-left: 1em;">
<p>[...] Miller wrote a good article on some of the gotchas of using the DeploymentItem attribute. The article is a good read and addresses handling deployment [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ade Miller</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-1394</link>
		<dc:creator>Ade Miller</dc:creator>
		<pubDate>Fri, 12 Feb 2010 23:38:26 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-1394</guid>
		<description>Gerry,

I think the order is based on how reflection returns the methods and classes. I never investigated this as I never rely on this - it&#039;s an anti-pattern to expect tests to run in the same order or rely on ordering.

Ade</description>
		<content:encoded><![CDATA[<p>Gerry,</p>
<p>I think the order is based on how reflection returns the methods and classes. I never investigated this as I never rely on this &#8211; it&#8217;s an anti-pattern to expect tests to run in the same order or rely on ordering.</p>
<p>Ade</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gerry lowry</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-1392</link>
		<dc:creator>gerry lowry</dc:creator>
		<pubDate>Fri, 12 Feb 2010 22:30:07 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-1392</guid>
		<description>Actually, it appears that test order is quite strange.  Example, I&#039;ve posted the following at stackoverflow:

 was looking at a legacy MSTest project. The tests were always running in the same order. The order was not alphabetic and was bouncing between methods in two *.cs TestMethod files.

I did not change the physical order of the legacy code. I did for my convenience append &quot;MSTest01&quot; to the method name of the first test, &quot;MSTest02&quot; to the method name of the second test, et cetera.

To my surprise, the execution order of the TestMethod functions changed; #3 first, #6 second, #5 third, et cetera.

When I removed the &quot;MSTestnn&quot; strings from the TestMethod function names, their execution order changed back to the previous ordering, i.e., one test from the first .cs file, two tests from the second .cs file, five tests from the first .cs file, et cetera.

It seems that file location may not be a factor while TestMethod function name may be a factor.

http://stackoverflow.com/questions/2255284/how-does-mstest-determine-the-order-in-which-to-run-test-methods

[P.S.:  I appreciate you sharing your MSTest tips.  Have you looked at xUnit.net?]</description>
		<content:encoded><![CDATA[<p>Actually, it appears that test order is quite strange.  Example, I&#8217;ve posted the following at stackoverflow:</p>
<p> was looking at a legacy MSTest project. The tests were always running in the same order. The order was not alphabetic and was bouncing between methods in two *.cs TestMethod files.</p>
<p>I did not change the physical order of the legacy code. I did for my convenience append &#8220;MSTest01&#8243; to the method name of the first test, &#8220;MSTest02&#8243; to the method name of the second test, et cetera.</p>
<p>To my surprise, the execution order of the TestMethod functions changed; #3 first, #6 second, #5 third, et cetera.</p>
<p>When I removed the &#8220;MSTestnn&#8221; strings from the TestMethod function names, their execution order changed back to the previous ordering, i.e., one test from the first .cs file, two tests from the second .cs file, five tests from the first .cs file, et cetera.</p>
<p>It seems that file location may not be a factor while TestMethod function name may be a factor.</p>
<p><a href="http://stackoverflow.com/questions/2255284/how-does-mstest-determine-the-order-in-which-to-run-test-methods" rel="nofollow">http://stackoverflow.com/questions/2255284/how-does-mstest-determine-the-order-in-which-to-run-test-methods</a></p>
<p>[P.S.:  I appreciate you sharing your MSTest tips.  Have you looked at xUnit.net?]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ade Miller</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-774</link>
		<dc:creator>Ade Miller</dc:creator>
		<pubDate>Thu, 04 Jun 2009 14:52:36 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-774</guid>
		<description>Jared,

Process monitor is very noisy but the filter feature will let you cut down the output. I&#039;d try setting a filter on the Process Name to exclude everything but MSTEST.EXE.

Ade</description>
		<content:encoded><![CDATA[<p>Jared,</p>
<p>Process monitor is very noisy but the filter feature will let you cut down the output. I&#8217;d try setting a filter on the Process Name to exclude everything but MSTEST.EXE.</p>
<p>Ade</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jared</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-766</link>
		<dc:creator>Jared</dc:creator>
		<pubDate>Mon, 01 Jun 2009 19:24:19 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-766</guid>
		<description>Hi Ade,

I&#039;ve gotten past the issue of #including &quot;afxwin.h&quot; and I can get the unit tests to run fine through the IDE. When I run it using mstest.exe though, the tests hang while loading the unit test DLL. I believe this is because it is missing a DeploymentItem, although there are no external files that the tests rely upon. 

This only starts to happen when I call AfxGetApp() and also AFX_MANAGE_STATE, of which I&#039;m not sure which one is causing the issue.

My guess is that it is looking for an MFC DLL. Is there any way that you can have mstest or another tool tell you what items it is looking for?

I have tried Process Monitor but there are so many calls it gets overwhelming trying to find the missing DLL.

Thanks in advance,
Jared</description>
		<content:encoded><![CDATA[<p>Hi Ade,</p>
<p>I&#8217;ve gotten past the issue of #including &#8220;afxwin.h&#8221; and I can get the unit tests to run fine through the IDE. When I run it using mstest.exe though, the tests hang while loading the unit test DLL. I believe this is because it is missing a DeploymentItem, although there are no external files that the tests rely upon. </p>
<p>This only starts to happen when I call AfxGetApp() and also AFX_MANAGE_STATE, of which I&#8217;m not sure which one is causing the issue.</p>
<p>My guess is that it is looking for an MFC DLL. Is there any way that you can have mstest or another tool tell you what items it is looking for?</p>
<p>I have tried Process Monitor but there are so many calls it gets overwhelming trying to find the missing DLL.</p>
<p>Thanks in advance,<br />
Jared</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ade Miller</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-675</link>
		<dc:creator>Ade Miller</dc:creator>
		<pubDate>Mon, 04 May 2009 16:52:57 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-675</guid>
		<description>Jared,

MSTest creates a TRX file. This is unfortunately in a proprietary format although you can convert it with &lt;a href=&quot;http://preetsangha.blogspot.com/2008/05/decoding-ms-test-trx-file.html&quot; rel=&quot;nofollow&quot;&gt;this tool&lt;/a&gt;.

The hang when including afxwin.h might be due to the not being able to load another dependent library. I&#039;ve seen similar behavior with WinSxS and OpenMP libraries (see &lt;a href=&quot;http://www.ademiller.com/blogs/tech/2009/05/gotchas-getting-c-projects-building-on-a-ci-server/&quot; rel=&quot;nofollow&quot;&gt;this post&lt;/a&gt;). I see you posted on &lt;a href=&quot;http://stackoverflow.com/questions/813358/using-mstest-with-mfc&quot; rel=&quot;nofollow&quot;&gt;stack overflow&lt;/a&gt;, which is probably a better place to get an answer for this. SxS load errors appear in the event log so that&#039;s a good place to look to see what&#039;s wrong also.

Ade</description>
		<content:encoded><![CDATA[<p>Jared,</p>
<p>MSTest creates a TRX file. This is unfortunately in a proprietary format although you can convert it with <a href="http://preetsangha.blogspot.com/2008/05/decoding-ms-test-trx-file.html" rel="nofollow">this tool</a>.</p>
<p>The hang when including afxwin.h might be due to the not being able to load another dependent library. I&#8217;ve seen similar behavior with WinSxS and OpenMP libraries (see <a href="http://www.ademiller.com/blogs/tech/2009/05/gotchas-getting-c-projects-building-on-a-ci-server/" rel="nofollow">this post</a>). I see you posted on <a href="http://stackoverflow.com/questions/813358/using-mstest-with-mfc" rel="nofollow">stack overflow</a>, which is probably a better place to get an answer for this. SxS load errors appear in the event log so that&#8217;s a good place to look to see what&#8217;s wrong also.</p>
<p>Ade</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jared</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-674</link>
		<dc:creator>Jared</dc:creator>
		<pubDate>Mon, 04 May 2009 13:45:57 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-674</guid>
		<description>Where is the MSTest log file located? I can&#039;t seem to find it within my solution. 

I&#039;m having a problem when I #include &quot;afxwin.h&quot;. The solution builds and then when it gets to running the tests, the first test will hang and no other tests will run. If I comment out the #include, then the tests will run fine.

My compiler options are /clr, /mTd and I&#039;m compiling to an MFC shared dll.</description>
		<content:encoded><![CDATA[<p>Where is the MSTest log file located? I can&#8217;t seem to find it within my solution. </p>
<p>I&#8217;m having a problem when I #include &#8220;afxwin.h&#8221;. The solution builds and then when it gets to running the tests, the first test will hang and no other tests will run. If I comment out the #include, then the tests will run fine.</p>
<p>My compiler options are /clr, /mTd and I&#8217;m compiling to an MFC shared dll.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: #2872 &#187; Blog Archive &#187; xUnit.net runs tests in random order</title>
		<link>http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/comment-page-1/#comment-79</link>
		<dc:creator>#2872 &#187; Blog Archive &#187; xUnit.net runs tests in random order</dc:creator>
		<pubDate>Tue, 06 Nov 2007 23:06:54 +0000</pubDate>
		<guid isPermaLink="false">http://ademiller.com/blogs/tech/?p=92#comment-79</guid>
		<description>[...] I was testing the behavior of MSTest&#8217;s DeploymentItem attribute I relied on fact that MSTest executes tests in a predictable order to figure out how the attribute [...]</description>
		<content:encoded><![CDATA[<div style="border-left: #bce1f4 5px solid; padding-left: 1em;">
<p>[...] I was testing the behavior of MSTest&#8217;s DeploymentItem attribute I relied on fact that MSTest executes tests in a predictable order to figure out how the attribute [...]</p>
</div>
]]></content:encoded>
	</item>
</channel>
</rss>
