Skip to content

MsTest .runsettings .testsettings

Jakub Raczek edited this page Apr 25, 2019 · 7 revisions

MsTest unit tests in Visual Studio can be configured by using a *.runsettings file or *.testsettings. It depends on Visual Studio version you using or test runner version.

Both files should be added as a content to your project during installation of each Ocaramba.MsTest nuget package.

One of solution is to use:

<?xml version="1.0" encoding="UTF-8"?>
<RunSettings>
	<RunConfiguration>
    <MaxCpuCount>4</MaxCpuCount>
		<ResultsDirectory>.\</ResultsDirectory>
	 </RunConfiguration>
<!-- MSTest adapter -->
  <MSTest>
    <CaptureTraceOutput>false</CaptureTraceOutput>
    <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
    <DeploymentEnabled>False</DeploymentEnabled>
<!--<SettingsFile>.\Testsettings.testsettings</SettingsFile>
    <ForcedLegacyMode>true</ForcedLegacyMode>-->
  </MSTest>
</RunSettings>

RunSettings.runsettings

<?xml version="1.0" encoding="UTF-8"?>
<RunSettings>
	<RunConfiguration>
    <!--<MaxCpuCount>4</MaxCpuCount>-->
		<ResultsDirectory>.\</ResultsDirectory>
	 </RunConfiguration>
<!-- MSTest adapter -->
  <MSTest>
    <CaptureTraceOutput>false</CaptureTraceOutput>
    <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
    <DeploymentEnabled>False</DeploymentEnabled>
    <SettingsFile>.\Testsettings.testsettings</SettingsFile>
    <ForcedLegacyMode>true</ForcedLegacyMode>
  </MSTest>
</RunSettings>

Testsettings.testsettings

<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="Local" id="164f37f6-b408-4a43-9caa-97fe6ccd4dc4" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Description>These are default test settings for a local test run.</Description>
  <Deployment enabled="false"/>
  <Execution parallelTestCount = "2">
	<TestTypeSpecific />
    <AgentRule name="Execution Agents">
    </AgentRule>
  </Execution>
</TestSettings>
Clone this wiki locally