visual-studioautomated-testsnunit-3.0runsettings

Having an issue with relative paths in .runsettings for output folders using NUnit 3.13.3 in Visual Studio 2017


I am using NUnit 3 with Visual Studio 2017. I am trying to store both TRX and XML test results into the same output folder. The problem I am having is that the .runsettings <ResultsDirectory> path is relative to the Solution folder, whereas the <TestOutputXml> path is relative to the WorkingDirectory, which is not the same as the Solution directory. Thus, if I try to store the result output into a relative path using ".\Results" for both .runsettings entries, I get two different Results folders - one in Bin, and the other in the Solution dir. I want one Results folder for both the TRX and XML output files to be in the same location (preferably relative to the Solution folder). How do I do this using .runsettings?

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <RunConfiguration>
    <!-- Path relative to VS solution directory -->
    <ResultsDirectory>.\TestResults</ResultsDirectory>
  </RunConfiguration>

  <LoggerRunSettings>
    <Loggers>
      <Logger friendlyName="trx" enabled="True">
        <Configuration>
          <LogFileName>TestResults.trx</LogFileName>
        </Configuration>
      </Logger>
    </Loggers>
  </LoggerRunSettings>

  <NUnit>
    <!-- Path relative to NUnit working directory -->
    <TestOutputXml>.\TestResults</TestOutputXml>
  </NUnit>
</RunSettings>

Solution

  • Issue reported on GitHub. See the following link for response. https://github.com/nunit/nunit3-vs-adapter/issues/997#issuecomment-1186165040