<?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>The Inquisitive Coder - Davy Brion&#039;s Blog &#187; Continuous Integration</title> <atom:link href="http://davybrion.com/blog/category/continuous-integration/feed/" rel="self" type="application/rss+xml" /><link>http://davybrion.com/blog</link> <description>inquisitive: adjective. given to inquiry, research, or asking questions; eager for knowledge; intellectually curious</description> <lastBuildDate>Sun, 29 Jan 2012 10:48:12 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Continuous Integration On A Real, Big Project</title><link>http://davybrion.com/blog/2009/05/continuous-integration-on-a-real-big-project/</link> <comments>http://davybrion.com/blog/2009/05/continuous-integration-on-a-real-big-project/#comments</comments> <pubDate>Sun, 24 May 2009 19:45:54 +0000</pubDate> <dc:creator>Davy Brion</dc:creator> <category><![CDATA[Continuous Integration]]></category><guid
isPermaLink="false">http://davybrion.com/blog/?p=1393</guid> <description><![CDATA[Some of you may remember a post of mine where i showed the complete lack of attention that was being paid to the Continuous Integration of one of our projects. This particular project is pretty big. The development of this project has gone on for years, and will keep going for years to come as [...]]]></description> <content:encoded><![CDATA[<p>Some of you may remember a post of mine where i showed <a
href="http://davybrion.com/blog/2009/03/continuous-failure/">the complete lack of attention that was being paid to the Continuous Integration of one of our projects</a>.  This particular project is pretty big.  The development of this project has gone on for years, and will keep going for years to come as it is a strategically important project for us.  The actual system is used internally by our company as well as a growing list of customers.</p><p>There are essentially 2 big problems with this project.  One is a mountain of legacy code with so much technical debt (due to <a
href="http://davybrion.com/blog/2008/09/beware-the-evils-of-code-generation/">the evils</a> of <a
href="http://www.codethinked.com/post/2009/05/05/Code-Generation-Should-be-the-Nuclear-Option.aspx">code generation</a>) it sorta resembles the current economic recession (as in: it'll take a <strong>long</strong> time to get everything sorted out).  The other problem is more a matter of organization.  We're a pretty small company and while we have great ideas for products, we simply can't assign a steady, stable team of developers to work on any of these projects on a continuous basis since we all often need to work on stuff that is simply more lucrative at that particular point in time.  The result is that this particular project typically has an ever rotating group of developers working on it, usually for short periods of time.  Some people work almost full-time on it, but that list is pretty limited.</p><p>Not exactly the ideal situation for a large project to apply CI and other agile development practices to, right?  Luckily for us, we're quite stubborn and we try to make the best out of every situation.  So back when this project's CI success rate was <a
href="http://davybrion.com/blog/2009/03/continuous-failure/">only showing a lack of success</a>, we all agreed to follow the <a
href="http://davybrion.com/blog/2009/03/continuous-integration-101/">CI rules</a> and at this point, i'm pretty proud to be able to show you guys the following picture:</p><p><img
src="http://davybrion.com/blog/wp-content/uploads/2009/05/image001.png" alt="image001" title="image001" width="979" height="864" class="aligncenter size-full wp-image-1394" /></p><p>Note: we moved to <a
href="http://www.jetbrains.com/teamcity/index.html">Team City</a> in July 2008 so i can't show you any earlier data than that.</p><p>Anyways, as you can see, after the dismal months of February and March, the success rate of the CI build gradually started improving again.  The average time to fix failing tests also decreased sharply.  We still have failing tests from time to time, but at least now they're all dealt with in a timely fashion.  We still have build failures, though those have decreased a lot as well and are always dealt with pretty soon now.  I'm not sure if this is because of my 'Continuous Bitching' whenever the build fails, or that everyone bought into the concept of CI again (for my own sake, i'll just assume that it's the latter instead of the former) but i'm pretty happy with the results that we're getting.</p><p>Also, take a look at the number of tests (we're at 16000+ now) and the duration of the build.  The build time is about 48 minutes on average now, which is obviously way above the recommended 10 minutes.  I'd love to see this go down to about 20 minutes (which i'd find very acceptable considering the size of the project) but that's gonna take a long while.  Of those 16000 tests, there are about 13000 tests that cover the legacy code and they <strong>all</strong> use the database.  And since those 13000 tests use a generated data layer, we can't just let it run on an in-memory database nor can we mock the database in those tests because all of that generated code, and pretty much everything that was written on top of it, is coupled more tightly than Siamese Twins.  We also lose a couple of minutes of build time due to our <a
href="http://davybrion.com/blog/2008/11/genesis-bridging-the-gap-between-requirement-and-code/">Genesis processing</a> but that is simply something that we can't go without anymore so we don't really mind the extra build time of that part.</p><p>So there you have it... the reason i wanted to post this is because when the topic of CI comes up, you always read about 'instant feedback' and really quick builds and things like that.  It's simply not always like that in the real world.  But with a bit of effort and focus, you can get many of the benefits that are usually attributed to CI, even on huge projects with lots of legacy code.</p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdavybrion.com%2Fblog%2F2009%2F05%2Fcontinuous-integration-on-a-real-big-project%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://davybrion.com/blog/2009/05/continuous-integration-on-a-real-big-project/"></g:plusone></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://davybrion.com/blog/2009/05/continuous-integration-on-a-real-big-project/"  data-text="Continuous Integration On A Real, Big Project" data-count="horizontal" data-via="davybrion">Tweet</a></div><div
style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://davybrion.com/blog/2009/05/continuous-integration-on-a-real-big-project/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://davybrion.com/blog/2009/05/continuous-integration-on-a-real-big-project/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://davybrion.com/blog/2009/05/continuous-integration-on-a-real-big-project/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>Continuous Integration 101</title><link>http://davybrion.com/blog/2009/03/continuous-integration-101/</link> <comments>http://davybrion.com/blog/2009/03/continuous-integration-101/#comments</comments> <pubDate>Tue, 17 Mar 2009 19:43:19 +0000</pubDate> <dc:creator>Davy Brion</dc:creator> <category><![CDATA[Continuous Integration]]></category><guid
isPermaLink="false">http://davybrion.com/blog/?p=1146</guid> <description><![CDATA[More and more people are working in teams where Continuous Integration is used. Not everyone truly 'gets' it though... Below is a quick list of things you, as a member of the team, need to keep in mind. Before you commit your changes to the repository: You update your local copy to get all of [...]]]></description> <content:encoded><![CDATA[<p>More and more people are working in teams where Continuous Integration is used.  Not everyone truly 'gets' it though... Below is a quick list of things you, as a member of the team, need to keep in mind.</p><p>Before you commit your changes to the repository:</p><ol><li>You update your local copy to get all of the changes that were committed since you last updated your local copy</li><li>If there are conflicts, you resolve them in your local copy... you DO NOT simply overwrite other people's changes</li><li>You compile your code (You'd think nobody would forget this one, right? Think again...)</li><li>If it doesn't compile, you fix it (Again, you'd think nobody would forget this one....)</li><li>If it compiles, you run the tests.  At least run the fast tests, and i do mean all of them, not the ones you just wrote or modified.  If you have thousands of slow tests, then you obviously can't run them every single time you need to commit.  But you can and should definitely run the fast tests. Yes, all of them!</li><li>If a test fails, fix the code that broke it, or fix the test if it's no longer correct.  Repeat this process until none of the fast tests fail.</li><li>Commit your code, and begin working on your next task, take a break, go home, whatever is most appropriate at the time.</li></ol><p>For the next section, i'm going to assume that everyone has at least something that continuously visualizes the state of the automated build, either TV's on the wall (like we have), or at least a system tray notifier (like we also have).</p><p>When the build breaks:</p><ol><li>If none of your team members beat you to it, look at the build results to figure out why it broke</li><li>If it's a compile error, alert the team (so they don't accidentally update their local copy with the broken code), and figure out who's responsible.  MAKE SURE THE COMPILE ERROR(S) ARE FIXED ASAP.  As a team, punish the guilty one for wasting the team's time (make the guilty one buy donuts, pizza, make them wear a dress for a day, whatever works...)</li><li>If it broke because of failing tests, look at the failures.  Where you the last one to touch those tests or the code that was being tested by them? Then fix it ASAP.  Was it someone else?  Discuss this with the person who's responsible.  If the developer who's responsible has time to fix it, then he/she must fix it at once.  If the developer can't fix it instantly, then someone else has to step up and fix it.  DO NOT WAIT FOR SOMEBODY ELSE TO FIX THEM.  Discuss it with the team and agree on someone to fix the tests.  If you're not sitting with the rest of the team, pick up the phone, use IM, whatever.  But at least do something!</li><li>Repeat these steps until the build is green again.</li></ol><p>As a member of the team, you have certain responsibilities.  Every team member has them.  You have to take your responsibilities seriously, if not, you're just wasting your team members' time.  At the same time, you should hold your team members accountable when they fail to take their responsibility serious.  Don't fight about it, but talk about it as a team.  When people don't do what they are supposed to do, discuss it with the entire team and after a couple of times (at most) people will feel that social pressure to not let the team down again.  If they don't, well then maybe they shouldn't be part of the team in the first place but that's a whole other story.</p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdavybrion.com%2Fblog%2F2009%2F03%2Fcontinuous-integration-101%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://davybrion.com/blog/2009/03/continuous-integration-101/"></g:plusone></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://davybrion.com/blog/2009/03/continuous-integration-101/"  data-text="Continuous Integration 101" data-count="horizontal" data-via="davybrion">Tweet</a></div><div
style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://davybrion.com/blog/2009/03/continuous-integration-101/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://davybrion.com/blog/2009/03/continuous-integration-101/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://davybrion.com/blog/2009/03/continuous-integration-101/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>What A Slow Build Might Tell You</title><link>http://davybrion.com/blog/2008/09/what-a-slow-build-might-tell-you/</link> <comments>http://davybrion.com/blog/2008/09/what-a-slow-build-might-tell-you/#comments</comments> <pubDate>Sat, 06 Sep 2008 12:06:20 +0000</pubDate> <dc:creator>Davy Brion</dc:creator> <category><![CDATA[Continuous Integration]]></category><guid
isPermaLink="false">http://davybrion.com/blog/?p=395</guid> <description><![CDATA[If you've ever read something about Test Driven Development or Continuous Integration then you've undoubtedly read that one of the key advantages of these practices is to shorten the feedback loop of your development process. Basically, that means being able to detect bugs or mistakes as soon as possible and being able to fix them [...]]]></description> <content:encoded><![CDATA[<p>If you've ever read something about Test Driven Development or Continuous Integration then you've undoubtedly read that one of the key advantages of these practices is to shorten the feedback loop of your development process.  Basically, that means being able to detect bugs or mistakes as soon as possible and being able to fix them as quickly as possible with as little effort as possible while keeping the quality and sanity of your code base as high as possible.</p><p>Those are obviously important goals. There's another reason why a fast build (with that i mean building the code and running all of the tests) is important.  I believe the duration of a build can be a good indication of the complexity and the quality of <strong>the code base</strong> of your project. If a build takes a long time, it's usually a strong indication that something is definitely not right in the code.</p><p>Let's apply the technique of <a
href="http://en.wikipedia.org/wiki/Root_cause_analysis">Root Cause Analysis</a> to the problem of a slow build of a fictional (yet very common) project:</p><p>Question: Why is the build so slow?
Answer: Because the tests take a long time to run</p><p>Question: Why do the tests take so long?
Answer: Because we need a lot of set up in the code to be able to run the tests</p><p>Question: Why do we need all that set up?
Answer: Because the code under test requires a lot of stuff to be in place before we can run it</p><p>Question: Why does the code under test require a lot of stuff to be in place before we can run it?
Answer: Because those classes do a lot of stuff... they get data from the database, do something with it and put it back into the database.</p><p>Question: Why do those classes do so much?
Answer: They instantiate Data Access Components and they don't work without real data in the database.</p><p>Bingo.</p><p>On a code level, what is the problem here? The last 2 answers indicate that the classes that are being tested have too many responsibilities and that there probably is a lot of highly coupled code in there.  By looking at the build time and asking those questions to the developers, you're able to learn a lot about the quality of the code without having any prior knowledge about the project or the code.</p><p>Obviously, it's not always possible to reach valid conclusions based purely on the build time of a project.  But again, it can be a great indication.</p><p>Now, the project mentioned above might actually have a really low number of bugs in it.  The application might even be perfect according to its users.  But that doesn't mean that the code of the application is in good shape.  If the code were in better shape, it might have been cheaper to develop the application.  It might mean that the maintenance of the code would be cheaper too.  But the slow build and the answers to the question do indicate complexity in the code.  We can't always eliminate complexity but we should strive to minimize it, because it leads to cheaper development in the long term.</p><p>Granted, a fast build time doesn't always mean that a code base is in great shape either.  That's a conclusion you could only reach by looking at the code and going through the tests.  But for slow builds, you'd be amazed what you could quickly learn from a few questions.</p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdavybrion.com%2Fblog%2F2008%2F09%2Fwhat-a-slow-build-might-tell-you%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://davybrion.com/blog/2008/09/what-a-slow-build-might-tell-you/"></g:plusone></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://davybrion.com/blog/2008/09/what-a-slow-build-might-tell-you/"  data-text="What A Slow Build Might Tell You" data-count="horizontal" data-via="davybrion">Tweet</a></div><div
style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://davybrion.com/blog/2008/09/what-a-slow-build-might-tell-you/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://davybrion.com/blog/2008/09/what-a-slow-build-might-tell-you/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://davybrion.com/blog/2008/09/what-a-slow-build-might-tell-you/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>The CI Build should be a given</title><link>http://davybrion.com/blog/2008/08/the-ci-build-should-be-a-given/</link> <comments>http://davybrion.com/blog/2008/08/the-ci-build-should-be-a-given/#comments</comments> <pubDate>Tue, 19 Aug 2008 20:24:13 +0000</pubDate> <dc:creator>Davy Brion</dc:creator> <category><![CDATA[Continuous Integration]]></category><guid
isPermaLink="false">http://davybrion.com/blog/?p=340</guid> <description><![CDATA[Just read an interesting post by Tim Barcz. It's about a team struggling to adopt agile practices, and if given a chance to start over, what they should set up first: a CI build or a unit testing process. I don't understand why someone would even have to choose between them. Setting up a regular [...]]]></description> <content:encoded><![CDATA[<p>Just read an interesting <a
href="http://devlicio.us/blogs/tim_barcz/archive/2008/08/19/what-first-ci-or-unit-testing.aspx">post</a> by Tim Barcz. It's about a team struggling to adopt agile practices, and if given a chance to start over, what they should set up first: a CI build or a unit testing process.</p><p>I don't understand why someone would even have to choose between them.  Setting up a regular CI build (with that i mean a simple compile + running all the tests) for a project should never take more than 10 minutes, tops. That is assuming that you already have a build server in place, obviously.  But with <a
href="http://www.jetbrains.com/teamcity/index.html">Team City</a> being so incredibly easy to install and configure, that can no longer be an issue.</p><p>So what does it take then? Drop in a simple, standard <a
href="http://davybrion.com/blog/2008/07/basic-msbuild-script/">build script</a> which builds your project and runs the tests, add a build configuration and you're done.  Setting up a basic CI build should never take more work than that, unless you have some very specific needs, or the project structure is somewhat messy... as in: it doesn't compile if you don't have certain assemblies in folders that are either hardcoded or 'assumed' to be there... which should be avoided at all times <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>Seriously though, long build scripts or requiring a lot of time to set up a new CI build are all signs that your CI process in general needs some refracturing (nope, not a typo).</p><p>And in case you needed some motivation: even TFS 2008 allows you to set up a CI build in less than 5 minutes of work <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdavybrion.com%2Fblog%2F2008%2F08%2Fthe-ci-build-should-be-a-given%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://davybrion.com/blog/2008/08/the-ci-build-should-be-a-given/"></g:plusone></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://davybrion.com/blog/2008/08/the-ci-build-should-be-a-given/"  data-text="The CI Build should be a given" data-count="horizontal" data-via="davybrion">Tweet</a></div><div
style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://davybrion.com/blog/2008/08/the-ci-build-should-be-a-given/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://davybrion.com/blog/2008/08/the-ci-build-should-be-a-given/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://davybrion.com/blog/2008/08/the-ci-build-should-be-a-given/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Using TeamCity&#8217;s NUnit support, while keeping the output around</title><link>http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/</link> <comments>http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/#comments</comments> <pubDate>Sat, 19 Jul 2008 14:56:15 +0000</pubDate> <dc:creator>Davy Brion</dc:creator> <category><![CDATA[Continuous Integration]]></category> <category><![CDATA[MSBuild]]></category> <category><![CDATA[TeamCity]]></category><guid
isPermaLink="false">http://davybrion.com/blog/?p=178</guid> <description><![CDATA[I've been playing around with TeamCity a lot lately. It's really amazing how easy to use and powerful it is. Definitely my favorite CI server for the time being... i'm even running it at home now for my personal projects. There was one issue at work that was somewhat hard to fix though. TeamCity has [...]]]></description> <content:encoded><![CDATA[<p>I've been playing around with <a
href="http://www.jetbrains.com/teamcity/">TeamCity</a> a lot lately. It's really amazing how easy to use and powerful it is. Definitely my favorite CI server for the time being... i'm even running it at home now for my personal projects.</p><p>There was one issue at work that was somewhat hard to fix though. TeamCity has fantastic integrated support for NUnit, but unfortunately it doesn't write NUnit's output to XML files like nunit-console.exe does.  After a bit of browsing, i found a <a
href="http://intellij.net/forums/message.jspa?messageID=5218450#5218450">post</a> on the TeamCity forums that discussed a workaround on how to get the output. Unfortunately the workaround is a bit cumbersome as it requires you to you create an XML file which contains the arguments that TeamCity would pass to its NUnitLauncher task.</p><p>I believe in 'script reuse' as much as i believe in 'code reuse', so every project's build script merely imports a generic build script and then it just overwrites some variables that the generic script uses and then it kicks off the usual build process.  Since all of our projects will now be built by TeamCity Build Agents, and we definitely need to have NUnit's results xml file i wanted to automate this whole thing as much as possible.</p><p>So instead of having to create (and thus, maintain) a cumbersome xml file for each project, i wrote an MSBuild task that would generate the xml file containing the arguments on the fly during the build, and would then pass those xml arguments to TeamCity's NUnitLauncher.  This way we get to keep all of TeamCity's NUnit integration goodness, while still keeping the NUnit result files around as well.</p><p>So now in my MSBuild file, i can just do this:</p><p><code></p><div
style="font-family: Consolas; font-size: 10pt; color: black; background: white;"><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &lt;</span><span
style="color: #a31515;">CreateItem</span><span
style="color: blue;"> </span><span
style="color: red;">Include</span><span
style="color: blue;">=</span>"<span
style="color: blue;">**\Bin\Debug\*Tests*.dll</span>"<span
style="color: blue;"> &gt;</span></p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &nbsp; &lt;</span><span
style="color: #a31515;">Output</span><span
style="color: blue;"> </span><span
style="color: red;">TaskParameter</span><span
style="color: blue;">=</span>"<span
style="color: blue;">Include</span>"<span
style="color: blue;"> </span><span
style="color: red;">ItemName</span><span
style="color: blue;">=</span>"<span
style="color: blue;">TestAssemblies</span>"<span
style="color: blue;"> /&gt;</span></p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &lt;/</span><span
style="color: #a31515;">CreateItem</span><span
style="color: blue;">&gt;</span></p><p
style="margin: 0px;">&nbsp;</p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &lt;</span><span
style="color: #a31515;">BuildTeamCityNUnitArguments</span><span
style="color: blue;"> </span><span
style="color: red;">HaltOnError</span><span
style="color: blue;">=</span>"<span
style="color: blue;">true</span>"<span
style="color: blue;"> </span><span
style="color: red;">HaltOnFirstTestFailure</span><span
style="color: blue;">=</span>"<span
style="color: blue;">true</span>"</p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span
style="color: red;">HaltOnFailureAtEnd</span><span
style="color: blue;">=</span>"<span
style="color: blue;">true</span>"<span
style="color: blue;"> </span><span
style="color: red;">TestAssemblies</span><span
style="color: blue;">=</span>"<span
style="color: blue;">@(TestAssemblies)</span>"</p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span
style="color: red;">NUnitResultsOutputFolder</span><span
style="color: blue;">=</span>"<span
style="color: blue;">TestResults</span>"<span
style="color: blue;"> </span></p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span
style="color: red;">PathOfNUnitArgumentsXmlFile</span><span
style="color: blue;">=</span>"<span
style="color: blue;">nunitarguments.xml</span>"<span
style="color: blue;"> /&gt;</span></p><p
style="margin: 0px;">&nbsp;</p><p
style="margin: 0px;">&nbsp;</p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &lt;</span><span
style="color: #a31515;">Exec</span><span
style="color: blue;"> </span><span
style="color: red;">Command</span><span
style="color: blue;">=</span>"<span
style="color: blue;">$(teamcity_dotnet_nunitlauncher) @@ nunitarguments.xml</span>"<span
style="color: blue;"> /&gt;</span></p></div><p></code></p><p>As you can see, there is nothing project-specific in there so this just integrates nicely into each build that we need.  The only limitation to this approach is that TeamCity's NUnitLauncher will write one NUnit result file for each assembly containing tests. Apparently there is no way in the current version of TeamCity to get it to combine those results.  We use an extra tool to analyze the NUnit output after the tests have run, and unfortunately it requires all of the results to be in one file.  I looked around for a way to merge the output of several NUnit result files, but i didn't find something that was already available.  So i wrote another MSBuild task that would merge the output into one xml file:</p><p><code></p><div
style="font-family: Consolas; font-size: 10pt; color: black; background: white;"><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &lt;</span><span
style="color: #a31515;">CreateItem</span><span
style="color: blue;"> </span><span
style="color: red;">Include</span><span
style="color: blue;">=</span>"<span
style="color: blue;">TestResults\*.xml</span>"<span
style="color: blue;"> &gt;</span></p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &nbsp; &lt;</span><span
style="color: #a31515;">Output</span><span
style="color: blue;"> </span><span
style="color: red;">TaskParameter</span><span
style="color: blue;">=</span>"<span
style="color: blue;">Include</span>"<span
style="color: blue;"> </span><span
style="color: red;">ItemName</span><span
style="color: blue;">=</span>"<span
style="color: blue;">NUnitOutputXmlFiles</span>"<span
style="color: blue;">/&gt;</span></p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &lt;/</span><span
style="color: #a31515;">CreateItem</span><span
style="color: blue;">&gt;</span></p><p
style="margin: 0px;">&nbsp;</p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &lt;</span><span
style="color: #a31515;">NUnitMergeOutput</span><span
style="color: blue;"> </span><span
style="color: red;">NUnitOutputXmlFiles</span><span
style="color: blue;">=</span>"<span
style="color: blue;">@(NUnitOutputXmlFiles)</span>"<span
style="color: blue;"> </span></p><p
style="margin: 0px;"><span
style="color: blue;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span
style="color: red;">PathOfMergedXmlFile</span><span
style="color: blue;">=</span>"<span
style="color: blue;">TestResults.xml</span>"<span
style="color: blue;"> /&gt;</span></p></div><p></code></p><p>Now we finally have all of TeamCity's goodness while we still get to run our post-test analysis on the NUnit result file that contains the testresults of all the test assemblies <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>You can find the code of the MSBuild tasks <a
href="http://davybrion.com/blog/stuff/">here</a>.  They are BSD-licensed so feel free to use them if you need them.</p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdavybrion.com%2Fblog%2F2008%2F07%2Fusing-teamcitys-nunit-support-while-keeping-the-output-around%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/"></g:plusone></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/"  data-text="Using TeamCity&#8217;s NUnit support, while keeping the output around" data-count="horizontal" data-via="davybrion">Tweet</a></div><div
style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/feed/</wfw:commentRss> <slash:comments>16</slash:comments> </item> <item><title>New book on Continuous Integration</title><link>http://davybrion.com/blog/2007/08/new-book-on-continuous-integration/</link> <comments>http://davybrion.com/blog/2007/08/new-book-on-continuous-integration/#comments</comments> <pubDate>Thu, 02 Aug 2007 06:03:17 +0000</pubDate> <dc:creator>Davy Brion</dc:creator> <category><![CDATA[Books]]></category> <category><![CDATA[Continuous Integration]]></category><guid
isPermaLink="false">http://ralinx.wordpress.com/2007/08/02/new-book-on-continuous-integration/</guid> <description><![CDATA[As part of Martin Fowler's Signature Series, a new book on Continuous Integration has been released written by Paul Duvall (with guest contributions from other authors as well). The book is called Continuous Integration: Improving Software Quality and Reducing Risk... should be pretty interesting. I already ordered my copy Tweet]]></description> <content:encoded><![CDATA[<p>As part of Martin Fowler's Signature Series, a new book on Continuous Integration has been released written by Paul Duvall (with guest contributions from other authors as well).  The book is called <a
href="http://www.amazon.com/Continuous-Integration-Improving-Addison-Wesley-Signature/dp/0321336380/ref=pd_bbs_sr_1/103-6901717-6302237?ie=UTF8&amp;s=books&amp;qid=1186034335&amp;sr=1-1"><i>Continuous Integration: Improving Software Quality and Reducing Risk</i></a>... should be pretty interesting. I already ordered my copy <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdavybrion.com%2Fblog%2F2007%2F08%2Fnew-book-on-continuous-integration%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://davybrion.com/blog/2007/08/new-book-on-continuous-integration/"></g:plusone></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://davybrion.com/blog/2007/08/new-book-on-continuous-integration/"  data-text="New book on Continuous Integration" data-count="horizontal" data-via="davybrion">Tweet</a></div><div
style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://davybrion.com/blog/2007/08/new-book-on-continuous-integration/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://davybrion.com/blog/2007/08/new-book-on-continuous-integration/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://davybrion.com/blog/2007/08/new-book-on-continuous-integration/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/43 queries in 0.016 seconds using disk: basic
Object Caching 676/754 objects using disk: basic
Content Delivery Network via Amazon Web Services: CloudFront: d18sni7re4ly7f.cloudfront.net

Served from: davybrion.com @ 2012-02-08 05:50:54 -->
