An open-source AI agent searches software repositories, plans, writes, and validates unit tests, helping developers automate code testing across programming languages.
Microsoft has released code-testing-generator, an open-source AI agent for generating unit tests in any programming language. The agent learns from a software repository, identifies code that requires tests, plans the testing process, writes the tests, and verifies that they work before completion.
The RPI process consists of three steps: Research, Plan, and Implement. First, the repository is analysed to identify the programming language, test framework, existing tests, and suitable build and test commands. Based on the analysis, the agent selects either the Direct, One-pass, or Iterative approach according to the workload.
During the planning stage, the agent writes unit tests, starting with simple code before progressing to code with more dependencies while mapping behaviours to test files. Finally, the generated tests are validated by checking for weak or missing assertions, coverage of requested scenarios, failures caused by code changes, successful workspace builds, and whether the repository’s test command detects the new tests.
Currently, the project includes only the unit test feature. As per Microsoft, integration test, end-to-end test, browser test, and performance test support lies beyond the scope of the agent.
Code-testing-generator can be accessed through the dotnet-test extension available in Microsoft’s dotnet/skills GitHub repository. It works with GitHub Copilot CLI and is also compatible with Visual Studio Code and VS Code Insider through plugin support, which is currently available as a preview feature.















































































