To use this functionality, the LLM provider must first be configured in the Parasoft Preferences. For details, see Configuring LLM Provider Settings.

This feature depends on LLMs, which may produce inaccurate information.

Follow these steps to improve a selected test with AI:

  1. Select a test method in the editor and then click the Improve [method_name] with AI button in the Unit Test Assistant view.

2. The Improve [method_name] with AI window appears.                                                                      

Screenshot 2024-09-12 142934.png

Specify the following:

3. Click Submit to send the query to the LLM provider and receive a result.                                                                         

The LLM provider returns the results as a stream of text. In most cases this will be the updated version of the test, but it might also include an explanation of the code.

The initial LLM provider response for the unit test improvements is always in English. When the language selected for Jtest is Chinese or Japanese, the Translate button is also available, which enables users to translate the initial response into their language. The button will be disabled if the original response from the LLM provider was empty or if the result has already been translated.

4. To apply the AI-generated solution, click the Apply button. A diff view of the code will open, allowing you to edit the code if needed before appending it to the test class.

If the code cannot be appended to the existing class, a new test class is created and code is added there.