webdad3
webdad3

Reputation: 9080

TeamCity VSTest 2015

I'm trying to setup TeamCity 9.1.7 on a server and I'm encountering an issue when trying to add a Testing step.

Runner Type: Visual Studio Tests

Test engine type: VSTest

Test engine version: VSTest 2015

Test file names: C2.Tests\bin\Debug\C2.Tests.dll

Target platform: x86

When I added this Step, I was prompted to add a Config parameter:

Name: teamcity.dotnet.vstest.14.0

Value: C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe

When I run all my steps I get an error in the Unit Testing step:

[14:23:17][Step 3/3] VSTest report watcher [14:23:17][VSTest report watcher] No reports found for paths: [14:23:17][VSTest report watcher] C:\BuildAgent\work\d28aa71801c772cb\TestResults*.trx [14:23:17][Step 3/3] Step Unit Testing (Visual Studio Tests) failed

I've had to do several things differently on this setup (on server) then when I was testing locally on my machine. For example setting up the 2015 Build Tools. I'm not sure where to look to correct this issue.

Please advise.

Upvotes: 7

Views: 7228

Answers (4)

masiton
masiton

Reputation: 187

If this helps anyone, in my case this exact error was generated when I wrongly identified the DLL file containing the tests. Instead of "IntegrationTests.dll" I wrote "ItegrationTests.dll". You can identify this issue by looking into the build log where team city says:

Command line params:

and then lists paths to all test DLL files. If it's empty, it means the files you have specified in the build step have not been found.

If you're using VS Test runner, you'll see these lines telling you what happened:

[Step 3/3] No test source files were specified.
[Step 3/3] Process exited with code 1
[Step 3/3] VSTest execution failure

If you're using MS Test runner, you'll see these lines instead:

[Step 3/3] Please specify tests to run, or specify the /publish switch to publish results. 
[Step 3/3] For switch syntax, type "MSTest /help"
[Step 3/3] Process exited with code 1
[Step 3/3] MSTest execution failure

Upvotes: 3

CularBytes
CularBytes

Reputation: 10321

From the documentation:

The Visual Studio Tests runner integrates MSTest runner and VSTest console runner. Support for both frameworks enables TeamCity to execute tests and automatically import their test results.

The Visual Studio Test Runner requires Visual Studio Test Agent or Microsoft Visual Studio installed on the build agent.

https://confluence.jetbrains.com/display/TCD10/Visual+Studio+Tests

So you can use VSTests perfectly fine from version 10.

For VSTests, you need to specify a different directory for the config parameter:

teamcity.dotnet.vstest.14.0: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe

This file will be available after installing the test agent (or visual studio).

If you still get the error then it means there is something wrong with the tests you have specified, you probably didn't reference to the assemblies correctly, make sure the path and .dll files exist.

Upvotes: 5

Cristopher Garro
Cristopher Garro

Reputation: 31

There are two problems in the current configuration:

  1. You are using as TestEngine the VSTest that will behave differently than the MsBuild

  2. When you run the Test using the MSBuild this will not generate the .trx files that the Report watcher needs to display the execution results.

So in order to fix your problem you need to change the Test Engine to [MSTest]

This link may help you understand the capabilities of each Test Engine

Choose and configure a test runner

Upvotes: 3

res10
res10

Reputation: 156

Try building the tests using the MSBuild step before the testing step - it seems if it can't find the DLLs containing your tests you get the "No reports found" error

Upvotes: 1

Related Questions