test tool generate tests for a selected component, based on the PR code changes.
The test tool supports the programming languages: Python, Java, C++, JavaScript, TypeScript, C#.
How to use the test tool
This tool can also be triggered interactively by using the analyze tool.
Manual usage
Comment on the PR:
test will generate tests for largest component.
Choosing components
You can set the component name as the name of a specific component in the PR. To get a list of the components that changed in the PR and choose the relevant component interactively, use theanalyze tool.
Configuration options
Configure thetest tool by setting configurations under the pr_test part in your configuration file.
| Possible configurations | Default value | What they do |
|---|---|---|
num_tests | 3 | Number of tests to generate. |
testing_framework | For Python: pytest,For Java: JUnit,For C++: Catch2, For JavaScript & TypeScript: jest | The testing framework to use. |
avoid_mocks | true | If set to true, the tool will try to avoid using mocks in the generated tests. Note that even if this option is set to true, the tool might still use mocks if it cannot generate a test without them. |
extra_instructions | none | Optional extra instructions for the tool. For example: “focus on the changes in the file X”, “Ignore changes in …” |
file | none | Lets you specify a relevant file in case there are several components with the same name. |
class_name | none | Lets you specify a relevant class name in case there are several methods with the same name in the same file. |
enable_help_text | true | If set to true, the tool will add a help text to the PR comment. |
Example usage
