Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Unit Test GeneratorNew to Visual Studio Code? Get it now.
Unit Test Generator

Unit Test Generator

Tom Abraham

|
65 installs
| (0) | Free
Use AI to generate unit test
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Unit Test Generator README

This extension utilizes a RAG Based approach to refactoring and generating new unit tests

Features

Simply open up the copilot chat button and use @unit-test-generator /gen to get started

Setup

  1. Ensure that you have the Github Copilot Chat VSCode extension installed

  2. Please acquire the Cognitive Services OpenAI User and Cognitive Services User role assignments for the servicehubtest deployment resource to get started

  3. Run az login in Windows/Ubuntu depending on where the VS Code extension is running

  4. Set your az account subscription to "AKS Long Running Things"

    • az account set --subscription 359833f5-8592-40b6-8175-edc664e2196a

Usage

Use Cases

  1. Test Refactoring
  2. Generating additional tests based on existing ones
  3. Generating brand new unit tests from scratch

For test refactoring and generating additional tests, please ensure that you have your <filename>.go and <filename>_test.go files created with a couple of sample tests to provide a good seed.

Otherwise, for generating brand new unit tests, only the <filename>.go is necessary.

Workflow

  1. Open the copilot chat extension and tag the unit test generator chat participant along with the gen command to get started

    • @unit-test-generator /gen <prompt>
  2. Before hitting enter, please click on the <filename>.go file and open it in your vs code window so we can include that as part of the context for the LLM.

  3. Attach any existing test files and/or test files that need to be refactored using the #file reference within the prompt

  4. After that, you just need to wait for the extension to complete the task and you will find the generated unit tests in “generated_unit_tests” file

    • You will also find that a few other files have been created such as debug_log.txt, etc. This is to assist in debugging in case the output of the LLM was not as expected.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft