Moving to real time test discovery in Test Explorer
Real time test discovery is a new Visual Studio feature that uses a Roslyn analyzer to discover tests and populate the test explorer in real time without requiring you to build your project. This feature has been introduced in Visual Studio 2017 15.5 Preview 2 behind a feature flag. You can try it out by using the instructions in the next section. This not only makes test discovery significantly faster, it also keeps the test explorer in sync with code changes such as adding or removing tests. Since real time discovery is powered by the Roslyn compiler it is only available for C# and Visual Basic projects.
How much better is real time discovery?
The feature uses Roslyn to sense edits to tests as you type, reducing the time it takes for changes to appear in the test explorer to a matter of seconds (depending on project size). We are eager to test how this feature performs in the field which is why it is being released in an experimental stage under a feature flag.
How to turn on the real time discovery feature flag
- Open the Visual Studio developer command prompt as an administrator.
notepad C:Program Files (x86)Microsoft Visual StudioPreviewEnterpriseCommon7IDECommonExtensionsPlatformShellMicrosoft.VisualStudio.FeatureFlags.pkgdef
Note: If you have installed Visual Studio in a non-default location replace <C:Program Files (x86)Microsoft Visual StudioPreview> with your install location.
- Modify this entry towards the bottom of the file by changing the last 0 to a 1 like below:
- Be sure to save the edited file.
- In the same command prompt run
- Start Visual Studio. Real time test discovery will be enabled for solutions which contain C# and Visual Basic test projects. You should see changes to your tests reflected in the Test Window in real time without requiring you to build your project.
- Provide feedback! Use the send feedback button located in Visual Studio in the top right corner to report a problem or provide a suggestion.
Why is this behind a feature flag?
Real time discovery is in an early development stage and not ready to be enabled by default. Including a few extra steps to turn on the flag scopes the feature to developers who are interested in testing it out.
Will real time discovery officially ship with the Visual Studio 2017 15.5 release?
No, this feature is in a preview to give us an opportunity to collect feedback in real world scenarios. It will not be on by default in the Visual Studio 15.5 release.
Where should I file a bug?
Please file bugs using the send feedback button located in Visual Studio in the top right corner to report a problem or provide a suggestion.
Is there a work around if I do not have admin access on my environment?
Yes, though please keep in mind, real time test discovery is an experimental feature and undesirable behavior may result from testing it out in these early stages. You can install the Feature Flags extension to turn on the flag through Tools > Options > Feature Flags > TestingTools.UnitTesting.FastTestDiscovery.