gpt4 book ai didi

azure-devops - 开发运维VSTest@2 : ##[error]Could not find testhost

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

我们正在使用 devops 构建我们的 .net 4.7.2 应用程序。作为其中的一部分,我们正在运行使用 nunit 框架和测试运行器的单元测试。

它已经运行了大约 18 个月,但在最后一天刚刚停止工作:(

它使用标准模板来运行测试,看起来像:

      - task: VSTest@2
displayName: "Running tests"
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*test*.dll
!**\*TestAdapter.dll
!**\obj\**
searchFolder: '$(System.DefaultWorkingDirectory)'

但是,现在该步骤失败并显示以下日志:

NUnit Adapter 4.2.0.0: Test execution startedRunning all tests in D:\a\1\s\Configuration.Tests\bin\Release\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dllNUnit3TestExecutor discovered 0 of 0 NUnit test cases using Current Discovery mode, Explicit runRunning all tests in D:\a\1\s\Configuration.Tests\bin\Release\testcentric.engine.metadata.dllNUnit3TestExecutor discovered 0 of 0 NUnit test cases using Current Discovery mode, Explicit runRunning all tests in D:\a\1\s\Api.Tests\bin\Release\testcentric.engine.metadata.dllNUnit3TestExecutor discovered 0 of 0 NUnit test cases using Current Discovery mode, Explicit runRunning all tests in D:\a\1\s\CommunicationTests\bin\Release\testcentric.engine.metadata.dllNUnit3TestExecutor discovered 0 of 0 NUnit test cases using Current Discovery mode, Explicit runRunning all tests in D:\a\1\s\Domain.Tests\bin\Release\testcentric.engine.metadata.dllNUnit3TestExecutor discovered 0 of 0 NUnit test cases using Current Discovery mode, Explicit runRunning all tests in D:\a\1\s\packages\NUnit3TestAdapter.4.2.1\build\net35\testcentric.engine.metadata.dllNUnit3TestExecutor discovered 0 of 0 NUnit test cases using Current Discovery mode, Explicit runNUnit Adapter 4.2.0.0: Test execution completeNo test is available in D:\a\1\s\Configuration.Tests\bin\Release\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll D:\a\1\s\Configuration.Tests\bin\Release\testcentric.engine.metadata.dll D:\a\1\s\Api.Tests\bin\Release\testcentric.engine.metadata.dll D:\a\1\s\CommunicationTests\bin\Release\testcentric.engine.metadata.dll D:\a\1\s\Domain.Tests\bin\Release\testcentric.engine.metadata.dll D:\a\1\s\packages\NUnit3TestAdapter.4.2.1\build\net35\testcentric.engine.metadata.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.##[error]Could not find testhostResults File: D:\a_temp\TestResults\VssAdministrator_WIN-FVJ4KUK6IFI_2022-08-18_12_38_44.trx##[error]Test Run Aborted.Total tests: UnknownPassed: 110Total time: 16.7203 SecondsVstest.console.exe exited with code 1.**************** Completed test execution *********************Test results files: D:\a_temp\TestResults\VssAdministrator_WIN-FVJ4KUK6IFI_2022-08-18_12_38_44.trxCreated test run: 1080Publishing test results: 112Publishing test results to test run '1080'.TestResults To Publish 112, Test run id:1080Test results publishing 112, remaining: 0. Test run id: 1080Published test results: 112Publishing Attachments: 1Execution Result Code 1 is non zero, checking for failed resultsCompleted TestExecution Model...##[warning]Vstest failed with error. Check logs for failures. There might be failed tests.##[error]Error: The process 'D:\a_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.205.0\Modules\DTAExecutionHost.exe' failed with exit code 1##[error]Vstest failed with error. Check logs for failures. There might be failed tests.Finishing: Running tests

查看这个日志,似乎nunit测试已经成功运行,但它可能正在尝试运行mstests?当 devops 获得更新并破坏工作管道时,这令人沮丧。

最佳答案

我们也有类似的情况。

单元测试使用 xUnit 运行。

/TestAdapterPath:"D:\a\1\s" Starting test execution, please wait... Atotal of 36 test files matched the specified pattern.2.4828

##[error]Could not find testhost

Data collector 'Code Coverage' message: No code coverage dataavailable. Profiler was not initialized..2.0273

##[error]Could not find testhost

Data collector 'Code Coverage' message: No code coverage dataavailable. Profiler was not initialized..2.3746

##[error]Could not find testhost

Data collector 'Code Coverage' message: No code coverage dataavailable. Profiler was not initialized..1.992

##[error]Could not find testhost

Data collector 'Code Coverage' message: No code coverage dataavailable. Profiler was not initialized..4.8409##[error]Could not find testhost

Data collector 'Code Coverage' message: No code coverage dataavailable. Profiler was not initialized..2.1874##[error]Could not find testhost

我比较了成功运行和失败运行的输出,发现测试平台的版本不同。如果您不指定版本,则默认版本将是最新版本,并且可能是预览版本。所以我在 YAML 中添加了一些东西来指定一个可行的版本。

- task: VisualStudioTestPlatformInstaller@1
inputs:
versionSelector: 'SpecificVersion'
testPlatformVersion: '17.2.0'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
codeCoverageEnabled: True
vsTestVersion: 'toolsInstaller'

https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/test/vstest?view=azure-devops https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/vstest-platform-tool-installer?view=azure-devops

关于azure-devops - 开发运维VSTest@2 : ##[error]Could not find testhost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73404846/

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