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.pyandapi.pyfiles. - Insert generated test code into the appropriate
test.pyfile in your Django app. - Easily configurable with your OpenAI API key.
- Download the extension as a
.vsixfile 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
.vsixfile to install.
- Open a Django project's
views.pyorapi.pyfile. - Press
Ctrl+Shift+Pto open the Command Palette. - Type
Generate Django Testand 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 Generatorand 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