Sebastian Weber
Sebastian Weber

Reputation: 6806

VSTest-Task not running .NET Core 2.1 xUnit-Tests from Test-plan

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:

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.

The error message is still the same.

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

Upvotes: 5

Views: 1348

Answers (1)

Sebastian Weber
Sebastian Weber

Reputation: 6806

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

Upvotes: 2

Related Questions