Introduce VSReuseInstance parameter for test settings

This commit is contained in:
Sebastien Lebreton 2017-02-09 20:00:59 -08:00
Родитель 53eaf54785
Коммит c63c636865
3 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -86,6 +86,7 @@ follows:
| VSHive | The hive name, like "Exp" or "Default" |
| VSLaunchTimeoutInSeconds [opt] | The number of seconds to wait for launch |
| VSDebugMixedMode | True to use mixed-mode debugging for tests |
| VSReuseInstance [opt] | False to disable the reuse of the same VS instance for distinct tests |
| ScreenCapture [opt] | Relative path to capture screenshots to |
| ScreenCaptureInterval [opt] | Milliseconds between screenshots |

Просмотреть файл

@ -40,6 +40,7 @@ namespace Microsoft.VisualStudioTools.VSTestHost {
private IRunContext _runContext;
private TesteeTestAdapter _remote;
private bool _mockVs;
private bool _reuseInstance;
public TesterTestAdapter() { }
@ -54,7 +55,8 @@ namespace Microsoft.VisualStudioTools.VSTestHost {
) {
var hiveOption = string.IsNullOrEmpty(hive) ? "" : (" /rootSuffix " + hive);
if (_ide != null &&
if (_reuseInstance &&
_ide != null &&
_remote != null &&
application == _currentApplication &&
executable == _currentExecutable &&
@ -169,6 +171,7 @@ namespace Microsoft.VisualStudioTools.VSTestHost {
Version version;
string launchTimeoutInSecondsString;
int launchTimeoutInSeconds;
string reuseInstanceString;
// VSApplication is the registry key name like 'VisualStudio'
application = vars[VSTestProperties.VSApplication.Key] ?? VSTestProperties.VSApplication.VisualStudio;
@ -216,6 +219,12 @@ namespace Microsoft.VisualStudioTools.VSTestHost {
return;
}
if (!vars.TryGetValue(VSTestProperties.VSReuseInstance.Key, out reuseInstanceString) ||
!bool.TryParse(reuseInstanceString, out _reuseInstance))
{
// the default behavior is to reuse the current instance when possible
_reuseInstance = true;
}
// TODO: Detect and perform first run of VS if necessary.
// The first time a VS hive is run, the user sees a dialog allowing

Просмотреть файл

@ -50,5 +50,9 @@ namespace Microsoft.VisualStudioTools.VSTestHost {
public static class VSDebugMixedMode {
public const string Key = "VSDebugMixedMode";
}
public static class VSReuseInstance {
public const string Key = "VSReuseInstance";
}
}
}