We had a previous walkthro that shows lab management in action with VS2010 Beta2. This walk thru is an update of the same walkthru but using the RC bits. Between Beta2 and RC, the lab management product has had a lot of improvements, especially in the getting started path. This post is an attempt to showcase these changes. I have also repeated the content of the 4 part series again, to keep the post readable in isolation. Folks who have had a chance to read the previous walkthru, please excuse the repetition.
Lab management is a new addition to the Visual Studio family with VS2010. The product uses virtualization to build and manage labs in the dev / test environment. The promise of the product is three fold.
Lab management also nicely plays along with the other VS2010 value propositions like rich data collection for bugs (snapshot the environment). For a developer, it is easy to debug a bug reported on a particular build (restore to the snapshot of the environment for that build) or to do smoke testing of his changes across various test configurations. For a tester, the environment is also a good starting point for exploratory testing, easily venturing into various corners of the product with the knowledge that a tester could always reach back a well known state.
Enough intro. This blog post series will walk you through the automation of the end-to-end workflow using a simple calculator web service and unit tests for the same. At the end of the post, we would see the automated workflow where triggering a build will build an app, deploy it to a VM, run tests on it and report results.
While this example does not use multiple VMs in an environment, the same experience is applicable for multi-tier app testing as well. We can extend the application under test to cover various topologies (from traditional backend / frontend to software NLB to VMs spanning multiple trust boundaries)
Prereqs:
Representing the host configurations pictorially, you can configure your systems to be in either of the configurations below.
Software downloads:
As part of the walk through we will
On the hypervisor machine (in my case varadademo.fareast.corp.microsoft.com), install both the SCVMM server and the Administrator console. The lab product uses SCVMM as the hub for driving all the VM related operations.
I have done the default installation. As part of the install, I had VMM install SQL Server Express.
VMM installs a SQL server that requires to be updated with some security patches. Use Windows Update to pick up the latest patches for VMM and SQL Server and reboot the machine after the updates are installed.
Launch the admin console, pair to localhost:8100
Select Add host and add the host machine (the same machine where I am running SCVMM)
Copy the Win2k8 R2 vhd you downloaded before to the library share and create a VM (Remember to set the VM memory to be 1GB). Join the VMs to domain, giving it right computer names, and any other typical setup you might want on the VM. (Windows update to pick up the latest patches).
In a single host setup (with 8GB configuration), you can host the test VM and the TFS VM on the same host. In this case, make two copies of the VHD and deploy them to the same host. A future post explains how to build out the test VM (and TFS VM as well if you are configuring in a 8GB setup)
In our example, we will use the test VM as a web server to host our app and test it via unit tests. So let us make sure that ASP.NET is configured. To keep the walk through simple, we will just install all the web server components. Logon to the test VM, and from a elevated command prompt,
C:\Users\lmtstlab>servermanagercmd -install Web-Server -a Servermanagercmd.exe is deprecated, and is not guaranteed to be supported in future releases of Windows. We recommend that you use the Windows PowerShell cmdlets that are available for Server Manager. Start Installation... [Installation] Succeeded: [Web Server (IIS)] IIS Hostable Web Core. [Installation] Succeeded: [Web Server (IIS)] IIS Management Scripts and Tools. [Installation] Succeeded: [Web Server (IIS)] IIS Management Console. [Installation] Succeeded: [Web Server (IIS)] Management Service. [Installation] Succeeded: [Web Server (IIS)] FTP Service. [Installation] Succeeded: [Web Server (IIS)] Custom Logging. [Installation] Succeeded: [Web Server (IIS)] IIS 6 Metabase Compatibility. [Installation] Succeeded: [Web Server (IIS)] Static Content. [Installation] Succeeded: [Web Server (IIS)] Logging Tools. [Installation] Succeeded: [Web Server (IIS)] Tracing. [Installation] Succeeded: [Web Server (IIS)] Request Monitor. [Installation] Succeeded: [Web Server (IIS)] IP and Domain Restrictions. [Installation] Succeeded: [Web Server (IIS)] Request Filtering. [Installation] Succeeded: [Web Server (IIS)] URL Authorization. [Installation] Succeeded: [Web Server (IIS)] IIS 6 WMI Compatibility. [Installation] Succeeded: [Web Server (IIS)] Dynamic Content Compression. [Installation] Succeeded: [Web Server (IIS)] Static Content Compression. [Installation] Succeeded: [Web Server (IIS)] Windows Authentication. [Installation] Succeeded: [Web Server (IIS)] Basic Authentication. [Installation] Succeeded: [Web Server (IIS)] ODBC Logging. [Installation] Succeeded: [Web Server (IIS)] IIS Client Certificate Mapping Authentication. [Installation] Succeeded: [Web Server (IIS)] Client Certificate Mapping Authentication. [Installation] Succeeded: [Web Server (IIS)] Digest Authentication. [Installation] Succeeded: [Web Server (IIS)] Default Document. [Installation] Succeeded: [Web Server (IIS)] Directory Browsing. [Installation] Succeeded: [Web Server (IIS)] ISAPI Filters. [Installation] Succeeded: [Web Server (IIS)] HTTP Errors. [Installation] Succeeded: [Web Server (IIS)] HTTP Redirection. [Installation] Succeeded: [Web Server (IIS)] HTTP Logging. [Installation] Succeeded: [Web Server (IIS)] ISAPI Extensions. [Installation] Succeeded: [Web Server (IIS)] Server Side Includes. [Installation] Succeeded: [Web Server (IIS)] CGI. [Installation] Succeeded: [Web Server (IIS)] FTP Extensibility. [Installation] Succeeded: [Web Server (IIS)] IIS 6 Management Console. [Installation] Succeeded: [Web Server (IIS)] .NET Extensibility. [Installation] Succeeded: [Web Server (IIS)] WebDAV Publishing. [Installation] Succeeded: [Web Server (IIS)] IIS 6 Scripting Tools. [Installation] Succeeded: [Web Server (IIS)] ASP. [Installation] Succeeded: [Web Server (IIS)] ASP.NET. <100/100> Success: Installation succeeded.
The above might take a few minutes.
The following is new for RC. In this step, we provision the VM to be lab ready from with in the virtual machine. As part of the process, the new VMPrep (click here for more documentation ) tool installs the build / test and lab agent on the VM. We first start with a share that has the downloaded isos expanded. So inside the AgentInstaller directory, we have the files from the agent install iso (not the iso, but the flat file hierarchy inside the iso) and the same is the case with the TFSInstaller directory.
c:\Windows\System32>dir \\msl-2324785\install\ Volume in drive \\msl-2324785\install has no label. Volume Serial Number is F82E-CAF7 Directory of \\msl-2324785\install 02/13/2010 11:02 AM <DIR> . 02/13/2010 11:02 AM <DIR> .. 02/11/2010 03:13 PM <DIR> AgentInstaller 02/09/2010 08:12 PM 72,357,888 LabMgmt.iso 02/11/2010 05:09 PM <DIR> TFSInstaller 02/13/2010 11:02 AM <DIR> VMPrepTool
Now from an elevated command prompt inside the VM run,
C:\Windows\system32>\\msl-2324785\install\VMPrepTool\VMPrepTool.exe SelfService /CurrentUserPassword:<password of the current user> /AgentInstaller:\\msl-2324785\install\AgentInstaller /TFSInstaller:\\msl-2324785\install\TFSInstaller
This process takes a while as it installs latest .NET framework, reboots, installs the agents and such. The command takes the current user password to allow for re-logon again.
We now have a active VM that can be used by the lab software to create test environments. At this point, you could also do any other prerequisite that your system under test might have. In this case, we wanted a web server, and thus we ended up doing nothing more than configuring the web server.
In the next blog in this series, we will work on configuring the VM that will act as the TFS server, the build and test controllers and VS machine.