I want to write XUnit.net test results on trx file everytime that tests are executed, currently on .net 8 using VS 2022.
So, I’ve red Microsoft docs about runsettings file and, as far as I understood, after adding this file to the test project the test behaviour can be customized.
My goal is to write test output on results.trx file into TestResults folder.
This is the runsettings file:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<ResultsDirectory>.TestResults</ResultsDirectory>
<!-- Configuration for loggers -->
<LoggerRunSettings>
<Loggers>
<Logger friendlyName="trx" enabled="True">
<Configuration>
<LogFileName>results.trx</LogFileName>
</Configuration>
</Logger>
<Logger friendlyName="blame" enabled="True" />
</Loggers>
</LoggerRunSettings>
</RunSettings>
Placed at the root of Test project, I’ve even added this line to .csproj test file:
<PropertyGroup>
<RunSettingsFilePath>$(MSBuildProjectDirectory)test.runsettings</RunSettingsFilePath>
</PropertyGroup>
Then when running tests (with right-click -> run tests) all works like a charm but the result is not written on result .trx file, I guess the .runsettings is completely ignored by VS.
Any idea?
1