Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataCollector in ".runsettings" file does not get injected into the test host process #2599

Closed
caghand opened this issue Oct 19, 2020 · 1 comment
Assignees
Labels

Comments

@caghand
Copy link
Member

caghand commented Oct 19, 2020

Description

When running dotnet test, if I specify a DataCollector using the command line, the in-process collector will be injected. But if I specify a DataCollector using a ".runsettings" file, the in-process collector won't be injected.

Steps to reproduce

Good case:
dotnet test <path_to_csproj_file> --collect "XPlat Code Coverage"

  • coverlet.collector gets injected into the test host process, and there are no problems.

Bad case:
dotnet test <path_to_csproj_file> --settings test.runsettings
(test.runsettings contains a DataCollector element with friendlyName="XPlat Code Coverage".)

Environment

.NET Core 3.1

@caghand caghand changed the title DataCollector in ".runsettings" file does not get injected into the test host DataCollector in ".runsettings" file does not get injected into the test host process Oct 19, 2020
@nohwnd nohwnd added the triaged label Jun 22, 2021
@jakubch1
Copy link
Member

Coverlet is not standard data collector. It is InProcess data collector which requires additional InProcDataCollector tag. I was able to run it correctly with below run settings.

  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="XPlat Code Coverage" enabled="True" />
    </DataCollectors>
  </DataCollectionRunSettings>
  <InProcDataCollectionRunSettings>
    <InProcDataCollectors>
      <InProcDataCollector assemblyQualifiedName="Coverlet.Collector.DataCollection.CoverletInProcDataCollector, coverlet.collector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" friendlyName="XPlat Code Coverage" enabled="True" codebase="C:\Users\UseThisAccount\.nuget\packages\coverlet.collector\3.0.3\build\netstandard1.0\coverlet.collector.dll" />
    </InProcDataCollectors>
  </InProcDataCollectionRunSettings>

The issue will be gone when coverlet will keep results in shared memory. In such case in process data collector is not needed.
I hope it will be resolved by: coverlet-coverage/coverlet#808.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants