From a Test, it's possible to export the following Xray data: Preconditions, Test Sets, TestPlans, Test Executions, and Test Runs.

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

Key: ${Key}
Cucumber Scenario: ${Cucumber Scenario}
Generic Test Definition: ${Generic Test Definition}
Test Type: ${TestType}
Test Status: ${TestStatus}
Test Steps Total: ${TestStepsCount}
Tests Count: ${TestsCount}
Test Repository Path: ${TestRepositoryPath}

Exporting Test Steps from a Test

For each Test Step you can export the following fields:

Below you can find an example on how to iterate over the list of TestSteps associated with a Test.

Total number of associated test steps: ${TestStepsCount}

// Iterating each test step
#{for teststeps}
	 Action: ${TestSteps[n].Action}
     Data: ${TestSteps[n].Data}
     Expected Result: ${TestSteps[n].ExpectedResult}
     Step Number: ${TestSteps[n].StepNumber}
	 // Replace the placeholder text to export any newly created test step field
	 Test Step Field:${Tests[n].<Test Step Field>}
     // Iterating over attachments for each test step
     #{for l=TestSteps[n].AttachmentsCount}
     	Id: ${TestSteps[n].Attachments[l].Id}
        Name: ${TestSteps[n].Attachments[l].Name}
        Image: ${TestSteps[n].Attachments[l].Attachment}
        FileURL: ${TestSteps[n].Attachments[l].FileURL}
     #{end}
#{end}
 
or
 
// Iterating each test step
#{for j=TestStepsCount}
	Action: ${TestSteps[j].Action}
    Data: ${TestSteps[j].Data}
	Expected Result: ${TestSteps[j].ExpectedResult}
    Step Number: ${TestSteps[j].StepNumber}
	// Replace the placeholder text to export any newly created test step field
	Test Step Field:${Tests[n].TestSteps[m].<Test Step Field>}
    // Iterating over attachments for each test step
    #{for l=TestSteps[j].AttachmentsCount}
		Id: ${TestSteps[j].Attachments[l].Id}
        Name: ${TestSteps[j].Attachments[l].Name}
		Image: ${TestSteps[n].Attachments[l].Attachment}
		FileURL: ${TestSteps[n].Attachments[l].FileURL}
    #{end}
#{end}

Exporting Preconditions from a Test

Below you can find an example on how to iterate over the list of Preconditions associated with a Test.

Total number of associated preconditions: ${PreConditionsCount}

// Iterating each precondition
#{for preconditions}
	Key: ${PreConditions[n].Key}
	Type: ${PreConditions[n].PreCondition.Type}
	Definition: ${PreConditions[n].PreCondition.Definition}
#{end}
 
or
 
// Iterating each precondition
#{for j=PreConditionsCount}
	Summary: ${PreConditions[j].Summary}
	Type: ${PreConditions[j].PreCondition.Type}
	Definition: ${PreConditions[j].PreCondition.Definition}
#{end}

For more detailed information on how to export Pre-conditions and its information please check the page Exporting Precondition.


Exporting Test Sets from a Test

Below you can find an example on how to iterate over the list of TestSets associated with a Test.

Total number of associated test sets: ${TestSetsCount}

// Iterating each test set
#{for testSets}
	Description: ${TestSets[n].Description}
#{end}
 
or
 
// Iterating each test set
#{for j=TestSetsCount}
	Summary: ${TestSets[j].Summary}
#{end}

For more detailed information on how to export Test Sets and its information please check the page Exporting Test Set.


Exporting Test Plans from a Test

Below you can find an example on how to iterate over the list of TestPlans associated with a Test.

Total number of associated test plans: ${TestPlansCount}

// Iterating each test plan
#{for testPlans}
	Summary: ${TestPlans[n].Summary}
#{end}
 
or
 
// Iterating each test plan
#{for j=TestPlansCount}
	Description: ${TestPlans[j].Description}
#{end}

For more detailed information on how to export Test Plans and its information please check the page Exporting Test Plan.


Exporting Test Executions from a Test

Below you can find an example on how to iterate over the list of TestExecutions associated with a Test.

Total number of associated test executions: ${TestExecutionsCount}

// Iterating each test execution
#{for testExecutions}
	Key: ${TestExecutions[n].Key}
	Test Environments: ${TestExecutions[n].TestEnvironments}
#{end}
 
or
 
// Iterating each test execution
#{for j=TestExecutionsCount}
	Summary: ${TestExecutions[j].Summary}
	Test Environments: ${TestExecutions[j].TestEnvironments}
#{end}

For more detailed information on how to export Test Executions and its information please check the page Exporting Test Execution.


Exporting Test Runs from a Test

Below you can find an example on how to iterate over the list of TestRuns associated with a Test.

Total number of associated test runs: ${TestRunsCount}

// Iterating each test run
#{for testruns}
    Assignee Id: ${TestRuns[n].AssigneeId}
    Key: ${TestRuns[n].Key}
    Summary: ${TestRuns[n].Summary}
    Comment: ${TestRuns[n].Comment}
    Generic Test Definition: ${TestRuns[n].Generic Test Definition}
    Cucumber Scenario: ${TestRuns[n].Cucumber Scenario}
    Executed by: ${TestRuns[n].Executed By}
    Execution Status: ${TestRuns[n].Execution Status}
    Started on: ${TestRuns[n].Started On}
    Finished on: ${TestRuns[n].Finished On}
	// Replace the placeholder text to export any custom field associated with the test run.
	Test Run Custom Field:${TestRuns[n].<Test Run Custom Field>}

    // Iterating over execution evidences for each test run
    Execution Evidences Total: ${TestRuns[n].ExecutionEvidencesCount}
    #{for m=TestRuns[n].ExecutionEvidencesCount}
        Id: ${TestRuns[n].ExecutionEvidences[m].Id}
        Name: ${TestRuns[n].ExecutionEvidences[m].Name}
		File URL: ${TestRuns[n].ExecutionEvidences[m].FileURL}
		Evidence: ${TestRuns[n].ExecutionEvidences[m].Evidence}
    #{end}

    // Iterating over execution defects for each test run
    Execution Defects Total: ${TestRuns[n].ExecutionDefectsCount}
    #{for m=TestRuns[n].ExecutionDefectsCount}
        Id: ${TestRuns[n].ExecutionDefects[m].Id}
        Description: ${TestRuns[n].ExecutionDefects[m].Description}
        Key: ${TestRuns[n].ExecutionDefects[m].Key}
        Summary: ${TestRuns[n].ExecutionDefects[m].Summary}
    #{end}

	// Iterating over parameters for each test run
    Parameters Total: ${TestRuns[n].ParametersCount}
	#{for m=TestRuns[n].ParametersCount}
        Key: ${TestRuns[n].Parameters[m].Key}
        Value: ${TestRuns[n].Parameters[m].Value}
    #{end}

	// Iterating over preconditions for each test run
    Preconditions Total: ${TestRuns[n].PreConditionsCount}
    #{for m=TestRuns[n].PreConditionsCount}
        Definition: ${TestRuns[n].PreConditions[m].PreCondition.Definition}
        Type: ${TestRuns[n].PreConditions[m].PreCondition.Type}
    #{end}

    // Iterating over test steps for each test run
    Test Steps Total: ${TestRuns[n].TestStepsCount}
    #{for m=TestRuns[n].TestStepsCount}
        Action: ${TestRuns[n].TestSteps[m].Action}
        Comment: ${TestRuns[n].TestSteps[m].Comment}
        Data: ${TestRuns[n].TestSteps[m].Data}
        Expected Result: ${TestRuns[n].TestSteps[m].ExpectedResult}
		Actual Result: ${TestRuns[n].TestSteps[m].ActualResult}
        Status: ${TestRuns[n].TestSteps[m].Status}
        Step Number: ${TestRuns[n].TestSteps[m].StepNumber}
		// Replace the placeholder text to export any custom field associated with the test step.
		Step Custom Field:${TestRuns[n].TestSteps[m].<Step Custom Field>}
        // Iterating over attachments for each test step
        #{for l=TestRuns[n].TestSteps[m].AttachmentsCount}
            Id: ${TestRuns[n].TestSteps[m].Attachments[l].Id}
            Name: ${TestRuns[n].TestSteps[m].Attachments[l].Name}
            Image: ${TestRuns[n].TestSteps[m].Attachments[l].Image}
            FileURL: ${TestRuns[n].TestSteps[m].Attachments[l].FileURL}
        #{end}
        // Iterating over evidences for each test step
        #{for l=TestRuns[n].TestSteps[m].EvidencesCount}
            Id: ${TestRuns[n].TestSteps[m].Evidences[l].Id}
            Name: ${TestRuns[n].TestSteps[m].Evidences[l].Name}
			File URL: ${TestRuns[n].TestSteps[m].Evidences[l].FileURL}
			Evidence: ${TestRuns[n].TestSteps[m].Evidences[l].Evidence}
        #{end}
        // Iterating over defects for each test step
        #{for l=TestRuns[n].TestSteps[m].DefectsCount}
            Description: ${TestRuns[n].TestSteps[m].Defects[l].Description}
            Id: ${TestRuns[n].TestSteps[m].Defects[l].Id}
            Key: ${TestRuns[n].TestSteps[m].Defects[l].Key}
            Summary: ${TestRuns[n].TestSteps[m].Defects[l].Summary}
        #{end}
    #{end}
#{end}

Exporting Parameterized Tests from a Test Run

To export all this data, we first need to execute the test run. If we change any data, we need to return to the Execution Page and merge it with the new data.

FieldsDescription
ParametersCountTotal of Parameters declared in Dataset
IsDataDriven

Returns "true" if the current test run is data-driven; otherwise, it returns "false"

IterationsOverallExecutionStatus

List of all the statuses in the current test run iteration and their percentages
IterationsOverallExecutionStatus.STATUS.CountThe number of STATUS in the test run iterations
Iterations Overall Execution Status.STATUS.PercentageThe percentage of STATUS in the test run iterations
ParametersList of the parameters from each test run iteration

The field IsDataDriven is going to return TRUE only if the test run has more than one iteration.


Exporting Test Runs Parameters from a Test

For each Test Run Parameter you can export the following fields:

Below you can find an example of how to iterate over the list of Test Run Parameters associated with a Test.

// Iterating each test run
#{for testruns}
	// Iterating over parameters for each test run
    Parameters Total: ${TestRuns[n].ParametersCount}
	#{for m=TestRuns[n].ParametersCount}
        Key: ${TestRuns[n].Parameters[m].Key}
        Value: ${TestRuns[n].Parameters[m].Value}
    #{end}
#{end}

Exporting Test Runs Iterations from a Test

For each Test Run Iteration you can export the following fields:

Below you can find an example of how to iterate over the list of Test Run Iterations associated with a Test.

// Iterating each test run
#{for testruns}
	IsDataDriven: ${TestRuns[n].IsDataDriven}	
	
	// Iterations Overall Execution Status (percentage + total of testes per status)
	List of Statuses: ${TestRuns[n].Iterations Overall Execution Status}
	TO DO: ${TestRuns[n].Iterations Overall Execution Status.TO DO.Percentage}% - ${TestRuns[n].Iterations Overall Execution Status.TO DO.Count}
    EXECUTING: ${TestRuns[n].Iterations Overall Execution Status.EXECUTING.Percentage}% - ${TestRuns[n].Iterations Overall Execution Status.EXECUTING.Count}
    PASSED: ${TestRuns[n].Iterations Overall Execution Status.PASSED.Percentage}% - ${TestRuns[n].Iterations Overall Execution Status.PASSED.Count}
    FAILED: ${TestRuns[n].Iterations Overall Execution Status.FAILED.Percentage}% - ${TestRuns[n].Iterations Overall Execution Status.FAILED.Count}
    ABORTED: ${TestRuns[n].Iterations Overall Execution Status.ABORTED.Percentage}% - ${TestRuns[n].Iterations Overall Execution Status.ABORTED.Count}

	// Iterating over test runs iterations
    Total of Iterations from a Test Run: ${TestRuns[n].IterationsCount}
	#{for m=TestRuns[n].IterationsCount}
		Name: ${TestRuns[n].Iterations[m].Name}
		Status: ${TestRuns[n].Iterations[m].Status}
		Parameters: ${TestRuns[n].Iterations[m].Parameters}

		// Iterating over parameters for each test run iteration
		Parameters Total: ${TestRuns[n].Iterations[m].ParametersCount}
		#{for l=TestRuns[n].Iterations[m].ParametersCount}
			Key: ${TestRuns[n].Iterations[m].Parameters[l].Key}
			Value: ${TestRuns[n].Iterations[m].Parameters[l].Value}
		#{end}

		// Iterating over preconditions for each test run iteration
    	Preconditions Total: ${TestRuns[n].Iterations[m].PreConditionsCount}
		#{for l=TestRuns[n].Iterations[m].PreConditionsCount}
     	    Definition: ${TestRuns[n].Iterations[m].PreConditions[l].PreCondition.Definition}
    	    Type: ${TestRuns[n].Iterations[m].PreConditions[l].PreCondition.Type}
    	#{end}

		//Iterating over test steps for each test run iteration
		#{for i=TestRuns[n].Iterations[m].TestStepsCount}
			Step Number: ${TestRuns[n].Iterations[m].TestSteps[i].StepNumber}
			Action: ${TestRuns[n].Iterations[m].TestSteps[i].Action}
			Data: ${TestRuns[n].Iterations[m].TestSteps[i].Data}
			Expected Result: ${TestRuns[n].Iterations[m].TestSteps[i].ExpectedResult}
			Status: ${TestRuns[n].Iterations[m].TestSteps[i].Status}
			Comment: ${TestRuns[n].Iterations[m].TestSteps[i].Comment}
			Actual Result: ${TestRuns[n].Iterations[m].TestSteps[i].ActualResult}
			// Replace the placeholder text to export any custom field associated with the test step.
        	Step Custom Field:${TestRuns[n].Iterations[m].TestSteps[i].<Step Custom Field>}
			
			// Iteration Test Step Attachments
			#{for l=TestRuns[n].Iterations[m].TestSteps[i].AttachmentsCount}
				Id: ${TestRuns[n].Iterations[m].TestSteps[i].Attachments[l].Id}
				Name: ${TestRuns[n].Iterations[m].TestSteps[i].Attachments[l].Name}
				Image: ${TestRuns[n].Iterations[m].TestSteps[i].Attachments[l].Attachment}
				FileURL: ${TestRuns[n].Iterations[m].TestSteps[i].Attachments[l].FileURL}
			#{end}
			// Iteration Test Step Evidences
			#{for l=TestRuns[n].Iterations[m].TestSteps[i].EvidencesCount}
				Id: ${TestRuns[n].Iterations[m].TestSteps[i].Evidences[l].Id}
				Name: ${TestRuns[n].Iterations[m].TestSteps[i].Evidences[l].Name}
				File URL: ${TestRuns[n].Iterations[m].TestSteps[i].Evidences[l].FileURL}
				Evidence: ${TestRuns[n].Iterations[m].TestSteps[i].Evidences[l].Evidence}
			#{end}
			// Iteration Test Step Defects
			#{for l=TestRuns[n].Iterations[m].TestSteps[i].DefectsCount}
				Description: ${TestRuns[n].Iterations[m].TestSteps[i].Defects[l].Description}
				Id: ${TestRuns[n].Iterations[m].TestSteps[i].Defects[l].Id}
				Key: ${TestRuns[n].Iterations[m].TestSteps[i].Defects[l].Key}
				Summary: ${TestRuns[n].Iterations[m].TestSteps[i].Defects[l].Summary}
			#{end}
		#{end}
	#{end}
#{end}

The word document below shows an example with all the mappings available to export from a Test:

word.pngXray_Tests.docx