1

我需要设置工作服。在此之前,我正在尝试/p:CoverletOutputFormat=lcov设置vstest.console. 所以我成功地使用命令dotnet test --results-directory "./testresults" -l trx -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=lcov进行设置。这个案子正在奏效。CoverletOutputFormatdotnet test

但目前我需要将它用于dotnet vstest

我的完整命令是: vstest.console MyFolder\MyDll.dll /ResultsDirectory:"./testresults" /Logger:trx /EnableCodeCoverage /p:CoverletOutputFormat=lcov 输出是:The argument /p:CoverletOutputFormat=lcov is invalid

4

1 回答 1

1

选项1

vstest.console MyFolder\MyDll.dll /ResultsDirectory:"./testresults" /Logger:trx /EnableCodeCoverage --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=lcov


选项 2

使用以下命令和运行设置文件:

vstest.console MyFolder\MyDll.dll /ResultsDirectory:"./testresults" /Logger:trx /EnableCodeCoverage /Settings:CodeCoverage.runsettings

CodeCoverage.runsettings

<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="XPlat Code Coverage">
        <Configuration>
          <Format>lcov</Format>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>
于 2020-07-30T11:43:20.603 回答