gpt4 book ai didi

c# - Visual Studio 测试任务 : Test Assembly wildcard format

转载 作者:太空宇宙 更新时间:2023-11-03 12:13:39 25 4
gpt4 key购买 nike

我有一个具有核心功能的库(“Base.dll”)和附加的单元测试项目(“Base.Test.dll”),它们有一个单独的构建定义。我的项目依赖于这些核心功能(“SomeTool.dll”)以及附加的单元测试(“SomeTool.Test.dll”)。

此外,我有一个特殊的单元测试项目(“Base.Test.Structure.dll”),它检查在二进制文件编译到的目录的父目录中找到的所有 *.csproj 文件,如果它们被配置为正确的方式<LangVersion>latest</LangVersion> .

激活门控 checkin 并具有适当的 Base 构建定义后,无需在每个工具的每个构建中运行 Base.Test。因此,我想在

的 Visual Studio 测试任务的“测试程序集”字段中调整默认模式
**\$(BuildConfiguration)\*.test*.dll;-:**\obj\**

**\$(BuildConfiguration)\*.test*.dll;-:**\obj\**;-:**\Base.*;+:**\Base.Test.Structure.dll

但是结构测试没有被发现也没有被执行。在没有工具特定单元测试的工具构建定义中,我得到“找不到要发布的结果”。

我怀疑不可能在模式中的“-:”之后使用“+:”。有人可以证实这一点吗?还有其他方法可以实现我想要的吗?

最佳答案

Visual Studio 测试任务仅使用 Visual Studio 测试运行器。具有 Visual Studio 测试的测试框架。

Test Assembly: This field specifies the test assemblies(s) from which the tests should be picked.

  • Wildcards can be used
  • Multiple paths can be specified separated by a semicolon
  • Paths are relative to the Sources Directory

For example, **\commontests\*test*.dll;
**\frontendtests\*test*.dll;-:**\obj\**
or $(Build.SourcesDirectory)\Tests\*tests*.dll;-:$(Build.SourcesDirectory)\Tests\Integrationtests.dll

Include patterns start with ‘+:’, and exclude patterns with ‘-:’ (Default is include). For Javascript tests, this will point to .js files containing the tests. Folders/Files which are having ";" in their names should be given as ";;" in input.

Run Tests using Visual Studio task

该文档未声明您无法在模式中的“-:”之后使用“+:”。

博客的评论是对的,所有排除表达式总是优先于包含表达式,所以如果一个文件同时匹配包含和排除表达式,则该文件不被包含。

对于新版本的vststest task ,将 - 更改为 !。关于 minimatch patterns 的官方文档还明确声明:

leading ! changes the meaning of an include pattern to exclude.

Exclude patterns

关于c# - Visual Studio 测试任务 : Test Assembly wildcard format,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50831028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com