gpt4 book ai didi

teamcity-8.0 - TeamCity 无法从自定义构建脚本生成 DotCover 报告

转载 作者:行者123 更新时间:2023-12-02 17:45:07 25 4
gpt4 key购买 nike

我需要做什么才能让 TeamCity 正确生成针对我的项目的覆盖率报告?

我有一个针对我的代码运行 DotCover 的自定义 powershell 构建脚本。构建脚本有一个像这样的覆盖方法

Function Invoke-NUnitWithCoverage ( [string] $targetAssembly, [string] $outputDir, [string] $runCommand){
$fileName = Get-TestFileName $outputDir $runCommand

$xmlFile = "$fileName-TestResults.xml"
$txtFile = "$fileName-TestResults.txt"
$coverageFile = "$fileName-CoverageResults.xml"

exec{ dotcover.exe analyse /TargetExecutable=$nunitRunnerDir\nunit-console.exe /TargetArguments="$targetAssembly /fixture:$runCommand /xml=$xmlFile /out=$txtFile /nologo /framework=4.0" /Output=$coverageFile /ReportType=xml } "Running code coverage '$runCommand' failed."
Write-Host "##teamcity[importData type='dotNetCoverage' tool='dotcover' path='$coverageFile']"
}

输出在 TeamCity 上显示正确,但未生成报告。这是 TeamCity 日志。 正如您所看到的,存在生成失败。

TL;DR;
如果您不想阅读整个日志,请查看以下关键行。

[JetBrains dotCover] Failed to merge snapshots. Unknown storage type. Unknown storage type
...
[JetBrains dotCover] Unhandled exception: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
...
[JetBrains dotCover] Report generation failed. Too short file
...
[JetBrains dotCover] Failed to create zipped snapshot. Too short file
...
[JetBrains dotCover] 'E:\BuildAgent\temp\buildTmp\dotCover5237101456909205485Merge' is not a coverage snapshot.
##teamcity[importData type='dotNetCoverage' tool='dotcover' path='E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-App-Tests-CoverageResults.xml']
....
....
Waiting for 16 service processes to complete
[10:32:34]Processing 1 coverage report(s)
[10:32:34]Generating coverage report by dotcover for files: [E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-App-Tests-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-Framework-Test-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-CommonDataService-Tests-Unit-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-Contracts-Tests-Unit-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-Invoicing-Tests-Unit-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-FlowingGasService-Tests-Unit-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-JobSchedulingService-Tests-Unit-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-CommonDataService-Tests-Integration-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-Contracts-Tests-Integration-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-Invoicing-Tests-Integration-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-FlowingGasService-Tests-Integration-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-JobSchedulingService-Tests-Integration-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-CommonDataService-Tests-Acceptance-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-Contracts-Tests-Acceptance-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-FlowingGasService-Tests-Acceptance-CoverageResults.xml, E:\BuildAgent\work\81eb7c2fdfcfc0af\build-artifacts\results\TransCanada-GCTS-Invoicing-Tests-Acceptance-CoverageResults.xml]
[10:32:34]Get dotCover version (1s)
[10:32:35]Started dotCover: E:\BuildAgent\tools\dotCover\dotCover.exe version E:\BuildAgent\temp\buildTmp\dotCover2609519531914093171Version
[10:32:35]
Output: JetBrains dotCover Console Runner v2.7.2.84. Copyright (c) 2009-2014 JetBrains s.r.o. All rights reserved.
[10:32:35]dotCover exited with code: 0
[10:32:35]Use DotCover 2.7.x commands set
[10:32:35]Merge dotCover reports (10s)
[10:32:45]Started dotCover: E:\BuildAgent\tools\dotCover\dotCover.exe merge E:\BuildAgent\temp\buildTmp\dotcover6392358845042650216.xml
[10:32:45]
Output: JetBrains dotCover Console Runner v2.7.2.84. Copyright (c) 2009-2014 JetBrains s.r.o. All rights reserved.
[JetBrains dotCover] Snapshot merging started [12/3/2014 10:32:44 AM]
[JetBrains dotCover] Source snapshots number: 16
Merging snapshots 1-5
[JetBrains dotCover] Failed to merge snapshots. Unknown storage type. Unknown storage type
[10:32:45]dotCover exited with code: -2
[10:32:45]dotCover returned non-zero exit code.
[10:32:45]Remove dotCover snapshot files
[10:32:45]Started dotCover: E:\BuildAgent\tools\dotCover\dotCover.exe delete E:\BuildAgent\temp\buildTmp\dotcover4610370083173723447.xml
[10:32:45]
Output: JetBrains dotCover Console Runner v2.7.2.84. Copyright (c) 2009-2014 JetBrains s.r.o. All rights reserved.
[JetBrains dotCover] Unhandled exception: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
[10:32:45]dotCover exited with code: -10
[10:32:45]dotCover returned non-zero exit code.
[10:32:45]Generate dotCover report (7s)
[10:32:52]Started dotCover: E:\BuildAgent\tools\dotCover\dotCover.exe report E:\BuildAgent\temp\buildTmp\dotcover8678535704262330052.xml
[10:32:52]
Output: JetBrains dotCover Console Runner v2.7.2.84. Copyright (c) 2009-2014 JetBrains s.r.o. All rights reserved.
[JetBrains dotCover] Report generation started [12/3/2014 10:32:45 AM]
[JetBrains dotCover] Report generation failed. Too short file
[10:32:52]dotCover exited with code: -2
[10:32:52]dotCover returned non-zero exit code.
[10:32:52]Generate dotCover HTML report
[10:32:52]Packing snapshot files (6s)
[10:32:59]Started dotCover: E:\BuildAgent\tools\dotCover\dotCover.exe zip E:\BuildAgent\temp\buildTmp\dotcover1602620273009840026.xml
[10:32:59]
Output: JetBrains dotCover Console Runner v2.7.2.84. Copyright (c) 2009-2014 JetBrains s.r.o. All rights reserved.
[JetBrains dotCover] Failed to create zipped snapshot. Too short file
[10:32:59]dotCover exited with code: -2
[10:32:59]dotCover returned non-zero exit code.
[10:32:59]Remove dotCover snapshot files (6s)
[10:33:06]No statistics values are provided by dotCover report generator (recommended)

最佳答案

对于 dotCover,您应该发送由 dotCover.exe cover 命令生成的快照 (dotCover.snapshot) 文件的路径,而不是 .xml 文件。

关于teamcity-8.0 - TeamCity 无法从自定义构建脚本生成 DotCover 报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27279539/

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