5
votes

My VSTS - "Visual Studio Test" task can't find any tests of the .NET Core assembly. But in VS 2017 and in the console, it works well.

VSTS Task's logs:

enter image description here

enter image description here

enter image description here

My run settings file:

enter image description here

4
Please don't post code as image, use text.sticky bit

4 Answers

7
votes

Refer to these additional settings of Visual Studio Test task:

  1. Path to vstest.console.exe: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform
  2. Other console options: /framework:".NETCoreApp,Version=v2.0"
1
votes

I had a similar issue where the cause was I had copied a semi-colon separated search pattern in the "Test files" field from my v1 Visual Studio Test task definition to my v2 definition

Apparently v2 does not support semi-colon separation so i changed to new-line separation and it worked.

I.e. changed build/Tests/*Test.dll;-:**\obj\** to

build/Tests/*Test.dll -:**\obj\**

0
votes

Remove <TargetFrameworkVersion>Framework45</TargetFrameVersion> from runsettings.

As mentioned in warning message(Following DLL(s) do not match framework/platform), vstest.console ignoring .NET Core test-assemblies because the TargetFrameworkVersion value(Framework45) in runsettings.

You can remove TargetFrameworkVersion from runsettings if you are using VS >= 15.5. From 15.5 vstest.console has capability to detect framework and platform by reading metadata from test-assembly.

0
votes

Commonly this is caused by a lack of a test adapter for the framework you're using. For example for nunit you need to use nunitTestAdapter.