DEV Community

Cover image for VSCode + ChatGPT = Auto Unit Test
Mariusz Malek
Mariusz Malek

Posted on

VSCode + ChatGPT = Auto Unit Test

I've created an extension for VSCode that uses ChatGPT to automatically generate unit tests for you.

With this extension, all you have to do is select a function in your code and the extension will do the rest. It uses ChatGPT, a powerful language model, to analyze your function and generate appropriate test cases for it.

Image description

Not only does this save you time and effort in writing unit tests, it also ensures that your tests are thorough and comprehensive.

The extension is easy to use and integrates seamlessly into VSCode, so you can start using it right away.

So next time you're struggling to write unit tests, give this extension a try. It will make your life easier and help you write better code.

Usage:
To generate a unit test, open a TypeScript file in Visual Studio Code and run the "Generate Unit Tests" command (Ctrl+Shift+P and then type "Generate Unit Tests"). This will prompt you for input and then generate a unit test based on that input using ChatGPT.

Repository: https://github.com/mariuszmalek/autotest-chatgpt-vscode

Top comments (0)