ENTERPRISE

Visual Studio Team System 2008 : Deploying and Running Tests (part 1) - Remote deployment, Deploy additional files

5/15/2013 7:51:02 PM

1. Remote deployment

This type of deployment involves deploying the testing application and the supporting files to the remote machines, which are used for testing or running the test application. This deployment is not a direct or automatic deployment as we do with the local deployment. The first deployment happens in the centralized system called controller, which then distributes and deploys the application or files to the agent computers. The agents are the actual remote computers on which the application has to be deployed.

For conducting tests such as simulated tests, Visual Studio requires multiple computers at different locations. This happens in the case of concurrent user tests or load tests while running the test simultaneously on multiple computers at different locations or the same location.

The group of computers consists of a controller and other agents. The controller is the central computer that communicates with the agents. So when the remote deployment happens, it first copies the files to the local deployment folder which is the Out folder as mentioned in the previous section. Then it is deployed to the local folder in the controller computer, which then distributes the files to the agents. The agents are the real computers which conduct the tests.

Remote deploymenttests, deployinglocal deployment

The above screenshot shows the test run configuration. For the remote option, we have to provide the Controller and the Agents information for the deployment.

2. Deploy additional files

The configuration settings contain the list of additional items to be deployed as part of test deployment. Open the test configuration file, which opens in a configuration editor tool which is the inbuilt tool in Visual Studio used for easy editing of the configuration information. In the screenshot below, the Deployment section shown in the configuration editor tool specifies the additional files or folder to be deployed. You can use the Add File or Add Directory option to select the deployment items.

Deploy additional filestests, deployingremote deployment

The other way of achieving the same is to edit the configuration XML file directly without using the tool. The XML file text below shows a sample test configuration file with a couple of additional deployment items, test timeouts, user defined naming scheme, and a setup script.

<?xml version="1.0" encoding="UTF-8"?>
<TestRunConfiguration name="TestRunConfig1" id="fa788594-6ac2-495e-a484-2229faa94326" xmlns="http://microsoft.com/schemas/VisualStudio /TeamTest/2006">
<Description>Test configuration file with the user defined scheme</Description>
<CodeCoverage enabled="true">
<Regular>
<CodeCoverageItem binaryFile="C:\Workspace\CustomRules\bin\ Debug\CustomRules.dll" 
pdbFile="C:\Workspace\CustomRules\bin\Debug\ CustomRules.pdb" instrumentInPlace="true" /> </Regular> </CodeCoverage> <Timeouts runTimeout="1800000" testTimeout="2700000" /> <Remote controllerName="&lt;Local - No controller&gt;" /> <Deployment> <DeploymentItem filename="Test.dll" /> <DeploymentItem filename="ClassLibrary1.dll" /> </Deployment> <NamingScheme baseName="User1@MyPC" useDefault="false" /> <Scripts setupScript="C:\Workspace\TestingApp\SetEnvironment.bat" /> <Hosts skipUnhostableTests="false"> <AspNet name="ASP.NET" executionType="WebDev" urlToTest="http://localhost:49459/TestingApp/"> <DevelopmentServer pathToWebSite="C:\Workspace\TestingApp" webApplicationRoot="http://localhost:49459/ TestingApp/" /> </AspNet> <DeviceHostRunConfigData name="Smart Device" deviceId="AE1FD546-ECB8-4553-B0AA-53E129544859"
 deviceName="Pocket PC 2003 Device" platformId="3C41C503-53EF-4c2a-8DD4-A8217CAD115E" platformName="Pocket PC 2003"
uiPlatformId="00000000-0000-0000-0000-000000000000"/> </Hosts> <TestTypeSpecific> <WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207"> <Browser name="Internet Explorer 6.0"> <Headers> <Header name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" /> <Header name="Accept" value="*/*" /> <Header name="Accept-Language" value="{{$IEAcceptLanguage}}" /> <Header name="Accept-Encoding" value="GZIP" /> </Headers> </Browser> <Network Name="LAN" BandwidthInKbps="0" /> </WebTestRunConfiguration> </TestTypeSpecific> </TestRunConfiguration>

If we need more files to be added as part of deployment, we can update the Deployment section directly in the XML file and then add the files. Given here is the updated deployment section, which includes an additional file CustomRules.dll to be deployed:

<Deployment>
<DeploymentItem filename="Test.dll" />
<DeploymentItem filename="ClassLibrary1.dll" />
<DeploymentItem filename="CustomeRules.dll" />
</Deployment>

We can edit any section of the XML file to change the configurations. This is similar to the configurations set using the IDE.

3. Using deploymentItem attribute

This attribute can be specified as part of the unit test methods to deploy additional items for a single test. To specify the attribute, open the unit test code and open the TestMethod. Add the DeploymentItem attribute to the method. Specify the file or folder as a parameter to the attribute. For example, the following code deploys the test.dll file as part of the test deployment.

[TestMethod()]
[DeploymentItem("Test.dll")]
public void GetTotalPriceTest()
{
Class1 target = new Class1();
double expected = 0F;
double actual;
actual = target.GetTotalPrice();
Assert.AreEqual(expected, actual);
}

This parameter can specify the file or folder with an absolute path or a relative path. Relative paths are relative to the path specified in the test configuration file.

4. Deploy items for individual test

The items specified in the test configuration setting are the default additional deployment items for the test project. Each test has its own properties, which includes the list of additional deployment items. These are specific to this test and not for the entire test project. To specify the items for a test, open the Test List Editor or the Test View window and select the test. Open the test Properties window and open the string collection editor for the deployment items and specify the list of deployment items. For example, the following screenshot shows the properties specified for a test with two additional deployment items, Test.dll and Classlibrary2.dll.

Deploy items for individual testremote deployment, testsDeploymentItem attribute, using

The deployment item is a collection property, which contains the list of all the deployment items specified for the test.

Other  
 
Video
Video tutorials
- How To Install Windows 8

- How To Install Windows Server 2012

- How To Install Windows Server 2012 On VirtualBox

- How To Disable Windows 8 Metro UI

- How To Install Windows Store Apps From Windows 8 Classic Desktop

- How To Disable Windows Update in Windows 8

- How To Disable Windows 8 Metro UI

- How To Add Widgets To Windows 8 Lock Screen

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010
programming4us programming4us
Top 10
Free Mobile And Desktop Apps For Accessing Restricted Websites
MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
TOYOTA CAMRY 2; 2.5 : Camry now more comely
KIA SORENTO 2.2CRDi : Fuel-sipping slugger
How To Setup, Password Protect & Encrypt Wireless Internet Connection
Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
Backup & Restore Game Progress From Any Game With SaveGameProgress
Generate A Facebook Timeline Cover Using A Free App
New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
Popular Tags
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Exchange Server Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe Photoshop CorelDRAW X5 CorelDraw 10 windows Phone 7 windows Phone 8 Iphone