Presentation is loading. Please wait.

Presentation is loading. Please wait.

Eliminate Team Build Headaches with Unit Tests, WiX and Virtualization Benjamin Day

Similar presentations


Presentation on theme: "Eliminate Team Build Headaches with Unit Tests, WiX and Virtualization Benjamin Day"— Presentation transcript:

1 Eliminate Team Build Headaches with Unit Tests, WiX and Virtualization Benjamin Day http://benday.com

2 Who am I? Owner, Benjamin Day Consulting, Inc. –Email: benday@benday.combenday@benday.com –Web: http://www.benday.comhttp://www.benday.com –Blog: http://blog.benday.comhttp://blog.benday.com Trainer, Consultant –Visual Studio Team System, Team Foundation Server Microsoft MVP for VSTS Microsoft VSTS/TFS Customer Advisory Council Microsoft Cloud Services Advisory Group Leader of Beantown.NET INETA User Group

3 Goals Build, Test, and Deploy Your App The Application –Test Driven Development / Unit Tests –ASP.NET –WCF hosted in IIS

4 Why automated builds? Repeatability Did I mention repeatability? Eliminate the “works on my box” problem

5 Demo 1 Tour of the app Add it to TFS source control

6 Why Continuous Integration? Eliminate painful integration Catch bugs early (Theoretically) ship immediately Code always builds Tests always pass

7 Demo 2 Create the Team Build Run the tests from the build Configure Continuous Integration Run the build

8 3 rd Party MSBuild Tasks Saves you time/effort Free MSBuild Community Tasks –http://msbuildtasks.tigris.org/http://msbuildtasks.tigris.org/ –IIS Configuration tasks SDC Tasks –http://www.codeplex.com/sdctaskshttp://www.codeplex.com/sdctasks –Microsoft Virtual Server 2005 R2 tasks

9 Build is failing IIS isn’t configured Best practice: delete and recreate IIS virtual directories Ensures… –…a clean environment –…you’re testing the right version –…you know how to configure your app

10 Demo 3 Configure IIS in the BeforeTest target

11 KICKING IT OVER THE WALL

12 Move code between environments How would you get the current version to QA? QA can’t test against continuous integration –Needs a stable code base version to test against

13 QA Test Environment Use Virtual Machines –Cheap –Hyper-V or Virtual Server 2005 R2 Create template machines with SysPrep.exe Configure the machines then Enable Undo Disks –Easy rollback to completely clean, known state –Fresh state  you know how to config your app

14 How do you get the code to QA? Need a good way to get it there Need a good way to configure it Worst-practice: humans configure the app Best-practice: automated configuration –Automatic deploy, config = great documentation Create an MSI installer using WiX

15 WIX

16 What does an installer do for you? Install & Uninstall Registry keys Folder paths COM registration Update logic Program menu shortcuts Way too hard for a non-technical user Non-repeatable without an automated installer

17 What is WiX? Windows Installer Xml Xml to describe Windows Installer MSI’s Developed by Microsoft –Around 1999 Released to Open Source in April 2004 Mostly written by Rob Mensching –http://robmensching.com/http://robmensching.com/ http://wix.sourceforge.net/

18 WiX is not dead Sourceforge site has spotty updates Weekly drops are still getting made http://wix.sourceforge.net/releases/ http://wix.sourceforge.net/releases/ Visual Studio setup is written in WiX WiX will be included as a project type in VS2010

19 How do you get started? Go to http://wix.sourceforge.net/releases/http://wix.sourceforge.net/releases/ Download & install the latest 3.0.* release

20 WiX Projects in Visual Studio “Votive”

21 Votive Projects Allow you to add, edit Intellisense Compiler support Defines variables to reference solution/project paths Source control

22 Votive Project Types WiX Project –Generates *.msi WiX Merge Module –Installer referenced from another installer –Generates *.msm WiX Library Project –Re-usable pieces of WiX WiX Custom Action –Extend the installer logic

23 Other tools that comes with WiX Heat.exe –Jump starts WiX creation Candle.exe –WiX Compiler Light.exe –WiX Linker Dark.exe –Decompiler Smoke.exe –Validator

24 Basic WiX Elements - Root element w/ Namespaces - What you’re installing, “Refs”

25 Defining the user interface –Defines user interface features –Reference a UI WixUIExtension.dll –Pre-defined UI Sequences –WixUI_Mondo, WixUI_Advanced, WixUI_FeatureTree, WixUI_InstallDir, WixUI_Minimal Decent documentation at http://www.wixwiki.com http://www.wixwiki.com

26 Installing Web Apps Use heat.exe to start –HINT: don’t bother with the “website” option Edit the directory references Add reference to WixIisExtension.dll Point Set

27 Tips for Deploying Web Apps Put each app in a separate wxs file –IIS Service Host –Web UI –Admin Web UI During Dev/QA, use WiX to simplify deployment of releases –Generate and build WiX during TFS Team Build –Use or

28 Best Practice Set Id=“*” –Auto generates a new id on compile Never change your upgrade code

29 Demo 4 Create the WiX Installer Install the app Configure IIS Run the build  MSI

30 MSIExec From the Command Line Msiexec installer.msi –/i – install –/u – uninstall –/L filename – specify a log file –/qn – silent Pass parameters in using –MY_PARAMETER=value Control feature installation –ADDLOCAL=ProductFeature,ProductFeature2

31 A MORE COMPLEX ENVIRONMENT

32 Deploying to other machines What if you need to deploy to other machines in order to test? Deploy the WCF service to another box before running tests Environment specific configurations in the WiX

33 Fancy. Compile Create the installer Start virtual machines from Team Build Copy the installer to the VMs Run the installer Run tests against the running WCF app Tear down the VMs

34 Control VMs from Team Build Start / Stop Virtual Server 2005 R2 machines Use the SDC Tasks http://www.codeplex.com/sdctasks http://www.codeplex.com/sdctasks

35 The VirtualMachine Tasks <VirtualServer.VirtualMachine.Start ServerName=“virtualServerName" MachineName=“virtualMachineName" Timeout="20“ />

36 Demo 5 Start a virtual machine Wait for it to start Copy the MSI Install the MSI Run the tests Stop the virtual machine

37 Summary Running app with unit tests App compiled by Team Build Team Build configures the app WiX to create the installer Installer from the build that we can hand off to QA Start virtual machines Copy / Run installer Run tests using the VM

38 Who am I? Owner, Benjamin Day Consulting, Inc. –Email: benday@benday.combenday@benday.com –Web: http://www.benday.comhttp://www.benday.com –Blog: http://blog.benday.comhttp://blog.benday.com Trainer, Consultant –Visual Studio Team System, Team Foundation Server Microsoft MVP for VSTS Microsoft VSTS/TFS Customer Advisory Council Microsoft Cloud Services Advisory Group Leader of Beantown.NET INETA User Group


Download ppt "Eliminate Team Build Headaches with Unit Tests, WiX and Virtualization Benjamin Day"

Similar presentations


Ads by Google