{"id":58914,"date":"2025-11-19T10:05:00","date_gmt":"2025-11-19T18:05:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=58914"},"modified":"2025-11-19T10:05:00","modified_gmt":"2025-11-19T18:05:00","slug":"github-copilot-testing-for-dotnet","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/github-copilot-testing-for-dotnet\/","title":{"rendered":"Supercharge Your Test Coverage with GitHub Copilot Testing for .NET"},"content":{"rendered":"<p>Writing high-quality unit tests is critical for reliable software, but it\u2019s often time-consuming and repetitive. What if GitHub Copilot could take care of that for you?  <\/p>\n<p>Today we\u2019re thrilled to announce GitHub Copilot testing for .NET is now available in Visual Studio Insiders. This new capability brings AI-powered unit test generation directly into your development workflow, helping you go from zero coverage to tested confidence in just a few clicks.<\/p>\n<h2>GitHub Copilot testing for .NET<\/h2>\n<p>Unlike a one-off prompt, GitHub Copilot testing is purpose-built for testing. It understands your code\u2019s structure, your project\u2019s setup, and what good tests should look like. Whether you need tests for a single member, a file, an entire project, or even your whole solution, Copilot automatically generates, builds, and runs tests across the selected scope. The result? Faster feedback, fewer bugs, and more confidence in your code.  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/11\/header-image.webp\" alt=\"GitHub Copilot testing generating unit tests in Visual Studio\" \/><\/p>\n<h2>Key Features<\/h2>\n<p>Unit testing is essential for shipping reliable software, but writing tests by hand can be tedious and time-consuming. GitHub Copilot testing for .NET makes it faster and easier to create high-quality tests that reflect your real code.<\/p>\n<h3>Here&#8217;s what makes GitHub Copilot testing different<\/h3>\n<ul>\n<li><strong>AI-generated unit tests at scale:<\/strong> Automatically create, build, and run tests for individual members, files, projects or entire solutions.  <\/li>\n<li><strong>Deterministic, type-safe results:<\/strong> Tests are grounded in compiler and language semantics, ensuring consistency and predictability.<\/li>\n<li><strong>Support for MSTest, xUnit, and NUnit:<\/strong> Works with your existing frameworks and workflows.  <\/li>\n<li><strong>Smart Visual Studio integration:<\/strong> GitHub Copilot testing is more deeply integrated with Visual Studio than prompt-writing in vanilla Copilot Chat. It uses Roslyn analyzers, MSBuild, project system integrations, and Test Explorer to deliver a seamless experience for setup, execution, and test discovery, all from within your IDE.  <\/li>\n<li><strong>Automatic test recovery:<\/strong> Sometimes not every test will pass right away \u2013 and that\u2019s okay. Copilot doesn\u2019t stop there. When a test fails, it attempts to fix the issue, regenerate the test, and rerun it to ensure it works, giving you a strong starting point for reliable coverage.  <\/li>\n<\/ul>\n<h3>From zero coverage to confidence<\/h3>\n<p>GitHub Copilot testing for .NET lets you go from zero tests to meaningful coverage with just a few clicks. AI isn\u2019t just changing how we write code, but it\u2019s also changing how we validate it. What used to take hours of manual work is now automated, giving you faster feedback and the confidence to keep shipping.<\/p>\n<h2>Getting Started<\/h2>\n<p><strong>Pre-requisites:<\/strong> The latest Visual Studio 2026 Insiders Build, C# code, and a GitHub Copilot license.<\/p>\n<ol>\n<li>Install the latest Visual Studio Insiders build and ensure that the <strong>\u201cGitHub Copilot testing\u201d<\/strong> capability is enabled in <strong>Tools &gt; Options &gt; GitHub &gt; Copilot &gt; Testing<\/strong>.<br \/>\n<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/11\/settings-image.webp\" alt=\"Settings option for tool\" \/>  <\/li>\n<li>Open your C# project or solution and make sure it builds without errors to simplify the process.  <\/li>\n<li>Use the following syntax in the Copilot Chat window to start GitHub Copilot testing and begin generating tests:<br \/>\n<code>@Test #target<\/code><br \/>\nWhere <code>#target<\/code> can be the name of a member, class, file, project, solution, or <code>#changes<\/code> for git diff.<br \/>\n<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/11\/prompt-image.webp\" alt=\"Prompt to invoke tool\" \/>  <\/li>\n<li>In the Chat window, select Send. GitHub Copilot testing for .NET will then initiate an iterative process. Copilot will analyze your code and create a test project if one doesn\u2019t exist. Then it generates tests, builds, and runs them, all automatically.<br \/>\n<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/11\/generating-tests.webp\" alt=\"GitHub Copilot testing showing iterative test generation process\" \/><\/li>\n<li>Test explorer shows the results as the tests are generated. If Test Explorer is not automatically opened, you may do so by selecting <strong>Test &gt; Test Explorer<\/strong>.  <\/li>\n<li>After test generation is complete, GitHub Copilot testing will provide a summary in Copilot Chat which includes the following:  \n<ol>\n<li>Stats about the number of unit tests, files, and projects that were created or modified.<\/li>\n<li>Before and after view of coverage so that you can easily understand the change in coverage.<\/li>\n<li>Quality indicators will surface pass\/fail signals and any skipped or unstable cases to watch.<\/li>\n<li>If there are testability gaps, Insights point you to them and suggest practical fixes.<\/li>\n<li>Direct links take you straight to the new test projects and files so you can jump right in and iterate.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/11\/summary.webp\" alt=\"Post-generation summary\" \/><\/p>\n<p>For more information, check out our <a href=\"https:\/\/learn.microsoft.com\/visualstudio\/test\/github-copilot-test-dotnet-overview?view=visualstudio\">Getting Started docs<\/a>.<\/p>\n<h2>Try it out today<\/h2>\n<p>Download the Visual Studio Insiders build, enable GitHub Copilot testing, and see how AI can help you ship faster with fewer bugs. We\u2019d love to hear what you think. Let us know with the \u201cGive Feedback\u201d button in Visual Studio. Your feedback will help shape the future of AI-powered development for .NET.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Boost your testing workflow with GitHub Copilot testing for .NET, available now in Visual Studio. Automatically generate, build, and run high-quality unit tests for files, projects, or entire solutions.<\/p>\n","protected":false},"author":51892,"featured_media":58915,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685,7781,646],"tags":[7793,147],"class_list":["post-58914","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-ai","category-visual-studio","tag-copilot","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>Boost your testing workflow with GitHub Copilot testing for .NET, available now in Visual Studio. Automatically generate, build, and run high-quality unit tests for files, projects, or entire solutions.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/58914","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/51892"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=58914"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/58914\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58915"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=58914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=58914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=58914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}