Generate tests with AI
This functionality relies on the AI Assistant plugin that requires an additional license.
For more information, refer to JetBrains AI Service licensing and Enable AI Assistant plugin.
With AI Assistant, you can generate unit tests for code segments. AI Assistant analyzes both your code and its documentation to recommend tests that will provide insights into your code's behavior.
Place the caret somewhere within a method and right-click to open the context menu.
Alternatively, press AltEnter.
Select AI Actions and then Generate Unit Tests.
The generated test opens in a separate AI Diff tab.
If you want to improve the generated code, click Specify, add new requirements, and press Enter.
If you want to regenerate the answer, click
Regenerate.
Click Accept all to save the generated test.
It will be shown as a new file in a separate tab.
If you already have a test module in your project, the new test will be stored there. If not, the new test will be stored next to the source file.
Thanks for your feedback!