【发布时间】:2019-11-02 08:01:42
【问题描述】:
我的项目结构如下:
.
├── Application
├── Application.Core
├── Application.Domain
├── Application.Tests
├── Application.IntegrationTests
└── README.md
运行测试的命令我使用以下输入:
dotnet test $folder.FullName -c Release --no-build /p:CoverletOutput='$root\coverage' /p:MergeWith='$root\coverage.json' /p:CoverletOutputFormat=opencover
$folder 指向我的 Application.Tests 路径:C:\projects\coredemoapp\CoreDemoApp.Tests 和 $root 到 C:\projects\coredemoapp\
所有测试都成功运行。但是,问题是没有创建coverage.json 和coverage.opencover.xml 文件。
我也尝试通过以下命令直接使用coverlet:
coverlet <path to test.dll> -
-target "dotnet" --targetargs "test --no-build" --merge-with $root\coverage.json --format opencover
,一切都在我的本地机器上运行,具有 dll 的显式路径。但是在使用以前的$folder.FullName 作为<path to assembly> 运行命令的情况下,coverlet 假定路径到 debug dll,而不是应该的 release 版本,并且失败。
【问题讨论】:
-
至少部分解决方案是提前使用coverlet --targetargs 并将release参数传递给它:
--targetargs "test -c Release --no-build"
标签: powershell dotnet-test coverlet