我有一个用 .net framework 4.6 编写的 Windows 服务。我正在尝试为此服务运行声纳分析。MStest.exe
我的要求是使用或生成代码覆盖率结果和单元测试用例报告vstest.console.exe
。我已经为我的服务编写了使用 MStest 的测试用例。
使用 MSTest,我编写了以下命令:
MSTest /testcontainer:.\SolutionTests\bin\Release\SolutionTests.dll /resultsfile:"C:\SonarQube\Solution.trx"
使用 vstest.console.exe,我编写了以下命令:
vstest.console.exe SolutionTests\bin\Release\SolutionTests.dll /Enablecodecoverage /Logger:trx;LogFileName="C:\SonarQube\Solution.trx"
在这两种情况下,只生成单元测试报告(.trx 文件),因为我在命令中明确设置了文件名。
有什么方法可以.coverage
通过添加其他参数在同一命令中生成文件。我在几篇文章中读到说 MSTest 命令生成了两个报告(result.trx and data.coverage
),但没有写到确切的命令如何执行它。我运行了上面的命令,它没有为我生成 data.coverage 文件。