What the hell is Continuous Integration Anyway?
For those of you unfamiliar with the term here is the Wikipedia definition:
“In software engineering, continuous integration (CI) implements continuous processes of applying quality control - small pieces of effort, applied frequently. Continuous integration aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing the traditional practice of applying quality control after completing all development.”
My personal definition is:
“Giving a damn that the code you write is not breaking the app considering that other developers are working on the code base at the same time and realizing that you are not infallible.”
Sounds a lot like common sense right? But when you have a room filled with developers who are adamant THEIR code could not possibly be responsible for a build failure… it REALLY helps to have a system in place.
I can still remember a time when builds were a matter of gritted teeth, chewed finger nails, white knuckles and headless chickens.
In some ways I don’t think we have improved all that much as a programmers, certainly the skill sets have become more diverse but I for one am a little less daring than I used to be.
But there is one undeniable fact:
The quality of my code and and my teams code has improved exponentially.
We MAKE deadlines, our code’s quality is quantifiable (due to quality unit and integration testing) and most importantly if I needed to run an emergency release/build at ANY time, I am ALWAYS a couple of clicks away from a working copy of any of the applications in our portfolio. This means I sleep better, this means a cold one tastes like it should, this means I am not worried about a bonus coming in December!
Raiders of the Lost Ark
There are a lot of Indiana Jones, seat of your pants outfits out there and hand on heart I used to be one of them, that’s not to say I haven’t produced some really “out there” code which worked very well indeed, but when it comes to thousands and hundreds of thousands of dollars you are playing with, the time has really come to stop letting the seat of you pants take the strain.
Don’t get me wrong, you wouldn’t catch me dead being a code Nazi, it would be a total cluster (something beginning with f) if we started to value precision over ingenuity and creativity in our code.
BUT……… There are some SMART steps you CAN take to narrow the odds and Continuous integration is definitely one of them.
Way back when there were very few tools to help you do this, I started running 2 builds a day (using a get latest from Visual Source Safe), ran the test fixtures then confirmed it built and finally kept a copy on my machine locally. Which is kind of the equivalent of digging a coal mine with a Spork.
So what if I told you there was a way to do this all for FREE AND let you sleep better AND give you more time to think about the important stuff?
Drum Roll please…
Daadaaa Your Free Continuous Integration Toolkit:
There are lots to choose from, we first tried Cruisecontrol.net, but we ran into several issues, mostly reliability. I am sure it is probably light years better these days, but it is an open source project. We finally settled on TeamCity from Jetbrains (who also make ReSharper) this is a seasoned product with amazing functionality and it is 100% free for the Professional Edition.
Check out the comprehensive list of features here:
Where TeamCity really excels is that with very little setup you have totally automated Continuous Integration solution, which doesn’t break!
Download TeamCity Here:
2. Source Control (Code Repository)
Luckily, Visual Source Safe is dead (for good reason, I was absolutely sick of fixing the source safe database 4 times a week) and we have been using VisualSVN server (Subversion server for Windows), which never breaks, ever since.
Tortoise SVN integrates nicely with the windows shell and if you are looking for tight Visual Studio Integration then take a look at Ankh SVN (Free).
Download Ankh SVN Here:
Download VisualSVN Server Here:
3. Testing Framework
You can of course use MSTest (built in to Visual Studio) but we like NUnit (or old faithful as we know her). We like NUnit because ReSharper (Not Free but worth EVERY penny) has wicked good NUnit test support, so it is really easy to run tests locally in the Visual Studio IDE (ReSharper has a testing result window which clearly displays results). There are of course plenty of other free testing frameworks out there, and if you combine this with mocking tools like Telerik’s Just Mock you have a really powerful non-invasive testing solution.
Download NUnit Here:
In fairness many of our choices were based upon a cool Screencast one of my team found over at Rob Connery’s Kona blog which actually details setting up TeamCity and hooking it into unit testing, subversion etc. it also offers some insight on quality testing so it is a must watch, especially if you want a detailed walkthrough to help you to set up the Continuous Integration stack detailed above.
I always encourage my team to dive into the creativity gene pool because this gives us a competitive edge, Continuous Integration is about refining the process of Software Development so that your team really does function like a team and ergo the products you produce are of high quality, within budget and on time. While Continuous Integration is a guideline or development philosophy, having a set of tools to automate the process is invaluable when realizing the goal, taking the pain out of patterns and best practices is half the battle to making them stick!
Trust me, the less effort your team has to make to conform to a programming paradigm the exponentially more likely they are to do it, it’s just human nature!