Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In order to make the integration in your Java Maven projects easier, we have developed the Xray-Maven-Plugin. This plugin It enables the upload of your Tests directly to Xray with a single Maven command.

The plugin supports single or multi-module projects and multiple test frameworks. With the execution of a single Maven target com.xpandit.xray:xray-maven-plugin:xray, the plugin will upload the results of the tests to your Jira instance.

List of Available Properties

...


Property NameRequired ((tick)-Yes,(question)-Optional)DescriptionExamples
xray.jiraURL
(tick)Full URL of Jira, including the relative path, if its being used
http://localhost:8080
xray.resultsFormat
(tick)

Results format. Available formats here

Warning

case sensitive

JUNIT
xray.username
(tick)Jira Username
admin
xray.password
(tick)

Jira Password

Warning

plain-text only

password
xray.projectKey
(tick)Jira Project Key MYPROJKEY
xray.testExecKey
(question)Test Execution Issue IDMYT2-5
xray.testPlanKey
(question)Test Plan Issue IDMYT2-54
xray.testEnvironments
(question)Test EnvironmentiOS 
xray.fixVersion
(question)Fix VersionRelease 1.0
xray.revision
(question)Revision1234
xray.surefire.location
(tick)Folder with .xml files or xml file to be uploaded
${basedir}/target/surefire-reports/TEST-com.xpandit.xray.service.ResultImporterTest.xml
${basedir}/target/surefire-reports
Info
titlePlease note

You may configure the plugin properties in your project pom.xml, the settings.xml file (see project guidelines below) or via the console with -D option (e.g., -Dxray.projectKey=PROJ).

List of Available Result Formats

Each result format points to a specific Xray REST Endpoint where the results are imported. The result format is configured in the property xray.resultsFormat and is case-sensitive.

Results Format (xray.resultsFormat)

Description
JUNITJUnit XML output format (more information regarding its endpoint here)


Build, Test and Upload Results 

Code Block
mvn clean package surefire:test com.xpandit.xray:xray-maven-plugin:xray 

Upload Results Only 

Code Block
mvn com.xpandit.xray:xray-maven-plugin:xray 

Maven Project Guidelines

Standard Environment Configuration 

Code Block
languagexml
title~/.m2/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- OTHER CONFS-->
  <profiles>
    <profile>
	<!-- OTHER CONFS-->
      <properties>
        <xray.jiraURL>http://localhost:8080</xray.jiraURL>
        <xray.resultsFormat>JUNIT</xray.resultsFormat>
        <xray.username>admin</xray.username>
        <xray.password>password</xray.password>
      </properties>
    <id>MyActiveProfile</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>MyActiveProfile</activeProfile>
  </activeProfiles>
</settings>


Simple Project

This example describes the usage of the plugin on a standard simple, single-module Project 

Code Block
languagexml
themeConfluence
linenumberstrue
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/maven-v4_0_0.xsd">
    <!-- CONF's -->
    <properties>
       
        <!--XRay Properties -->

        <!--IN PROFILE ~.m2/settings.xml-->
        <!--<xray.jiraURL></xray.jiraURL>
        <xray.resultsFormat></xray.resultsFormat>
        <xray.username></xray.username>
        <xray.password></xray.password>-->

        <xray.projectKey>MYPROJKEY</xray.projectKey>
        <!--
		<xray.testExecKey></xray.testExecKey>
        <xray.testPlanKey></xray.testPlanKey>
        <xray.testEnvironments></xray.testEnvironments>
        <xray.fixVersion></xray.fixVersion>
        <xray.revision></xray.revision>
        -->

        <xray.surefire.location>${basedir}/target/surefire-reports</xray.surefire.location>
        <!--End Xray Properties -->

    </properties>

    <build>
		<pluginManagement>
        	<plugins>
             <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <version>2.19.1</version>
                  <configuration>
                      <testFailureIgnore>true</testFailureIgnore>
                  </configuration>
             </plugin>
         </plugins>
	  </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-report-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.xpandit.xray</groupId>
                <artifactId>xray-maven-plugin</artifactId>
                <version>1.0.0</version>
            </plugin>
        </plugins>
    </reporting>

    <pluginRepositories>
        <pluginRepository>
            <id>xpand-plugins</id>
            <name>xpand-plugins</name>
            <url>http://maven.xpand-it.com/artifactory/releases</url>
        </pluginRepository>
    </pluginRepositories>

</project>

Multi-Module Project

This example describes the usage of the plugin on a Module Project, in this case just one sub-module.

...

Code Block
languagexml
themeConfluence
titleModuleA.pom
linenumberstrue
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/maven-v4_0_0.xsd">
    <!-- CONF's -->
    <name>Module A</name>

    <properties>
        <!--XRay Properties -->
        <xray.surefire.location>${basedir}/target/surefire-reports</xray.surefire.location>
        <!--End Xray Properties -->
    </properties>
</project>

Troubleshooting

Unable to upload the results file: The process is failing with status code 403

The importing of the execution results file failed and when you check the log, it shows the following:

...

If you are a Jira administrator, you can go to Jira administration > User Management and reset the failed login.


Version History

  • 1.0.0 - 9 May 2016
    • Import JUnit results: You can import the JUnit results to Xray either as an XML file or a folder with multiple XML files.