4
votes

I'm trying to create a release pipeline in VSTS that runs my xUnit-tests as specified in a Test Plan.

Long story short: I can't get it to work.

What I'm using:

  • Azure DevOps (formerly VSTS)
  • Visual Studio Test task (v2.*)
  • Test project targeting .NET Core 2.1
  • xunit 2.4 with xunit.runner.visualstudio 2.4

In Azure DevOps I defined a Test Plan that contains a Test Suite which contains a Test that has an Associated Automation which points to my xUnit test. I had to use the REST API to link the test code to the Test as described here.

I can select that Test in the visual designer for the VSTest task.

When I run the release pipeline the VSTest task fails with the following error message:

DiscoveryMessage : System.IO.FileNotFoundException: Unable to find tests for D:\a\r1\a\Foo.Tests.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate. Rerun with /diag option to diagnose further.

The path to the Foo.Tests.dll is correct, all required files are copied as well.

  • I explicitly specified the framework version in a .runsettings file (as the option Other console options doesn't work when using the Test plan option).
  • Specified the path to custom test adapters
  • used Visual Studio 2017 and Installed by Tools Installer options
  • Added a .NET Core Tool installer to install the correct .NET Core SDK
  • ...and any other combination of settings I could think of.

The error message is still the same.

Any ideas what I might be missing? Your help would be greatly appreciated at this point!

1
Did you reference the ""Microsoft.NET.Test.Sdk" in your project? Is it possible to share a project sample for us to check the issue?Eddie Chen - MSFT

1 Answers

2
votes

After several more hours we stumbled across a web page that stated that you don't have to copy the binaries of your test project as input for the VSTest task but PUBLISH it instead. That never came to mind as vstest.console.exe runs smoothly when you point it at the binaries on a local machine.


UPDATE: We had to add a Publish Artifact task at the end of our Build Pipeline and make the Release Pipeline pick up the published artifact.

enter image description here