There are a few new goodies added to your everyday test tools that I hope will improve your test inner loop! To familiarize yourself with these new features you can see them in action in the Visual Studio Tips and Tricks video on Testing or keep reading!
Show in Test Explorer
Easily jump from the editor to the test in the Test Explorer with the new Show in Test Explorer command (Ctrl+E,S). Show in Test Explorer is also available from the editor right-click menu, CodeLens test glyph, and the right-click in the Solution Explorer.
Play a sound when a test run completes!
The Test Explorer can now play a sound when a test run completes. You can select two sounds, one that indicates the test run succeeded with all passing tests and a second sound to indicate the test run completed with at least one failing test. These sounds are completely customizable using the Windows sound dialog!
Console.WriteLine in Test Explorer
Console.Writeline will now appear in the test detail pane. For xUnit, output that uses the ITestOutputHelper will appear. Standard output as well as standard error will be shown in this pane, so your test output is available where you need it.
Remote Testing
Run and debug tests on Linux containers, WSL, or over SSH connections!
Visual Studio can make your cross-platform development easier than ever with remote testing! You can now run Linux tests from Visual Studio by connecting the Test Explorer to remote environments. These can be Linux containers, WSL, and even SSH connections! Check out the setup documentation to get started at https://aka.ms/remotetesting.
Normally I’d have to push to a CI run before getting feedback from Linux test or other operating systems, but now I can get it all in my inner dev loop, including debugging a test in a Linux container.
Test web apps with Playwright
Playwright is the latest in cross-platform, asynchronous web UI testing. It’s built with modern browsers and services in mind meaning each step automatically uses awaits. This reduces the flakiness that typically plagues web UI tests. Not only is Playwright cross-platform, but it is also cross-language supporting TypeScript, JavaScript, Python, Java, and .NET. It also comes with a recorder that generates tests based on your actions. Read more https://playwright.dev.
Where can I learn more?
If you are interested in more on performance, how hot reload can apply to the Test Explorer, or more on running tests over SSH connections check out the longer demo from .NET Conf.
You can find more test tools documentation at http://aka.ms/visualstudiotest.
To get started with Remote Testing follow the instructions at https://aka.ms/remotetesting.
As always, we are incredibly thankful to the community who suggested many of these features, commented design suggestions, and upvoted them to the top of our backlog! This guidance is invaluable to creating tools that the community loves. Share what you’d like to see next in your test experience in the comments!
Thanking you all and wishing you well,
I'm really stuck in my school project using the windows form .net in C#, everything works fine until I get to the end and add the web browser from the toolbox, it all looks good but every time I click the play button it tells me the browser can't play the video. I'm working with the new 2022 version and even the version that is on azure labs has a very similar problem. Any ideas...
I am still rather disappointed that Microsoft has removed the TCM tool that was formerly used to import Test Cases into Azure Devops. This tool made it really easy to import large quantity of tests methods into Azure Devops Test Cases rather than have to individually import each Test Method. Please bring this tool back or create an equivalent tool that can batch import.
The "Show in Test Explorer" command is definitely a welcome (and long needed) addition.
But it's still not enough to handle huge solutions with thousands or tens of thousands of tests.
This is the main reason why we still cannot phase out third party tools (namely: ReSharper) and solely work with VS built in features.
From my point of view there are two feature missing:
1. Working with unit test "sessions" that contain only a (small)...
One function that would be useful is to add a button to the test explorer that would reset all of the tests to "Not run" Therefore, I could start with a new slate of all of the tests and when running only the tests I need, I will easily be able to know which passed and which didn't without looking through all that had run previously. I was hoping for something like this...
Thank you for the feedback, James. And thank you for filing the request. Linking here if anyone would like to upvote: https://developercommunity.visualstudio.com/t/adding-a-button-to-test-explorer-to-reset-the-test/744285
Are there any plans to make an extension similar to Test Explorer for Visual Studio Code? The current extensions for C# tests pale in comparison to the Visual Studio offering.
There aren’t any plans that I’m involved in. Though I do think some new abilities arrived with the new VSCode Test APIs that test adapters for each language can take advantage of.
My focus is on the programming side rather than real testing, so I am not a testing expert. However, while dealing with.Net, I favour xUnit.net over NUnit for unit testing.
To me, as long as horizontal scroll (Shift+scroll) isn’t supported on VS, and especially in test explorer, it’s still considered broken.
Thanks for the feedback. I completely understand. This is a known issue if you'd like to upvote and follow for updates. https://developercommunity.visualstudio.com/t/Touchpad-rightleft-scroll-doesnt-work-/1465753
I did doublecheck, Drew Noakes has a lovely side scroller extension that allows (shift+scroll) in the main editor window, but it doesn't work in the Test Explorer detail summary. :/ Linking in case this helps you for use in the Editor: https://marketplace.visualstudio.com/items?itemName=drewnoakes.SideScroller
Yeah thank you!
I’m actually a long time subscriber to that issue. Was really saddened to hear that it didn’t make it to 2022.