TeamCity.VSTest.TestAdapter 1.0.9

TeamCity VSTest Adapter

Provides an integration TeamCity and test frameworks.

Usage:

 - Create a test project, for example using the command line: dotnet new xunit
 - Add the NuGet reference to this package

Install-Package TeamCity.VSTest.TestAdapter -Version 1.0.9
dotnet add package TeamCity.VSTest.TestAdapter --version 1.0.9
paket add TeamCity.VSTest.TestAdapter --version 1.0.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Test Adapter for <img src="https://cdn.worldvectorlogo.com/logos/teamcity.svg" height="20" align="center"/>

<img src="http://jb.gg/badges/official.svg"/> NuGet TeamCity.VSTest.TestAdapter License <img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:TeamCityPluginsByJetBrains_TeamCityVSTestTestAdapter_Build)/statusIcon.svg"/>

Provides the TeamCity integration with test frameworks via the Visual Studio Test Platform or VSTest IDE tools.

<img src="https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/blob/master/Samples/MS.Tests/Docs/NewTest.gif"/>

Supported platforms:

  • Visual Studio Test Platform
  • VSTest Console version 12+

Visual Studio Test Platform

Presently, Visual Studio has an open and extensible test platform with tests written using various test frameworks and run using a variety of adapters. The Test Platform, from its vantage, resolves the lifecycle of the test into a series of stages – two of which are writing and running the test – with the goal of providing extensibility at each stage.

For each test project:

  • Add a NuGet reference to the Visual Studio Test Platform.

    dotnet add package Microsoft.NET.Test.Sdk
    
  • Add NuGet references to NuGet packages of the selected test framework and coresponding test adapter which supports Visual Studio Test Platform. For example:

    dotnet add package MSTest.TestFramework   
    dotnet add package MSTest.TestAdapter
    
    dotnet add package xunit   
    dotnet add package xunit.runner.visualstudio
    

    :warning: tests might not be reported correctly for .NET Core xunit test projects when logging verbosity levels is minimal or quiet because of issue, so try avoiding using these verbosity levels

    dotnet add package NUnit   
    dotnet add package NUnit3TestAdapter
    
    dotnet add package DevTeam.TestFramework   
    dotnet add package DevTeam.TestAdapter
    

    or others.

Alternatively to two steps above, you could create the a test project from the command line using the specified template:

dotnet new mstest

or

dotnet new xunit
  • To support the TeamCity integration add a NuGet reference to the TeamCity Test Adapter to turn on the TeamCity integration.

    dotnet add package TeamCity.VSTest.TestAdapter
    

Thus, the final project file could look like the following:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>    
    <TargetFrameworks>net45;netcoreapp1.0;netcoreapp2.0</TargetFrameworks>    
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
    <PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
    <PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
    <PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.6" />    
  </ItemGroup>  
</Project>

VSTest Console

  • To support the TeamCity integration, add a NuGet reference to the TeamCity Test Adapter

  • To run tests from the command line, use additional command line arguments: /TestAdapterPath:., /Logger:teamcity

    • The first argument points to the path where the runner can find the assembly of the TeamCity logger (the directory of the testing aseembly).

    • The second argument points to the TeamCity service messages logger.

For example:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" dotNet.XUnit.Tests.dll /Logger:teamcity /TestAdapterPath:.

VSTest extensions

  • Download the custom logger

  • Extract the contents of the downloaded archive on the agent machine:

    • for VisualStudio 2017 update 5 onwards - to PROGRAM_FILES(x86)\Microsoft Visual Studio\2017&lt;Edition>\Common7\IDE\Extensions\TestPlatform\Extensions

    • for VisualStudio 2017 till update 4 - to PROGRAM_FILES(x86)\Microsoft Visual Studio\2017&lt;Edition>\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions

    • for VisualStudio 2015 - to PROGRAM_FILES\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions

    • for VisualStudio 2013 - to PROGRAM_FILES\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions

    • for VisualStudio 2012 - to PROGRAM_FILES\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions

  • Check that the custom logger was installed correctly by executing vstest.console.exe /ListLoggers in the console on the agent machine. If the logger was installed correctly, you will see the logger with FriendlyName TeamCity listed: TeamCity.VSTest.TestLogger.TeamCityTestLogger URI: logger://teamcity

See more details in the Wiki.

See the article for details on how to create tests using the Visual Studio Test Platform.

Docker Container Support

To run tests from within a Docker container that is hosted on a machine running the TeamCity agent, the container must have an environment variable set to a/any value. Example...

ENV TEAMCITY_PROJECT_NAME=My Project
RUN dotnet test

Test Adapter for <img src="https://cdn.worldvectorlogo.com/logos/teamcity.svg" height="20" align="center"/>

<img src="http://jb.gg/badges/official.svg"/> NuGet TeamCity.VSTest.TestAdapter License <img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:TeamCityPluginsByJetBrains_TeamCityVSTestTestAdapter_Build)/statusIcon.svg"/>

Provides the TeamCity integration with test frameworks via the Visual Studio Test Platform or VSTest IDE tools.

<img src="https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/blob/master/Samples/MS.Tests/Docs/NewTest.gif"/>

Supported platforms:

  • Visual Studio Test Platform
  • VSTest Console version 12+

Visual Studio Test Platform

Presently, Visual Studio has an open and extensible test platform with tests written using various test frameworks and run using a variety of adapters. The Test Platform, from its vantage, resolves the lifecycle of the test into a series of stages – two of which are writing and running the test – with the goal of providing extensibility at each stage.

For each test project:

  • Add a NuGet reference to the Visual Studio Test Platform.

    dotnet add package Microsoft.NET.Test.Sdk
    
  • Add NuGet references to NuGet packages of the selected test framework and coresponding test adapter which supports Visual Studio Test Platform. For example:

    dotnet add package MSTest.TestFramework   
    dotnet add package MSTest.TestAdapter
    
    dotnet add package xunit   
    dotnet add package xunit.runner.visualstudio
    

    :warning: tests might not be reported correctly for .NET Core xunit test projects when logging verbosity levels is minimal or quiet because of issue, so try avoiding using these verbosity levels

    dotnet add package NUnit   
    dotnet add package NUnit3TestAdapter
    
    dotnet add package DevTeam.TestFramework   
    dotnet add package DevTeam.TestAdapter
    

    or others.

Alternatively to two steps above, you could create the a test project from the command line using the specified template:

dotnet new mstest

or

dotnet new xunit
  • To support the TeamCity integration add a NuGet reference to the TeamCity Test Adapter to turn on the TeamCity integration.

    dotnet add package TeamCity.VSTest.TestAdapter
    

Thus, the final project file could look like the following:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>    
    <TargetFrameworks>net45;netcoreapp1.0;netcoreapp2.0</TargetFrameworks>    
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
    <PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
    <PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
    <PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.6" />    
  </ItemGroup>  
</Project>

VSTest Console

  • To support the TeamCity integration, add a NuGet reference to the TeamCity Test Adapter

  • To run tests from the command line, use additional command line arguments: /TestAdapterPath:., /Logger:teamcity

    • The first argument points to the path where the runner can find the assembly of the TeamCity logger (the directory of the testing aseembly).

    • The second argument points to the TeamCity service messages logger.

For example:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" dotNet.XUnit.Tests.dll /Logger:teamcity /TestAdapterPath:.

VSTest extensions

  • Download the custom logger

  • Extract the contents of the downloaded archive on the agent machine:

    • for VisualStudio 2017 update 5 onwards - to PROGRAM_FILES(x86)\Microsoft Visual Studio\2017&lt;Edition>\Common7\IDE\Extensions\TestPlatform\Extensions

    • for VisualStudio 2017 till update 4 - to PROGRAM_FILES(x86)\Microsoft Visual Studio\2017&lt;Edition>\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions

    • for VisualStudio 2015 - to PROGRAM_FILES\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions

    • for VisualStudio 2013 - to PROGRAM_FILES\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions

    • for VisualStudio 2012 - to PROGRAM_FILES\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions

  • Check that the custom logger was installed correctly by executing vstest.console.exe /ListLoggers in the console on the agent machine. If the logger was installed correctly, you will see the logger with FriendlyName TeamCity listed: TeamCity.VSTest.TestLogger.TeamCityTestLogger URI: logger://teamcity

See more details in the Wiki.

See the article for details on how to create tests using the Visual Studio Test Platform.

Docker Container Support

To run tests from within a Docker container that is hosted on a machine running the TeamCity agent, the container must have an environment variable set to a/any value. Example...

ENV TEAMCITY_PROJECT_NAME=My Project
RUN dotnet test

Version History

Version Downloads Last updated
1.0.9 (current) 1,895 6/5/2018
1.0.8 8,445 4/11/2018
1.0.7 15,274 12/18/2017
1.0.6 7,399 11/14/2017
1.0.5 4,218 10/19/2017