<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Geir-Tore Lindsve &#187; tfs</title>
	<atom:link href="http://lindsve.net/tag/tfs/feed/" rel="self" type="application/rss+xml" />
	<link>http://lindsve.net</link>
	<description>Ramblings of a .NET developer</description>
	<lastBuildDate>Mon, 21 Jun 2010 19:24:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>TargetProcess now integrates with TFS</title>
		<link>http://lindsve.net/2009/08/25/targetprocess-now-integrates-with-tfs/</link>
		<comments>http://lindsve.net/2009/08/25/targetprocess-now-integrates-with-tfs/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 07:39:52 +0000</pubDate>
		<dc:creator>Geir-Tore</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[TargetProcess]]></category>
		<category><![CDATA[tfs]]></category>

		<guid isPermaLink="false">http://lindsve.net/2009/08/targetprocess-now-integrates-with-tfs/</guid>
		<description><![CDATA[Just wanted to post that TargetProcess now finally integrates with TFS source control management! I can now check in my changes to TFS and update my User Stories/Tasks in TargetProcess from the checkin comments, like: #1234 time:0.5 state:done comment:Foobar! This &#8230; <a href="http://lindsve.net/2009/08/25/targetprocess-now-integrates-with-tfs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just wanted to post that <a href="http://targetprocess.com/">TargetProcess</a> now finally integrates with TFS source control management! I can now check in my changes to TFS and update my User Stories/Tasks in TargetProcess from the checkin comments, like:</p>
<blockquote><p>#1234 time:0.5 state:done comment:Foobar!</p>
</blockquote>
<p>This is a huge, time saving WIN(!), since I don’t have to navigate within TargetProcess just for updating a task with time/state/++.</p>
<p>More details can be found in the <a href="http://targetprocess.com/support/Documentation.aspx">documentation for integrating with TFS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://lindsve.net/2009/08/25/targetprocess-now-integrates-with-tfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating NUnit test result in the TFS Data Warehouse</title>
		<link>http://lindsve.net/2009/01/20/integrating-nunit-test-result-in-the-tfs-data-warehouse/</link>
		<comments>http://lindsve.net/2009/01/20/integrating-nunit-test-result-in-the-tfs-data-warehouse/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 14:37:58 +0000</pubDate>
		<dc:creator>Geir-Tore</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mbunit]]></category>
		<category><![CDATA[nunit]]></category>
		<category><![CDATA[tfs]]></category>
		<category><![CDATA[unittesting]]></category>

		<guid isPermaLink="false">http://lindsve.net/?p=147</guid>
		<description><![CDATA[Team Foundation Server has a great story when it comes to integrating several development practices into a single data warehouse for running reports on, and out of the box (at least) the Developer and Test editions of Visual Studio integrates &#8230; <a href="http://lindsve.net/2009/01/20/integrating-nunit-test-result-in-the-tfs-data-warehouse/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Team_Foundation_Server" target="_blank">Team Foundation Server</a> has a great story when it comes to integrating several development practices into a single data warehouse for running reports on, and out of the box (at least) the Developer and Test editions of Visual Studio integrates into this warehouse with MS’s own unit testing framework, <a href="http://en.wikipedia.org/wiki/MSTest" target="_blank">MSTest</a>.</p>
<p>We played around a bit with MSTest a while ago in a couple of projects I’m on at work, but came to the conclusion that it fell short of <a href="http://www.mbunit.com/" target="_blank">MbUnit</a> which provides a much better story when it comes with integrating with other test runner tools (<a href="http://testdriven.net/" target="_blank">TestDriven.Net</a> / <a href="http://www.jetbrains.com/resharper/" target="_blank">ReSharper</a>) which I think is far superior to the one in Visual Studio and also has a larger arsenal of extensions and out-of-the-box asserts.</p>
<p>During the time we have been using MbUnit we have always been using the HTML reports which MbUnit provides and adding a link to this report in the build report provided by Team Build. The ability to have the test results in TFS have been something we have wanted the whole time though, and lately I found a project called <a href="http://www.codeplex.com/nunit4teambuild" target="_blank">NUnit for Team Build</a> on <a href="http://www.codeplex.com/" target="_blank">CodePlex</a>. This triggered me to try <a href="http://www.nunit.org/index.php" target="_blank">NUnit</a> with a subset of our tests to try to get this thing running and this solution provides exactly what we have wanted.</p>
<p>There wasn’t much hassle getting the unit tests converted from MbUnit to NUnit, as it mostly consisted of replacing the using statements to point to NUnit.Framework instead of MbUnit.Framework and then rename/edit some of the asserts.</p>
<p> <span id="more-147"></span>
</p>
<h1></h1>
<h3>What to do</h3>
<p>NUnit for Team Build doesn’t perform any kind of voodoo magic here. The main idea of this project is to simply use XSLT to transform the XML test results from NUnit to the XML format which MSTest generates and then trigger the MSTest executable to publish these results to TFS. What NUnit for Team Build provides is the XSLT document to be used for the transformation, and as such it should be feasible to create your own XSLT document to enable other unit testing frameworks to publish their results to TFS.</p>
<p>The actions necessary to set this up in Team Build is already described on the project site for NUnit for Team Build so I don’t want to repeat that here, but you can find it <a href="http://www.codeplex.com/nunit4teambuild/Wiki/View.aspx?title=sample%20script&amp;referringTitle=Home" target="_blank">here</a>.</p>
<p>I did have to alter their XSLT document a bit to make it work though. Specifically:</p>
<ol>
<li>Had to modify the transformation of the paths to the test assemblies </li>
<li>The error message NUnit adds when expected values does not match contains a line break so the expected value and real value is displayed on separate lines. I wanted them on a single line so that error messages for these cases where displayed on a single line which fits the report view in Visual Studio better. </li>
<li>Had to add a error message if tests are not executed for some reason (we had some tests which for some reason where inside private text fixtures, which caused them to not be executed) </li>
<li>Added support for the description attribute so that test descriptions are included in the TFS results </li>
</ol>
<p>The first item was easy enough. I just compared where the XSLT document expected to find items inside the NUnit XML files and modified them.</p>
<p>For the error messages modifications I looked in the &lt;Output&gt; element in the XSLT document. The original transformation is like this:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">xsl:for-each</span> <span class="attr">select</span><span class="kwrd">=&quot;./failure&quot;</span><span class="kwrd">&gt;</span></pre>
<pre class="csharpcode"><span class="kwrd">    </span><span class="kwrd">&lt;</span><span class="html">ErrorInfo</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Message</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">xsl:value-of</span> <span class="attr">select</span><span class="kwrd">=&quot;./message&quot;</span><span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">Message</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">StackTrace</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">xsl:value-of</span> <span class="attr">select</span><span class="kwrd">=&quot;./stack-trace&quot;</span><span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">StackTrace</span><span class="kwrd">&gt;</span>
<span class="kwrd">    &lt;/</span><span class="html">ErrorInfo</span><span class="kwrd">&gt;</span></pre>
<pre class="csharpcode"><span class="kwrd">&lt;/</span><span class="html">xsl:for-each</span><span class="kwrd">&gt;</span></pre>
<p>
  </p>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>I added a simple conditional test on the message and if it contains the text ‘Expected’, then simply remove line breaks in the message:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">xsl:for-each</span> <span class="attr">select</span><span class="kwrd">=&quot;./failure&quot;</span><span class="kwrd">&gt;</span></pre>
<pre class="csharpcode"><span class="kwrd">    </span><span class="kwrd">&lt;</span><span class="html">ErrorInfo</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Message</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">xsl:choose</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">xsl:when</span> <span class="attr">test</span><span class="kwrd">=&quot;contains(./message, 'Expected')&quot;</span><span class="kwrd">&gt;</span>
                    <span class="kwrd">&lt;</span><span class="html">xsl:value-of</span> <span class="attr">select</span><span class="kwrd">=&quot;translate(./message, '&amp;#xA;', '')&quot;</span><span class="kwrd">/&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">xsl:when</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">xsl:otherwise</span><span class="kwrd">&gt;</span>
                    <span class="kwrd">&lt;</span><span class="html">xsl:value-of</span> <span class="attr">select</span><span class="kwrd">=&quot;./message&quot;</span><span class="kwrd">/&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">xsl:otherwise</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">xsl:choose</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">Message</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">StackTrace</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">xsl:value-of</span> <span class="attr">select</span><span class="kwrd">=&quot;./stack-trace&quot;</span><span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">StackTrace</span><span class="kwrd">&gt;</span>
<span class="kwrd">    &lt;/</span><span class="html">ErrorInfo</span><span class="kwrd">&gt;</span></pre>
<pre class="csharpcode"><span class="kwrd">&lt;/</span><span class="html">xsl:for-each</span><span class="kwrd">&gt;</span></pre>
<p>
  </p>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Adding an error message for not executed tests where also pretty trivial. I added the following inside the same &lt;Output&gt; element, below the above failure message handling:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">xsl:for-each</span> <span class="attr">select</span><span class="kwrd">=&quot;./reason&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">ErrorInfo</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Message</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">xsl:value-of</span> <span class="attr">select</span><span class="kwrd">=&quot;translate(./message, '&amp;#xA;', '')&quot;</span><span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">Message</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">StackTrace</span><span class="kwrd">&gt;&lt;/</span><span class="html">StackTrace</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">ErrorInfo</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">xsl:for-each</span><span class="kwrd">&gt;</span></pre>
<p><span class="kwrd">My last modification is that I added support for the description field. This was done by adding the following inside the &lt;UnitTest&gt; element, just before the &lt;Css&gt; element:</span></p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Description</span><span class="kwrd">&gt;&lt;</span><span class="html">xsl:value-of</span> <span class="attr">select</span><span class="kwrd">=&quot;@description&quot;</span><span class="kwrd">/&gt;&lt;/</span><span class="html">Description</span><span class="kwrd">&gt;</span></pre>
<h3>Some afterthoughts</h3>
<p><span class="kwrd">There is a couple of things which I still want to update in the XSLT document though, but which I haven’t had time to look at yet:</span></p>
<ol>
<li><span class="kwrd"></span><span class="kwrd">The Test Results window in Visual Studio does not contain any information in the Project column in the test lists. This won’t be a problem as long as all tests is inside the same assembly, but if you have tests in multiple assemblies, then it would be nice to see where tests are located in this view.</span> </li>
<li><span class="kwrd">All dates and time data is hardcoded in the XSLT document and the transformation of the duration times seems to be weak. I would like to add some better transforms for this, but this is also something which I haven’t got to yet.</span> </li>
</ol>
<p><span class="kwrd">If anyone have some ideas for handling these two issues, then I would love to see them.</span></p>
<p><span class="kwrd">Note: I have also seen some references to <a href="http://www.codeplex.com/NUnitForVS" target="_blank">NUnitForVS</a>, where NUnit tests are executed by the test runner in Visual Studio:</span></p>
<blockquote>
<p>This add-in for Visual Studio Team System will allow you to run NUnit tests just like Visual Studio Unit tests integrated in Visual Studio. It makes Visual Studio to see NUnit test as mstest. That means everything you can do with Visual Studio Unit tests you can also do with NUnit tests. For example publishing of results in TFS or code coverage.</p>
</blockquote>
<p>This should be a better solution than the one I have described in this post, simply because it adds code coverage too. I plan to take a look at this one in the near future, but if anyone already has done so and has some feedback, please add them in the comments <img src='http://lindsve.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://lindsve.net/2009/01/20/integrating-nunit-test-result-in-the-tfs-data-warehouse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
