Infrastructure for executing interactive UI tests in Visual Studio.
Перейти к файлу
Sebastien Lebreton 42fbbb64d3
Add workaround for global assembly resolution issues with dev16
2019-04-22 10:45:27 -07:00
Build Dev16 support (#38) 2018-12-20 14:16:21 -08:00
Installer Revert to target version 14 in the wix installer, as it's only used before Dev15 2018-12-20 14:52:10 -08:00
VSTestHost Add workaround for global assembly resolution issues with dev16 2019-04-22 10:45:27 -07:00
VSTestUtilities Dev16 support (#38) 2018-12-20 14:16:21 -08:00
.gitattributes Update eol handling. 2015-09-30 19:09:41 -07:00
.gitignore Fixes signing 2016-02-26 17:07:48 -08:00
.hgeol Update eol handling. 2015-09-30 19:09:41 -07:00
BuildVSTestHost.ps1 Dev16 support (#38) 2018-12-20 14:16:21 -08:00
BuildVSTestUtilities.ps1 Dev16 support (#38) 2018-12-20 14:16:21 -08:00
DeveloperGuide.md Introduce VSReuseInstance parameter for test settings 2017-02-09 20:00:59 -08:00
DisableSkipVerification.reg Dev16 support (#38) 2018-12-20 14:16:21 -08:00
DisableVSTestHost12.0.reg Fixes line endings, hopefully for the last time. 2015-09-30 09:51:57 -07:00
DisableVSTestHost14.0.reg Fixes line endings, hopefully for the last time. 2015-09-30 09:51:57 -07:00
DisableVSTestHost15.0.reg Fixes signing 2016-02-26 17:07:48 -08:00
EnableSkipVerification.reg Dev16 support (#38) 2018-12-20 14:16:21 -08:00
EnableVSTestHost12.0.reg Increases version to 1.0.5 2016-09-16 14:47:42 -07:00
EnableVSTestHost14.0.reg Increases version to 1.0.5 2016-09-16 14:47:42 -07:00
EnableVSTestHost15.0.reg Increases version to 1.0.5 2016-09-16 14:47:42 -07:00
LICENSE Initial commit 2015-04-24 11:52:11 -07:00
README.md Update readme 2017-02-12 09:44:42 -08:00
VSTestHost.sln [WIP] Adds per-test settings and screen recording. 2015-06-10 18:27:14 -07:00
VSTestUtilities.sln Some tidying after pr #18 2016-02-12 11:40:47 -08:00
build.root Fixes signing 2016-02-26 17:07:48 -08:00
nuget.config Updates nuget and adds config 2016-03-04 10:50:59 -08:00

README.md

VisualStudio-TestHost

Join the chat at https://gitter.im/Microsoft/VisualStudio-TestHost

Infrastructure for executing interactive UI tests in Visual Studio.

Quick Start

The latest release will install the required components into all supported versions of Visual Studio. After installing a new version of Visual Studio, you will need to reinstall the test host.

Test settings files are used to specify the version of Visual Studio to launch. Example file

Add the [HostType("VSTestHost")] attribute to your unit tests, and your test will now launch VS and run within its process. The VS instance will be reused between tests, so make sure you clean everything up regardless of whether your test passes or fails. In PTVS we use a helper class with IDisposable to ensure that failed tests do not affect later ones.

Use the VSTestContext static class to access the global service provider and DTE objects of the running Visual Studio instance. You can obtain a UI automation object with AutomationElement.FromHandle(VSTestContext.DTE.MainWindow.HWnd).

For information about how this extension works, see the Developer Guide.

Supported Versions

The following versions of Visual Studio may be used as test targets:

  • Visual Studio 2015 Community and higher
  • Visual Studio Express 2015 for Web or Desktop
  • Visual Studio 2013 Community and higher
  • Visual Studio Express 2013 for Web or Desktop with Update 2
  • Visual Studio 2012 Professional and higher

The following versions of Visual Studio may be used to launch tests:

  • Visual Studio 2015 Community and higher
  • Visual Studio 2013 Community and higher

(The difference in support is due to changes in the unit test framework. If possible, tests should be launched with the same version as the test target.)

Test Settings

These settings should be specified in a .testsettings file or with the TestProperty attribute before launching tests.

Setting Description Values
VSApplication The registry key name "VisualStudio", "WDExpress", "VWDExpress", "Mock"
VSExecutable The executable name or path "devenv", "wdexpress", "vwdexpress"
VSVersion The version number "11.0", "12.0", "14.0" or blank (match tester)
VSHive The hive name "Exp" or "Default"
VSLaunchTimeoutInSeconds The number of seconds to wait for launch Any number, or blank (30s)
VSDebugMixedMode Use native debugging for tests "True", "False" or blank
VSReuseInstance Reuse of the same VS instance for distinct tests "True", "False" or blank (reuse)
ScreenCapture Directory to capture screenshots into Blank (do not capture) or a relative path
ScreenCaptureInterval Milliseconds between screenshots Any number, or blank (1000ms)

If VSApplication is set to Mock, no instance of Visual Studio will be launched and tests will be run in the current process. In this case, the VSTestContext.IsMock property will be true and VSTestContext.ServiceProvider should be set by your test run initializer.

When screen capture is enabled, only unique screenshots are retained, and all screenshots are deleted when a test passes.