Sitelet https://github.com/coverlet-coverage/coverlet/issues/1880
Skip to content

Coverlet.MTP - Unable to load coverlet.mtp.appsettings.json #1880

Description

@pinkfloydx33

Using Coverlet.MTP v10.0.0-preview.3.g24d3f6899a I am unable to get Coverlet to pick up the coverlet.mtp.appsettings.json configuration file. Another user has reported similar as an aside in a different issue

What is also odd is that in my MTP test project that the coverlet.mtp.appsettings.json file does not look to get automatically picked up by my test project and simply gets ignored unless I directly pass in the args for what I would have provided in the json file.

Originally posted by @AraHaan in #1877


Looking at the code it appears that it might not be wired through properly because CoverletTestSessionHandler is never passed an IConfiguration object:

public static void AddCoverletCodeCoverage(this ITestApplicationBuilder builder)
{
// Register the test session lifetime handler
builder.TestHost.AddTestSessionLifetimeHandler(serviceProvider =>
new CoverletTestSessionHandler());
}

This constructor is never invoked

public CoverletTestSessionHandler(IConfiguration? configuration, string testModule)
{
_ = new CoverletMTPSettingsParser();
_settings = CoverletMTPSettingsParser.Parse(configuration, testModule);
}

but instead this one is:

public CoverletTestSessionHandler()
{
_settings = new CoverletMTPSettings();
}


If this is not a bug, how does one get the coverlet.mtp.appsettings.json file to load? There is no indication in diagnostic logs that it's trying to load despite being in the output directory .

Is there any chance you could get this to also work with the testconfig.json file supported by MTP? It'd be nice if I could reduce the number of files I need to manage

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SolvedThe issue is solved and can be closedbugSomething isn't workingdocumentationdriver-MTPIssue related to Microsoft Testing Platform driver

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions