Problem with compatibility with Visual Studio .runsettings file between VS 2015 and VS 2019

102 Views Asked by At

I have added some RunConfigurations to my Visual Studio 2019 test project that uses NUnit testing. Namely, the following:

<RunSettings>

  <RunConfiguration>
    <!-- Path relative to solution directory -->
    <ResultsDirectory>.\TestResults</ResultsDirectory>

    <TestSessionTimeout>0</TestSessionTimeout>
    <DisableParallelization>true</DisableParallelization>

    <!-- 0 = As many processes as possible, limited by number of cores on machine, 1 = Sequential (1 process), 2-> Given number of processes up to limit by number of cores on machine-->
    <MaxCpuCount>0</MaxCpuCount>

    <TargetPlatform>x86</TargetPlatform>

  </RunConfiguration>

...

This configuration has worked fine when running tests with Visual Studio 2019. However, I just found out that a few people in my group only have Visual Studio 2015, and when they try to run tests with it, the run fails because the TestSessionTimeout and DisableParallelization settings are unexpected by Visual Studio 2015 for some reason. Is there some way that I can place conditions on the RunConfiguration child elements so that they will be excluded for VS 2015? Or, is there some explanation as to why this is a problem with VS 2015 when the same version of the NUnitTestAdapter is loaded with VS 2015 and VS 2019?

This is the error that is reported by VS 2015:

------ Discover test started ------
Invalid settings 'RunConfiguration'. Unexpected XmlElement: 'TestSessionTimeout'.
========== Discover test finished: 0 found (0:00:00.0150754) ==========
------ Run test started ------
Invalid settings 'RunConfiguration'. Unexpected XmlElement: 'TestSessionTimeout'.
========== Run test finished: 0 run (0:00:00.0130547) ==========

My test solution is using the following NUnit Nuget Packages:

  • NUnit 3.13.3
  • NUnit3TestAdapter 4.3.1

I was expecting Visual Studio 2015 to not fail the test run because of the .runsettings that it apparently does not recognize.

0

There are 0 best solutions below