Skip to content

Commit 8903f7b

Browse files
committed
Add tags filtering option
1 parent 60c4f1d commit 8903f7b

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ usage: assertthat-bdd-standalone-1.6.jar
3535
-o,--outputFolder <FOLDER PATH> Features output folder
3636
-p,--proxyPassword <PASSWORD> Proxy password
3737
-q,--jql <JQL> JQL filter for features
38+
-b,--tags <tags expression Tags expression for scenarios
39+
filtering
3840
-r,--report Upload report
3941
-s,--secretKey <ASSERTTHAT_SECRET_KEY> Secret key
4042
-k,--type <cucumber|karate> Report type

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.assertthat.plugins</groupId>
77
<artifactId>assertthat-bdd-standalone</artifactId>
8-
<version>1.7-SNAPSHOT</version>
8+
<version>1.7</version>
99
<name>assertthat-bdd-standalone</name>
1010
<description>AssertThat BDD Jira plugin client standalone</description>
1111
<url>http://www.assertthat.com</url>

src/main/java/com/assertthat/plugins/api/Main.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public static void main(String[] args) throws IOException, JSONException {
109109
jqlOption.setArgName("JQL");
110110
options.addOption(jqlOption);
111111

112+
Option tagsOption = new Option("b", "tags", true, "Tags filter for " +
113+
"scenarios");
114+
tagsOption.setRequired(false);
115+
tagsOption.setArgName("tags");
116+
options.addOption(tagsOption);
117+
112118
Option typeOption = new Option("k", "type", true, "Report type");
113119
typeOption.setRequired(false);
114120
typeOption.setArgName("cucumber|karate");
@@ -161,14 +167,18 @@ public static void main(String[] args) throws IOException, JSONException {
161167
cmd.getOptionValue("proxyPassword"),
162168
cmd.getOptionValue("mode"),
163169
cmd.getOptionValue("jql"),
170+
cmd.getOptionValue("tags"),
164171
cmd.getOptionValue("type"),
165172
cmd.getOptionValue("jiraServerUrl")
166173
);
167174

168175
APIUtil apiUtil = new APIUtil(arguments.getProjectId(), arguments.getAccessKey(), arguments.getSecretKey(), arguments.getProxyURI(), arguments.getProxyUsername(), arguments.getProxyPassword(), arguments.getJiraServerUrl());
169176

170177
if (cmd.hasOption("features")) {
171-
File inZip = apiUtil.download(new File(arguments.getOutputFolder()), arguments.getMode(), arguments.getJql());
178+
File inZip =
179+
apiUtil.download(new File(arguments.getOutputFolder()),
180+
arguments.getMode(), arguments.getJql() ,
181+
arguments.getTags());
172182
File zip = new FileUtil().unpackArchive(inZip, new File(arguments.getOutputFolder()));
173183
zip.delete();
174184
}

src/main/java/com/assertthat/plugins/internal/APIUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public static void copyInputStream(InputStream in, OutputStream out) throws IOEx
9292
out.close();
9393
}
9494

95-
public File download(File targetDir, String mode, String jql) throws IOException {
95+
public File download(File targetDir, String mode, String jql,
96+
String tags) throws IOException {
9697
if (targetDir.exists()) {
9798
for (File f : targetDir.listFiles()) {
9899
if (f.getName().endsWith(".feature")) {
@@ -109,6 +110,9 @@ public File download(File targetDir, String mode, String jql) throws IOException
109110
if (mode != null) {
110111
queryParams.add("mode", mode.trim());
111112
}
113+
if (tags != null) {
114+
queryParams.add("tags", tags.trim());
115+
}
112116
if (jql != null) {
113117
queryParams.add("jql", jql.trim());
114118
}

src/main/java/com/assertthat/plugins/internal/Arguments.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class Arguments {
4141
private String jql;
4242
private String jiraServerUrl;
4343
private String type = "cucumber";
44+
private String tags;
4445

4546
public Arguments(String accessKey,
4647
String secretKey,
@@ -54,6 +55,7 @@ public Arguments(String accessKey,
5455
String proxyPassword,
5556
String mode,
5657
String jql,
58+
String tags,
5759
String type,
5860
String jiraServerUrl) {
5961
this.accessKey = System.getenv("ASSERTTHAT_ACCESS_KEY");
@@ -82,6 +84,9 @@ public Arguments(String accessKey,
8284
if (type != null) {
8385
this.type = type;
8486
}
87+
if (tags != null) {
88+
this.tags = tags;
89+
}
8590

8691
if (jsonReportFolder != null && !jsonReportFolder.trim().isEmpty()) {
8792
this.jsonReportFolder = jsonReportFolder;
@@ -203,4 +208,11 @@ public void setProxyPassword(String proxyPassword) {
203208
this.proxyPassword = proxyPassword;
204209
}
205210

211+
public String getTags() {
212+
return this.tags;
213+
}
214+
215+
public void setTags(String tags) {
216+
this.tags = tags;
217+
}
206218
}

0 commit comments

Comments
 (0)