繁体   English   中英

获取VS Test Explorer以仅显示测试名称而不是完整类型名称

[英]Get VS Test Explorer to show only test name not full type name

我的VS测试资源管理器显示包括完整类型名称的测试,如下所示:

CompanyName.ProjectName.Web.Tests.SutDoesWhatItShould

而不仅仅是:

SutDoesWhatItShould

这是非常难以理解/烦人的。 我该如何解决?

我正在使用xunit runner用于visual studio(预发行版)和xunit.net。

在v2中,这现在是可配置的,请参阅http://xunit.github.io/docs/configuration-files.html

所以你需要添加到app.config:

<appSettings>
    <add key="xunit.methodDisplay" value="method"/>
</appSettings>

并且如评论中所述,您可能需要重新启动Visual Studio。

对于.NET Core项目(使用.json配置):

  1. xunit.runner.json文件添加到测试项目中,其中包含以下内容: { "methodDisplay": "method" }
  2. Copy if newer您刚刚添加的xunit.runner.json文件的选项Copy if newer ,请设置Copy if newer
  3. 构建测试项目

有关更多信息,请参阅文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM