Skip to content

Commit 263a7bc

Browse files
author
Maksym Kopytovskyi
committed
Add ability to add labels in Test Execution issue
1 parent 7bec882 commit 263a7bc

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ A Maven Plugin for integrating Java (JUnit5) automation tests results with Xray
1919
<plugin>
2020
<groupId>io.github.kopytovskiy</groupId>
2121
<artifactId>xray-junit5-json-plugin</artifactId>
22-
<version>0.0.1</version>
22+
<version>0.0.3</version>
2323
</plugin>
2424
</plugins>
2525
</build>
@@ -31,6 +31,7 @@ A Maven Plugin for integrating Java (JUnit5) automation tests results with Xray
3131
<configuration>
3232
<projectKey>${projectKey}</projectKey>
3333
<issueType>${issueType}</issueType>
34+
<labels>${labelsList}</labels>
3435
<testPlanKey>${testPlanKey}</testPlanKey>
3536
<pathToJUnitReport>${pathToJUnitReport}</pathToJUnitReport>
3637
<xrayClientId>${xrayClientId}</xrayClientId>
@@ -44,6 +45,7 @@ A Maven Plugin for integrating Java (JUnit5) automation tests results with Xray
4445

4546
- `projectKey` (required): The key of the Xray project (e.g. "QA").
4647
- `issueType` (required): The number of issue type to be created (e.g., "10007").
48+
- `labelsList`: The list of labels to be added to the Test Execution (e.g., "Automation, API").
4749
- `testPlanKey`: The key of the Xray test plan. If not provided, the Test Execution will be **not** linked to any.
4850
- `pathToJUnitReport` (default: "target/TEST-junit-jupiter.xml"): The path to the JUnit XML report file.
4951
- `xrayClientId` (required): The client ID for authenticating with the Xray API.

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.kopytovskiy</groupId>
88
<artifactId>xray-junit5-json-plugin</artifactId>
9-
<version>0.0.2</version>
9+
<version>0.0.3</version>
1010
<packaging>maven-plugin</packaging>
1111

1212
<licenses>

src/main/java/io/github/kopytovskiy/plugin/ImportResultsMojo.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.github.kopytovskiy.plugin;
22

33
import lombok.extern.slf4j.Slf4j;
4+
import org.apache.commons.lang3.StringUtils;
45
import org.apache.maven.plugin.AbstractMojo;
56
import org.apache.maven.plugin.MojoExecutionException;
67
import org.apache.maven.plugin.MojoFailureException;
@@ -27,6 +28,9 @@ public class ImportResultsMojo extends AbstractMojo {
2728
@Parameter(property = "issueType", required = true)
2829
private String issueType;
2930

31+
@Parameter(property = "labels")
32+
private String[] labels;
33+
3034
@Parameter(property = "testPlanKey")
3135
private String testPlanKey;
3236

@@ -55,6 +59,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
5559
JSONObject resultsJiraFieldsData = new JSONObject();
5660
resultsJiraFieldsData.put("project", new JSONObject().put("key", projectKey));
5761
resultsJiraFieldsData.put("issuetype", new JSONObject().put("id", issueType));
62+
resultsJiraFieldsData.put("labels", StringUtils.stripAll(labels));
5863

5964
if (!customJiraFields.isEmpty()) {
6065
for (Map.Entry<String, String> customField : customJiraFields.entrySet()) {

0 commit comments

Comments
 (0)