In order to make the integration in your Java Maven projects and Xray easier we have developed the Xray-Maven-Plugin. This plugin 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 Xray for JIRA instance.
The table bellow describes all the properties available on the plugin.
Property Name | Required ( | Description | Examples | |
---|---|---|---|---|
xray.jiraURL | Full URL of JIRA, including the relative path if its being used | http://localhost:8080 | ||
xray.resultsFormat | JUNIT | |||
xray.username | Jira Username | admin | ||
xray.password | JIRA Password
| password | ||
xray.projectKey | JIRA Project Key | MYPROJKEY | ||
xray.testExecKey | Test Execution Issue ID | MYT2-5 | ||
xray.testPlanKey | Test Plan Issue ID | MYT2-54 | ||
xray.testEnvironments | Test Environment | iOS | ||
xray.fixVersion | ![]() | Fix Version | Release 1.0 | |
xray.revision | Revision | 1234 | ||
xray.surefire.location | Folder with files .xml files or xml file to be uploaded | ${basedir}/target/surefire-reports/TEST-com.xpandit.xray.service.ResultImporterTest.xml ${basedir}/target/surefire-reports |
You may configure the plugin properties in your project pom.xml, the settings.xml file (see project guidelines below) or via console with -D option (e.g -Dxray.projectKey=PROJ) |
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 |
---|---|
JUNIT | JUnit XML output format, more information regarding it's endpoint here. |
mvn clean package surefire:test com.xpandit.xray:xray-maven-plugin:xray |
mvn com.xpandit.xray:xray-maven-plugin:xray |
<?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> |
This example describes the usage of the plugin on a standard Simple, Single Module Project
<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> |
This example describes the usage of the plugin on a Module Project, in this case just one sub-module
<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 --> <modules> <module>ModuleA</module> </modules> <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> |
<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> |
The importing of the execution results file is failing and when you check the log, it presents you the following:
By default, when the user successively tries to log in to JIRA with wrong credentials, the next time you try to log in, JIRA instance will prompt you to provide a CAPTCHA. It is not possible to provide this information via maven project configuration, so it will fail with status code 403 Forbidden.
You will need to log in to JIRA via browser and provide the CAPTCHA.
In case you are a JIRA administrator, you can go to JIRA administration > User Management and reset the failed login for the user who failed to log in.