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

This feature depends on OpenAI, 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.                                                                      

Specify the following:

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

OpenAI 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 OpenAI 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 OpenAI was empty or if the result has already been translated.

4. To apply the AI-generated solution, copy the recommended code snippet using the Copy code option and paste it into the existing test file or a new file.

If multiple snippets are returned, only the first code snippet is copied.