DEV Community

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

Posted on

10

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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (1)

Collapse
 
miguelvelarde profile image
MiguelVelarde

I didn't find it in VS marketplace.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay