Using Example Tests for Better Test Generation
Please Notice
In JetBrains this field is called "Reference Test"
Overview
Qodo Gen enhances its test generation capabilities by allowing the use of example tests. This feature enables Qodo Gen to generate new tests that follow a specific style or format you prefer, ensuring consistency and adherence to your project's testing conventions.
Providing an Example Test
There are several ways to provide Qodo Gen with an example test, each designed to suit different workflows and preferences:
- Direct Input: Copy and paste a test you like into the "Example Test" field located in the main test tab. Once you regenerate the test suite, Qodo Gen will attempt to generate new tests mirroring the styling of your example.
- Configuration Tab: For a more permanent setup, you can add the example test to the configuration tab. Saving this to the configuration file means all future tests generated by Qodo Gen will use this example as a template.
- Automatic Detection: If no example test is provided, Qodo Gen will search your project for a suitable test to use as an example. The identified test will be displayed in the main test tab with a note explaining Qodo Gen's choice. You have the option to delete or change this test if it doesn't meet your requirements.
Benefits of Using Example Tests
- Consistency: Ensures that all generated tests adhere to your preferred style and formatting, maintaining consistency across your test suite.
- Customization: Gives you the flexibility to influence the structure and content of the generated tests, tailoring them to better fit your project's needs.
- Efficiency: Saves time by automating the generation of tests that align with your existing testing practices, reducing the need for manual adjustments.
Managing the Example Test
- Change or Remove: At any point, you can modify or remove the current example test from the main test tab to adjust Qodo Gen's test generation behavior.
- Update Configuration: To change the default example test for future test generations, simply update the example test in the configuration tab and save your changes.