gpt4 book ai didi

azure - 无法让 Azure DevOps 识别并运行我的 NUnit 测试

转载 作者:行者123 更新时间:2023-12-03 01:39:44 25 4
gpt4 key购买 nike

我正在尝试让我的 NUnit 测试在 Azure DevOps 管道中运行。然而,即使我可以看到我的项目正在构建:

Done Building Project "D:\a\3\s\Src\Standard\Splyce.Standard.Common.Tests\Splyce.Standard.Common.Tests.csproj" (default targets).

我仍然得到以下信息:

##[warning]No test assemblies found matching the pattern: **\*test*.dll,!**\*TestAdapter.dll,!**\obj\**.

我按照 https://developercommunity.visualstudio.com/solutions/357521/view.html 的说明进行操作添加“vsTest - 测试程序集”步骤,并且没有更改任何设置。

我的测试项目确实包含 NUnit3 测试适配器:

Test Adapter

所以我很确定这只是一个路径问题。然而,程序集选择器上的通配符应该可以找到它。这是我的相关解决方案的磁盘文件夹结构:

更新:显示磁盘上的物理布局包括 Src。

E:.
+---BuildProcessTemplates
\---Src
+---AgentApiServer
| +---Splyce.AgentApi.Common
| | +---bin
| | | \---Debug
| | | \---netcoreapp2.1
| | +---MirrorEngine
| | | \---Framework
| | | +---Dtos
| | | +---Enums
| | | +---Events
| | | \---Interfaces
| | \---obj
| | \---Debug
| | \---netcoreapp2.1
| \---Splyce.AgentApi.Server
| +---bin
| | \---Debug
| | +---netcoreapp2.0
| | +---netcoreapp2.1
| | \---netcoreapp2.2
| +---obj
| | \---Debug
| | +---netcoreapp2.0
| | +---netcoreapp2.1
| | \---netcoreapp2.2
| +---Properties
| \---wwwroot
\---Standard
+---Common
+---packages
| +---NUnit.3.11.0
| | +---build
| | \---lib
| | +---net20
| | +---net35
| | +---net40
| | +---net45
| | +---netstandard1.4
| | \---netstandard2.0
| +---NUnit3TestAdapter.3.13.0
| | \---build
| | +---net35
| | \---netcoreapp1.0
| \---Shouldly.3.0.2
| \---lib
| +---net40
| +---net451
| +---netstandard1.3
| \---netstandard2.0
+---Splyce.Standard.Common
| +---bin
| | \---Debug
| | \---netstandard2.0
| +---Helpers
| \---obj
| \---Debug
| \---netstandard2.0
+---Splyce.Standard.Common.Tests
| +---bin
| | +---Debug
| | \---Release
| +---obj
| | \---Debug
| | \---TempPE
| \---Properties
+---Splyce.Standard.DbMigrations
| +---bin
| | \---Debug
| | \---netstandard2.0
| +---Dtos
| +---Framework
| | +---DbUp
| | +---Dtos
| | | \---DatabaseMigrationsManager
| | +---Enums
| | \---Events
| \---obj
| \---Debug
| \---netstandard2.0
+---Splyce.Standard.Messaging
| +---bin
| | \---Debug
| | \---netstandard2.0
| +---Client
| | +---Publisher
| | \---Subscriber
| +---Framework
| | +---Interfaces
| | \---Messages
| +---Messages
| | +---Health
| | \---Mirroring
| \---obj
| \---Debug
| \---netstandard2.0
\---UnitTestProject1
+---bin
| \---Debug
| \---netcoreapp2.2
\---obj
\---Debug
\---netcoreapp2.2

任何人都可以给我任何关于如何让 Azure 找到我的测试程序集的想法吗?

最佳答案

我遇到了类似的问题,但根本原因最终与我的 VSBuild 任务上的 msbuildArgs 参数设置为“/target:Publish”有关。 VSBuild 日志让我知道该项目无法发布,这也阻止了它的构建。

Done Building Project "D:\BuildAgents\Agent03_work\1\s\Calculators\Calculators.csproj" (Publish target(s)).Project "D:\BuildAgents\Agent03_work\1\s\Workbench.sln" (1) is building "D:\BuildAgents\Agent03_work\1\s\Calculators.Tests\Calculators.Tests.csproj" (5) on node 1 (Publish target(s))._DeploymentUnpublishable:Skipping unpublishable project.Done Building Project "D:\BuildAgents\Agent03_work\1\s\Calculators.Tests\Calculators.Tests.csproj" (Publish target(s)).

我的决定只是添加一个额外的构建任务。这是我更新的 yaml:

- task: VSBuild@1
inputs:
solution: '$(solution)'
vsVersion: '16.0'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'

- task: VSTest@2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: '**\*Test*.dll'
searchFolder: '$(System.DefaultWorkingDirectory)'

- task: VSBuild@1
inputs:
solution: '$(solution)'
vsVersion: '16.0'
platform: '$(buildPlatform)'
msbuildArgs: '/target:Publish'
configuration: '$(buildConfiguration)'

其次是 CopyFiles 和 PublishBuildArtifacts 任务。

关于azure - 无法让 Azure DevOps 识别并运行我的 NUnit 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54955701/

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