Visual Studio Team Services Integration

Applies to CrossBrowserTesting SaaS, last modified on January 19, 2022

Create a unit test project and add Selenium WebDriver

  1. Open up Visual Studio 2017.

  2. Under Visual C# choose Test and create a new Unit Test Project.

  3. After your project is created add Selenium WebDriver to your project by going to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

  4. Select "selenium.webdriver".

Copy the unit testcode into your project and publish a repository to VSTS Git

  1. Copy the example C# code found here into Visual Studio.

  2. Click on Add to Source Control (located in the bottom right corner of Visual Studio).

  3. Choose Git.

  4. When the push panel comes up in Team Explorer, click the "publish Git repo" button within the Visual Studio Team Services box.

  5. Choose the Visual Studio account and domain that you wish to use and name your repository.

  6. Click publish repository.

Create and queue a build for Visual Studio Team Services

  1. Go to your visual studio team services dashboard and select the repository you just created.

  2. Click Set up Build.

  3. Choose VSTS Git, the team project, repository, and the branch you want to use and click Continue.

  4. Choose .Net Desktop and click Apply.

  5. Click on Process and set a name for your CI build. Make sure the Agent queue is Hosted VS2017.

  6. Click on Trigger and select Enable continuous integration. Then make sure the Type entry is "include" and the branch is the one that you are using for this build.

  7. Click on Tasks.

  8. Click on the plus sign beside Phase 1.

  9. Choose Archive Files and select Add.

  10. Put $(Build.Repository.LocalPath) for the "Root folder or file to archive" choice.

  11. Make sure the Archive task is listed right above the Publish Artifact task by dragging the Archives task into position.

  12. Go to the VsTest (Visual Studio Test) task.

  13. Add a line to the Test Assemblies entries like the following "**\$(BuildConfiguration)\*bin\Release\{Insert Name of your Project here}.dll". For my cbt_vsts_csharp project I enter "**\$(BuildConfiguration)\*bin\Release\cbt_vsts_csharp.dll".

  14. Select Save and Queue.

  15. Select Save and Queue again.

  16. Click on the Build Number to be taken to the build run page.

Create a release to an Azure App Service

  1. After the build runs click on Release.

  2. Choose Azure App Service deployment and click Apply.

  3. Click the lightning bolt in the artifacts box and enable continuous deployment.

  4. Add a filter for the primary branch.

  5. Click in the rectangle in the Artifacts box and change the Source alias to drop.

  6. Click on the Tasks tab.

  7. Choose your Azure subscription.

  8. Choose the App service name that goes along with the subscription.

  9. Click on Tasks.

  10. Click the plus sign beside run on agent and select Visual Studio Test task.

  11. Modify the Test assemblies entry to include "**\$(BuildConfiguration)\*bin\Release\{name of your project}.dll".

  12. Save the release pipeline.

  13. Click on the + Release button.

  14. Choose Create Release.

  15. Click Create.

  16. Once again you can click on the Release number to be taken to the View Release page. If you click on Logs it will let you watch the output from your release tasks.

Now when you push to Visual Studio Team Services the build and release pipelines will both execute automatically.

See Also


Highlight search results