It writes tests and saves it into a file.
As it's an AI, it's not perfect. It's a good start, but you should always review the generated tests.
- Python 3.6+
- OpenAI API key (You can obtain one from platform.openai.com/account/api-keys)
-
Run:
pip install hb_test_generator
-
Set the
OPENAI_API_KEY
environment variable with your OpenAI API key
hb-generate-tests app/helpers/membership_helper.rb
will create aspec/helpers/membership_helper_spec.rb
.hb-generate-tests src/components/MyComponent.vue
will create atests/components/MyComponent.spec.js
.
hb-generate-tests ...
hb-generate-test ...
hb-gen-tests ...
hb-gen-test ...
Create a test_generator_prompt.txt
file containing the base prompt. Default prompt is:
Write tests for below code. Name and place it according to best practices.
Write rspec tests for below code. Use factory instead of yml fixtures if needed. Put it into `spec/` dir. Name format `*_spec.rb`.
Write jest tests for below code. Put it into `tests/` dir near `src/` dir. Name format `*.spec.js`.
python3 setup.py sdist bdist_wheel
twine upload dist/*