{"id":235724,"date":"2021-12-20T09:00:00","date_gmt":"2021-12-20T17:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=235724"},"modified":"2021-12-13T13:57:26","modified_gmt":"2021-12-13T21:57:26","slug":"vs22-test-tools-for-net-and-cross-platform-apps","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/vs22-test-tools-for-net-and-cross-platform-apps\/","title":{"rendered":"Test tools for .NET and cross-platform apps"},"content":{"rendered":"<p>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 <a href=\"https:\/\/youtu.be\/D_5cRxJwUcM\">Visual Studio Tips and Tricks video on Testing<\/a> or keep reading!<\/p>\n<p><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/D_5cRxJwUcM\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\ufeff<\/span><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><\/p>\n<h3>Show in Test Explorer<\/h3>\n<p>Easily jump from the editor to the test in the Test Explorer with the new <strong>Show in Test Explorer<\/strong> command (<strong>Ctrl+E,S<\/strong>). Show in Test Explorer is also available from the editor right-click menu, CodeLens test glyph, and the right-click in the Solution Explorer.<\/p>\n<p><figure id=\"attachment_235731\" aria-labelledby=\"figcaption_attachment_235731\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/show-in-test-explorer.png\"><img decoding=\"async\" class=\"wp-image-235731 size-large\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/show-in-test-explorer-1024x685.png\" alt=\"Image of the show in test explorer command in Visual Studio\" width=\"640\" height=\"428\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/show-in-test-explorer-1024x685.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/show-in-test-explorer-300x201.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/show-in-test-explorer-768x513.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/show-in-test-explorer.png 1038w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><figcaption id=\"figcaption_attachment_235731\" class=\"wp-caption-text\">Show in Test Explorer command in right-click menu<\/figcaption><\/figure><\/p>\n<h3>Play a sound when a test run completes!<\/h3>\n<p>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!<\/p>\n<p><figure id=\"attachment_235732\" aria-labelledby=\"figcaption_attachment_235732\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/test-audio-cues.png\"><img decoding=\"async\" class=\"wp-image-235732 size-full\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/test-audio-cues.png\" alt=\"Image of test audio cues in visual studio test explorer\" width=\"677\" height=\"367\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/test-audio-cues.png 677w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/test-audio-cues-300x163.png 300w\" sizes=\"(max-width: 677px) 100vw, 677px\" \/><\/a><figcaption id=\"figcaption_attachment_235732\" class=\"wp-caption-text\">Test Audio Cues in Test Explorer settings<\/figcaption><\/figure><\/p>\n<h3>Console.WriteLine in Test Explorer<\/h3>\n<p>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.<\/p>\n<p><figure id=\"attachment_235728\" aria-labelledby=\"figcaption_attachment_235728\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/console-writeline-test-explorer.png\"><img decoding=\"async\" class=\"wp-image-235728 size-large\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/console-writeline-test-explorer-1024x457.png\" alt=\"Image of console writeline output appearing in test explorer in visual studio\" width=\"640\" height=\"286\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/console-writeline-test-explorer-1024x457.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/console-writeline-test-explorer-300x134.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/console-writeline-test-explorer-768x343.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/console-writeline-test-explorer-1536x686.png 1536w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/console-writeline-test-explorer.png 1884w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><figcaption id=\"figcaption_attachment_235728\" class=\"wp-caption-text\">Console.Writeline output appears in Test Explorer details<\/figcaption><\/figure><\/p>\n<h3>Remote Testing<\/h3>\n<p>Run and debug tests on Linux containers, WSL, or over SSH connections!<\/p>\n<p>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 <a href=\"https:\/\/aka.ms\/remotetesting\">https:\/\/aka.ms\/remotetesting<\/a>.<\/p>\n<p>Normally I\u2019d 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 <strong>debugging a test in a Linux container<\/strong>.<\/p>\n<p><figure id=\"attachment_235730\" aria-labelledby=\"figcaption_attachment_235730\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/remote-testing.png\"><img decoding=\"async\" class=\"wp-image-235730 size-large\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/remote-testing-1024x548.png\" alt=\"Image of remote testing in visual studio debugging a test in a Linux container\" width=\"640\" height=\"343\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/remote-testing-1024x548.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/remote-testing-300x161.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/remote-testing-768x411.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/remote-testing.png 1441w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><figcaption id=\"figcaption_attachment_235730\" class=\"wp-caption-text\">Debug a test in a Linux container with Remote Testing<\/figcaption><\/figure><\/p>\n<h3>Test web apps with Playwright<\/h3>\n<p>Playwright is the latest in cross-platform, asynchronous web UI testing. It\u2019s 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 <a href=\"https:\/\/playwright.dev\">https:\/\/playwright.dev<\/a>.<\/p>\n<p><figure id=\"attachment_235729\" aria-labelledby=\"figcaption_attachment_235729\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/playwright-recorder-dotnet.png\"><img decoding=\"async\" class=\"wp-image-235729 size-large\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/playwright-recorder-dotnet-1024x482.png\" alt=\"Image of playwright recorder generating .NET test code\" width=\"640\" height=\"301\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/playwright-recorder-dotnet-1024x482.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/playwright-recorder-dotnet-300x141.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/playwright-recorder-dotnet-768x362.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/playwright-recorder-dotnet-1536x723.png 1536w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/playwright-recorder-dotnet.png 1920w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><figcaption id=\"figcaption_attachment_235729\" class=\"wp-caption-text\">Playwright recorder generating .NET tests<\/figcaption><\/figure><\/p>\n<h3>Where can I learn more?<\/h3>\n<p>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 <a href=\"https:\/\/youtu.be\/YGPH-j3HAPo\">longer demo from .NET Conf<\/a>.<\/p>\n<p>You can find more test tools documentation at <a href=\"http:\/\/aka.ms\/visualstudiotest\">http:\/\/aka.ms\/visualstudiotest<\/a>.<\/p>\n<p>To get started with Remote Testing follow the instructions at <a href=\"https:\/\/aka.ms\/remotetesting\">https:\/\/aka.ms\/remotetesting<\/a>.<\/p>\n<p>As always, we are incredibly thankful to the community who <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/suggest-a-feature\">suggested many of these features<\/a>, commented design suggestions, and <a href=\"https:\/\/developercommunity.visualstudio.com\/\">upvoted them<\/a> to the top of our backlog! This guidance is invaluable to creating tools that the community loves. <strong>Share what you\u2019d like to see next in your test experience in the comments!<\/strong><\/p>\n<p>Thanking you all and wishing you well,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visual Studio 2022 brings better test tools to your everyday development with Show in Test Explorer, Remote Testing, Test audio cues, Playwright, and more!<\/p>\n","protected":false},"author":355,"featured_media":235731,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1195,155],"tags":[237,361,5,287,12,6815],"class_list":["post-235724","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cross-platform","category-visual-studio","tag-net","tag-net-core","tag-csharp","tag-tips-and-tricks","tag-visual-studio","tag-visual-studio-2022"],"acf":[],"blog_post_summary":"<p>Visual Studio 2022 brings better test tools to your everyday development with Show in Test Explorer, Remote Testing, Test audio cues, Playwright, and more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/235724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/355"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=235724"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/235724\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/235731"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=235724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=235724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=235724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}