VSTest-Task未运行来自测试计划的.NET Core 2.1 xUnit-Test [英] VSTest-Task not running .NET Core 2.1 xUnit-Tests from Test-plan

查看:126
本文介绍了VSTest-Task未运行来自测试计划的.NET Core 2.1 xUnit-Test的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在VSTS中创建一个发布管道,以按照测试计划中的指定运行我的xUnit-test。



长话短说:我无法正常工作。



我正在使用什么:




  • Azure DevOps(以前为VSTS)

  • Visual Studio测试任务( v2。*)

  • 面向.NET Core 2.1的测试项目

  • xunit 2.4具有xunit.runner.visualstudio 2.4



在Azure DevOps中,我定义了测试计划包含 Test Suite 包含 Test 并具有 Associated Automation 指向我的xUnit测试。
我必须使用REST API将测试代码链接到 Test ,如


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!

解决方案

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.

这篇关于VSTest-Task未运行来自测试计划的.NET Core 2.1 xUnit-Test的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆