Ask AI to Suggest Tests
Use AI to suggests additional test cases for uncovered or modified functions in the PR, including edge cases.
Configuration Description
Conditions (all must be true):
- A PR is created or new code has been committed to the PR.
- The PR has a label "askai tests"
Automation Actions:
- Add a comment with suggested tests generated by an AI model
Configuration Example
manifest:
version: 1.0
triggers:
on:
- commit
- pr_created
automations:
ask_ai_tests:
if:
- {{ pr.labels | match(term="askai tests") | some }}
run:
- action: add-comment@v1
args:
comment: |
# 🧪 Test Suggestions 🧪
{{ source | askAI("QA tester",
"Identify any new or modified functions without test coverage in this PR.
Suggest specific test cases to add, including edge cases.
If all functions are covered, return 'No additional tests needed.'", env.OPEN_AI_TOKEN) }}
Additional Resources
gitStream is a workflow automation tool that enables you to use YAML configuration files to optimize your code review process. Add context to PRs, find code experts for reviews, and automate the merge process to maximize developer productivity.
Learn More about how gitStream Works.
Related Automations:
- Estimate the amount of time it would require someone to complete a PR review.
- Flag missing Jira ticket information
- Label PRs that delete files.
- Label PRs that lack tests
- Provide information about what percent of a PR is new code.
- Request PR authors to provide screenshots in relevant PRs.
More Automations can be found on the Automation Library and Integrations pages.