Django Test Generator is a VSCode extension that helps you automatically generate test code for your Django views and APIs using the OpenAI API.
- Automatically generate pytest test code for
views.py
andapi.py
files. - Insert generated test code into the appropriate
test.py
file in your Django app. - Easily configurable with your OpenAI API key.
- Download the extension as a
.vsix
file or install directly from the VSCode Marketplace (if published). - Open the Extensions view by clicking the Extensions icon in the Activity Bar on the side of the window or by pressing
Ctrl+Shift+X
. - Click on the
...
menu and selectInstall from VSIX...
. - Select the downloaded
.vsix
file to install.
- Open a Django project's
views.py
orapi.py
file. - Press
Ctrl+Shift+P
to open the Command Palette. - Type
Generate Django Test
and pressEnter
. - The extension will read the content of the file, generate test code using OpenAI API, and insert it into
test.py
.
You need to set your OpenAI API key in the extension settings:
- Go to
File > Preferences > Settings
(or pressCtrl+,
). - Search for
Django Test Generator
and enter your OpenAI API key.
- Visual Studio Code
- Node.js and npm
- OpenAI API key
- Ensure that your OpenAI API key is valid and has sufficient quota.
- Initial release of Django Test Generator.
MIT