Skip to end of metadata
Go to start of metadata

Visual Studio Team Services (VSTS) enables continuous delivery by speeding up the testing cycle while increasing the quality of mobile and desktop applications. With Sauce Plugin for VSTS users can easily pass Sauce Labs authentication credentials as a part of the VSTS build process, Launch & Stop Sauce Connect Proxy, and embed the report around the statuses of executed tests.

Note: the plugin is currently in a private beta and interested customers should request the invite by reach out to beta@saucelabs.com and providing your visual studio subdomain name ( https://<name>.visualstudio.com )

Team Server 2015 Version 2 Required

You must have Team Foundation Server 2015 Update 2 installed to use Sauce Labs with VSTS. Previous versions will not be able to install the new extension format.  

Installing Beta Version

  1. Request access to beta by reaching out to beta@saucelabs.com   

    1. If non-beta version is installed, remove the non-beta by going to manage extensions page

  2. Once beta access is granted, navigate to Visual Studio Marketplace and install (cloud instance) or download the plugin (on prem)

  3. Update your tests to set build in your capabilities (See Examples below)

  4. Add Sauce Labs steps into your build pipeline

    1. Once the plugin is installed two additional steps will be accessible: “Manage Sauce Credentials” & “Stop Sauce Connect”. 

  5. Build as normal

  6. Click Sauce Labs tab on build result page to view a summary of tests that were executed on Sauce

Setting Up the Sauce Labs Manage Credentials Task for Your Build

The Manage Credentials task is what allows you to authenticate with your Sauce Labs account via VSTS and start Sauce Connect. You need to configure the task to create a new service endpoint that will contain your Sauce Labs username and access key.

  1. In your VSTS dashboard, click Build & Release.
  2. Under Build Definition, choose an appropriate template for your project. 
  3. Click Edit, to edit build details (if it is an existing build) or New to create a new build
    1. Configure your Source Settings for the project.
      1. Users who don't have a working set of sets could refer to our sample repository 
    2. Click Create.
  4. Click Add Task
  5. Under Test, search for and add Sauce Labs - Manage Credentials.
  6. Next, click on the newly added step and under  Sauce Labs Credentials menu, click Manage.
  7. This will open the Services tab.
  8. Click New Service Endpoint
  9. Select New Sauce Labs Credentials
  10. For Connection Name, enter an appropriate name.
  11. For User name and API Token, enter your Sauce username and access key.
  12. Click OK.
  13. Go back to the build steps for your project, and make sure that under Control Options for the Manage Credentials task, the Enabled option is selected 

Using Sauce Connect

Sauce Connect is a tunneling application that established a secure connection between applications or sites under test in your local network or machine, and the virtual machines running browsers in the Sauce Labs testing cloud. It is not necessary to set up Sauce Connect to run tests with the Sauce Labs browser cloud, you only need to use it if the application or site under test is not publicly accessible over a network. Check out the topics under Sauce Connect Proxy for more information. 

If you want to use Sauce Connect with VSTS, you need to both Enable Sauce Connect in your Manage Credential task and add the Sauce Labs - Stop Sauce Connect task to your build. These will start up a Sauce Connect tunnel when your build begins, and then close the tunnel when it finishes.

  1. In your Manage Credentials task, click Enable Sauce Connect.
  2. Select whether the task should Always run and/or Continue on error.
  3. In your build definition, search for and add Sauce Labs - Stop Sauce Connect.
  4. Make sure that the Sauce Labs - Stop Sauce Connect task is enabled.
    We recommend that you set this task to Always run so there are no extra Sauce Connects tunnels stay running after your job ends.

Task Order is Important

If you use the Sauce Connect tasks in your build, you must have your build steps set up so that the Sauce Labs - Manage Credentials task executes first. 

Setting Build capability examples

c#

 capabilities.SetCapability("build", Environment.GetEnvironmentVariable("SAUCE_BUILD_NAME"));

Java

desiredCapabilities.setCapability("build", System.getEnv("SAUCE_BUILD_NAME"));

Questions? 

Please reach out to help@saucelabs.com 

 

  • No labels