1
votes

I have a Visual Studio solution with test projects , for example :

MySolution.sln
MyProject.csproj
MyProject.Tests.csproj

In TeamCity it's easy to create a build step of type Visual Studio Tests that targets all tests found in MyProject.Tests.dll ( those notated with [TestMethod] and [DataTestMethod] ).

I've done some Googling but I'm not finding how to run only a specific test by name - similar to Visual Studio right-click on test name and run tests.

Does anyone know if this is possible ?

1

1 Answers

2
votes

TeamCity uses VSTest.Console.exe under the hood to run tests. So basically, you can use params listed in here: https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options?view=vs-2017, to decide, which tests should be run.

In TeamCity interface, there is a field Test Names. Use this field to specify tests to run:

TeamCity Test Configuration

This will give you something like this:

vstest.console.exe path\to\tests.assembly.dll /Tests:TestClass.TestName1,TestClass.TestName2