<?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>Thunk it up</title>
	<atom:link href="http://www.thunkitup.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thunkitup.com</link>
	<description>intelligence shared</description>
	<lastBuildDate>Fri, 03 Sep 2010 15:49:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Adding Code Metrics To Your TeamCity Build</title>
		<link>http://www.thunkitup.com/2010/09/adding-code-metrics-to-your-teamcity-build/</link>
		<comments>http://www.thunkitup.com/2010/09/adding-code-metrics-to-your-teamcity-build/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 15:42:16 +0000</pubDate>
		<dc:creator>simon.crozier</dc:creator>
				<category><![CDATA[CODE]]></category>
		<category><![CDATA[TeamCity]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=281</guid>
		<description><![CDATA[Introduction In our last blog posts we&#8217;ve been looking at code coverage reports and how to improve code coverage. We&#8217;ve been doing on the assumption that fully tested code is good code. While that assumption is true to an extent it&#8217;s not the full picture. A 100% coverage score tell us that all the code [...]]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>In our last blog posts we&#8217;ve been looking at code coverage reports and how to improve code coverage. We&#8217;ve been doing on the assumption that fully tested code is good code. While that assumption is true to an extent it&#8217;s not the full picture. A 100% coverage score tell us that all the code is visited by at least test, even putting aside that the tests may be flawed or incomplete does this even ensure good quality code. Indeed what is good quality code ? Its more than possible to write a 100 line &#8220;God&#8221; method that just does everything using various control structures such as &#8220;if /else&#8221; and &#8220;for / do&#8221;. It&#8217;s entirely possible to make this code functionally correct then fully and properly test it giving it a 100%  coverage score . But that doesn&#8217;t get round the fact the code is difficult to understand and deal with thus making edits hard. Even if your test highlight inaccuracies and regression your not exactly helping the developer that has to work on the code after you.</p>
<h2>How &#8211; Code-Metrics</h2>
<p>This is where code-metrics step in, using certain key indicators we detect and track &#8220;code quality&#8221;.  Now I&#8217;m sure that will have raised a few eyebrows, how can you detect and track something so unquantifiable as quality if its not described purely by functional correctness. First of all this is not an exact science, these are indicators they highlight possible areas to look at they don&#8217;t define or guarantee quality. Secondly they&#8217;re not boolean, they don&#8217;t give you yes or no that&#8217;s good quality code, broadly speaking the metrics are calculated and then there is a recommended range that the value should fall in.</p>
<p>Now metrics are a funny game, they seem like a very coarse tool trying to give information on what appears to be  a very complex problem but choosing the right ones and interpreting correctly with reference to historic figures provides a surprisingly accurate &#8220;health check&#8221; of your code-base.</p>
<h2>What&#8217;s The Plan?</h2>
<p>Over the course of this post we&#8217;re going to look at using a freeware tool called SourceMonitor to  automatically build-up a code-base metrics report for each build triggered by TeamCity. Then in a very similar manner to our coverage reports we&#8217;re going to feed these metric valves back into TeamCity for evaluation. Later we&#8217;ll look at getting TeamCity graph each of these metrics allowing us a quick per build health check on the code base. Hopefully allowing us to target our &#8220;bad&#8221; on a per method basis and gradually improve our scores, overtime improving the code quality making it easier to understand and  simpler edited which has to be good for everyone.</p>
<p><span id="more-281"></span></p>
<h1>Which Metrics</h1>
<p>Okay so we said above that the choice of metrics is very important to the value of the suite so which metrics are we using, what do they measure and why.</p>
<p>Well in truth, in a effort to keep this post as simple as possible we&#8217;re just going to use the out of box metrics provided by SourceMonitor, but this isn&#8217;t a bad choice the metrics provided give a good a array of views. That said its still worth discussing theses metrics.</p>
<p>You&#8217;ll may being to notice a recurring theme here:</p>
<blockquote><p>Metrics aren&#8217;t answers but they prompt telling Questions, and in answering the question you will likely improve your system</p></blockquote>
<h3>Number of Lines</h3>
<p>Starting off with the simplest to understand, number of lines is just a count of how many of code (not including comments) you have in your code-base. Doesn&#8217;t sound like a metric ? Well actually it one of the most important, it not only gives a good idea of the size of the project it, looking at it historically shows you growth rate.</p>
<ul>
<li>If I saw number of line grows dramatically an one specific build I&#8217;d want to know what got checked in, depending on the size of the jump I may start to wonder if this new item wasn&#8217;t better suited to being a project of its own.</li>
<li>If I saw a large number of line I&#8217;d be paying a lot more attention to the other percentages becuase you immediately know you&#8217;re dealing with a much large project and the size of problem that can hide in a few % grows.</li>
</ul>
<blockquote><p>Lines Metric: the number of physical lines in a source file, or for a  checkpoint the total number of lines in all files in the checkpoint.</p></blockquote>
<h3>Method per Class</h3>
<p>As the name suggests this monitor an average how many methods each class has. An inflated figure here suggested you have too few objects in your solution and have had to overwork your objects to provide all the functionality you need.</p>
<p>If I saw  a high figure here this I would ask:</p>
<ul>
<li>Which objects/classes are pushing this figure up, are they doing too much?</li>
<li>Can I decompose this object into smaller objects?</li>
<li>Are there any service objects or helper object that I can create ?</li>
<li>Can I introduce an abstract object and share the general case of the same funcationlity moving it out of the class itself.</li>
</ul>
<p>If I saw a sudden and significant increase in this figure I&#8217;d be asking:</p>
<ul>
<li>What object is it that has changed, is it an addition, if its new has the objects role been thoroughly thought about should it actually be two or more different object?</li>
<li>If its an existing object, has it&#8217;s role changed significantly to justify the increase. Is this the right way to do or are we just pushing functionality on this object because its there rather than adding a new object.</li>
</ul>
<blockquote><p><span style="font-family: 'Arial'; font-weight: bold;">Statements per  Method:</span><span style="font-family: 'Arial';"> </span>The total number of  statements found inside of all methods found in a file or checkpoint divided by  the number of methods found in the file or checkpoint.</p>
<p><strong><span style="color: #339966;">Recommended Range = 2-22</span></strong></p></blockquote>
<h3>Statements per Method</h3>
<p>The total number of statements found inside of all methods found in a file or  checkpoint divided by the number of methods found in the file or checkpoint.</p>
<h3>Calls per  Method</h3>
<p><span style="font-family: 'Arial';"> </span>The total number of  calls to other methods found inside of all methods found in a file or checkpoint  divided by the number of methods found in the file or checkpoint.</p>
<h3>Cyclomatic complexity &#8211; Avg / Max</h3>
<p>A reasonably complicated this one so for a proper description i&#8217;ll refer you to the group&#8217;s knowledge, or <a title="Cyclomatic Complexity" href="http://en.wikipedia.org/wiki/Cyclomatic_complexity">WikiPedia as its otherwise known</a> (<a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity">http://en.wikipedia.org/wiki/Cyclomatic_complexity</a>)</p>
<p>This is a very interesting metric and is surprisingly efficient measure of quality. In our case we&#8217;ll be watching both the max and the average for the project. I tend to use the average when comparing two different projects, given its aggregated its less prone to fluctuations.</p>
<p>However; on  a per build basis I look at the maximum and watch for any changes. If i see a jump I&#8217;ll immediately investigate the most &#8220;complex&#8221; methods find out who coded them and try arrange to pair with them to get it lower. Whilst that sounds heavy handed at first it&#8217;s actually a very effect learning aid. For me pairing on boil plate code is a bit wasteful, a high complexity score indicates some fairly involved logic and these are the point where pairing can make a big difference both in terms of the eventual solution and seeing how the other pair approaches the same problem. I find these effective because the original developer has a clear understanding of the requirement so its not as artificial as text examples.</p>
<blockquote><p>The Average Complexity metric is a measure of the overall complexity measured  for each method (and, if present, each function) in a file or checkpoint. It is  computed as a simple arithmetic average of all complexity values measured for a  file or checkpoint. When the Modified Complexity option is enabled, average  complexity values are displayed with a trailing asterisk (example: 4.56*).</p></blockquote>
<blockquote><p><strong><span style="color: #339966;">Recommended Avg Range = 2 &lt;-&gt; 4</span></strong></p></blockquote>
<blockquote><p>Maximum Method  Complexity: This is the complexity value of the most complex method in a file.  (Note: when the Modified Complexity option is enabled, average complexity values  are displayed with a trailing asterisk. Example: &#8220;4.56*&#8221;.) The Project and  Checkpoint Views display only the method with maximum complexity; however, in  the Details View for a file (double click on  a file in Checkpoint View) the complexities of all methods are listed. All  method complexities are shown in the Method  View as well.</p>
<p><strong><span style="color: #339966;"><span style="color: #000000; font-weight: normal;"><strong><span style="color: #339966;">Recommended Max Range = 2&lt;-&gt;8</span></strong></span></span></strong></p></blockquote>
<h1><!--more-->Producing Reports at Buildtime</h1>
<h2>Step#1  : Installing SourceMonitor on the build agent(s).</h2>
<p>Unsurprising the first step of the process is to install the reporting program on all build agent(s). For this blog I&#8217;m using SourceMonitor 2.5 available from <a href="http://www.campwoodsw.com/sourcemonitor.html">http://www.campwoodsw.com/sourcemonitor.html</a> or <a href="http://www.softpedia.com/get/Programming/SDK-DDK/SourceMonitor.shtml">http://www.softpedia.com/get/Programming/SDK-DDK/SourceMonitor.shtml</a></p>
<p>Simply run the installer on the build agent and install it to the default directory</p>
<div id="attachment_288" class="wp-caption alignnone" style="width: 523px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/09/InstallingSourceMonitor.jpg"><img class="size-full wp-image-288" title="InstallingSourceMonitor" src="http://www.thunkitup.com/wp-content/uploads/2010/09/InstallingSourceMonitor.jpg" alt="Installing SourceMonitor" width="513" height="398" /></a><p class="wp-caption-text">Installing SourceMonitor</p></div>
<h2>Setting Build Agent Environmental Variable</h2>
<p>Now we need to set a property on the build agent that tell it where it&#8217;s SourceMonitor installation, this allow us to :</p>
<ul>
<li>Tell TeamCity to only use a build agent with SourceMonitor installed.</li>
<li>Simply use the environmental variable in build scripts and not have to worry about which directory it was actually installed</li>
</ul>
<p>This process is the same one we used for telling the build agent where its NCoverExplorer installation was in previous blog posts. To do this you just edit your build agent’s properties file to include a variable stating the location. In our case our build agent was installed to c:\buildAgent so the properties file is c:\BuildAgent\conf\buildAgent.properties. In that we added the line</p>
<blockquote>
<div>“env.SourceMonitor=C\:\\Program Files\\SourceMonitor”</div>
</blockquote>
<div id="_mcePaste">- just a reminder we extracted SourceMonitor to “C\:\\Program Files\\SourceMonitor”</div>
<div>
<div id="attachment_292" class="wp-caption alignnone" style="width: 310px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/09/AgentProperties1.jpg"><img class="size-medium wp-image-292" title="AgentProperties file" src="http://www.thunkitup.com/wp-content/uploads/2010/09/AgentProperties1-300x204.jpg" alt="AgentProperties file" width="300" height="204" /></a><p class="wp-caption-text">AgentProperties file</p></div>
</div>
<div>
<p>To see this reflected in TeamCity web server go and make a cup of tea and then check on the build agents Environment variables. The build agent itself watches the property file for changes and will reload the file when it sees you have changed it; but it may take a while to perculate up to the webserver itself hence waiting a few mins. To see the build agent’s environment variables is almost identical to system properties except its the next tab along.</p>
<blockquote>
<div>Teamcity-&gt; Agents -&gt; Click on agent name -&gt; Environment properties</div>
</blockquote>
<div>
<div id="attachment_293" class="wp-caption alignnone" style="width: 310px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/09/EnvironmentalVariables.jpg"><img class="size-medium wp-image-293" title="Environmental Variables" src="http://www.thunkitup.com/wp-content/uploads/2010/09/EnvironmentalVariables-300x204.jpg" alt="Environmental Variables" width="300" height="204" /></a><p class="wp-caption-text">Environmental Variables</p></div>
<p><!--more--></p>
<h2>Step #2: Creating A SourceMonitorCommands.XML</h2>
<p>In this step we&#8217;re going to create a SourceMonitorCommands.xml file, this could really be seen as a mini build for SourceMonitor. It tell it which files you are interested in profiling and which you are not. At first we had one of these for each project we wanted to profile. Eventually we noticed most of our project followed a simillar layout Dao, Domain and Tests the file were all the identical. So we&#8217;ve developed a standard one and its only when the project shape differs from the normal structure do we create a new SourceMonitorCommands.xml file.</p>
<p>The below is full source for our standard SourceMonitorCommands.xml</p>
<pre>
<blockquote>

&lt;?xml version="1.0" encoding="utf-8"?&gt;

&lt;sourcemonitor_commands&gt;
  &lt;write_log&gt;true&lt;/write_log&gt;
  &lt;command&gt;
    &lt;project_file&gt;MyProject.smp&lt;/project_file&gt;
    &lt;project_language&gt;CSharp&lt;/project_language&gt;
    &lt;source_directory&gt;.&lt;/source_directory&gt;

    &lt;checkpoint_name&gt;Baseline&lt;/checkpoint_name&gt;

    &lt;source_subdirectory_list&gt;
      &lt;exclude_subdirectories&gt;true&lt;/exclude_subdirectories&gt;
      &lt;source_subtree&gt;bin\&lt;/source_subtree&gt;
      &lt;source_subtree&gt;obj\&lt;/source_subtree&gt;
      &lt;source_subtree&gt;Properties\&lt;/source_subtree&gt;
      &lt;source_subtree&gt;Pre-Reqs\&lt;/source_subtree&gt;
      &lt;source_subtree&gt;HstDllsRepos\&lt;/source_subtree&gt;
      &lt;source_subtree&gt;3rdPartyDlls\&lt;/source_subtree&gt;
	  &lt;source_subtree&gt;Tests\&lt;/source_subtree&gt;
    &lt;/source_subdirectory_list&gt;

    &lt;parse_utf8_files&gt;True&lt;/parse_utf8_files&gt;
    &lt;file_extensions&gt;*.cs&lt;/file_extensions&gt;
    &lt;include_subdirectories&gt;true&lt;/include_subdirectories&gt;

    &lt;ignore_headers_footers&gt;True&lt;/ignore_headers_footers&gt;

    &lt;export&gt;
      &lt;export_file&gt;SourceMonitor-details.xml&lt;/export_file&gt;
      &lt;export_type&gt;2&lt;/export_type&gt;
    &lt;/export&gt;
  &lt;/command&gt;

  &lt;command&gt;
    &lt;project_file&gt;MyProject.smp&lt;/project_file&gt;
    &lt;checkpoint_name&gt;Baseline&lt;/checkpoint_name&gt;
    &lt;export&gt;
      &lt;export_file&gt;SourceMonitor-summary.xml&lt;/export_file&gt;
      &lt;export_type&gt;1&lt;/export_type&gt;
    &lt;/export&gt;
  &lt;/command&gt;
&lt;/sourcemonitor_commands&gt;</blockquote>
</pre>
<p>Although confusing at first, the XML is actually fairly straight forward. the only things you really need to worry about is the tag:</p>
<blockquote><p>&lt;source_subdirectory_list&gt;&lt;exclude_subdirectories&gt;true&lt;/exclude_subdirectories&gt;</p></blockquote>
<p>All the directories within these tags will not be included in the profiling, remembering that will mean everything else is ! We&#8217;ve used this stop it processing the .net generated code, imported Dlls and Test code so we&#8217;re only looking at out live code not the tests. Once you&#8217;re happier with using SourceMonitor you may find you want to play about with these setting but for now we&#8217;ll assume you&#8217;ve followed a similar standard to us.</p>
<p>Now you need to copy this default file into the same directory as you have installed SourceMonitor itself, when we come to write the build script later we&#8217;ll default them to just look for this locally to SourceMonitor installed directory so remember to do this for each build agent</p>
<p><!--more--></p>
<h2>Step #3 : Configuring the build Script</h2>
<p>For our builds we&#8217;ve used nAnt, we found it had the good compatibility with what we needed to do (mono etc) and didn&#8217;t tie us down too much.  Obviously you can do the same using MsBuild or whatever.</p>
<h3>Clean the dir</h3>
<p>The first additions we needed to make was to delete any left over objects/files from the last time SourceMonitor ran in the build dir.</p>
<blockquote><p>&lt;delete file=&#8221;SourceMonitor-summary.xml&#8221; failonerror=&#8221;false&#8221; /&gt; &lt;delete file=&#8221;SourceMonitor-details.xml&#8221; failonerror=&#8221;false&#8221; /&gt; &lt;delete file=&#8221;SourceMonitor.log&#8221; failonerror=&#8221;false&#8221; /&gt; &lt;delete file=&#8221;MyProject.smp&#8221; failonerror=&#8221;false&#8221; /&gt;</p></blockquote>
<p>We&#8217;ve also set failonerror to be false because the file may actually not be there and we don&#8217;t want the build to fail just because it couldn&#8217;t find the files we were wanting to delete anyway.</p>
<h3>Run SourceMonitor</h3>
<p>Next we need to actually run SourceMonitor itself, as you can see we&#8217;re running it from the directory defined by the environmental variable we setup earlier.</p>
<div>
<blockquote>
<div>&lt;exec program=&#8221;%env.SourceMonitor%/SourceMonitor.exe&#8221; failonerror=&#8221;false&#8221;&gt;</div>
<div>&lt;arg value=&#8221;/C&#8221; /&gt;</div>
<div>&lt;arg value=&#8221;%env.SourceMonitor%/SourceMonitorCommands.xml&#8221; /&gt;</div>
<div>&lt;/exec&gt;</div>
</blockquote>
</div>
<p>We&#8217;re also passing a few arguments over at the same time. The first argument is &#8220;C&#8221; and the second is the location of the &#8220;SourceMonitorCommands.xml&#8221; we made earlier, again we&#8217;re using the environmental variable to locate the SourceMonitor directory.</p>
<h3>Publishing the Metric Values to TeamCity</h3>
<p>Now we need to get the Metric values the SourceMonitor has calculated and publish them back into TeamCity thankfully this task is surprisingly easy we simply use nant&#8217;s &lt;xmlpeek&gt; task and then echo the result into a TeamCity ##teamcity[buildStatisticValue] . If you&#8217;ve left the SourceMonitorCommands.xml using the same export format we specified you should be able to just copy and paste this into your build.</p>
<blockquote><p>&lt;xmlpeek xpath=&#8221;//*/metric[@id='M0']&#8221; file=&#8221;SourceMonitor-summary.xml&#8221; property=&#8221;NumberOfLines&#8221; /&gt;</p>
<p>&lt;echo message=&#8221;##teamcity[buildStatisticValue key='NumberOfLines' value='${NumberOfLines}']&#8221; /&gt;</p>
<p>&lt;xmlpeek xpath=&#8221;//*/metric[@id='M5']&#8221; file=&#8221;SourceMonitor-summary.xml&#8221; property=&#8221;MethodsPerClass&#8221; /&gt;</p>
<p>&lt;echo message=&#8221;##teamcity[buildStatisticValue key='MethodsPerClass' value='${MethodsPerClass}']&#8221; /&gt;</p>
<p>&lt;xmlpeek xpath=&#8221;//*/metric[@id='M7']&#8221; file=&#8221;SourceMonitor-summary.xml&#8221; property=&#8221;StatementsPerMethod&#8221; /&gt;</p>
<p>&lt;echo message=&#8221;##teamcity[buildStatisticValue key='StatementsPerMethod' value='${StatementsPerMethod}']&#8221; /&gt;</p>
<p>&lt;xmlpeek xpath=&#8221;//*/metric[@id='M10']&#8221; file=&#8221;SourceMonitor-summary.xml&#8221; property=&#8221;MaxComplexity&#8221; /&gt;</p>
<p>&lt;echo message=&#8221;##teamcity[buildStatisticValue key='MaxComplexity' value='${MaxComplexity}']&#8221; /&gt;</p>
<p>&lt;xmlpeek xpath=&#8221;//*/metric[@id='M14']&#8221; file=&#8221;SourceMonitor-summary.xml&#8221; property=&#8221;AvgComplexity&#8221; /&gt;</p>
<p>&lt;echo message=&#8221;##teamcity[buildStatisticValue key='AvgComplexity' value='${AvgComplexity}']&#8221; /&gt;</p></blockquote>
<h3>Checking the Results</h3>
<p>Having done all the above and running the build you should be able to see the output in the build log if you click &#8220;all messages&#8221;</p>
<div id="attachment_303" class="wp-caption alignnone" style="width: 310px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/09/BuildLogAllMessage.jpg"><img class="size-medium wp-image-303 " style="border: 1px solid black;" title="Build Log All Message" src="http://www.thunkitup.com/wp-content/uploads/2010/09/BuildLogAllMessage-300x149.jpg" alt="Build Log All Message" width="300" height="149" /></a><p class="wp-caption-text">Build Log All Message</p></div>
<h1><!--more-->Report and Graphing the Results in TeamCity</h1>
<p>Now that we have the results in TeamCity it&#8217;s time to look at displaying the results in a useful way, and let&#8217;s be honest whats more useful that a pretty graph ! TeamCity being TeamCity has actually made this surprising easy, if not particularly intuitive.</p>
<div id="attachment_306" class="wp-caption alignnone" style="width: 288px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/09/OutputGraphs.jpg"><img class="size-medium wp-image-306" title="Output Graphs" src="http://www.thunkitup.com/wp-content/uploads/2010/09/OutputGraphs-278x300.jpg" alt="Output Graphs" width="278" height="300" /></a><p class="wp-caption-text">Output Graphs</p></div>
<h2>Find you Build Type Id From TeamCity</h2>
<p>First step is find you Build Type Id, we use this to tell TeamCity what statistics to look up for its graphs. The easiest way to get this is to guide yourself to the last successful build using the projects page and then checking the URL in the address bar. This should have a key of &#8220;<em>&amp;buildTypeId=</em>&#8221; the key after this will be you<strong> Build Type ID</strong>.</p>
<p>For example, when we went to the build log for last successful build of our project the screen looked as follows</p>
<div id="attachment_307" class="wp-caption alignnone" style="width: 310px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/09/GettingTheBuildId.jpg"><img class="size-medium wp-image-307" title="Getting The Build Id" src="http://www.thunkitup.com/wp-content/uploads/2010/09/GettingTheBuildId-300x145.jpg" alt="Getting The Build Id" width="300" height="145" /></a><p class="wp-caption-text">Getting The Build Id</p></div>
<p>As you can see the URL in the address bar is</p>
<blockquote>
<div>http://mother/viewLog.html?buildId=1773&amp;tab=buildResultsDiv&amp;buildTypeId=<span style="color: #ff00ff;">bt8</span></div>
</blockquote>
<p>So the Build Type Id of our project is &#8220;<strong>bt8</strong>&#8220;, and yes our build server is called &#8220;mother&#8221; (well mother knows best !)</p>
<h1>Adding Custom Graphs to a Project in TeamCity</h1>
<p>Now you&#8217;re going to have trust me a bit here, this sounds dodgy and hacky but it is actually completely Okay. Trust me I&#8217;m a developer.</p>
<h3>Find the Projects Folder on the TeamCity WebServer</h3>
<p>When we want to show extra graphs for our TeamCity project we have to edit the project file directly, there doesn&#8217;t seem to be any provision for this through the front-end. Firstly we have to find the project file for the TeamCity project in question. This will be stored in the &#8220;<em>config</em>&#8221; folder held in the TeamCity web server installation directory. We just took the defaults for server installation so our &#8220;<em>config</em>&#8221; folder in &#8220;c:\teamCity\<em>config&#8221;</em> in here you should see a folder for each project, the folders have the same name as your project so should be easy to distinguish which folder you need to be looking in.</p>
<h3>Adding additional Graphs to &#8220;plugin-settings.xml&#8221;</h3>
<p>In the folder for your project you should find a file called &#8220;<strong>plugin-settings.xml</strong>&#8220;. If you&#8217;ve not never added anything to this file it should be fairly short, looking something like the following</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;</p>
<p>&lt;settings&gt;</p>
<p>&lt;custom-graphs /&gt;</p>
<p>&lt;/settings&gt;</p></blockquote>
<p>In this you need to add a few tags with the<em> &lt;custom-graphs /&gt;</em> tag. These additional tags tell TeamCity to load the statistics from the build logs and plot them on a graph. To do this successfully you need to also tell TeamCity which buildTypeId you are interested in, this is the number you found earlier, ours was &#8220;<span style="color: #ff00ff;">bt8</span>&#8220;.</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;</p>
<p>&lt;settings&gt;</p>
<p>&lt;custom-graphs&gt;</p>
<p>&lt;graph title=&#8221;Unit Test Coverage from NCover&#8221; defaultFilters=&#8221;" hideFilters=&#8221;" seriesTitle=&#8221;Coverage&#8221;&gt;</p>
<p style="text-align: justify;">&lt;valueType key=&#8221;CodeCoverageB&#8221; title=&#8221;Block-level&#8221; buildTypeId=&#8221;<span style="color: #ff00ff;">bt8</span>&#8221; /&gt;</p>
<p>&lt;valueType key=&#8221;CodeCoverageC&#8221; title=&#8221;Class-level&#8221; buildTypeId=&#8221;<span style="color: #ff00ff;">bt8</span>&#8221; /&gt;</p>
<p>&lt;valueType key=&#8221;CodeCoverageL&#8221; title=&#8221;Line-level&#8221; buildTypeId=&#8221;<span style="color: #ff00ff;">bt8</span>&#8221; /&gt;</p>
<p>&lt;valueType key=&#8221;CodeCoverageM&#8221; title=&#8221;Method-level&#8221; buildTypeId=&#8221;<span style="color: #ff00ff;">bt8</span>&#8221; /&gt;</p>
<p>&lt;/graph&gt;</p>
<p>&lt;graph title=&#8221;Complexity From Source Monitor&#8221; defaultFilters=&#8221;" hideFilters=&#8221;showFailed&#8221;&gt;</p>
<p>&lt;valueType key=&#8221;MaxComplexity&#8221; title=&#8221;Max Complexity&#8221; buildTypeId=&#8221;<span style="color: #ff00ff;">bt8</span>&#8221; /&gt;</p>
<p>&lt;valueType key=&#8221;AvgComplexity&#8221; title=&#8221;Average Complexity&#8221; buildTypeId=&#8221;<span style="color: #ff00ff;">bt8</span>&#8221; /&gt;</p>
<p>&lt;/graph&gt;</p>
<p>&lt;graph title=&#8221;Statements per Method from Source Monitor&#8221; defaultFilters=&#8221;" hideFilters=&#8221;showFailed&#8221;&gt;</p>
<p>&lt;valueType key=&#8221;StatementsPerMethod&#8221; title=&#8221;Statements per Method&#8221; buildTypeId=&#8221;<span style="color: #ff00ff;">bt8</span>&#8221; /&gt;</p>
<p>&lt;/graph&gt;</p>
<p>&lt;graph title=&#8221;Methods per Class from Source Monitor&#8221; defaultFilters=&#8221;" hideFilters=&#8221;showFailed&#8221;&gt;</p>
<p>&lt;valueType key=&#8221;MethodsPerClass&#8221; title=&#8221;Methods per Class&#8221; buildTypeId=&#8221;<span style="color: #ff00ff;">bt8</span>&#8221; /&gt;</p>
<p>&lt;/graph&gt;</p>
<p>&lt;graph title=&#8221;Number of Lines from Source Monitor&#8221; defaultFilters=&#8221;" hideFilters=&#8221;showFailed&#8221;&gt;</p>
<p>&lt;valueType key=&#8221;NumberOfLines&#8221; title=&#8221;Number Of Lines&#8221; buildTypeId=&#8221;<span style="color: #ff00ff;">bt8</span>&#8221; /&gt;</p>
<p>&lt;/graph&gt;</p>
<p>&lt;/custom-graphs&gt;</p>
<p>&lt;/settings&gt;</p></blockquote>
<p>Again if you&#8217;ve stuck the format of the files above you should pretty much be able to copy and paste and then simple replace &#8220;<span style="color: #ff00ff;">bt8</span>&#8221; with your Build Type Id. You&#8217;ll no doubt notice that we also include the Code Coverage statistics at the same point, these were generated per build by <strong>TeamCity </strong>using the technique described in earlier posts but its handy to have everything in the same place.</p>
<p><!--more--></p>
<h1>Viewing the Graphs</h1>
<p>To view the graphs for you project simply click on the project name in the projects screen and then click &#8220;<strong>statistics</strong>&#8220;<strong> </strong>and you should see the graphs below.</p>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/09/OutputGraphs.jpg"><img class="size-medium wp-image-306" style="padding: 0px; margin: 0px; border: 0px none initial;" title="Output Graphs" src="http://www.thunkitup.com/wp-content/uploads/2010/09/OutputGraphs-278x300.jpg" alt="Output Graphs" width="278" height="300" /></a></p>
<p>Note: There is massive potential confusion here. We&#8217;ve defined our graphs at the project level, TeamCity also makes different statistics available on a very similar looking page but at the build level. To ensure you&#8217;re looking at the right page it might be easier to use the drop down projects list at the top of everypage (as shown below) selecting the required project and clicking &#8220;<strong>statistics</strong>&#8221; immediately. This will take you to the <strong>PROJECT STATISTICS</strong> page, NOT the <strong>BUILD STATISTICS</strong> page.</p>
<div id="attachment_311" class="wp-caption alignnone" style="width: 480px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/09/ProjectsDropDown.jpg"><img class="size-full wp-image-311" title="Projects Drop Down" src="http://www.thunkitup.com/wp-content/uploads/2010/09/ProjectsDropDown.jpg" alt="Projects Drop Down" width="470" height="314" /></a><p class="wp-caption-text">Projects Drop Down</p></div>
<h1>Conclusions:</h1>
<p>Subsequent posts will show how to use the report created here to do targeted re-factoring of your projects in an effort to improve quality, but for you should be getting an idea of where your code is strong and where it&#8217;s could be improved.</p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/09/adding-code-metrics-to-your-teamcity-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improving Test Coverage Using Coverage Reports</title>
		<link>http://www.thunkitup.com/2010/08/improving-test-coverage/</link>
		<comments>http://www.thunkitup.com/2010/08/improving-test-coverage/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 12:15:26 +0000</pubDate>
		<dc:creator>simon.crozier</dc:creator>
				<category><![CDATA[TeamCity]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=254</guid>
		<description><![CDATA[Introduction In the last blog post we looked at getting TeamCity to automatically generate test coverage reports and graphs to give us a clear view of how well tested our projects are. While the metrics and figures produced do give a valuable snap-shot of the current situation they&#8217;re not really detailed enough to allow us to drill [...]]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>In the last blog post we looked at getting TeamCity to automatically generate test coverage reports and graphs to give us a clear view of how well tested our projects are. While the metrics and figures produced do give a valuable snap-shot of the current situation they&#8217;re not really detailed enough to allow us to drill down and see where we&#8217;re lacking cover.</p>
<p>In this post we&#8217;ll look at how we can use the coverage report to drill down and directly target the methods that are lacking coverage. The below image gives a teaser of where we&#8217;re trying to get to.</p>
<h2>What we&#8217;ll get</h2>
<div id="attachment_255" class="wp-caption alignnone" style="width: 570px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/testCoverage.jpg"><img class="size-full wp-image-255        " style="border: 1px solid black;" title="Test Coverage" src="http://www.thunkitup.com/wp-content/uploads/2010/08/testCoverage.jpg" alt="Targeted test coverage report from NCoverExplorer" width="560" height="184" /></a><p class="wp-caption-text">Targeted test coverage report from NCoverExplorer</p></div>
<h2>What it&#8217;s telling us.</h2>
<p>In the above image you can see we&#8217;ve already drilled down to the class <em>AbstractBaseDao -</em> don&#8217;t worry we&#8217;ll get into how you actually do that, but for now let&#8217;s just look at what it&#8217;s telling us. This page is telling us that after a full test run Create has been visited 4 times but none of the tests have hit the last <em>throw new exception(&#8220;boo&#8221;)</em>, because of this the Create method&#8217;s coverage is only 83%. Hit that particular throw with a test and coverage will go to 100%&#8230;neat huh ?</p>
<p>The really cool thing is it&#8217;s going to take us about 2 mins to actually get to this stage.</p>
<h1><span id="more-254"></span>Getting the Coverage Report</h1>
<p>If you&#8217;ve followed the steps from the earlier blog post getting the coverage report out of TeamCity couldn&#8217;t be easier and that&#8217;s what we&#8217;re going to go through in this section. However If your not using TeamCity or you&#8217;ve just done your setup differently you&#8217;re going to have to find your own way of getting to your &#8220;coverage.xml&#8221;. Once you&#8217;ve got this the rest of the step should apply so just skip onto the next section.</p>
<h2>Project Coverage.XML</h2>
<p>As we saw last time TeamCity runs using NCover which watches NUnit running it tests and keeps track of what lines were hit during the run. The result of this is an XML file, TeamCity then uses NCoverExplorer to interpret this coverage report into the key metrics and graphs it so nicely displays under the coverage tab. The below image is a full coverage xml report in all it&#8217;s glory</p>
<div id="attachment_256" class="wp-caption alignnone" style="width: 310px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/CoverageReportExample.jpg"><img class="size-medium wp-image-256 " style="border: 1px solid black;" title="CoverageReportExample" src="http://www.thunkitup.com/wp-content/uploads/2010/08/CoverageReportExample-300x161.jpg" alt="Colourised example of a Coverage XML  Report" width="300" height="161" /></a><p class="wp-caption-text">Colourised example of a Coverage XML  Report</p></div>
<p>One of the really nice things about TeamCity&#8217;s implementation of  this coverage analysis is the that it publishes all the reports etc it created and processed to get these results as artifacts in a artifacts folder named Coverage. Infact TeamCity published not only the individual files but also a zip archive of all these files &#8211; now that&#8217;s just showing off !</p>
<p>Anyway for our purposes we&#8217;re only actually interested in the <strong>CoverageReport.xml</strong> so go ahead and save that to your desktop. You can download this from build artifacts directly from the <strong>Projects</strong> page in TeamCity but as its an XML file you may find your browser tries to read this itself rather than actually downloading. I find the easiest way to get round this is to go to the build overview page &#8211; just click on the build you&#8217;re interested, probably the topmost build and you should be taken to the build overview screen. In the tabs along the top the tab before the (all important) coverage tab is an <strong>Artifacts</strong> tab. Go into that tab, drill down/expand the artifact folder structure till you see the &#8220;<strong>CoverageReport.xml</strong>&#8221; &#8211; usually under <em>TeamCity -&gt; .net Coverag</em>e then right click the link to &#8220;<strong>CoverageReport.xml</strong>&#8221; and choose &#8220;<em>Save As</em>&#8221; and save the xml file to your desktop.</p>
<div id="attachment_257" class="wp-caption alignnone" style="width: 790px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/DownloadCoverageReport.jpg"><img class="size-full wp-image-257" title="DownloadCoverageReport" src="http://www.thunkitup.com/wp-content/uploads/2010/08/DownloadCoverageReport.jpg" alt="Download the NCover Coverage Report from Teamcity" width="780" height="341" /></a><p class="wp-caption-text">Download the NCover Coverage Report from Teamcity</p></div>
<h1>Opening the Coverage Report</h1>
<p>To open the coverage report we use NCoverExplorer  - this is same program that was installed on the build agents in the earlier posts. In that post we used NCoverExplorer 1.4.0.7 <a href="http://www.kiwidude.com/dotnet/DownloadPage.html">http://www.kiwidude.com/dotnet/DownloadPage.html</a> and again that is fine for what we&#8217;re doing here.</p>
<p>Simply install and run NCoverExplorer. Once its open either drag and drop the CoverageReport.xml from your desktop to the NCoverExplorer window or use the File -&gt;Open menu and guide it to the XML on your desktop or wherever you saved it.</p>
<p>NCoverExplorer will now load the coverage report and interpret its contents into a drill down class diagram</p>
<div id="attachment_272" class="wp-caption alignnone" style="width: 790px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/NCoverExplorerLoad1.jpg"><img class="size-full wp-image-272" title="NCoverExplorer Loading report" src="http://www.thunkitup.com/wp-content/uploads/2010/08/NCoverExplorerLoad1.jpg" alt="NCoverExplorer Loading report" width="780" height="341" /></a><p class="wp-caption-text">NCoverExplorer Loading report</p></div>
<h1>Reading the Report</h1>
<p>In this particular report you can see there are two assemblies that have been examined in the test <strong>HST.Core.DAO</strong> and <strong>HST.Core.Domain</strong>. Obviously these are just what have been configured in TeamCity<strong> </strong>as the assemblies to profile.</p>
<p>You can also see the coverage percentages that would tie in with what you would see within TeamCity itself, although you may notice a slight discrepancy between the two values this is due to the filtering/aggregation TeamCity applies.</p>
<h2>Filtering</h2>
<p>In the previous post we set TeamCity to look at Module, Class, Function summary, NCoverExplorer (<em>NCE</em>)  itself defaults to looking at line level coverage. Obviously this increased granuality would cause <em>NCE</em> to have a slightly lower overall percentage as TeamCity is doing a some aggregation. To set <em>NCE</em> to aggregate the same way as TeamCity simply press <strong>CNTRL+6</strong> or <strong>View-&gt;Coverage-&gt; &#8220;Function Coverage (%) (unvisted #)</strong>&#8220;.</p>
<p>Personally speaking I would leave <em>NCE</em> on its default aggregation mode of &#8220;<strong>Sequence Points (%)</strong>&#8221; <strong>CNTRL+1</strong>, while it would possibly be too much information for a per build process I think that this view is more appropriate for targeted test coverage improvement.</p>
<p>For the rest of the blog we&#8217;ve swapped back to <em>NCE</em> default aggregation model.</p>
<h1>Targeting of Effort / Colour-coding</h1>
<p>As you can see from the above image, from a top down level our coverage % is pretty good (98% + 100%).  To show this <strong>HST.Core.Domain </strong>is Black indicating that its at 100% and obviously can&#8217;t be improved. <strong>HST.Core.DAO</strong> is also colour <span style="color: #000080;">Dark B</span><span style="color: #0000ff;"><span style="color: #000080;">lue</span> </span>indicating that is ins&#8217;t at 100% but it is well above the 90% recommended so isn&#8217;t really a massive concern and you should concentrate on other areas first. However; given the our only other assembly here is at 100% and I like things &#8220;just so&#8221; we&#8217;re going to push on and try and improve this percentage.</p>
<p>Drilling down through the project structure reveals a very different situation, under the headline figure of 98% we actually have a few classes that have mid-nineties coverage.</p>
<div id="attachment_274" class="wp-caption alignnone" style="width: 790px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/NCoverExplorerDrillDown.jpg"><img class="size-full wp-image-274" title="NCoverExplorer Drill Down" src="http://www.thunkitup.com/wp-content/uploads/2010/08/NCoverExplorerDrillDown.jpg" alt="NCoverExplorer Drill Down" width="780" height="341" /></a><p class="wp-caption-text">NCoverExplorer Drill Down</p></div>
<p><em>So what gives we had a coverage report 98% but when we&#8217;ve actually drill down we&#8217;ve got two classes with 96% or less that doesn&#8217;t sound right? </em>Yeah, valid question but the answer is simple, <strong>AbstractBaseDao </strong>and <strong>MetaDataItemDao </strong>are relatively simple classes (less than 20 lines each) the <strong>RelationshipLinkDao </strong>is a fairly involved DAO with lots of criteria implementations so is well over 100 lines long. Given <strong>RelationshipLinkDao </strong>is at  99% in terms of overall percentage the extra length has caused more weighting to be applied to <strong>RelationshipLinkDao&#8217;s </strong>score and thus brought the overall score up. That&#8217;s not to say that we can&#8217;t or shouldn&#8217;t improve these scores just that overall terms they&#8217;re not as important, conversely if <strong>RelationshipLinkDao </strong>had an even slightly lower percentage it would have a massive impact on the overall score.</p>
<h1>Method Level Targeting</h1>
<p>Obviously using this technique we can continue to drill down our classes and find specific areas for improvement. If we drill into MetaDataItemDao we are shown the classes internal scores and we&#8217;ll start to see where we&#8217;re dropping percentage points.</p>
<div id="attachment_275" class="wp-caption alignnone" style="width: 790px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/MethodLineLevelDrillDown.jpg"><img class="size-full wp-image-275" title="Method Line Level Drill Down" src="http://www.thunkitup.com/wp-content/uploads/2010/08/MethodLineLevelDrillDown.jpg" alt="Method Line Level Drill Down" width="780" height="341" /></a><p class="wp-caption-text">Method Line Level Drill Down</p></div>
<p>Now you can start to see <em>NCE</em> showing us where we can improve, by this point we&#8217;ve drilled down to method level and because <em>NCE</em> can show us the actual scores for each method rather than the aggregated scores you&#8217;ll start to get a picture of where <strong>MetaDataItemDao&#8217;s </strong>score of 95% has come from. In this case only two methods have let the side down: <strong>UpdateExistingItemValue </strong>and <strong>CreateMetaDataItem</strong> both have scored 80%. This means the majority of the code has been tested but there still exists a large chunk of code that is untested &#8211; remember this large chunk is relative to the method size I can tell you that in both these cases it is one line of a five line method. But to put it another way that is 20% of the method&#8217;s code is completely without tests and that&#8217;s not really acceptable.</p>
<h1>Line Level Target</h1>
<p>Okay so we&#8217;ve narrowed down where the untested code lies, and we&#8217;ve a sneaky suspicion it&#8217;s a one line omission in this case we could likely just look at the method and have a good stab at what line isn&#8217;t covered. Failing that we could put a debug point on and see which line doesn&#8217;t get hit. I don&#8217;t know about you but both of them options sound tiresome if we were dealing with a larger method. This is where <em>NCE&#8217;s</em> really nice feature comes in &#8220;Line-Level-Analysis&#8221;.</p>
<h2>Source Location Substitution</h2>
<p>To clearly understand what we&#8217;re going to look at next there something we need to remember, this report was created by watching the build agent run the unit tests against the Dlls it just built. So as far as the report is concerned these Dlls and the source for them live in a certain place &#8211; as we&#8217;re using TeamCity this will be where ever the build agent has been told to put its work. Obviously when you look at it from your machine your source code is very likely to be in a completely different directory. So what we have to do is tell <em>NCE</em> which directory in the report to substitute and which directory to substitute it for. We could do this by hand in a text editor using a simple find and replace &#8211; the report itself is only XML after all  - but thankfully <em>NCE</em> has the ability to do this for us.</p>
<p>When you click on a method, for example the <strong>UpdateExistingItemValue </strong>used above, <em>NCE</em> will attempt to display the source code for the method. In doing so <em>NCE</em> will find the source code directory the report is talking about doesn&#8217;t exist on your machine. To solve this it will pop up the below box</p>
<div id="attachment_276" class="wp-caption alignnone" style="width: 468px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/ResolveMissingSourceCodeFile.jpg"><img class="size-full wp-image-276" title="Resolve Missing Source Code Files" src="http://www.thunkitup.com/wp-content/uploads/2010/08/ResolveMissingSourceCodeFile.jpg" alt="Resolve Missing Source Code Files" width="458" height="506" /></a><p class="wp-caption-text">Resolve Missing Source Code Files</p></div>
<p>This is because the XML report has a line in it similar to</p>
<blockquote>
<div id="_mcePaste">&lt;seqpnt visitcount=&#8221;223&#8243; line=&#8221;8&#8243; column=&#8221;3&#8243; endline=&#8221;8&#8243; endcolumn=&#8221;27&#8243; excluded=&#8221;false&#8221; document=&#8221;c:\BuildAgent\work\429982adbac874b6\DAO\Mappings\MetaDataItemMap.cs&#8221; /&gt;</div>
</blockquote>
<p>In this case the build agent is building our project from &#8220;<strong>c:\BuildAgent\work\429982adbac874b6</strong>&#8221; but on my machine the source code is actually at &#8220;<strong>C:\Projects\HstCore</strong>&#8220;, from what i&#8217;ve seen every project in TeamCity will given a long alphanumeric identifier on the build agent and generally this directory will correspond to your SVN root on your machine.  So all i need to do is select <strong>429982adbac874b6</strong> in the upper window and use the browse button to find the right directory on my machine as per below</p>
<div>
<div id="attachment_277" class="wp-caption alignnone" style="width: 468px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/ResolvedSourceCodeFile.jpg"><img class="size-full wp-image-277" title="Resolved Source Code File" src="http://www.thunkitup.com/wp-content/uploads/2010/08/ResolvedSourceCodeFile.jpg" alt="Resolved Source Code File" width="458" height="506" /></a><p class="wp-caption-text">Resolved Source Code File</p></div>
</div>
<p>After that I just press Replace, after which<em> </em><em>NCE</em> will inform you of how many time its replaced the directory with the new one.</p>
<p>Once this is complete it will return you to the main window, if successful it will have also loaded the source file, located the method you requested and have highlighted the offending untested lines as seen below. Obviously this could be confused if the source code the build agent used was different to the one on your machine but you wouldn&#8217;t be that silly anyway would you !</p>
<div id="attachment_278" class="wp-caption alignnone" style="width: 310px"><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/LineLevelDrillDown.jpg"><img class="size-medium wp-image-278" title="Line Level Drill Down" src="http://www.thunkitup.com/wp-content/uploads/2010/08/LineLevelDrillDown-300x144.jpg" alt="Line Level Drill Down" width="300" height="144" /></a><p class="wp-caption-text">Line Level Drill Down</p></div>
<p>After this step is done you&#8217;ve got a colour coded source file telling you what code still needs coverage. Lets be honest it doesn&#8217;t get much better than that.</p>
<h2>Conclusion</h2>
<p>Now that you can see the untested line it should be relatively trivial to write a test to hit that line and  get your tests coverage to 100% at least.</p>
<p>I know the accepted standard for code coverage is 90% but I find the devil really is in the detail, assuming your other tests are really good that extra 10% of untested code is by definition where the bugs will be found. I personally have found if you really push for that extra 10% you easily find enough problem-ets and mis-assumptions to justify that extra leg work. Really who doesn&#8217;t want to get 100%.</p>
<p>There are other methods of getting decent coverage reports on your source, running NCover yourself on your machine and looking at that CoverageReport.xml is an obvious one but why bother when TeamCity is doing the leg work anyway. <strong>JetBrain&#8217;s</strong> own <strong>dotCover</strong> tool looks promising but is still a little immature for proper use. I find this an easy way of doing something worthwhile. If you do it another way great, just so long as everyone does it i think the world will be a better place</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/08/improving-test-coverage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling Test Coverage Reports in Teamcity 5.1</title>
		<link>http://www.thunkitup.com/2010/08/enabling-test-coverage-reports-in-teamcity-5-1/</link>
		<comments>http://www.thunkitup.com/2010/08/enabling-test-coverage-reports-in-teamcity-5-1/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 12:00:05 +0000</pubDate>
		<dc:creator>simon.crozier</dc:creator>
				<category><![CDATA[TeamCity]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=217</guid>
		<description><![CDATA[Introduction One of the most useful code metrics we found so far is &#8220;Test coverage&#8221;. The basic premise is fairly obvious: the system watches your suite of unit tests running and then establishes which lines of your code have been &#8220;hit&#8221; and which haven&#8217;t and presents this as a percentage. Most coverage engines will also [...]]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>One of the most useful code metrics we found so far is &#8220;Test coverage&#8221;. The basic premise is fairly obvious: the system watches your suite of unit tests running and then establishes which lines of your code have been &#8220;hit&#8221; and which haven&#8217;t and presents this as a percentage. Most coverage engines will also spit out a report providing you a drill down mechanismn to find where your code is lacking tests.</p>
<p>The following is a how-to on enabling code coverage using NCover and NCoverExplorer in Teamcity. Teamcity&#8217;s website does provide the basics on how to configure this but it can be a bit vague in places, given that this will be far more explicit hopefully with screen grabs at each signifcant stage.</p>
<h1>Ingredients : For this post we&#8217;re using :-</h1>
<div id="_mcePaste">
<ul>
<li>TeamCity Professional 5.1.3 (build 13506)</li>
<li>Windows XP Build agent associated with the above.</li>
<li>NCover 1.5.8 &#8211; <a href="http://www.ncover.com/download/current">http://www.ncover.com/download/current</a></li>
<li>NCoverExplorer 1.4.0.7 <a href="http://www.kiwidude.com/dotnet/DownloadPage.html">http://www.kiwidude.com/dotnet/DownloadPage.html</a></li>
</ul>
</div>
<h2>Note about NCover :</h2>
<p>There now seems to be three distinctly sepereate versions of NCover :</p>
<div id="_mcePaste">
<ul>
<li>NCover 1.x is a freely available community project but it does seem to have stopped active development</li>
<li>NCover 1.5.8 Community Edition &#8211; Freely available from <a href="http://www.ncover.com/download/current">http://www.ncover.com/download/current</a> &#8211; although you do have to signup for a free &#8220;account&#8221;</li>
<li>NCover 3.x and above is a commerically available product costing *some* money.</li>
</ul>
</div>
<p>I believe the team responsible for 1.x decided to commericalise it so the same team is responsible for 3.x but I could be wrong about that. I&#8217;ve never used 3.x due to the costs, I&#8217;d assume it has some advantage but i&#8217;ve been more than happy with 1.x abilities so its never really been an issue. Just to be clear I&#8217;ve no involvement with either product or organisation other than being a user of one.</p>
<p>I signed up for a account and downloaded the NCover 1.5.8 Msi and thats the one this guide will be talking about.</p>
<h2>Setting up the build agent(s)</h2>
<h2>Step one:</h2>
<p>Install NCover on the build agent using the MSI taking the defaults &#8211; in our case the build agent was on a XP box seperate from the teamcity server but I don&#8217;t imagine thats critical</p>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/InstallingNCover.jpg"><img class="size-medium wp-image-220 alignnone" title="Installing NCover" src="http://www.thunkitup.com/wp-content/uploads/2010/08/InstallingNCover-300x234.jpg" alt="Installing NCover" width="300" height="234" /></a></p>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/InstallingNCover1.jpg"><img class="size-medium wp-image-221 alignnone" title="InstallingNCover1" src="http://www.thunkitup.com/wp-content/uploads/2010/08/InstallingNCover1-300x234.jpg" alt="" width="300" height="234" /></a></p>
<h2>Step two:</h2>
<p>Once installed restart the build agent service or if you think its easier just reboot the agent&#8217;s machine. This will cause the agent to reset and do a discovery session. Hopefully this will cause the agent to find its copy of NCover and inform the Teamcity web server of it&#8217;s new found abilities. You can check its done this by going into the agent&#8217;s<strong> system properties</strong> and to see if there is an entry there for ncover.v1.path this should tally with the default installation directory of NCover  <strong>C:\Program Files\NCover</strong> (this may differ on 64bit machines but the build agent should detect the difference).</p>
<blockquote>
<div id="_mcePaste">Teamcity-&gt; Agents -&gt; Click on agent name -&gt; System properties</div>
</blockquote>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildAgentWithNCover.jpg"><img class="aligncenter size-medium wp-image-236" title="TeamCityBuildAgentWithNCover" src="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildAgentWithNCover-256x300.jpg" alt="" width="256" height="300" /></a></p>
<h2>Step three:</h2>
<p>Extract the contents of <strong>NCoverExplorer-1.4.0.7.zip</strong> to a sensible place on the agent machine. For our installation I chose &#8220;<strong>C:\Program Files\NCoverExplorer</strong>&#8220;, it doesn&#8217;t have to be there but that made the most sense to me.</p>
<h2>Step four:</h2>
<p>The teamcity build agent won&#8217;t automatically detect the presence or location of NCoverExplorer so you have to either tell teamcity in your build configuration or tell your build agent directly where it is on that machine. We decided that if you told it through the build configuration then it would force all build agents to have it in the same place &#8211; which maybe quite reasonable given you just extract it where you want it. But given we run also run a 64bit build agent as well we thought it&#8217;s likely that we&#8217;d want the files in different locations on different build agents so we went with giving the build agent a Environment property detailing where it is.</p>
<div id="_mcePaste">To do this you just edit your build agent&#8217;s properties file to include a variable stating the location.</div>
<p>In our case our build agent was installed to c:\buildAgent so the properties file is <em>c:\BuildAgent\conf\buildAgent.properties</em>. In that we added the line</p>
<blockquote>
<div><em>&#8220;env.ncoverExplorerHome=C\:\\Program Files\\NCoverExplorer&#8221;</em></div>
<div>- just a reminder we extracted NCoverExploerer to &#8220;C:\Program Files\NCoverExplorer</div>
</blockquote>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildAgentPropetiesFileWithNCoverExplorer1.jpg"><img class="aligncenter size-medium wp-image-237" title="TeamCityBuildAgentPropetiesFileWithNCoverExplorer" src="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildAgentPropetiesFileWithNCoverExplorer1-300x174.jpg" alt="" width="300" height="174" /></a></p>
<p>To see this reflected in TeamCity web server go and make a cup of tea and then check on the build agents Environment variables. The build agent itself watches the property file for changes and will reload the file when it sees you have changed it; but it may take a while to perculate up to the webserver itself hence waiting a few mins. To see the build agent&#8217;s environment variables is almost identical to system properties except its the next tab along.</p>
<blockquote>
<div id="_mcePaste">Teamcity-&gt; Agents -&gt; Click on agent name -&gt; Environment properties</div>
</blockquote>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildAgentEnvironmentVariablesWithNCoverExplorer.jpg"><img class="aligncenter size-medium wp-image-223" title="TeamCityBuildAgentEnvironmentVariablesWithNCoverExplorer" src="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildAgentEnvironmentVariablesWithNCoverExplorer-256x300.jpg" alt="" width="256" height="300" /></a></p>
<p>To Re-iterate step four can be skipped if you choose to, the location of NCoverExplorer can just be specifed manually in the build configuration.</p>
<h1>Setting up the build configuration</h1>
<p>For this part i&#8217;m going to assume you have a working C# build configuration with a working/reporting NUnit tests suite and you just want to add coverage reports to this, so i&#8217;m going to skip the settting up of that focus on adding coverage reports to it.</p>
<p>Get to the build configuration or configuration template you want to add coverage to. In our case we want to add it to a project we&#8217;ve called &#8220;Prime&#8221; which uses a NAnt script to run so we went</p>
<blockquote>
<div id="_mcePaste">Administration -&gt; Prime -&gt; 3 Runner: NAnt</div>
</blockquote>
<p>But the &#8220;3 Runner: XXX&#8221; tab should be available to every configuration</p>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildConfigurationRunnerPage.jpg"><img class="aligncenter size-medium wp-image-224" title="TeamCityBuildConfigurationRunnerPage" src="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildConfigurationRunnerPage-300x276.jpg" alt="" width="300" height="276" /></a></p>
<p>If your chosen runner is compatible with TeamCity&#8217;s coverage task, scrolling down you should see a section called &#8220;.NET Coverage&#8221;. If this section isn&#8217;t there you&#8217;ll probably find you need to change your build runner to NAnt/MsBuild/Visual Studio(SLN)/Visual Studio 2003 &#8211; teamcity&#8217;s website should provide details of compatible runners.</p>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildAgentCodeCoverageSetup.jpg"><img class="aligncenter size-medium wp-image-225" title="TeamCityBuildAgentCodeCoverageSetup" src="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityBuildAgentCodeCoverageSetup-300x289.jpg" alt="" width="300" height="289" /></a></p>
<h2>Configuration</h2>
<p>I&#8217;ll now go through each setting in this section and detail what we&#8217;ve done with each, as you get more familiar with NCover you can edit these to suit your system but our settings should give you a &#8220;starter for 10&#8243;</p>
<h3>q: .NET Coverage tool:</h3>
<div id="_mcePaste">a: NCover (1.x)</div>
<p>desc: as discussed earlier there are a few different version of NCover available and supported by TeamCity, this guide has focused on 1.x</p>
<h3>q: .NET Runtime:</h3>
<div id="_mcePaste">a: .NET Framework 2.0, version x86</div>
<p>desc: should be obvious really but we&#8217;ve using a 32bit XP with .net 3.5 which runs on the 2.0 CLR</p>
<h3>q: Path to NCover:</h3>
<div id="_mcePaste">a: %system.ncover.v1.path%</div>
<p>desc: this is the System property you saw being detected in &#8220;Setting up the build agent(s): Step two&#8221;</p>
<h3>q: Path to NCoverExplorer:</h3>
<div id="_mcePaste">a: %env.ncoverExplorerHome%</div>
<p>desc: this is the Environment variable we created in  &#8221;Setting up the build agent(s): Step Four&#8221;. If you chose not to do that, this is where you&#8217;d directly specify the path so in our case it would have been &#8221;<strong>C:\program files\NCoverExplorer\</strong>&#8221;</p>
<h3>q: Additional NCover Arguments:</h3>
<div id="_mcePaste">a: n/a</div>
<p>desc: not found any need for this yet</p>
<h3><strong>q: Assemblies to Profile:</strong></h3>
<div id="_mcePaste">a: HST.Prime.Dao</div>
<div id="_mcePaste">HST.Prime.Domain</div>
<p>desc: this/these are the assemblies you want the coverage report to look at &#8211; more than likely just your DLL names with the DLL part dropped off. Remember not to include the test assembly or reference assemblies, these should be tested elsewhere, including them will drop your percentage unless you&#8217;ve tested them completely in this project.</p>
<h3>q: Exclude Attributes:</h3>
<div id="_mcePaste">a: HST.Core.Domain.NoTestCoverage</div>
<p>desc: there is argueably a few areas within you&#8217;re assembly you simply don&#8217;t want to or can&#8217;t test. For this we defined an attribute that can be put above a method or class telling NCover to ignore the lines. This akin to NUnit&#8217;s [TestFixture] attribute telling it to look at them. You can see our attribute is actually defined in a reference assembly and used accross projects too. Obviously over use of this attribute will just distort/massage your results so should be used as a last resort. I&#8217;m happy to report that we&#8217;ve actually managed to eliminate all uses of this attribute in our code but you may not be as lucky so I&#8217;ve included it for completeness.</p>
<p>The <a title="TeamCity blog post" href="http://laribee.com/using-attributes-to-exclude-code-from-coverage">blog post</a> I read about this on entailed some great advice &#8220;When employing a tactic like this we’ll do well to remember the guiding wisdom of <a title="Ben Parker on Wiki" href="http://en.wikipedia.org/wiki/Uncle_Ben">Uncle Ben Parker</a>…&#8221;  <em>With great power comes great responsibility</em></p>
<h3>q: Report Type:</h3>
<div id="_mcePaste">a: Module Class Function Summary</div>
<p>desc: controls the details of the report you see in the report coverage tab of the build output. We&#8217;ve found this the most instructive.</p>
<h3>q: Sorting:</h3>
<div id="_mcePaste">a: Coverage Percentage Ascending</div>
<p>desc: fairly obvious.</p>
<h1>The Report</h1>
<p>When all the above is done what you get :</p>
<h2>Individual Build Summary</h2>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityNCoverOutput11.jpg"><img class="aligncenter size-large wp-image-228" style="border: 1px solid black;" title="TeamCityNCoverOutput1" src="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityNCoverOutput11-550x174.jpg" alt="" width="550" height="174" /></a></p>
<h2>Coverage Tab of each build:</h2>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityNCoverOutput2.jpg"><img class="aligncenter size-large wp-image-227" title="TeamCityNCoverOutput2" src="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityNCoverOutput2-550x491.jpg" alt="" width="550" height="491" /></a></p>
<h2>Build statics graphs</h2>
<p><a href="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityNCoverOutput3.jpg"><img class="aligncenter size-large wp-image-229" title="TeamCityNCoverOutput3" src="http://www.thunkitup.com/wp-content/uploads/2010/08/TeamCityNCoverOutput3-550x528.jpg" alt="" width="550" height="528" /></a></p>
<h1>Conculsion</h1>
<p>Thats it a simple guide to getting Coverage reports going in teamcity.</p>
<p>I hope to follow this up with another blog post about how to use the coverage report to help you target where your code coverage has missed. Extracting more in depth targeting than the graphs alone provide&#8230; but thats for another day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/08/enabling-test-coverage-reports-in-teamcity-5-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>#01 What&#8217;s it about?</title>
		<link>http://www.thunkitup.com/2010/07/agile-development-environment-on-a-budget-01-introduction/</link>
		<comments>http://www.thunkitup.com/2010/07/agile-development-environment-on-a-budget-01-introduction/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 14:30:06 +0000</pubDate>
		<dc:creator>simon.crozier</dc:creator>
				<category><![CDATA[Development Environment on a Budget]]></category>
		<category><![CDATA[FEATURED]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=130</guid>
		<description><![CDATA[The first in a series looking at development environment. Discussing the motivations behind each step and a practical how-to on configuring yours.]]></description>
			<content:encoded><![CDATA[<p><span style="font-weight: normal; font-size: 13px;">Welcome to the first in this series of articles relating to development environment setup. </span>What I&#8217;m trying to do here is provide an insight to our systems and the thoughts and reasoning behind why we&#8217;ve gone that way.</p>
<p>We&#8217;re not a leading authority on the subject but we&#8217;re hoping in committing this to the web we&#8217;ll stimulate comments and feedback that will help us whilst also providing a resource for others trying to do the same.</p>
<p style="text-align: justify;">This first article is going to focus more on our motivations and limitations, giving background on who we are and what we&#8217;re trying to achieve. Later articles will focus on specific items and have more of a &#8220;how-to&#8221; flavour than this. I feel its worth discussing these items first to give you an idea of where we are coming from; that should help guide you as to how much of the subsequent posts will be relevant to you.</p>
<h2 style="text-align: justify;">Who Are We ? Mighty Oaks From Small Acorns Grow</h2>
<p style="text-align: justify;"><a rel="attachment wp-att-133" href="http://www.thunkitup.com/2010/07/agile-development-environment-on-a-budget-01-introduction/large/"><img class="size-full wp-image-133 alignleft" style="margin-top: 0px; margin-bottom: 0px; margin-left: 5px; margin-right: 5px; padding: 0px;" title="Freaky Geeky" src="http://www.thunkitup.com/wp-content/uploads/2010/07/large.jpg" alt="Freaky Geeky" width="127" height="151" /></a>My name is Simon Crozier, and I am a development manager / lead developer at HighSpeedTraining, we&#8217;re based in Leeds (Yorkshire, UK). We&#8217;re not the biggest company (less than 15 people in total), and we work on a relatively modest budget &#8211; in short we&#8217;re no IBM. We definitely consider ourselves a technology company, although we work in a market that is relatively immature in IT and development terms (e-learning).</p>
<p style="text-align: justify;">Technology in e-learning is generally regarded as equipment and resource rather than key business and market drivers, as such much of what is considered the norm in other industries have yet to be widely adopted in e-learning. We&#8217;re a fairly young company and as such it&#8217;d be fair to say our development team is still finding its feet slightly but we&#8217;re committed to doing things <em>Right</em>.</p>
<p style="text-align: justify;">Its not all bad news though !&#8230; Being a small technology company everybody in the team, including non-technical members, appreciates that the good use of technology is key to allowing us to compete with our more established competitors. Further more being a young company we&#8217;re still defining our standards and we&#8217;re flexible enough to adapt and make big changes quickly. We&#8217;re also lucky enough to have a group of developers who are enthusiastic about their roles, see themselves as craftsmen and appreciate you never know enough. No RFAs here !</p>
<p style="text-align: justify;">In short we&#8217;re currently in a really positive position, but we think the decisions we make at this point will have a big impact on the company&#8217;s future. Collectively we&#8217;ve no interest in being good enough; we want to be as excellent as budget allows.</p>
<p style="text-align: justify;"><span id="more-130"></span></p>
<h2 style="text-align: justify;"><strong>What Are Our Drivers</strong></h2>
<div id="_mcePaste" style="text-align: justify;">
<div id="attachment_132" class="wp-caption alignright" style="width: 341px"><a rel="attachment wp-att-132" href="http://www.thunkitup.com/2010/07/agile-development-environment-on-a-budget-01-introduction/team_text2/"><img class="size-full wp-image-132   " style="margin-left: 5px; margin-right: 5px;" title="The development team" src="http://www.thunkitup.com/wp-content/uploads/2010/07/team_text2.jpg" alt="The development team" width="331" height="192" /></a><p class="wp-caption-text">The development team</p></div>
<p>For these articles to be useful both for us and you, its important you as the reader work out what it is you&#8217;re trying to achieve and have some appreciation for what budget you&#8217;ll have to play with. If your budget is tiny some of what we&#8217;re looking at simply won&#8217;t be practical or possible. Equally if you&#8217;ve an enormous budget some of what we&#8217;re doing won&#8217;t be appropriate for you either &#8211; in that you may have options we don&#8217;t. We&#8217;d love to get some feedback on what the rest of the world thinks about what we&#8217;ve done but a comment of &#8220;buy X piece of software its brilliant and only cost £3m&#8221; &#8211; brilliant it might be but that just ain&#8217;t going to happen for us in the near future &#8211; that said it might still be worth noting because others reading may have the budget.</p>
</div>
<p style="text-align: justify;">So what are our drivers here? As a lead developer I want my team to be producing the best software for the future of the business, to do this i need to get the best from each and every developer.</p>
<p style="text-align: justify;">Whilst that&#8217;s easy to say, it masks some basic conflicts that every development team suffers from. &#8220;How do you get the best for the future that you don&#8217;t know yet&#8221; :- if the business wanders into submarine building in ten years time, spending nine years developing an awesome cup cake icing process isn&#8217;t a good use of time.  That sort of conflict is a given really; frustrating but obvious and its visibility makes it manageable.</p>
<p style="text-align: justify;">There are also more subtle conflicts. For example the &#8220;best&#8221; code base for the business in our case is the most reliable &#8211; appreciated in other markets efficiency may trump accuracy or similar.  On the other hand the &#8220;best&#8221; code base for developers maybe written in language X that is really easy to work with but resulting code is a little haphazard. As the lead developer the best code base for me is one that can quickly adapt, is easily manageable &#8211; i.e. bugs are spotted quickly &#8211; and code quality can be assured. Whilst none of these are mutually exclusive there is often a trade-off between them somewhere.</p>
<p style="text-align: justify;">The management of these types of conflict aren&#8217;t the responsibility of any one person or a collective, everyone in the business will, at some point, have to give and take. There are things you can do to mitigate these conflicts business plans, project management, development methodologies can all combine to ease the burden but ultimately there is no total solution.</p>
<p style="text-align: justify;">There&#8217;s not even a single &#8220;good approach&#8221;.</p>
<p style="text-align: justify;">In broad strokes what we&#8217;re talking about won&#8217;t directly resolve any conflicts but it will help to highlight that there is a conflict happening, allowing a decision to be made. Our watch word here is visibility; as I&#8217;ve said there is rarely one solution but an early heads-up there is a problem festering is always a good thing.</p>
<p style="text-align: justify;">What we&#8217;re going to discuss is simply what we&#8217;ve tried, it might not even work for us&#8230; if it doesn&#8217;t we&#8217;ll try to identify why and post up our findings.</p>
<div style="text-align: justify;"><!--more--></div>
<h2 style="text-align: justify;"><strong>What Are We Talking About</strong></h2>
<p style="text-align: justify;">What we&#8217;re going to be talking about is what we&#8217;re doing with our development environment. Not the IDEs and languages as such but the processes that are triggered once the code-base has been altered. The drivers are broadly the same as mentioned above but as a developer myself discussions will likely be skewed towards the developer&#8217;s motivations with an eye on where the business is going rather than directly from the business&#8217;s point of view.</p>
<p style="text-align: justify;">The aim of this series is to not only tell you why we&#8217;ve done something but also how we&#8217;ve done it &#8211; using screen-shots and coding listings.  I&#8217;m going to try and show you the nuts and bolts of what we&#8217;re doing, while also highlighting the business motivations and impact of the individual items. Our experience has shown us that for a very little budget and a reasonable amount of time you can have a very decent development environment running. Ideally roughly following what we&#8217;re about to set out any team should be able to replicate a similar environment for very little cost and start to get the benefits.</p>
<p style="text-align: justify;">As such for the series we&#8217;re using examples surrounding our code base which is C# .net based with NUnit tests around it and some selenium tests but to be honest that shouldn&#8217;t matter too much. Most of what we&#8217;re talking about surrounds what goes on after the code has been created and is not language specific. The key components we&#8217;re talking about will actually be the continuous integration engine and post build events which are pretty much language agnostic.</p>
<h2 style="text-align: justify;">In A Nutshell</h2>
<p style="text-align: justify;"><img class="alignright size-medium wp-image-131" style="margin-left: 5px; margin-right: 5px;" title="H &amp; W Belfast Cranes" src="http://www.thunkitup.com/wp-content/uploads/2010/07/228695837_d4daa02c2d-225x300.jpg" alt="H &amp; W Belfast Cranes" width="225" height="300" /></p>
<p style="text-align: justify;">I was explaining the idea for these articles to a non-technical friend and the best metaphor I could come up with was that I discussing building a crane. If you know in advance you&#8217;re building project is going to need a lot of lifting and shifting of heavy stuff the first thing you do is build the crane.</p>
<p style="text-align: justify;">There is little value in the crane itself, and it could even be described as non-essential. But in a lot of circumstances the things the crane allows you to do and the speed it allows you to do them more than justify the cost of the crane and its construction.</p>
<p style="text-align: justify;">I see the things we&#8217;re going to discuss as similar, arguably non-essentials but the abilities they offer have what I&#8217;d think is a massive positive effect on the development team and their ability to consistently produce high quality code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/07/agile-development-environment-on-a-budget-01-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adv. JavaScript 1 / 3</title>
		<link>http://www.thunkitup.com/2010/07/douglas-crockford-advanced-javascript-1-of-3/</link>
		<comments>http://www.thunkitup.com/2010/07/douglas-crockford-advanced-javascript-1-of-3/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 13:08:02 +0000</pubDate>
		<dc:creator>dan.jordan</dc:creator>
				<category><![CDATA[VIDEO]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=120</guid>
		<description><![CDATA[Douglas Crockford speaks a lot of sense about Javascript and this talk (the first of his three part series) covers alot of interesting information about the correct use of Javascript. If only they hadn&#8217;t called Javascript JAVA &#8211; Script, perhaps people wouldn&#8217;t try write software in a Java style&#8230; http://video.yahoo.com/watch/111585/1027823]]></description>
			<content:encoded><![CDATA[<p>Douglas Crockford speaks a lot of sense about Javascript and this talk (the first of his three part series) covers alot of interesting information about the correct use of Javascript. If only they hadn&#8217;t called Javascript JAVA &#8211; Script, perhaps people wouldn&#8217;t try write software in a Java style&#8230;</p>
<p><a href="http://video.yahoo.com/watch/111585/1027823">http://video.yahoo.com/watch/111585/1027823</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/07/douglas-crockford-advanced-javascript-1-of-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Epic win for a dead format!</title>
		<link>http://www.thunkitup.com/2010/07/epic-win-for-a-dead-format/</link>
		<comments>http://www.thunkitup.com/2010/07/epic-win-for-a-dead-format/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 15:47:21 +0000</pubDate>
		<dc:creator>dan.jordan</dc:creator>
				<category><![CDATA[DEV ENVIRONMENTS]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=111</guid>
		<description><![CDATA[I admit it today I used a floppy disk! Who would&#8217;ve thunk it? In order to build our dev environment we decided to buy obselete servers from ebay and use them as virtual hosts. The idea being that we could back up the virtual servers easily and just move them about as hardware dies or [...]]]></description>
			<content:encoded><![CDATA[<p>I admit it today I used a floppy disk! Who would&#8217;ve thunk it?</p>
<p>In order to build our dev environment we decided to buy obselete servers from ebay and use them as virtual hosts. The idea being that we could back up the virtual servers easily and just move them about as hardware dies or becomes bogged down. My advice if you are considering this same path is DON&#8217;T DO IT!</p>
<p>I thought floppy drives were a thing of the past, my development manager is convinced having DVD drives are a thing of the past but still one came to my rescue today. Turns out if you want to load a third party RAID driver into windows setup you need to use one, slipstreaming an install is an option but if you aren&#8217;t sure what driver you need you go through an awful lot of cd&#8217;s.</p>
<p>Also got to use a dos boot disk today aswell, even edited a config.sys file (remember them? think games an not enough high memory and it&#8217;ll all come flooding back&#8230;).</p>
<p>Still we now have a dual AMD Opteron 250 and a Dell Power Edge 2850 running 64bit Windows 2003. We&#8217;ll see how the hardware stands up to what we&#8217;re throwing at it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/07/epic-win-for-a-dead-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Realtime analytics for Twitter coming soon?</title>
		<link>http://www.thunkitup.com/2010/07/realtime-analytics-for-twitter-coming-soo/</link>
		<comments>http://www.thunkitup.com/2010/07/realtime-analytics-for-twitter-coming-soo/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 08:36:21 +0000</pubDate>
		<dc:creator>bomski</dc:creator>
				<category><![CDATA[CODE]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=106</guid>
		<description><![CDATA[Over at the engineering blog at Twitter; an interesting mention of  &#8216;Cassandra&#8217; has appeared; Reading further into this; it would appear that the guys at Twitter are proposing to use Apache Cassandra for their new realtime analytics product. It remains to be seen whether or not Twitter will be charging for this service, as part [...]]]></description>
			<content:encoded><![CDATA[<p>Over at the <a href="http://engineering.twitter.com/2010/07/cassandra-at-twitter-today.html" target="_blank">engineering blog</a> at Twitter; an interesting mention of  &#8216;Cassandra&#8217; has appeared; Reading further into this; it would appear that the guys at Twitter are proposing to use Apache Cassandra for their new realtime analytics product. It remains to be seen whether or not Twitter will be charging for this service, as part of their &#8220;monetisation strategy&#8221;.</p>
<p><a href="http://cassandra.apache.org/" target="_blank">Cassandra</a> is a second-generation distributed database that was open-sourced by Facebook back in 2008.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/07/realtime-analytics-for-twitter-coming-soo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft&#8217;s new Web Development Suite &#8211; WebMatrix</title>
		<link>http://www.thunkitup.com/2010/07/microsofts-new-web-development-suite-webmatrix/</link>
		<comments>http://www.thunkitup.com/2010/07/microsofts-new-web-development-suite-webmatrix/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 08:28:33 +0000</pubDate>
		<dc:creator>bomski</dc:creator>
				<category><![CDATA[CODE]]></category>
		<category><![CDATA[DEV ENVIRONMENTS]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=101</guid>
		<description><![CDATA[Microsoft has announced a complete web development package called WebMatrix. WebMatrix is everything you need to build a static or dynamic website &#8211; the package encompasses IIS Developer Express (a dev webserver), ASP.NET (web framework) and SQL Server Compact (embedded database). The package integrates code editor, database editor, web server management, SEO, and FTP publishing, [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft has announced a complete web development package called WebMatrix.</p>
<p>WebMatrix is everything you need to build a static or dynamic website &#8211; the package encompasses IIS Developer Express (a dev webserver), ASP.NET (web framework) and SQL Server Compact (embedded database).</p>
<p>The package integrates code editor, database editor, web server management, SEO, and FTP publishing, allowing you to seamlessly build, develop and deploy your web project.</p>
<p>WebMatrix provides an easy way to get started with Web development. With an integrated code editor and a database editor, Web site and server management, search optimization, FTP publishing, and more, WebMatrix provides a fresh, new Web site development experience which seamlessly bridges all the key components you need in order to create, run, and deploy a Web site.</p>
<p>WebMatrix is currently in Beta testing; however it is freely available for Windows users &#8211; <a href="http://www.microsoft.com/web/webmatrix/" target="_blank">Give it a spin!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/07/microsofts-new-web-development-suite-webmatrix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing SVN Server on Windows</title>
		<link>http://www.thunkitup.com/2010/07/installing-svn-serve-on-windows/</link>
		<comments>http://www.thunkitup.com/2010/07/installing-svn-serve-on-windows/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 09:22:00 +0000</pubDate>
		<dc:creator>dan.jordan</dc:creator>
				<category><![CDATA[DEV ENVIRONMENTS]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=88</guid>
		<description><![CDATA[Subversion server is a fantastic option for source control in your organisation, its both mature, reliable, free and makes Visual Source Safe look like a clumsy oaf. You can install SVN server either on a Linux platform (we&#8217;ve had it running nicely on Ubuntu) or on Windows. You can then perform all the required updates [...]]]></description>
			<content:encoded><![CDATA[<p>Subversion server is a fantastic option for source control in your organisation, its both mature, reliable, free and makes Visual Source Safe look like a clumsy oaf.</p>
<p>You can install SVN server either on a Linux platform (we&#8217;ve had it running nicely on Ubuntu) or on Windows. You can then perform all the required updates etc to your code using the fantastic tortoise SVN Client - <a title="Tortoise SVN Client" href="http://tortoisesvn.tigris.org/">http://tortoisesvn.tigris.org/</a></p>
<p>Now it&#8217;s easier than ever before to install on Windows so there can be no excuses! A developer called bkohrs has developed a 1-click setup App that is effectively just &#8220;fire and forget&#8221;. You can find this setup here: <a href="http://svn1clicksetup.tigris.org/">http://svn1clicksetup.tigris.org/</a> &#8211; many thanks to bkohrs for developing this tool.</p>
<p>This app gives you a basic install from which you can work, with this you can get an SVN Server up and running in minutes! To access your server using Tortoise simply enter the address for your repository in the form: svn://YOUR_SERVER_NAME and use the browse repo option.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/07/installing-svn-serve-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why hasn&#8217;t e-assessment arrived more quickly?</title>
		<link>http://www.thunkitup.com/2010/07/why-hasnt-e-assessment-arrived-more-quickly/</link>
		<comments>http://www.thunkitup.com/2010/07/why-hasnt-e-assessment-arrived-more-quickly/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 19:55:44 +0000</pubDate>
		<dc:creator>bomski</dc:creator>
				<category><![CDATA[FEATURED]]></category>

		<guid isPermaLink="false">http://www.thunkitup.com/?p=61</guid>
		<description><![CDATA[Ken Boston was bullish about the power of technology to transform the educational experience of millions of pupils. &#8220;On-screen assessment will shortly touch the life of every learner in this country,&#8221; predicted Boston, at the time chief executive of the Qualifications and Curriculum Authority, in a speech at London&#8217;s Royal Festival Hall, setting out his [...]]]></description>
			<content:encoded><![CDATA[<p>Ken Boston was bullish about the power of technology to transform the educational experience of millions of pupils.<span id="more-61"></span> &#8220;On-screen assessment will shortly touch the life of every learner in this country,&#8221; predicted Boston, at the time chief executive of the Qualifications and Curriculum Authority, in a speech at London&#8217;s Royal Festival Hall, setting out his organisation&#8217;s &#8220;blueprint&#8221; for the use of technology in exams.</p>
<p>But that was back in 2004, and few experts would say that he has been proved right. In fact, five years on, none of the predictions Boston made on that day has turned out to be correct.</p>
<p>Sceptics, then, might have let out a weary sigh at the Guardian&#8217;s revelation last week that Simon Lebus, chief executive of Cambridge Assessment, a department of Cambridge University and the umbrella organisation for exam boards including OCR, was offering a similar promise: that traditional pen-and-paper exams could be obsolete in the next 10 to 15 years, to be replaced by computerised testing. For many in this field, the big question has been why, given that technological change has happened quickly in so many other areas of life, the pace of reform in this area means that, for most pupils, taking exams still means scribbling on paper.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thunkitup.com/2010/07/why-hasnt-e-assessment-arrived-more-quickly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
