Page History
...
In order to make the integration in your Java Maven projects and Xray easier, we have developed the Xray-Maven-Plugin. This plugin It enables the upload of your Tests directly to Xray with a single Maven Commandcommand.
The Plugin plugin supports single or multi-module projects and multiple test frameworks. With the execution of a single maven Maven target com.xpandit.xray:xray-maven-plugin:xray, the plugin will upload the results of the tests to your Xray for JIRA Jira instance.
List of Available Properties
...
Property Name | Required ( | Description | Examples | ||
---|---|---|---|---|---|
xray.jiraURL | Full URL of JIRAJira, including the relative path, if its being used | http://localhost:8080 | |||
xray.resultsFormat | Results format. Available formats here
| JUNIT | |||
xray.username | Jira Username | admin | |||
xray.password | JIRA Jira Password
| password | |||
xray.projectKey | JIRA 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 |
Info | ||
---|---|---|
| ||
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 |
---|---|
JUNIT | JUnit XML output format , (more information regarding it's 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 | ||||
---|---|---|---|---|
| ||||
<?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 simple, single-module Project
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<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 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<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> |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<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 is failing failed and when you check the log, it presents you shows the following:
By default, when the user you successively tries try to log in to JIRA into Jira with the wrong credentials, the next time you try to log in, JIRA Jira instance will prompt you to provide a CAPTCHA the next time you try to log in. It is not possible to provide this information via maven the Maven project configuration, so it will fail with status code 403 Forbidden.
You will need to log in to JIRA into Jira via the browser and provide the CAPTCHA.
In case If you are a JIRA Jira administrator, you can go to JIRA Jira administration > User Management and reset the failed login for the user who failed to log in.
Version History
- 1.0.0 - 9 May 2016
- Import JUnit results: You can import the JUnit results to Xray for JIRA - Either a either as an XML file or a folder with multiple XML files;.
- Import JUnit results: You can import the JUnit results to Xray for JIRA - Either a either as an XML file or a folder with multiple XML files;.