---
title: "AI Test Script Generation"
canonical: "https://docs.getxray.app/space/XRAYCLOUD/1243774987/AI%20Test%20Script%20Generation"
format: markdown
---
> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (toc)

# Introduction

AI Test Script Generation allows you to generate automation scripts directly from manual Test cases.

The feature is designed to fit into existing Test automation workflows. It helps reduce the effort required to create automated Tests, allows testers without deep automation expertise to contribute to automation, and produces scripts that are compatible with supported tools and frameworks.

## Requirements and Prerequisites

- You must have [Xray already installed](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44566344) on your Jira Cloud instance.
- Configuration via [AI Hub](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/1241974430) is available for Jira Admins only.

## Guidelines

### Xray Apps

The AI Test Script Generation has nuances depending on the [Xray app/tier you’re using (Xray Enterprise vs Xray Test Management for Jira)](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/392921546). More below.

### Work Items

The AI Test Script Generation only works on Test Work items. The Work item must have at least one [Test Step](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565316) (or several Test Steps), if it’s a Manual Test; or a non-empty definition if it’s a [Gherkin](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565320) Test type.

### Scripts Generation

- Generated scripts may include placeholders (for example, `<BASE_URL>` or `<USERNAME>`). Replace these placeholders with values specific to your environment (such as URLs, credentials, or element selectors) before running the script.
- After generating a script, you can refine it by providing additional instructions. You can iterate on a generated script up to **five times per feature use**. After reaching this limit, you must start a new script generation.

### File Uploading

- File uploads are subject to a maximum total size limit, calculated as the sum of all selected files. If this threshold (1 MB) is exceeded, you must adjust your selection until the combined size complies with the allowed limit. Any additional files will not be uploaded.
- File types allowed: TXT, MD, XML, YAML, PY, C, CPP, CC, C, C++, JAVA, JS, TS, JSX, TSX, SH, BASH, GO, RUST, SQL, HTML, RTF, CSV, JSON, DOC, DOCX, PDF.

### Best Practices

Generated scripts are intended as a starting point and may require refinement to match your project standards. You should always:

- Provide clear and specific instructions.
- Keep your input focused and concise.
- Review and adjust the generated script before executing it.

# Operations

## Management and Configuration

AI Test Script Generation is enabled by default via the AI Hub. From there, Admins can manage user access to AI Test Script Generation or can disable the feature.

## Using the AI Test Script Generation

### On the Xray Enterprise App

![image](media://17fa9ba2-5019-4880-adcb-e8f625da112a)

#### Via a Work Item

##### Creating and Downloading Automated Test Scripts

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to your Test Work item (Figure 1) and, under *Test details*, click *Automate Test* (Figure 1 - 1).
> 
> ![Figure 1 - Automate](media://5b530be6-0116-42c5-8409-7f5f941ad320)
> 
> > Macro (rw-step)
> 
> You will immediately land on the Generate Automated Test modal (Figure 2).
> 
> ![Figure 2 - Modal](media://109c374e-59cc-458f-b2f8-3425af702c7a)
> 
> Here, you can:
> 
> 1 - Select a framework (Figure 2 - 1; mandatory).
> 
> 2 - Pick a language (Figure 2 - 2; mandatory).
> 
> 3 - Add a version name (Figure 2 - 3; optional).
> 
> 4 - Select linked Work items (Figure 2 - 4; optional). Xray automatically fetches linked Work items. For example, if a Test is linked to a Requirement that has an attachment, Xray pre-fills this section with that attachment. You can remove it or add additional files as needed.
> 
> 5 - Upload attachments (Figure 2 - 5; optional); if there are files already attached, Xray will automatically fetch those files and keep them attached.
> 
> 6 - Describe the automation you want to create (Figure 2 - 7); Then, click *Generate* (Figure 2 - 8), and you will see the results in the AI assistant section (Figure 2 - 6).
> 
> 7 - Once Step 6 is concluded, you will find the output in *Automation Scripts* (Figure 2 - 9).
> 
> 8 - Click *Create automated tes*t (Figure 2 - 10).
> 
> > Macro (rw-step)
> 
> You will see a success message (Figure 3 - 1).
> 
> ![Figure 3 - Success.png](media://165609fc-44b7-4127-bf18-b830918db0cb)
> 
> > Macro (rw-step)
> 
> The generated Test scripts can be downloaded by clicking the *Version* dropdown menu (Figure 4 - 1) and selecting the corresponding version. In this case, it’s *v2* (Figure 4 - 2).
> 
> ![Figure 4 - Version](media://1533ec09-0ffa-4cee-aafc-9b2604e6ce7b)
> 
> > ⚠️ - When the versioning [Feature toggle in Global Settings](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565845) is enabled, Xray creates a new Test version.
> > ⚠️ - When it is disabled, Xray creates a new Test instead.
> 
> 
> > Macro (rw-step)
> 
> Click *Download* (Figure 4 - 2) to immediately receive the generated Test scripts on your machine as a ZIP file.

##### Replacing an Automated Test Script

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Once an automated Test script has been created, click *Replace automated test* (Figure 4 - 3). This action allows you to upload an external script file (ZIP only) that will replace the current automation script.
> 
> > Macro (rw-step)
> 
> A modal will open (Figure 5 - 1).
> 
> ![Figure 5 - Modal](media://35519430-cd58-4f11-a09e-e871e2cea439)
> 
> > Macro (rw-step)
> 
> Click *Select file* (Figure 5 - 1) to upload your external file, and then click *Replace* (Figure 5 - 2).
> 
> > Macro (rw-step)
> 
> You will see a success message, and the new file will replace the older one immediately.

#### Via the Test Repository

> ⚠️ - Only possible if you have Tests there.
> ⚠️ - It works only for one Test at a time.

##### Creating and Downloading Automated Test Scripts

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to the [Test Repository](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565166).
> 
> > Macro (rw-step)
> 
> Select the Test for which you want to create automated scripts by clicking it (Figure 6 - 1).
> 
> ![Figure 6 - Test repository](media://b628c7a8-e725-405d-a2b1-1e2bb9d6f218)
> 
> > Macro (rw-step)
> 
> Click the *AI Actions* button (Figure 6 - 2) and then *Automate Test* (Figure 6 - 3).
> 
> > Macro (rw-step)
> 
> You will immediately land on the Generate Automated Test modal (Figure 7).
> 
> ![Figure 7 - Modal](media://3489d005-1c7d-4a7d-8ce6-9601288819e1)
> 
> Here, you can:
> 
> 1 - Select a framework (Figure 7 - 1; mandatory).
> 
> 2 - Pick a language (Figure 7 - 2; mandatory).
> 
> 3 - Add a version name (Figure 7 - 3; optional).
> 
> 4 - Select linked Work items (Figure 7 - 4; optional). Xray automatically fetches linked Work items. For example, if a Test is linked to a Requirement, Xray pre-fills this section with that Requirement. You can remove it or add additional work items as needed
> 
> 5 - Upload attachments (Figure 7 - 5; optional). If the linked Test or Requirement has attachments, Xray will automatically retrieve and display them below.
> 
> 6 - Describe the automation you want to create (Figure 7 - 7); Then, click *Generate* (Figure 7 - 8), and you will see the resultant script will appear in section 9. In here, you will see a brief explanation given by the AI of what and why it has generated that output. 
> 
> 7 - Once Step 6 is concluded, you will find the output in *Automation Scripts* (Figure 7 - 9).
> 
> 8 - Click *Create automated tes*t (Figure 7 - 10).
> 
> > Macro (rw-step)
> 
> You will see a success message (Figure 8 - 1).
> 
> ![Figure 8 - Success.png](media://83b177c6-79a7-45e8-929f-6498cce023c8)
> 
> 
> > Macro (rw-step)
> 
> Select the Test for which you’ve just created automated scripts (Figure 9 - 1), right-click it, and click *View Issue* (Figure 9 - 1).
> 
> ![Figure 9 - Issue](media://96df20d5-ba90-43e8-9daf-d91613b6221f)
> 
> > Macro (rw-step)
> 
> The respective Work item will open (Figure 10).
> 
> ![Figure 10 - Version](media://302bb15d-96ed-4beb-9bb9-70d729a5212c)
> 
> > Macro (rw-step)
> 
> Click the *Version* dropdown menu (Figure 10 - 1) and select the corresponding version. In this case, it’s *v4* (Figure 10 - 2).
> 
> > ⚠️ - When the versioning [Feature toggle in Global Settings](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565845) is enabled, Xray creates a new Test version.
> > ⚠️ - When it is disabled, Xray creates a new Test instead.
> 
> > Macro (rw-step)
> 
> Click *Download* (Figure 10 - 3) to immediately receive the generated automated Test scripts on your machine as a ZIP file.

##### Replacing an Automated Test Script

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Once an automated Test script is created, click *Replace automated test* (Figure 10 - 4). This action allows you to upload an external script file (ZIP only) that will replace the current automation script.
> 
> > Macro (rw-step)
> 
> A modal will open (Figure 11 - 1).
> 
> ![Figure 11 - Modal](media://1de6f431-2306-4f5a-909d-628d10778700)
> 
> > Macro (rw-step)
> 
> Click *Select file* (Figure 11 - 1) to upload your external file, and then click *Replace* (Figure 11 - 2).
> 
> > Macro (rw-step)
> 
> You will see a success message, and the new file will replace the older one immediately.

### On the Xray Jira Test Management App

![Banner-Xray-Documentation-Advanced.png](media://1ae9dee6-8b8b-412b-8a31-435c37ed41ce)

#### Via a Work Item

##### Creating and Downloading Automated Test Scripts

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to your Test Work item (Figure 12) and, under *Test details*, click *Automate Test* (Figure 12 - 1).
> 
> ![Figure 12 - Automate](media://5b530be6-0116-42c5-8409-7f5f941ad320)
> 
> > Macro (rw-step)
> 
> You will immediately land on the Generate Automated Test modal (Figure 13).
> 
> ![Figure 13 - Modal](media://26836491-1f41-46d1-a976-8f25e966826c)
> 
> Here, you can:
> 
> 1 - Select a framework (Figure 13 - 1; mandatory).
> 
> 2 - Pick a language (Figure 13 - 2; mandatory).
> 
> 3 - Add an AI test prefix (Figure 13 - 3; optional).
> 
> 4 - Select linked Work items (Figure 13 - 4; optional).
> 
> 5 - Upload attachments (Figure 13 - 5; optional).
> 
> 6 - Describe the automation you want to create (Figure 13 - 7); Then, click *Generate* (Figure 13 - 8), and you will see the results in the AI assistant section (Figure 13 - 6).
> 
> 7 - Once Step 6 is concluded, you will find the output in *Automation Scripts* (Figure 13 - 9).
> 
> 8 - Click *Create automated tes*t (Figure 13 - 10).
> 
> > Macro (rw-step)
> 
> You will see a success message (Figure 14 - 1).
> 
> ![Figure 14 - Download.png](media://943ca959-8c39-4997-bd79-e0a6e5ff1c7c)
> 
> > Macro (rw-step)
> 
> Click *Download* (Figure 14 - 2) to immediately receive the generated Test scripts on your machine as a ZIP file.

##### Replacing an Automated Test Script

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Once an automated Test script is created, click *Replace automated test* (Figure 14 - 3). This action allows you to upload an external script file (ZIP only) that will replace the current automation script.
> 
> > Macro (rw-step)
> 
> A modal will open (Figure 15 - 1).
> 
> ![Figure 15 - Modal](media://35519430-cd58-4f11-a09e-e871e2cea439)
> 
> > Macro (rw-step)
> 
> Click *Select file* (Figure 15 - 1) to upload your external file, and then click *Replace* (Figure 15 - 2).
> 
> > Macro (rw-step)
> 
> You will see a success message, and the new file will replace the old one immediately.

#### Via the Test Repository

> ⚠️ - Only possible if you have Tests there.
> ⚠️ - It works only for one Test at a time.

##### Creating and Downloading Automated Test Scripts

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to the [Test Repository](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565166).
> 
> > Macro (rw-step)
> 
> Select the Test for which you want to create automated scripts by clicking it (Figure 16 - 1).
> 
> ![Figure 16 - Test repository](media://b628c7a8-e725-405d-a2b1-1e2bb9d6f218)
> 
> > Macro (rw-step)
> 
> Click the *AI Actions* button (Figure 16 - 2) and then *Automate Test* (Figure 16 - 3).
> 
> > Macro (rw-step)
> 
> You will immediately land on the Generate Automated Test modal (Figure 17).
> 
> ![Figure 17 - Modal](media://f24e54d4-3e44-4037-87c3-b7bab3a80d02)
> 
> Here, you can:
> 
> 1 - Select a framework (Figure 17 - 1; mandatory).
> 
> 2 - Pick a language (Figure 17 - 2; mandatory).
> 
> 3 - Add an AI test prefix (Figure 17 - 3; optional).
> 
> 4 - Select linked Work items (Figure 17 - 4; optional).
> 
> 5 - Upload attachments (Figure 17 - 5; optional).
> 
> 6 - Describe the automation you want to create (Figure 17 - 7); Then, click *Generate* (Figure 17 - 8), and you will see the results in the AI assistant section (Figure 17 - 6).
> 
> 7 - Once Step 6 is concluded, you will see the result in *Automation Scripts* (Figure 17 - 9).
> 
> 8 - Click *Create automated tes*t (Figure 17 - 10).
> 
> > Macro (rw-step)
> 
> You will see a success message (Figure 18 - 1).
> 
> ![Figure 18 - Success](media://e4d076c1-4e0f-450c-b9c1-f3f66789a44d)
> 
> > Macro (rw-step)
> 
> Select the Test for which you’ve just created automated scripts (Figure 19 - 1), right-click it, and click *View Issue* (Figure 19 - 1).
> 
> ![Figure 19 - Issue](media://96df20d5-ba90-43e8-9daf-d91613b6221f)
> 
> > Macro (rw-step)
> 
> The respective Work item will open (Figure 20).
> 
> ![Figure 20 - Work item](media://238fcdfa-650a-4eb3-80cd-960cd763d18b)
> 
> > Macro (rw-step)
> 
> Click *Download* (Figure 20 - 1) to immediately receive the generated Test scripts on your machine as a ZIP file.

##### Replacing an Automated Test Script

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Once an automated Test script is created, click *Replace automated test* (Figure 20 - 2). This action allows you to upload an external script file (ZIP only) that will replace the current automation script.
> 
> > Macro (rw-step)
> 
> A modal will open (Figure 21 - 1).
> 
> ![Figure 21 - Modal](media://1de6f431-2306-4f5a-909d-628d10778700)
> 
> Click *Select file* (Figure 21 - 1) to upload your external file, and then *Replace* (Figure 21 - 2).
> 
> > Macro (rw-step)
> 
> You will see a success message, and the new file will replace the old one immediately.

> ✅ Visit [this Xray Academy course ](https://academy.getxray.app/plus/my/training/175)to learn more about the AI Test Script Generation.

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> If you have questions or technical issues, please [contact the Support team via the Customer Portal (Jira service management)](https://jira.getxray.app/servicedesk/customer/portal/2/user/login?destination=portal%2F2%2Fcreate%2F28) or [send us a message using the in-app chat](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44577312).