Microsoft releases open-source agent that generates unit tests

Microsoft releases open-source agent that generates unit tests

Microsoft has released code-testing-generator, an open-source agent for generating unit tests in any programming language, according to the company. Released July 31, the code-testing-generator agent learns from the user’s repository, then plans, writes, and checks the tests to prove that they work. Currently the agent writes unit tests only. Integration tests, end-to-end tests, browser tests, and performance tests are outside its current scope, Microsoft said. The agent coordinates test generation using the “research-plan-implement” (RPI) pipeline. First the agent searches the repository for the code that needs tests, detecting the language and test framework and looking for existing tests to guide its work, and finding the correct commands for building and running the tests. Next the agent chooses the right amount of work from three paths: Direct: Read the relevant code, write the tests, and validate the result. Single pass: Research and plan once, then implement that plan. Iterative: Repeat the cycle to cover a large request or reach a coverage goal. The agent then plans and writes the tests It starts with simple code and then moves to code with more dependencies, mapping each behavior to a test file. The agent then checks that the generated tests are useful. According to Microsoft, it checks for the following problems before it finishes: It considers small code changes that should make the tests fail. It looks for weak or missing assertions. It checks that every requested scenario has a matching test. It builds the full workspace and runs the full test suite. It confirms that the repository’s test command can find the new tests. The code-testing-generator agent is available in the dotnet-test plugin in the dotnet/skills repository on GitHub. The plugin can be used in GitHub Copilot CLI and is also available in Visual Studio Code and VS Code Insiders through plugin support, which is a preview feature.

Original Source

Read the full article at Infoworld →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.