MSDN Magazine - March 2008 - (Page 71) ated an installer by adding a Visual Studio® Web Setup Project to the solution. I then added the primary output of the guestbook project to the bin folder and the files Global.asax, GuestBook.aspx, and web.config to the Web Application Folder. With that I have an installer! This leaves a solution containing three projects: the production application guestbook, the test project GuestBook.Test, and the Deployment Project GuestBookSetup. If only we had a CI system to build it From a developer’s perspective, I find it helpful to think of CI as task-based development. After I complete a task, I submit to the build. Let’s go a little deeper here and talk about task size. Tasks are things that you can complete in a day or less. Tasks are things that, when complete, leave the system in working order. In addition, tasks are generally smaller than requirements. There are many tasks to be performed when setting up a CI server. Let’s start with the physical server that will host the CI server. First, the development environment needs to be installed on the CI server. This can include external dependencies needed for integration testing like Microsoft SQL Server® as well as controls or other runtime dependencies needed for compilation. The remainder of the development environment will contain the development directory tree. Tree Surgeon is a free tool for creating a development tree (codeplex.com/treesurgeon). The tree should have clear locations for build scripts, production source code, test source code, and third-party dependencies. With the tree defined, I can begin a build script (see Figure 3). Without getting radical, you should attempt to have no external dependencies. This increases the simplicity of your development environment. If you have no external dependencies, all that a new developer need do is copy the dev tree from the source on your server. That is the ultimate in simplicity. However, most projects include some external dependencies, so all of your external dependencies should be codified in an installation script. Check to see whether the dependency is present, and if not, install it. The script could be executing an install from a shared drive on the network or even downloading the installer from the Web. Configuration of external dependencies should be codified in Figure 3 CI Build Script GuestBook c:\Projects $(RootDirectory)\$(ProjectName) $(ProjectRootDirectory)\Trunk $(ProjectCodeLineDirectory)\Build $(ProjectCodeLineDirectory)\Source $(ProjectCodeLineDirectory)\Third Party $(SourceDirectory)\Unit Test $(SourceDirectory)\Install Getting Started Figure 1 Finished Sample App Saves Names and Comments code, increment versions, compile, run tests, execute static analysis, and create installers. Very little, if anything, varies between CI server instances. This commonality is the key for lowering the cost of adopting continuous integration. In this article I will explore the work required to set up and use a CI server and various solutions that help get the work done. I will first create a CI server manually using CruiseControl.Net, MSBuild 2.0, MbUnit, and WatiN. Following that, I will show you how to use an open source project called CI Factory to do the same thing with far less effort. The sample application I will use is a simple guestbook from the open source project NunitAsp. I will compile the application, create an Microsoft Installer (MSI) setup app, install it, and test it with WatiN. The finished guestbook application allows you to save your name and a comment, as shown in Figure 1. As you might have guessed, the app is storing the name and comment in the session state. The WatiN test for this is simple, as you can see in Figure 2. WatiN is a Microsoft® .NET testing framework built on Internet Explorer®. It will open a new instance of Internet Explorer and drive the test. The test will enter the name Jay and the comment Hello, click the save button, and validate that the guests table contains the expected content. The guestbook application does not come with an installer. I creFigure 2 Testing the Sample App [Test] public void Register() { Ie = new IE(“about:blank”); Ie.GoTo(“http://localhost/GuestBook/GuestBook.aspx”); Ie.TextField(Find.ByName(“name”)).TypeText(“Jay”); Ie.TextField(Find.ByName(“comments”)).TypeText(“Hello”); Ie.Button(Find.ByName(“save”)).Click(); Assert.AreEqual(“Jay”, Ie.TableCell(Find.By(“innerText”, “Jay”)) .Text, @”innerText does not match”); Assert.AreEqual(“Hello”, Ie.TableCell(Find.By(“innerText”, “Hello”)).Text, @”innerText does not match”); } march2008 71 http://codeplex.com/treesurgeon
Table of Contents Feed for the Digital Edition of MSDN Magazine - March 2008 MSDN Magazine - March 2008 Contents Toolbox CLR Inside Out Data Points Advanced Basics Office Space Introducing ASP.NET MVC Loosen Up CI Server Performance Office Development Test Run Security Briefs Extreme ASP.NET Foundations .NET Matters {End Bracket} MSDN Magazine - March 2008 MSDN Magazine - March 2008 - (Page Intro) MSDN Magazine - March 2008 - Contents (Page Cover1) MSDN Magazine - March 2008 - Contents (Page Cover2) MSDN Magazine - March 2008 - Contents (Page 1) MSDN Magazine - March 2008 - Contents (Page 2) MSDN Magazine - March 2008 - Contents (Page 3) MSDN Magazine - March 2008 - Contents (Page 4) MSDN Magazine - March 2008 - Contents (Page 5) MSDN Magazine - March 2008 - Contents (Page 6) MSDN Magazine - March 2008 - Contents (Page 7) MSDN Magazine - March 2008 - Contents (Page 8) MSDN Magazine - March 2008 - Contents (Page 9) MSDN Magazine - March 2008 - Contents (Page 10) MSDN Magazine - March 2008 - Toolbox (Page 11) MSDN Magazine - March 2008 - Toolbox (Page 12) MSDN Magazine - March 2008 - Toolbox (Page 13) MSDN Magazine - March 2008 - Toolbox (Page 14) MSDN Magazine - March 2008 - CLR Inside Out (Page 15) MSDN Magazine - March 2008 - CLR Inside Out (Page 16) MSDN Magazine - March 2008 - CLR Inside Out (Page 17) MSDN Magazine - March 2008 - CLR Inside Out (Page 18) MSDN Magazine - March 2008 - CLR Inside Out (Page 19) MSDN Magazine - March 2008 - CLR Inside Out (Page 20) MSDN Magazine - March 2008 - Data Points (Page 21) MSDN Magazine - March 2008 - Data Points (Page 22) MSDN Magazine - March 2008 - Data Points (Page 23) MSDN Magazine - March 2008 - Data Points (Page 24) MSDN Magazine - March 2008 - Data Points (Page 25) MSDN Magazine - March 2008 - Data Points (Page 26) MSDN Magazine - March 2008 - Advanced Basics (Page 27) MSDN Magazine - March 2008 - Advanced Basics (Page 28) MSDN Magazine - March 2008 - Advanced Basics (Page 29) MSDN Magazine - March 2008 - Advanced Basics (Page 30) MSDN Magazine - March 2008 - Advanced Basics (Page 31) MSDN Magazine - March 2008 - Advanced Basics (Page 32) MSDN Magazine - March 2008 - Office Space (Page 33) MSDN Magazine - March 2008 - Office Space (Page 34) MSDN Magazine - March 2008 - Office Space (Page 35) MSDN Magazine - March 2008 - Office Space (Page 36) MSDN Magazine - March 2008 - Office Space (Page 37) MSDN Magazine - March 2008 - Office Space (Page 38) MSDN Magazine - March 2008 - Office Space (Page 39) MSDN Magazine - March 2008 - Office Space (Page 40) MSDN Magazine - March 2008 - Office Space (Page 41) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 42) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 43) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 44) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 45) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 46) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 47) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 48) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 49) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 50) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 51) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 52) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 53) MSDN Magazine - March 2008 - Loosen Up (Page 54) MSDN Magazine - March 2008 - Loosen Up (Page 55) MSDN Magazine - March 2008 - Loosen Up (Page 56) MSDN Magazine - March 2008 - Loosen Up (Page 57) MSDN Magazine - March 2008 - Loosen Up (Page 58) MSDN Magazine - March 2008 - Loosen Up (Page 59) MSDN Magazine - March 2008 - Loosen Up (Page 60) MSDN Magazine - March 2008 - Loosen Up (Page 61) MSDN Magazine - March 2008 - Loosen Up (Page 62) MSDN Magazine - March 2008 - Loosen Up (Page 63) MSDN Magazine - March 2008 - Loosen Up (Page 64) MSDN Magazine - March 2008 - Loosen Up (Page 65) MSDN Magazine - March 2008 - Loosen Up (Page 66) MSDN Magazine - March 2008 - Loosen Up (Page 67) MSDN Magazine - March 2008 - Loosen Up (Page 68) MSDN Magazine - March 2008 - Loosen Up (Page 69) MSDN Magazine - March 2008 - CI Server (Page 70) MSDN Magazine - March 2008 - CI Server (Page 71) MSDN Magazine - March 2008 - CI Server (Page 72) MSDN Magazine - March 2008 - CI Server (Page 73) MSDN Magazine - March 2008 - CI Server (Page 74) MSDN Magazine - March 2008 - CI Server (Page 75) MSDN Magazine - March 2008 - CI Server (Page 76) MSDN Magazine - March 2008 - CI Server (Page 77) MSDN Magazine - March 2008 - CI Server (Page 78) MSDN Magazine - March 2008 - CI Server (Page 79) MSDN Magazine - March 2008 - CI Server (Page 80) MSDN Magazine - March 2008 - Performance (Page 81) MSDN Magazine - March 2008 - Performance (Page 82) MSDN Magazine - March 2008 - Performance (Page 83) MSDN Magazine - March 2008 - Performance (Page 84) MSDN Magazine - March 2008 - Performance (Page 85) MSDN Magazine - March 2008 - Performance (Page 86) MSDN Magazine - March 2008 - Performance (Page 87) MSDN Magazine - March 2008 - Performance (Page 88) MSDN Magazine - March 2008 - Office Development (Page 89) MSDN Magazine - March 2008 - Office Development (Page 90) MSDN Magazine - March 2008 - Office Development (Page 91) MSDN Magazine - March 2008 - Office Development (Page 92) MSDN Magazine - March 2008 - Office Development (Page 93) MSDN Magazine - March 2008 - Office Development (Page 94) MSDN Magazine - March 2008 - Office Development (Page 95) MSDN Magazine - March 2008 - Office Development (Page 96) MSDN Magazine - March 2008 - Test Run (Page 97) MSDN Magazine - March 2008 - Test Run (Page 98) MSDN Magazine - March 2008 - Test Run (Page 99) MSDN Magazine - March 2008 - Test Run (Page 100) MSDN Magazine - March 2008 - Test Run (Page 101) MSDN Magazine - March 2008 - Test Run (Page 102) MSDN Magazine - March 2008 - Test Run (Page 103) MSDN Magazine - March 2008 - Test Run (Page 104) MSDN Magazine - March 2008 - Test Run (Page 105) MSDN Magazine - March 2008 - Test Run (Page 106) MSDN Magazine - March 2008 - Security Briefs (Page 107) MSDN Magazine - March 2008 - Security Briefs (Page 108) MSDN Magazine - March 2008 - Security Briefs (Page 109) MSDN Magazine - March 2008 - Security Briefs (Page 110) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 111) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 112) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 113) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 114) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 115) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 116) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 117) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 118) MSDN Magazine - March 2008 - Foundations (Page 119) MSDN Magazine - March 2008 - Foundations (Page 120) MSDN Magazine - March 2008 - Foundations (Page 121) MSDN Magazine - March 2008 - Foundations (Page 122) MSDN Magazine - March 2008 - Foundations (Page 123) MSDN Magazine - March 2008 - Foundations (Page 124) MSDN Magazine - March 2008 - Foundations (Page 125) MSDN Magazine - March 2008 - Foundations (Page 126) MSDN Magazine - March 2008 - Foundations (Page 127) MSDN Magazine - March 2008 - Foundations (Page 128) MSDN Magazine - March 2008 - .NET Matters (Page 129) MSDN Magazine - March 2008 - .NET Matters (Page 130) MSDN Magazine - March 2008 - .NET Matters (Page 131) MSDN Magazine - March 2008 - {End Bracket} (Page 132) MSDN Magazine - March 2008 - {End Bracket} (Page Cover3) MSDN Magazine - March 2008 - {End Bracket} (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.