4.0

Table Of Contents
VMware, Inc. 15
Chapter 2 Getting Started with the Lab Manager SOAP API
Advanced C# Sample Integrating Lab Manager and Quality Center
ThisC#.NETsampleinthissectionisamoreextensive,andmorepractical,sampleofusingtheLab Manager
SOAPAPI.ThiscodesampleshowstheintegrationoftheLab ManagerSOAPAPIcallswithaMercury
InteractiveCorporationQualityCenterproduct.Thesamplecodeperformsthesetasks:
MakesLab ManagerAPI(Lab ManagerSOAPAPI)callstocheckoutaconfigurationfromthelibraryand
deployit.
UsesMercuryQualityCentertorunaseriesofpredefinedtestsonthedeployedconfiguration.
MakesLab ManagerSOAPAPIcallstocapturetheconfigurationandundeployitfromtheworkspace.
Thesetasksareaccomplishedinthesamplecodeusingthesemethods:
CheckoutDeployConfiguration()Obtainstheconfigurationfromthelibraryanddeploysittothe
Lab Managerworkspace.
RunQCTestset()RunsaseriesofpredefinedMercuryInteractiveQualityCentertests.Formore
informationaboutthepredefinedtests,seetheMercuryInteractiveQualityCenterdocumentation.
CaptureUndeployConfiguration()Undeploystheconfigurationandcapturesittothelibrary.
Inaddition,theGetLMAPI()methodcreatesanewbindingtotheLab ManagerAPIandsetsupauthentication
parameters.Thismethodconfiguresthecertificatepolicyforthe.NETservicepointmanagertoacceptany
certificateprogrammatically.GetLMAPI()returnsaninstanceof
theLab Managerbinding.
CopythissamplecodeandpasteitintoyourMicrosoftVisualStudio2005environment.
using System;
using System.Configuration;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using TDAPIOLELib; //** From Mercury Quality Center
namespace MATRun
{
/// <summary>
/// Class1 comprises methods to check out a configuration from the Lab
/// Manager Library and deploy it to the Workspace; execute several
/// tests; and capture a configuration.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
NameValueCollection settings=ConfigurationSettings.AppSettings;
string filename = null;
string buildlocation = null;
string buildversion = null;
if ( args.Length > 0 )
{
buildlocation = args[0];
buildversion = args[1];
}
if ( buildlocation == null )
{
buildlocation =
@"\\fs.labmanger.com\public\build\outputdir\1423\artifacts";
buildversion = "Lab Manager-2.0.4018";
}