Visual Studio Adds Automated Unit Testing with GitHub Copilot for C#
Microsoft has introduced a new feature in Visual Studio 2026 that makes it easier for developers to test their C# code. This new capability is part of GitHub Copilot Chat and automates the process of creating, running, and fixing tests for .NET projects. It aims to streamline testing by handling much of the work automatically, saving developers time and effort.
What is GitHub Copilot Testing for .NET?
This new feature allows GitHub Copilot to generate unit tests for C# code across different project types, files, classes, or individual members. It understands how a developer’s solution is structured, including the test frameworks and build systems in use. Instead of just providing code snippets, it offers an end-to-end testing workflow, making it more comprehensive than a simple code suggestion.
Developers can ask Copilot to generate tests for popular frameworks like xUnit, NUnit, and MSTest. When a testing request is made, it creates relevant tests, compiles and runs them automatically, and then detects any failures. If tests don’t pass, it attempts to fix issues and reruns them until a stable state is achieved. This process helps ensure that the code is thoroughly tested and reliable.
How the Testing Workflow Works
Once the tests are generated and executed, GitHub Copilot provides a detailed summary. This includes information about which test files and projects were created or modified, coverage metrics before and after testing, and signals indicating whether tests passed or failed. It also highlights any unstable or flaky tests, offering insights into potential gaps in test coverage.
The summary includes direct links to the generated tests, so developers can review and adjust them if needed. This makes it easy to iterate on tests quickly and improve overall code quality. Additionally, Copilot now supports free-form prompting, meaning developers can describe what they want to test in natural language, making the process more flexible and user-friendly.
Requirements and Availability
This new testing feature is available in Visual Studio 2026 version 18.3. It requires a paid GitHub Copilot license, as it is part of the premium offering. Microsoft announced this update on February 11, and it aims to help developers write more reliable code faster by automating the tedious parts of testing.
Overall, GitHub Copilot testing for .NET is designed to integrate seamlessly into the developer’s workflow, offering a smarter way to handle unit tests. It’s especially useful for teams looking to improve their testing coverage without significantly increasing their workload. As this feature continues to evolve, it could become a key tool for modern software development.















What do you think?
It is nice to know your opinion. Leave a comment.