---
title: "Precondition"
canonical: "https://docs.getxray.app/space/XRAYCLOUD/44565159/Precondition"
format: markdown
---
<details>
<summary>Table of Contents</summary>

> Macro (toc)
</details>

# Introduction

<span style="color: #000000">Preconditions specify the conditions that need to be fulfilled to </span><span style="color: #000000">[execute a Test](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565037)</span><span style="color: #000000">.</span>

A Precondition is like defining step 0 for your Tests. This is very useful in many use cases where you have to start by doing the same thing. For example, if you are going to do something on a system, you most likely have to authenticate first. Sometimes, you have to do several things (e.g., restore the database, authenticate, etc.) before proceeding with your <span style="color: #000000">[Test steps](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565316)</span>. Each of these steps may be done and used independently, i.e., some Tests may require just restoring the database, others may require just authenticating, and others may require both or more.

# Precondition Types

There are three Test Types available:

- Manual.
- Generic.
- Cucumber.

Each of the Test Types has a Kind, and the Kind of the Type of Precondition must be of the same Kind as the Type of the Test it is associated with.

# Operations

## Creating a Precondition Work Item

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> On your Jira Cloud instance, click the *Create* button (Figure 1 - 1). A modal will open (Figure 1).
> 
> ![Figure 1 - Create](media://5a84c98f-caaf-40ad-b95e-329ddfcdde22)
> 
> > Macro (rw-step)
> 
> Select the *Space* (mandatory; Figure 1 - 2). 
> 
> > Macro (rw-step)
> 
> On the *Work Type*, select *Precondition *(mandatory; Figure 1 - 3).
> 
> > Macro (rw-step)
> 
> Type a *Summary* (mandatory; Figure 1 - 4). Complete all remaining fields if necessary.
> 
> > Macro (rw-step)
> 
> Once you're done, click the *Create* button (Figure 1 - 6). 
> 
> > ℹ️ If you select the *Create another* option (Figure 1 - 5)), a new **modal** appears. This new Work item will be automatically pre-populated with your previous Precondition details while leaving the *Summary* field blank.

## Editing a Precondition Work Item

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to the Precondition Work Item you want to edit (Figure 2).
> 
> > Macro (rw-step)
> 
> Click *Precondition details* (Figure 2 - 2).
> 
> ![Figure 2 - Edit](media://90c5d584-41fc-40ca-82f2-c7a74e02782e)
> 
> > Macro (rw-step)
> 
> Operations:
> 
> - To edit the *Description* (Figure 2 - 1), hover your mouse over the field, click it, and a text editor will open. Make your changes. Once you're finished, click the *Save* button.
> - Use the dropdown menu to change the Test type (Figure 2 - 3). More info below.
> - To edit the *Steps* (Figure 2 - 4), hover your mouse over the field, click it, and a text editor will open. Make your changes. Once you're finished, click the check icon.
> - To edit the *Details* (Figure 2 - 5) and *More fields* (Figure 2 - 6), click the respective fields, hover your mouse over the field you wish to edit, and click it. Make your changes and click outside the field area to save.

## Cloning a Precondition Work Item

Cloning a Precondition Work Item creates a new Precondition with all the information of the cloned Precondition, except its executions. Therefore, the cloned Issue will not be associated with any Test Work Item.

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to the Precondition Work Item you want to clone, click the ellipsis icon (Figure 3 - 1), and then select *Clone* (Figure 3 - 2). A modal will open (Figure 4).
> 
> ![Figure 3 - Clone](media://efb35bd6-1e49-4ab9-8ce6-d5b286629ab2)
> 
> > Macro (rw-step)
> 
> Click the *Clone* button (Figure 4 - 2).
> 
> You can also check the *Clone sprint value *box (Figure 4 - 1) to include that value.
> 
> ![Figure 4 - Modal](media://739f28e4-fba4-467a-baac-dca045c5025a)
> 
> > Macro (rw-step)
> 
> You will see a success message (Figure 5 - 1), which contains a link (Figure 5 - 2) to open the cloned Work Item.
> 
> ![Figure 5 - Confirmation](media://1066a996-cee1-4ed8-9f18-4a463e92896b)

## Changing the Precondition Type

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to the Precondition Work Item whose type you want to change (Figure 6).
> 
> ![Figure 6 - Edit.png](media://05086ad5-c256-41e0-850e-8b5d2342980a)
> 
> > Macro (rw-step)
> 
> Use the dropdown menu to select the Test type (Figure 6 - 3) option you want to change to. You will have three options available: 
> 
> - Manual.
> - Generic.
> - Cucumber.
> 
> > Macro (rw-step)
> 
> Once you click the option, a modal will open (Figure 7). Click *Confirm* to proceed.
> 
> ![Figure 7 - Change](media://10c75a58-37c1-4d3f-8f10-d27775f199e4)
> 
> > ℹ️ When the Precondition type is changed, the previous information details (Figure 2 - 5) and the associated Tests will be lost.

## Creating Tests

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to the Precondition Work Item you want to create a Test for (Figure 8).
> 
> ![Figure 8 - Tests](media://18a5c436-f51e-4f76-8bfd-1af885d4fa82)
> 
> > Macro (rw-step)
> 
> Click *Tests* (Figure 8 -1), *Add to Tests* (Figure 8 - 2), then *New test* (Figure 8 - 3). 
> 
> A modal will open (Figure 9).
> 
> ![Figure 9 - Create](media://02669919-eb6c-405b-a92f-7c111f4bba5d)
> 
> > Macro (rw-step)
> 
> Fill in the fields (at least the mandatory; Figure 9).
> 
> Once you've finished, click the *Create* button (Figure 9 - 6).
> 
> > Macro (rw-step)
> 
> You will see a success message confirming the Test creation (Figure 10 - 1, and it will now appear on the Work Item (Figure 10 - 2).
> 
> ![Figure 10 - Work item](media://e1d773f0-c6f5-4f9a-a527-4955dce1075a)

## Associating Tests to a Precondition Work Item

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to the Precondition Work Item you want to associate a Test with (Figure 11).
> 
> ![Figure 11 - Tests](media://169b6ff2-4e59-4d14-96aa-a3cb0e527346)
> 
> > Macro (rw-step)
> 
> Click *Tests* (Figure 11 - 1 ), *Add to Tests* (Figure 11 - 2), then *Existing tests *(Figure 11 - 3). 
> 
> A modal will open (Figure 12).
> 
> ![Figure 12 - Modal](media://f39f122c-1bbd-449d-ae34-787f9d005444)
> 
> Here, you can:
> 
> - Click the *Select* tab (Figure 12 - 1) to find Work Items and select them (Figure 12 - 2). You can use the *X* icon (Figure 12 - 3) to unselect a selected Work Item.
> - Click the *Search* tab (Figure 12 - 4) to make a more refined Work Item search.
> - Make a JQL search (Figure 12 - 5).
> 
> > Macro (rw-step)
> 
> Once finished, click the *Add Selected* button (Figure 12 - 2).
> 
> > Macro (rw-step)
> 
> You will see a success message confirming the Test association (Figure 13 - 1, and it will now appear on the Work Item (Figure 13 - 2).
> 
> ![Figure 13 - Work item](media://aaebbf53-5d63-49b4-9c70-a9cf92d152b1)
> 
> > ℹ️ Only Tests that have the same Type as the Precondition will be associated.

## Removing Tests

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Open the Precondition from which you want to remove a Test.
> 
> > Macro (rw-step)
> 
> On the Tests table, click the ellipsis button (Figure 14 - 1) in the desired Test row and then click *Remove* in the dropdown menu (Figure 14 - 2). 
> 
> > Macro (rw-step)
> 
> You will be prompted with a confirmation dialog. There, click *Confirm*.
> 
> ![Figure 14 - Remove](media://ba534066-6a4f-48af-82a8-992b28837c69)

## Bulk Operations

Xray provides a bulk removal operation, with a limit of 100 rows, on the Tests table, allowing you to delete all the selected Test associations with a Precondition.

To execute these bulk actions:

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Open the Precondition Work Item.
> 
> > Macro (rw-step)
> 
> Click the checkbox (Figure 15 - 1), and a dropdown menu will appear. Choose the option best suited to select the Test Work Items you wish to remove (up to 100 rows).
> 
> ![Figure 15 - Select](media://c66d94e4-224c-487c-b730-3ec643df3f5e)
> 
> > Macro (rw-step)
> 
> Once the Work Items are selected, a *Select* button will appear (Figure 15 - 2). Click that button and a *Remove* button will be shown. 
> 
> > Macro (rw-step)
> 
> Once you click that button, a modal will open for you to confirm the removal of the Work Items.

## Xray History

Any changes to the Precondition data are recorded in the Xray History section. You can see them on the Work Item by scrolling down and clicking the *Xray History* option (Figure 14 - 3).

These updates include:

- Changing the Precondition Type.
- Changing the Precondition Definition.
- Linking the Precondition with other entities (Tests).

<details>
<summary>Support/Troubleshooting</summary>

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).
</details>