Skip to content

Commit 77b01f9

Browse files
committed
Add new option --tags
1 parent 7725326 commit 77b01f9

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

src/main/java/org/utplsql/cli/RunPicocliCommand.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public class RunPicocliCommand implements IRunCommand {
2323
"-p=[schema|schema:[suite ...][.test]|schema[.suite ...][.test]")
2424
private List<String> paths = new ArrayList<>();
2525

26+
@Option(names = {"--tags"},
27+
description = "comma-separated list of tags to run",
28+
split = ",")
29+
private List<String> tags = new ArrayList<>();
30+
2631

2732
@Option(
2833
names = {"-c", "--color"},
@@ -232,7 +237,8 @@ public RunCommandConfig getRunCommandConfig() {
232237
timeoutInMinutes,
233238
enableDbmsOutput,
234239
randomTestOrder,
235-
randomTestOrderSeed);
240+
randomTestOrderSeed,
241+
tags.toArray(new String[0]));
236242
}
237243

238244
private RunAction getRunAction() {

src/main/java/org/utplsql/cli/config/RunCommandConfig.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ public class RunCommandConfig extends ConnectionConfig {
2121
private boolean dbmsOutput = false;
2222
private boolean randomTestOrder = false;
2323
private final Integer randomTestOrderSeed;
24+
private final String[] tags;
2425

25-
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed"})
26-
public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfig[] reporters, boolean outputAnsiColor, Integer failureExitCode, boolean skipCompatibilityCheck, String[] includePackages, String[] excludePackages, FileMapperConfig sourceMapping, FileMapperConfig testMapping, ConfigLevel logConfigLevel, Integer timeoutInMinutes, boolean dbmsOutput, boolean randomTestOrder, Integer randomTestOrderSeed) {
26+
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags"})
27+
public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfig[] reporters, boolean outputAnsiColor, Integer failureExitCode, boolean skipCompatibilityCheck, String[] includePackages, String[] excludePackages, FileMapperConfig sourceMapping, FileMapperConfig testMapping, ConfigLevel logConfigLevel, Integer timeoutInMinutes, boolean dbmsOutput, boolean randomTestOrder, Integer randomTestOrderSeed, String[] tags) {
2728
super(connectString);
2829
this.suitePaths = suitePaths;
2930
this.reporters = reporters;
@@ -39,12 +40,17 @@ public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfi
3940
this.dbmsOutput = dbmsOutput;
4041
this.randomTestOrder = randomTestOrder;
4142
this.randomTestOrderSeed = randomTestOrderSeed;
43+
this.tags = tags;
4244
}
4345

4446
public String[] getSuitePaths() {
4547
return suitePaths;
4648
}
4749

50+
public String[] getTags() {
51+
return tags;
52+
}
53+
4854
public ReporterConfig[] getReporters() {
4955
return reporters;
5056
}

src/test/java/org/utplsql/cli/PicocliRunCommandTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void runCommandAllArguments() throws Exception {
2020
RunCommandConfig config = parseForConfig("run",
2121
TestHelper.getConnectionString(),
2222
"-p=app.betwnstr,app.basic",
23+
"--tags=tag1,tag.2",
2324
"-d",
2425
"-c",
2526
"-q",
@@ -51,6 +52,7 @@ void runCommandAllArguments() throws Exception {
5152

5253
assertNotNull(config.getConnectString());
5354
assertThat( config.getSuitePaths(), is(new String[]{"app.betwnstr", "app.basic"}));
55+
assertThat( config.getTags(), is(new String[]{"tag1", "tag.2"}));
5456
assertTrue( config.isOutputAnsiColor() );
5557
assertEquals( LoggerConfiguration.ConfigLevel.NONE, config.getLogConfigLevel());
5658
assertEquals( 10, config.getFailureExitCode());

src/test/java/org/utplsql/cli/RunCommandArgumentsTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public void allArgumentsAreRecognized() {
1717
"-f=ut_sonar_test_reporter",
1818
"-o=sonar_result.xml",
1919
"-s",
20+
"--tags=tag1,tag2",
2021
"-d",
2122
"-c",
2223
"--failure-exit-code=10",

0 commit comments

Comments
 (0)