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.
- Run
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:
[$RootKey$FeatureFlagsTestingToolsUnitTestingFastTestDiscovery] "Value"=dword:00000001
- Be sure to save the edited file.
- In the same command prompt run
devenv /updateconfiguration
- 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.
Q&A
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.