Automated tests 关于错误的Dotnet测试问题

Automated tests 关于错误的Dotnet测试问题,automated-tests,azure-pipelines,Automated Tests,Azure Pipelines,我正在Azure管道上工作,运行在Windows自托管代理上,在防火墙后面运行自动测试。 我想在Azure中查看管道结果中的测试结果和代码覆盖率。我的构建管道正在工作,但我还没有看到自动化测试的结果,所以我不确定会发生什么 我在管道中运行此功能: - job: Test steps: - task: NuGetAuthenticate@0 - task: DotNetCoreCLI@2 inputs: command: t

我正在Azure管道上工作,运行在Windows自托管代理上,在防火墙后面运行自动测试。 我想在Azure中查看管道结果中的测试结果和代码覆盖率。我的构建管道正在工作,但我还没有看到自动化测试的结果,所以我不确定会发生什么

我在管道中运行此功能:

  - job: Test
    steps:
      - task: NuGetAuthenticate@0

      - task: DotNetCoreCLI@2
        inputs:
          command: test
          projects: 'src/***.Test.Core/*.csproj'
          testRunTitle: '***Tests'
          arguments: '--collect "Code coverage"'
          publishTestResults: true
以下是日志摘录,以及我的问题和评论:

  • 代理和常规内容的初始化
  • 不确定什么是CHCP,但测试正在运行,我相信错误链接到防火墙,所以我希望在测试结果中看到这些错误
  • 推送结果时出错,这意味着“未能获取FF TestManagement.Server.UsePublishTestResultsLibInAgent值”
  • 无法获取FF TestManagement.PTR.CalculateStrunsummary,什么是CalculateStrunsummary
  • 我不知道如何处理这些警告,我对dotnetcore和Nuget了解不多,我的工作只是管道,而不是底层项目。在项目设置中,我看到.Net Core 3.1,我不知道在哪里可以找到我是否使用Nuget版本<5.7以及此警告是否适用于我
谢谢你的帮助,克劳德

更新1---------------------------------

多谢各位。 我知道我在代理上的DotNet Core版本不好, 代理具有版本5,而项目引用版本3.1

我添加了这个任务:

  - task: UseDotNet@2
    inputs:
      packageType: 'sdk'
      version: '3.1.x'
但我在防火墙后面,仍然有以下日志:

##[debug]agent.proxyurl=http://***proxy.***.***:443
##[debug]agent.proxyusername=undefined
##[debug]agent.proxypassword=undefined
##[debug]agent.proxybypasslist=["***.***,localhost,127.0.0.1","***.***","localhost","127.0.0.1"]
##[debug]agent.proxybypasslist=["***.***,localhost,127.0.0.1","***.***","localhost","127.0.0.1"]
##[debug]AZURE_HTTP_USER_AGENT=VSTS_c11775e3-cd05-4e03-abd2-35da98ef2f0f_build_164_0
Tool to install: .NET Core sdk version 3.1.x.
##[debug]task result: Failed
##[error]Failed to download or parse releases-index.json with error: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
最好在本地安装此版本吗?在这种情况下,我是否需要做一些特殊的事情,以便它使用正确的版本

更新2---------------------------------

感谢链接到一个已知问题。我注意到这个问题并没有提到我的一个错误:{“代码”:“无法在本地获取颁发者证书”}

任务是否会试图达到目标https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.1/releases.json“但不能,因为我们在防火墙后面

我不明白为什么它会尝试安装DotNet Core,因为它已经安装好了,但我对DotNet Core了解不多,我只是尝试运行自动测试

我最后的测试包括:

  - task: NuGetAuthenticate@0
    displayName: 'Authenticate with NuGet'

  - task: UseDotNet@2
    inputs:
      packageType: 'sdk'
      version: '3.1.101'
      installationPath: '$(Agent.ToolsDirectory)/dotnet'

  - task: DotNetCoreCLI@2
    inputs:
      command: test
      projects: 'src/myProject.Test.Core/*.csproj'
      testRunTitle: 'myProject'
      arguments: '--collect "Code coverage"'
      publishTestResults: true
日志包含:

##[debug]agent.proxyurl=http://proxy.myCie.com:443
##[debug]agent.proxyusername=undefined
##[debug]agent.proxypassword=undefined
##[debug]agent.proxybypasslist=["myCie.com,localhost,127.0.0.1","myCie.com","localhost","127.0.0.1"]
##[debug]agent.proxybypasslist=["myCie.com,localhost,127.0.0.1","myCie.com","localhost","127.0.0.1"]
##[debug]AZURE_HTTP_USER_AGENT=VSTS_xxx_build_173_0
Tool to install: .NET Core sdk version 3.1.101.
##[debug]task result: Failed
##[error]Failed to download or parse releases-index.json with error: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
##[debug]Processed: ##vso[task.issue type=error;]Failed to download or parse releases-index.json with error: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
##[section]Finishing: UseDotNet

感谢您的帮助

我认为这与GitHub问题类似。它与内部GitHub repo/url有关。这是因为我们在任务中指定的是在发布索引文件中搜索的,公众也可以访问该文件:

您也可以查看


在这种情况下,我建议您重新打开该问题。

Hi,关于警告消息,我们可以添加任务UseDotNet来指定版本,错误消息是将测试结果发布到摘要页面,这应该与代理的版本相关,您是否可以与托管代理一起尝试,然后在此处共享结果?谢谢,请看我的更新1经过一些挖掘,我变得更加困惑,因为代理上安装了几个版本,我写了一个新问题:谢谢,祝你有一个伟大的年终庆典!!!:)你好对不起,我将离开电脑直到明年。。。如果您有任何问题,请随时告诉我。如果答案可以帮助,你可以考虑接受它。祝你今天愉快。:)我做了一个新的测试,仍然失败,我在更新2中解释道。谢谢
##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build 
##[debug]Processed: ##vso[task.issue type=warning;].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) Use global.json using an older sdk version(<=3) to build 
##[debug]task result: Failed
##[error]Dotnet command failed with non-zero exit code on the following projects : *:\Agent\_work\24\s\src\***.Test.Core\***.Test.Core.csproj
##[debug]Processed: ##vso[task.issue type=error;]Dotnet command failed with non-zero exit code on the following projects : E:\Agent\_work\24\s\src\***.Test.Core\***.Test.Core.csproj
##[debug]Processed: ##vso[task.complete result=Failed;]Dotnet command failed with non-zero exit code on the following projects : E:\Agent\_work\24\s\src\***.Core\***.Test.Core.csproj
##[section]Async Command Start: Publish test results
##[warning]Failed to publish test results: Moved Temporarily
##[section]Async Command End: Publish test results
##[section]Finishing: DotNetCoreCLI
  - task: UseDotNet@2
    inputs:
      packageType: 'sdk'
      version: '3.1.x'
##[debug]agent.proxyurl=http://***proxy.***.***:443
##[debug]agent.proxyusername=undefined
##[debug]agent.proxypassword=undefined
##[debug]agent.proxybypasslist=["***.***,localhost,127.0.0.1","***.***","localhost","127.0.0.1"]
##[debug]agent.proxybypasslist=["***.***,localhost,127.0.0.1","***.***","localhost","127.0.0.1"]
##[debug]AZURE_HTTP_USER_AGENT=VSTS_c11775e3-cd05-4e03-abd2-35da98ef2f0f_build_164_0
Tool to install: .NET Core sdk version 3.1.x.
##[debug]task result: Failed
##[error]Failed to download or parse releases-index.json with error: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
  - task: NuGetAuthenticate@0
    displayName: 'Authenticate with NuGet'

  - task: UseDotNet@2
    inputs:
      packageType: 'sdk'
      version: '3.1.101'
      installationPath: '$(Agent.ToolsDirectory)/dotnet'

  - task: DotNetCoreCLI@2
    inputs:
      command: test
      projects: 'src/myProject.Test.Core/*.csproj'
      testRunTitle: 'myProject'
      arguments: '--collect "Code coverage"'
      publishTestResults: true
##[debug]agent.proxyurl=http://proxy.myCie.com:443
##[debug]agent.proxyusername=undefined
##[debug]agent.proxypassword=undefined
##[debug]agent.proxybypasslist=["myCie.com,localhost,127.0.0.1","myCie.com","localhost","127.0.0.1"]
##[debug]agent.proxybypasslist=["myCie.com,localhost,127.0.0.1","myCie.com","localhost","127.0.0.1"]
##[debug]AZURE_HTTP_USER_AGENT=VSTS_xxx_build_173_0
Tool to install: .NET Core sdk version 3.1.101.
##[debug]task result: Failed
##[error]Failed to download or parse releases-index.json with error: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
##[debug]Processed: ##vso[task.issue type=error;]Failed to download or parse releases-index.json with error: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
##[section]Finishing: UseDotNet
{
            "channel-version": "3.1",
            "latest-release": "3.1.10",
            "latest-release-date": "2020-11-10",
            "security": false,
            "latest-runtime": "3.1.10",
            "latest-sdk": "3.1.404",
            "product": ".NET Core",
            "support-phase": "lts",
            "eol-date": "2022-12-03",
            "releases.json": "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.1/releases.json"
        },