Set up continuous testing for your builds

Last Update: 4/7/2017

Team Services | TFS 2017 | TFS 2015

Find problems early after changes are checked in and built by running continuous tests using Visual Studio Team Services or Team Foundation Server.

Before you start:

Step 1: Set up app deployment for your build

  1. In Visual Studio Team Services or Team Foundation Server, go to your team project.

  2. Go to your build definition. Add steps to deploy your app for testing. For example, if you're testing a Visual Studio solution:

    Edit build definition

    Add a step to your build definition

    Add File Copy and PowerShell steps

  3. Add the details to copy your app from its drop location to its test environment:

    • Source folder for your app

    • List of machines where you want to deploy your app

    • Credentials to connect to the target machines

    • Target folder where to put your app

    Build definition, copy app details

    If you use the list of machines in more than one task, consider defining a variable that contains the list of machines. For example, a build or release definition variable or a variable defined within a project-wide variable group. Using a variable means that you can change the list of machines in one place and have the change apply to all the tasks that use the variable.

  4. Add the details to deploy your app using PowerShell:

    • List of machines where you want to deploy your app

    • Credentials to connect to the target machines

    • Path to the PowerShell script used to deploy your app

    Add step to deploy app with PowerShell

  5. Save your build definition.

    Build definition: save

Step 2: Set up test deployment for your build

  1. In your build definition, add a step with these details to deploy your tests:

    • Source folder for your tests

    • List of machines where you want to run your tests

    • Credentials to connect to the target machines

    • Target folder where to put your tests

    Build definition, copy tests

  2. Add a step with these details to deploy the test agent for running your tests:

    • List of machines where you want to deploy the test agent

    • Credentials to connect to the target machines

    • Credentials for the deployment agents, so the test agent can run in your test environment

    Build definition: deploy test agent details

  3. Save your build definition.

    Build definition: save

Step 3: Set up your tests to run with your build

  1. In your build definition, add a step with these details to run your tests with the test agent:

    • List of machines where you want to run your tests

    • Folder where you put your tests

    Build definition: Run tests with test agent

  2. Save your build definition.

    Build definition: save

  3. To check your test run, queue your build.

    Build definition: queue build

  4. After your build is done, review your test results.

Q & A

Q: What if I want to run debug builds of native (.cpp) unit tests on the machine with the test agent?

A: Make sure that you have debug versions of the Universal C Runtime (UCRT) on the machine with the test agent, specifically these libraries: ucrtbased.dll and vcruntime140d.dll. You can include these items with your deployment.

If you're running release builds of .cpp unit tests, make sure that you have Windows Update KB2999226 on your test agent machine.

Q: I'm having problems using xUnit with .NET Core apps. Where can I get more information?

A: See the blog post Unit Tests with .NET Core and Visual Studio Team Services.

See also

Help and support

Submit bugs through Connect, make suggestions on Uservoice, and send quick thoughts using the Send-a-Smile icon link in the Visual Studio, Team Services, or TFS title bar. We look forward to your feedback.