Updating missing files.
MODIFY
src/NUnitTestAdapter/AdapterSettings.cs
src/NUnitTestAdapter/AdapterSettings.cs
@@ -68,7 +68,7 @@ namespace NUnit.VisualStudio.TestAdapter
/// <summary>
/// If true, an adapter should disable any test case parallelization
/// </summary>
- public bool DisableParallelization { get; private set; }
+ public bool? DisableParallelization { get; private set; }
/// <summary>
/// True if test run is triggered in an IDE/Editor context.
@@ -147,7 +147,7 @@ namespace NUnit.VisualStudio.TestAdapter
TestAdapterPaths = GetInnerText(runConfiguration, "TestAdapterPaths");
CollectSourceInformation = GetInnerTextAsBool(runConfiguration, "CollectSourceInformation", true);
DisableAppDomain = GetInnerTextAsBool(runConfiguration, "DisableAppDomain", false);
- DisableParallelization = GetInnerTextAsBool(runConfiguration, "DisableParallelization", false);
+ DisableParallelization = GetInnerTextAsNullableBool(runConfiguration, "DisableParallelization");
DesignMode = GetInnerTextAsBool(runConfiguration, "DesignMode", false);
TestProperties = new Dictionary<string, string>();
@@ -245,15 +245,26 @@ namespace NUnit.VisualStudio.TestAdapter
private void UpdateNumberOfTestWorkers()
{
- if(DisableParallelization && NumberOfTestWorkers <=0)
+ if(!DisableParallelization.HasValue)
+ {
+ return;
+ }
+
+ if(DisableParallelization.Value && NumberOfTestWorkers < 0)
{
NumberOfTestWorkers = 0;
}
- else if(DisableParallelization && NumberOfTestWorkers > 0)
+ else if(DisableParallelization.Value && NumberOfTestWorkers > 0)
{
_logger.Warning(string.Format("DisableParallelization:{0} & NumberOfTestWorkers:{1} are conflicting settings, hence not running in parallel", DisableParallelization, NumberOfTestWorkers));
NumberOfTestWorkers = 0;
}
+ else if(!DisableParallelization.Value && NumberOfTestWorkers == 0)
+ {
+ _logger.Warning(string.Format("DisableParallelization:{0} & NumberOfTestWorkers:{1} are conflicting settings, hence running in parallel", DisableParallelization, NumberOfTestWorkers));
+ // Setting it to less than zero, so that framework will decide it.
+ NumberOfTestWorkers = -1;
+ }
}
private string GetInnerText(XmlNode startNode, string xpath, params string[] validValues)
@@ -312,6 +323,16 @@ namespace NUnit.VisualStudio.TestAdapter
return bool.Parse(temp);
}
+ private bool? GetInnerTextAsNullableBool(XmlNode startNode, string xpath)
+ {
+ string temp = GetInnerText(startNode, xpath);
+
+ if (string.IsNullOrEmpty(temp))
+ return null;
+
+ return bool.Parse(temp);
+ }
+
#endregion
}
}

MODIFY
src/NUnitTestAdapter/NUnitTestAdapter.cs
src/NUnitTestAdapter/NUnitTestAdapter.cs
@@ -90,7 +90,21 @@ namespace NUnit.VisualStudio.TestAdapter
public static bool IsRunningUnderIDE
{
- get; private set;
+ get
+ {
+ if (exeName == null)
+ {
+ Assembly entryAssembly = Assembly.GetEntryAssembly();
+ if (entryAssembly != null)
+ exeName = entryAssembly.Location;
+
+ }
+
+ return exeName != null && (
+ exeName.Contains("vstest.executionengine") ||
+ exeName.Contains("vstest.discoveryengine") ||
+ exeName.Contains("TE.ProcessHost"));
+ }
}
#endregion
@@ -111,7 +125,6 @@ namespace NUnit.VisualStudio.TestAdapter
{
Settings.Load(context);
TestLog.Verbosity = Settings.Verbosity;
- IsRunningUnderIDE = Settings.DesignMode;
}
catch (Exception e)
{

Updating missing files.