'.NET 6.0 Xunit test not considering allureConfig.json when Microsoft Dependency Injection is used

I am having a .NET 6.0 Xunit test project that uses Microsoft dependency injection(I used appsettings.json and it will be read from Startup.cs)

With the above configuration, all tests are running fine. Now I need to integrate Allure reports with the test project. For that I'm using Allure.XUnit Nuget package.

To use Allure.XUnit, we need to configure allureConfig.json. When appsettings.json is present, this allureConfig.json is not considered and thus the allure reports are not getting generated. When I remove the dependency injection (along wing startup.cs and appsettings.json obviously), reports are generating.

Here's how I have used appsettings.json in the project.

           builder.SetBasePath(Directory.GetCurrentDirectory())
               .AddJsonFile("appsettings.json", optional: false, reloadOnChange: false)
               .AddEnvironmentVariables();

I need to generate allure reports when dependency injection is used in the project. Can anyone help me with this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source