Skip to content

Using runsettings file in testArguments causes duplicate results/coverage to be collected #392

Open
@devklick

Description

@devklick

I have a simple .runsettings file in the root of my repo which just collects coverage:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
    <DataCollectionRunSettings>
        <DataCollectors>
            <DataCollector friendlyName="XPlat code coverage">
                <Configuration>
                    <Format>lcov</Format>
                </Configuration>
            </DataCollector>
        </DataCollectors>
    </DataCollectionRunSettings>
</RunSettings>

When I run dotnet test, I provide the path to the settings file, and it generates the coverage in a single folder:

dotnet test --settings .runsettings

image

However when I set the dotnet-test-explorer.testArguments setting to "--settings .runsettings" and run the same tests, it generates two folders; one similar to before, and another which is named after the host machine name (in this example, zebra is my computer name).
image

Both coverage.info files in the second example contain the exact same data.

Why is this extension collecting the same test results twice when the underlying dotnet test command does not, and how can I suppress the duplicate test results?

Notes:

I have tried using the format suggested on the readme, "--settings:./.runsettings", however it produces the same results.

I know that I can use /p parameters instead to collect coverage as suggested in the readme (/p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=../../lcov.info), and this works nicely, however I need to use the runsettings as part of my workflow. As such, I'd rather avoid having two separate configurations, and have everything just reading from the runsettings file.

Debug info:

  1. Dotnet sdk version: 8.0.100
  2. Unit test framework and relevants versions of that: xunit 2.4.2
  3. A link to a repo that replicated the issue: Can create one if required
  4. OS: Linux Mint 21.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions