【问题标题】:Why dotnet test project.csproj --filter category=unit fails in Azure DevOps?为什么 dotnet test project.csproj --filter category=unit 在 Azure DevOps 中失败?
【发布时间】:2019-04-16 15:46:06
【问题描述】:

我的解决方案是在 Azure DevOps 中构建的。由于该解决方案具有单元和集成测试,我需要进行过滤以避免总是编辑构建定义。在我的笔记本电脑上,以下命令运行良好,只执行我需要的测试。

dotnet test project.csproj --filter Category=Unit

但是,它在 Azure DevOps 中失败并显示以下消息。

[command]/usr/bin/dotnet test --filter Category=Unit {...}/{...}.Tests.csproj --configuration Release
No executable found matching command "dotnet-test --filter Category=Unit"
##[error]Error: /usr/bin/dotnet failed with return code: 1

测试项目有以下 nuget 包:

<ItemGroup>
        <PackageReference Include="FluentAssertions" Version="5.6.0" />
        <PackageReference Include="FluentValidation" Version="8.2.3" />
        <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.1" />
        <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
        <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
        <PackageReference Include="xunit" Version="2.4.1" />
        <PackageReference Include="xunit.analyzers" Version="0.10.0" />
        <PackageReference Include="xunit.runner.console" Version="2.4.1" />
        <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
    </ItemGroup>

构建设置:

【问题讨论】:

    标签: azure-devops xunit xunit.net


    【解决方案1】:

    您不需要自定义命令,只需将Command 字段更新为Test 并将用于过滤的参数标志移动到Arguments:

    【讨论】:

      猜你喜欢
      • 2020-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-17
      • 2021-01-30
      相关资源
      最近更新 更多