<?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>nunit &#8211; Gigpeppers</title>
	<atom:link href="https://www.gigpeppers.com/tag/nunit/feed" rel="self" type="application/rss+xml" />
	<link>https://www.gigpeppers.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Fri, 01 May 2009 15:35:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>
	<item>
		<title>Integrating NCover 1.5 with Nant builds</title>
		<link>https://www.gigpeppers.com/integrating-ncover-15-with-nant-builds/</link>
					<comments>https://www.gigpeppers.com/integrating-ncover-15-with-nant-builds/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 01 May 2009 15:35:49 +0000</pubDate>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[nant]]></category>
		<category><![CDATA[Ncover]]></category>
		<category><![CDATA[nunit]]></category>
		<guid isPermaLink="false">https://www.gigpeppers.com/blog/?p=38</guid>

					<description><![CDATA[Getting NCover to work with nant builds was more messy than I assumed. What&#8217;s more appalling about all this is that programmers new to NCover download it from the default NCover landing page, only to find that its a paid version(3)(version 1.5 is sufficient for most use cases and serves most of the purposes.) Another [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Getting <a href="http://www.ncover.com/" target="_blank">NCover</a> to work with nant builds was more messy than I assumed. What&#8217;s more appalling about all this is that programmers new to NCover download it from the default NCover landing page, only to find that its a paid version(3)(version 1.5 is sufficient for most use cases and serves most of the purposes.)</p>
<p>Another concern was that most of the the ncover tutorials on the web showed how to test a single unit test assembly even though ncover comes with a <a href="http://www.kiwidude.com/dotnet/doc/NCoverExplorer.NAntTasks/tasks/nunitproject.html" target="_blank">nunitproject</a> nant task to pick out multiple test files(which is the highway case).</p>
<p>Without much further ado, here’s what I did</p>
<p>Download version <a href="http://jabr.googlecode.com/files/NCover-1.5.8.zip" target="_blank">1.5.8 of NCover</a>, v <a href="http://www.kiwidude.com/dotnet/NCoverExplorer-1.4.0.7.zip" target="_blank">1.4 of NCover Explorer</a> and v <a title="NCover Extras" href="http://www.kiwidude.com/dotnet/NCoverExplorer.Extras-1.4.0.5.zip" target="_blank">1.4 of NCover Extras</a></p>
<p>NCover Extras encapsulates the functionalities provided by NCover as a set of nant tasks. This needs to be loaded.Also CoverLib.dll that comes with NCover needs to be registered.</p>
<div style="font-size: 8pt; margin: 20px 0px 10px; overflow: auto; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border: gray 1px solid; padding: 4px;">
<div style="font-size: 8pt; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">&lt;loadtasks assembly=<span style="color: #006080;">"${ncover.nant.task.dir}NCoverExplorer.NAntTasks.dll"</span>/&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">&lt;exec program=<span style="color: #006080;">"regsvr32"</span> workingdir=<span style="color: #006080;">"${ncover.dir}"</span> commandline=<span style="color: #006080;">"/s coverlib.dll"</span>/&gt;</pre>
</div>
</div>
<p>Add these lines before the target is called.</p>
<p>Now for the actual task…</p>
<div style="font-size: 8pt; margin: 20px 0px 10px; overflow: auto; width: 98.32%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; height: 295px; background-color: #f4f4f4; border: gray 1px solid; padding: 4px;">
<div style="font-size: 8pt; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">&lt;target name=<span style="color: #006080;">"coverage"</span>&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">  &lt;nunitproject project=<span style="color: #006080;">"${output.dir}tests.nunit"</span>&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    &lt;fileset basedir=<span style="color: #006080;">"${output.dir}"</span>&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">        &lt;include name=<span style="color: #006080;">"*.*Test*.dll"</span> /&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">      &lt;/fileset&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">  &lt;/nunitproject&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">  &lt;ncover</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    program=<span style="color: #006080;">"${ncover.dir}NCover.Console.exe"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    commandLineExe=<span style="color: #006080;">"${nunitconsoleexe.dir}nunit-console-x86.exe"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    logLevel=<span style="color: #006080;">"Verbose"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    commandLineArgs=<span style="color: #006080;">"${output.dir}tests.nunit /nodots /nologo"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    verbose=<span style="color: #006080;">"true"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    logFile=<span style="color: #006080;">"${coverage.reports.dir}/coverage.log"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    workingDirectory=<span style="color: #006080;">"${output.dir}"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    coverageFile=<span style="color: #006080;">"${coverage.reports.dir}Unit.Test.Coverage.xml"</span>&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    &lt;assemblies basedir=<span style="color: #006080;">"${output.dir}"</span>&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">      &lt;include name=<span style="color: #006080;">"CompanyName*.dll"</span> /&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">      &lt;exclude name=<span style="color: #006080;">"*.*Test*.dll"</span> /&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    &lt;/assemblies&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">  &lt;/ncover&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">  &lt;ncoverexplorer</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    program=<span style="color: #006080;">"${ncoverexplorer.dir}NCoverExplorer.Console.exe"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    projectName=<span style="color: #006080;">"ProjectName"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    reportType=<span style="color: #006080;">"ModuleClassFunctionSummary"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    outputDir=<span style="color: #006080;">"${coverage.reports.dir}"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    xmlReportName=<span style="color: #006080;">"TestCoverage.xml"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    sort=<span style="color: #006080;">"FunctionCoverageDescending"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    htmlReportName=<span style="color: #006080;">"TestCoverage.html"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    showExcluded=<span style="color: #006080;">"True"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    minimumCoverage=<span style="color: #006080;">"80"</span></pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    satisfactoryCoverage=<span style="color: #006080;">"80"</span> &gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    &lt;fileset&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">      &lt;include name=<span style="color: #006080;">"${coverage.reports.dir}Unit.Test.Coverage.xml"</span> /&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    &lt;/fileset&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">    &lt;exclusions&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">      &lt;exclusion type=<span style="color: #006080;">"Assembly"</span> pattern=<span style="color: #006080;">"*.Tests"</span> /&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">      &lt;exclusion type=<span style="color: #006080;">"Namespace"</span> pattern=<span style="color: #006080;">"*.Tests*"</span> /&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">    &lt;/exclusions&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white; border-style: none; padding: 0px;">  &lt;/ncoverexplorer&gt;</pre>
<p> </p>
<pre style="font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; border-style: none; padding: 0px;">&lt;/target&gt;</pre>
</div>
</div>
<p>The node with the nunitproject picks all the test dll’s from the output directory and builds a tests.nunit project file. This will be the input to <a href="http://www.nunit.org/index.php" target="_blank">Nunit</a> which NCover will profile.</p>
<p>Digging into the NCover node you’ll see how NCover is being instructed to take pick the assemblies. If you are copying the code verbatim then change the assemblies node to pick your project dll’s and avoid test dll’s(By convention test assemblies are named ProjectName.Tests.dll). The output of this profiling task will be an xml file(Unit.Test.Coverage.xml in this case) which will be the input to NCoverExplorer, to get those fancy html outputs.</p>
<p>Here’s a typical NCover output xml..</p>
<p><a href="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image.png"><img fetchpriority="high" decoding="async" style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" title="image" src="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image_thumb.png" alt="image" width="644" height="191" align="left" border="0" /></a></p>
<p>The next node ncoverexplorer takes the xml files and builds a html output. Something similar to what&#8217;s shown below. Additionally the attribute <a href="http://www.kiwidude.com/dotnet/doc/NCoverExplorer.NAntTasks/tasks/ncoverexplorer.html" target="_blank">failMinimum</a>(not shown in this case) will fail the build if coverage doesn&#8217;t meet the coverage percentage specified.</p>
<p>Here’s a sample output.</p>
<p><a href="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image_3.png"><img decoding="async" style="display: inline; border-width: 0px;" title="image" src="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image_thumb_3.png" alt="image" width="644" height="183" border="0" /></a></p>
<p>One little quirk I encountered here was using nunit-console.exe instead of nunit-console-x86.exe. My 64 bit Server 2008 build machine rejected the first executable outright since it ran as 64 bit.</p>
<p>What pissed me of in this exercise was the time it took to integrate a seemingly simple open source project. Pretty much the same experience I had dealing with DD-WRT firmware sources. Once the author/company decides to to release a higher version of the project as a paid version or to make money out of the project, they then obfuscate source paths or put in obstacles that deter consumers from downloading those open source versions.</p>
<p>In case of the DD-WRT the source <a href="http://blog.motiwala.com/2008/05/29/tomato-is-in-goodbye-dd-wrt" target="_blank">was hidden inside GB’s of data</a> and in this case the official NCover website removed all the forums and added nag screens asking users to signup(given below) before downloading..</p>
<p><a href="http://www.ncover.com/login" target="_blank"><img decoding="async" class="alignleft" style="display: block; margin-left: auto; margin-right: auto; border-width: 0pt;" title="image" src="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image_4.png" alt="image" width="244" height="143" border="0" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gigpeppers.com/integrating-ncover-15-with-nant-builds/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
