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

> Macro (toc)
</details>

# Introduction

From a [**Precondition**](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565159), it's possible to export the following Xray data: [**Tests**](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565156)**.**

In addition to the usual Jira mappings, you can export the following fields:

- *PreCondition.Type*
- *PreCondition.Definition*
- *PreConditionsCount*


##### **Some mappings you can export from a Pre-condition**

```
Key: ${Key}
Summary: ${Summary}
Type: ${PreCondition.Type}
Definition: ${PreCondition.Definition}
Count: ${PreConditionsCount}
```

# Exporting Tests from a Precondition

Below you can find an example of how to iterate over the list of **Tests** associated with a **Precondition.**

##### **Iterate over Tests**

```
Total number of associated tests: ${TestsCount}

// Iterating each test
#{for tests}
	Key: ${Tests[n].Key}
	Test Status: ${Tests[n].TestStatus}
	// Iterating over test steps for each test
	#{for m=Tests[n].TestStepsCount}
		Action: ${Tests[n].TestSteps[m].Action}
		Data: ${Tests[n].TestSteps[m].Data}
		Expected Result: ${Tests[n].TestSteps[m].ExpectedResult}
		// Replace the placeholder text to export any newly created test setp field.
		Test Step Field:${Tests[n].TestSteps[m].<Test Step Field>}
	#{end}
#{end}
 
or
 
// Iterating each test
#{for j=TestsCount}
	Key: ${Tests[j].Key}
	Test Status: ${Tests[j].TestStatus}
	// Iterating over test steps for each test
	#{for m=Tests[j].TestStepsCount}
		Action: ${Tests[j].TestSteps[m].Action}
		Data: ${Tests[j].TestSteps[m].Data}
		Expected Result: ${Tests[j].TestSteps[m].ExpectedResult}
		// Replace the placeholder text to export any newly created test setp field.
		Test Step Field:${Tests[n].TestSteps[m].<Test Step Field>}
	#{end}
#{end}
```

> ℹ️ Go [here](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44574749) to see more information on how to export Tests.

# <span style="color: #172B4D">Example</span>

<span style="color: #172B4D"> shows an example with all the mappings available to export from a Precondition.</span>


<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>