Run Your Independent Automated Tests Using vNext Build In Visual Studio Online

Published Mar 13 2019 10:01 AM 889 Views
First published on MSDN on Jul 26, 2017

Authored by Ganesh Alalasundaram

Here is a walk through of a cookbook which would enable the use of Visual Studio Online vNext builds for automated Selenium/CodedUI tests to run independently in an Azure VM.

Why Azure VM’s !

As local servers/hardware are aging and becoming more obsolete, using cloud based solutions offer power and flexibility

How to Configure !

Prerequisites :

  1. Create a Visual Studio account to provision a new TFS or use an existing TFS VSO account. You can refer here for more details.

  2. Create an Azure VM in mapped to a resource manager cluster or classic VM. More details can be found here .

  3. Create a test plan using test cases. Details can be found here

Steps :

  1. Go to “Build & Release” and click on “New” button

Mouse hover on “build, deploy and distributed test” and click on Apply button

  1. Make sure to remove tasks which are not being used.  Add an "AzureVM's file copy" task to the template.  Select the correct source and project where the source code is available.  For this example, GIT repository is being used.

  1. Restoring Nuget Package . This process restores the Nuget package before building the application. Make sure to target the path to the solution.

  1. Build Solution .

Select the desired solution for the build, then select the correct Visual Studio version

5. AzureVM’s file copy

This task is used to copy the build generated by the hosted/default agent to your Azure VM. Once the files are copied, the test agent will run the tests using the binaries.

  1. Select the desired solution as the source

  2. Azure connection type should be Azure Resource Manager

  3. Select your azure subscription

  4. Destination type as Azure VM

  5. RM Storage account – This is the storage account in which the VM is mapped. It can be found in the Azure portal under the Azure Resource Manager group

  6. Resource Group (automatically pops up when you have an existing group in azure)

  7. Admin login (Azure VM’s credential)

  8. Password (Azure VM’s password)

6. Deploy Test Agent.

This task is used to deploy Test agent onto the azure VM.

  1. Enter the Machine IP (I used a static IP and saved it as a variable in the next tab to build)

  2. Admin login (Azure VM’s credential)

  3. Password (Azure VM’s password)

  4. Protocol as Https

  5. Agent Username and Password. (This example is using a hosted test agent, but can be configured for other tests agents.

  6. Ensure the hosted agent has admin added as your role.

  7. Select Run UI Tests

  8. Select Test Agent version

  9. Select Update Test Agent

7. Run Tests on VM .

This task will configure the test cases or the binaries you need to run. This can be either Selenium or CodedUI Tests.

  1. Enter the IP or FQDN of the machine under Machine

  2. Test Drop location (where the binaries are available from the step 5)

  3. Select the Test Plan/Suite or Enter the assemblies name (*.dll)

  4. Mention the test configuration.

8. Save and Queue

  1. Select the agent (either hosted or your custom agent)

  2. Branch – As its GIT, I have configured my integration branch as my master.

Tests may fail with the exceptions like "WinRM client cannot process the request." To resolve, follow the steps below:

  1. Goto powershell and type “winrm -quickconfig” or “Enable-PSRemoting -Force”

  2. enable windows remote management service in services.msc

FAQ : To know more about agents you can refer to the blog here

  1. Create Deployment Group

To create a deployment group, go to Build & Release -> Deployment Group

Copy the script and run it inside the Azure VM. Use PAT for authentication.

  1. Reporting .

vNext can send a default mail with the Test Run results. To configure, Go to Settings -> Notifications. Create a new notification and select the template to create a custom notification.

Sample Report

Version history
Last update:
‎Mar 13 2019 10:01 AM
Updated by: