Reading other settings that meant for adapters
DisableParallelization
DesignMode : Can be used to figure out if IsRunningUnderIDE.
MODIFY
src/NUnitTestAdapter/AdapterSettings.cs
src/NUnitTestAdapter/AdapterSettings.cs
@@ -55,10 +55,26 @@ namespace NUnit.VisualStudio.TestAdapter
public string TestAdapterPaths { get; private set; }
+ /// <summary>
+ /// If false, an adapter need not parse symbols to provide test case file, line number
+ /// </summary>
public bool CollectSourceInformation { get; private set; }
+ /// <summary>
+ /// If true, an adapter shouldn't create appdomains to run tests
+ /// </summary>
public bool DisableAppDomain { get; private set; }
+ /// <summary>
+ /// If true, an adapter should disable any test case parallelization
+ /// </summary>
+ public bool DisableParallelization { get; private set; }
+
+ /// <summary>
+ /// True if test run is triggered in an IDE/Editor context.
+ /// </summary>
+ public bool DesignMode { get; private set; }
+
#endregion
#region Properties - TestRunParameters
@@ -131,6 +147,8 @@ namespace NUnit.VisualStudio.TestAdapter
TestAdapterPaths = GetInnerText(runConfiguration, "TestAdapterPaths");
CollectSourceInformation = GetInnerTextAsBool(runConfiguration, "CollectSourceInformation", true);
DisableAppDomain = GetInnerTextAsBool(runConfiguration, "DisableAppDomain", false);
+ DisableParallelization = GetInnerTextAsBool(runConfiguration, "DisableParallelization", false);
+ DesignMode = GetInnerTextAsBool(runConfiguration, "DesignMode", false);
TestProperties = new Dictionary<string, string>();
foreach (XmlNode node in doc.SelectNodes("RunSettings/TestRunParameters/Parameter"))
@@ -187,6 +205,12 @@ namespace NUnit.VisualStudio.TestAdapter
{
DomainUsage = "None";
}
+
+ // If DisableParallelization setting is passed from the testplatform, set the NumberOfTestWorkers to 0
+ if(DisableParallelization)
+ {
+ NumberOfTestWorkers = 0;
+ }
}
public void SaveRandomSeed(string dirname)

MODIFY
src/NUnitTestAdapterTests/AdapterSettingsTests.cs
src/NUnitTestAdapterTests/AdapterSettingsTests.cs
@@ -102,6 +102,20 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
Assert.That(_settings.DisableAppDomain, Is.EqualTo(true));
}
+ [Test]
+ public void DisableParallelizationSetting()
+ {
+ _settings.Load("<RunSettings><RunConfiguration><DisableParallelization>true</DisableParallelization></RunConfiguration></RunSettings>");
+ Assert.That(_settings.NumberOfTestWorkers, Is.EqualTo(0));
+ }
+
+ [Test]
+ public void DesignModeSetting()
+ {
+ _settings.Load("<RunSettings><RunConfiguration><DesignMode>true</DesignMode></RunConfiguration></RunSettings>");
+ Assert.That(_settings.DesignMode, Is.EqualTo(true));
+ }
+
[Test]
public void TestRunParameterSettings()
{

Reading other settings that meant for adapters

- DisableParallelization
- DesignMode : Can be used to figure out if IsRunningUnderIDE.