---
title: "Pre-Condition"
canonical: "https://docs.getxray.app/space/XRAY/301405098/Pre-Condition"
format: markdown
---
<span style="color: #000000">Pre-Conditions specify</span><span style="color: #000000"> the conditions that need to be fulfilled in order to execute a test</span><span style="color: #000000">.</span>

<span style="color: #000000"> A Pre-Condition is like defining the step "0" for your tests. This is very useful in many use cases where you have to start by doing exactly the same thing. For example, if you are going to do something on a system, you most probably have to authenticate first, right? But sometimes, you have to do several things  (e.g., restore DB, authenticate) before going through your Test steps. And each of those things may be done and used independently, i.e., some Tests may require just restoring the DB, another may require just to authentication, and others may require both things or more.  </span>

<span style="color: #000000"> </span>

> Macro (toc)

# Pre-Condition Types

Pre-Conditions Types must be the same Kind of the Test they are associated with, so they can be Manual or Automated.

- **Steps** Pre-Conditions: Conditions to be executed by the user before starting the Associated Test.
- **Unstructured kind** Pre-Conditions: Conditions to be executed by the external tool before starting the Associated Test.
- **Gherkin kind** Pre-Conditions: Background Gherkin clauses to be executed before starting the associated Scenarios.

# Actions

> Macro (toc)

## Create

To create a new Pre-Condition issue:

**Step 1**: Click the **Create Issue** at the top of the screen to open the **Create Issue** dialog box.

**Step 2**: Select the relevant **Project** and on **Issue Type** select **Pre-Condition**.

**Step 3**: Type a **Summary** for the Pre-Condition and complete all appropriate fields — at least, the required ones which are marked by an asterisk.

![image](media://c2827363-eb99-4ec9-b88d-ac07532bf98d)

**Step 4**: On the Pre-Condition Details tab, select the **Pre-Condition Type** and complete all appropriate fields.

> Macro (inline-media-image)

  
**Optional**:  
- Click on the Tests tab to associate the current issue with Tests.

**Step 5**: When you are satisfied with the content of your Pre-Condition, click the **Create** button. If you selected the **Create another** check box (above), a new **Create Issue** dialog appears. This issue is automatically pre-populated with your previous Pre-Condition details, while leaving the **Summary** field blank.

## Edit

### Using the Edit Issue dialog box

To Edit an existing Pre-Condition issue using the edit page:

**Step 1**: Click the **Edit** button (at the top-left of the 'view issue' page) to open the **Edit Issue** dialog / page.

![image](media://4eaa2656-fda7-4dea-99da-1b96dbf38b66)

**Step 2**: Modify your **Pre-Condition** details in the appropriate fields of the **Edit Issue** General tab.

**Step 3**: Modify your **Pre-Condition's Details** under the identically named tab on the **Edit Issue** page.

![image](media://2b038427-568f-48d8-a872-47cbe10a203f)

**Optional**:  
- Click on the Tests tab to edit Test associations.

**Step 4**: Click the **Update** button to save your changes.

### Using the Inline Edit for Jira App

To Edit an existing Pre-Condition issue using inline edit:

**Step 1**: On the **Pre-Condition** page view, hover your mouse over a field and click it to Edit Inline.

Examples:  
- You can hover on the actual **Pre-Condition Type**, click it to enter the edit mode, and choose other available option on the selected field.  
- You can hover on the **Condition** field, click it to enter the edit mode, and modify the contents.

**Step 2**: To save the changes, just click outside of the field area of click the save button located in the bottom right corner of the editing field. 

![image](media://6549ffb5-c705-4e63-8648-01ee4a5c8c16)

## Clone

To clone a Pre-Condition issue:

**Step 1**: Open the **Pre-Condition** you wish to **Clone**.

![image](media://78467ba0-a8e5-4e76-85b7-70c5c048d9c9)

**Step 2**: Select **More > Clone.** The **Clone Issue** screen will appear.

![image](media://31b76aab-a711-49fb-91c6-955f8f6db964)

**Step 3**: You can edit the clone Pre-condition's **Summary** if you wish.

- If the pre-condition contains links to other issue(s), you can select whether or not to include the links in the new clone pre-condition.  
- If the pre-condition contains sub-tasks, you can select whether or not to create the sub-tasks in the new clone pre-condition.  
- If the pre-condition contains attachments, you can select whether or not to include the attachments in the new clone pre-condition.

**Step 4**: Click **Create**.

## Change Pre-Condition Type

If the Pre-Condition type is changed, and the Pre-Condition is already associated with tests, a validation process will take place to check if there are any conflicts between Test types and the new Pre-Condition type. If there are conflicts, a confirmation popup dialog will appear showing the Test issue keys with different types. If the operation is confirmed, the association between the Pre-Condition and the conflicted Test issues will be removed. 

*Screenshot: Example ****Delete Pre-Condition Association?**** dialog* *box*

![image](media://ee2db3cc-5b03-434a-bedf-f05e1e16c73a)

## Associate Tests

To associate Tests with a Pre-Condition from the Pre-Condition issue view screen:

**Step 1**: Open the Pre-Condition you wish to associate a Test with.

**Step 2**: Click the **Associate Tests** button (under the **Tests** tab on the view page) to open the **Issue Picker D****ialog**.

![image](media://1db036b3-1479-461f-8f80-1fd4dd327185)

**Step 3**: <span style="color: #172b4d">Open the </span>**Search** <span style="color: #172b4d">tab.</span>

> ℹ️ **How to use de Issue Picker Dialog**
> ℹ️ 
> ℹ️ This is an example of how to add tests, using some of the features available in the Search tab.
> ℹ️ 
> ℹ️ For more information, please visit the[ ](https://getxraydocs.atlassian.net/wiki/spaces/XRAY/pages/301502281)[Issue Picker Dialog](https://getxraydocs.atlassian.net/wiki/spaces/XRAY/pages/301502281) detailed overview.

<span style="color: #333333">**Step 4:**</span><span style="color: #333333">** **</span><span style="color: #333333">Configure the search.</span>

<span style="color: #333333">-Use the</span><span style="color: #333333"> </span>**<span style="color: #333333">Filters</span>**<span style="color: #333333"> </span><span style="color: #333333">dropdown button to</span><span style="color: #333333"> </span>**<span style="color: #333333">include extra fields</span>**<span style="color: #333333"> </span><span style="color: #333333">in the search criteria.</span>

<span style="color: #333333">-</span>**<span style="color: #333333">Fill in</span>**<span style="color: #333333"> </span><span style="color: #333333">the filters values.</span>

<span style="color: #333333">-</span>**<span style="color: #333333">Press</span>**<span style="color: #333333"> </span><span style="color: #333333">the search button.</span>

![image](media://5c830ff9-fea2-4f69-9235-53957d9951f8)

**<span style="color: #333333">Step 5:</span>****<span style="color: #333333"> </span>**<span style="color: #333333">Select and Add tests.</span>

<span style="color: #333333">- Once the results are obtained you can</span><span style="color: #333333"> </span>**<span style="color: #333333">order, add/remove columns</span>**<span style="color: #333333"> </span><span style="color: #333333">to the results list (the columns selection is saved as a preference).</span>

<span style="color: #333333">- </span>**<span style="color: #333333">Check</span>**<span style="color: #333333"> the tests you wish to add from the listed results.</span>

**Step 6:**** **<span style="color: #333333"> Add tests by pressing "</span>**Add selected**<span style="color: #333333">".</span>

## Remove Tests

To remove Tests from a Pre-Condition using the Pre-Condition issue view screen:

**Step 1**: Open the Pre-Condition you wish to remove a Test.

**Step 2**: On the Tests table, hover over the desired Test row and click on the **Trash** button that appears at the end of the row. You will be prompted with a confirmation dialog.

## Bulk Operations

Xray provides the following bulk operations on the Tests table. 

- **Remove - **Deletes all the selected Tests associations with a Pre-Condition.

To execute these bulk actions:

**Step 1**: Open the Pre-Condition issue.

**Step 2**: Click on the Bulk button to activate the bulk edit mode (under the **Tests** section on the view page). A checkbox appears on each Test row and also the bulk actions button in the actions column header.

**Step 3**: Selected the desired Test issues.

**Step 4**: Click the **bulk actions button** and choose one of the available actions.


![image](media://7903a3ab-e142-4f9b-8019-ce8da5a48c74)