# Generate coded test cases

> Autopilot capabilities for generating coded and low-code test cases from natural language, comments, or existing code.

Autopilot assists you in generating coded test cases, either from text and existing code, or from manual test cases created in Test Manager.

## Generating coded test cases from text and existing code

In a new or existing coded automation, you can use Autopilot to generate code from natural language, from comments in your automation, or from existing lines of code. Use the `Ctrl + Shift + G` shortcut, or the Autopilot icon, to generate code.

## Generating coded test cases from manual tests

After you connect Studio Desktop to Test Manager, navigate to the Test Explorer and search for your manual tests. From here, you can choose one of the following scenarios to generate a coded test case for it:

* Create a coded test case, where the steps are shown as comments, using **Create Coded Test Case.**. Then prompt Autopilot to generate code based on the comments.
* Directly generate a fully functional coded test case using **Generate Coded Test Case with Autopilot**.

  ![docs image](https://dev-assets.cms.uipath.com/assets/images/autopilot/autopilot-docs-image-408592-a61e35d1-95fc2984.webp)

Refer to [Creating a coded test case from a manual test case](https://docs.uipath.com/studio/standalone/2024.10/user-guide/working-with-manual-test-cases#creating-a-coded-test-case-from-a-manual-test-case) and [Generating coded test cases using AI](https://docs.uipath.com/studio/standalone/2024.10/user-guide/working-with-manual-test-cases#generating-coded-test-cases-using-ai) for more information about generating test cases.

### Generate coded API test cases

If you want to create a coded test case that automates a scenario involving APIs, Autopilot can help with generating the code for this scenario. In the code editor, open the context menu and select **Generate Code**, then offer Autopilot the necessary instructions. For instance, you should offer Autopilot the API that you want to use, and the API key that it should access.

### Generate low-code test cases

Autopilot assists you in generating low-code test cases, either from text or from manual tests created in Test Manager.

#### From manual tests

Connect Studio Desktop to Test Manager and locate your manual test in the Test Explorer. Then, open the context menu for the manual test and select **Generate Test Case with Autopilot**.

#### From text

Open your blank low-code test case and select **generate with Autopilot** from the Designer panel. Enter the desired test steps, and then select **Generate** to trigger the test case generation.

Figure 1. Typing prompt instructions in the **Type annotation** field

![Typing prompt instructions in the Type annotation field](https://dev-assets.cms.uipath.com/assets/images/autopilot/autopilot-typing-prompt-instructions-in-the-type-annotation-field-469821-1000ac70-e657b5fe.webp)

For more information, refer to [Generating low-code test cases using AI](https://docs.uipath.com/studio/standalone/2024.10/user-guide/working-with-manual-test-cases#generating-low-code-test-cases-using-ai).

## Best practices

For guidance on writing effective prompts, and on using object repositories and naming conventions when converting text or manual tests into code, see:

* [Converting text into code](autopilot-for-testers-best-practices.md#converting-text-into-code)
* [Automating manual tests](autopilot-for-testers-best-practices.md#automating-manual-tests)
