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

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

Open
devklick opened this issue Dec 19, 2023 · 0 comments

Comments

@devklick
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant