Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add new option --tags
  • Loading branch information
pesse committed Jun 27, 2019
commit 77b01f94d9a0facefa891e3d966cb92f156b9935
8 changes: 7 additions & 1 deletion src/main/java/org/utplsql/cli/RunPicocliCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public class RunPicocliCommand implements IRunCommand {
"-p=[schema|schema:[suite ...][.test]|schema[.suite ...][.test]")
private List<String> paths = new ArrayList<>();

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


@Option(
names = {"-c", "--color"},
Expand Down Expand Up @@ -232,7 +237,8 @@ public RunCommandConfig getRunCommandConfig() {
timeoutInMinutes,
enableDbmsOutput,
randomTestOrder,
randomTestOrderSeed);
randomTestOrderSeed,
tags.toArray(new String[0]));
}

private RunAction getRunAction() {
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/org/utplsql/cli/config/RunCommandConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ public class RunCommandConfig extends ConnectionConfig {
private boolean dbmsOutput = false;
private boolean randomTestOrder = false;
private final Integer randomTestOrderSeed;
private final String[] tags;

@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed"})
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) {
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags"})
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) {
super(connectString);
this.suitePaths = suitePaths;
this.reporters = reporters;
Expand All @@ -39,12 +40,17 @@ public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfi
this.dbmsOutput = dbmsOutput;
this.randomTestOrder = randomTestOrder;
this.randomTestOrderSeed = randomTestOrderSeed;
this.tags = tags;
}

public String[] getSuitePaths() {
return suitePaths;
}

public String[] getTags() {
return tags;
}

public ReporterConfig[] getReporters() {
return reporters;
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/utplsql/cli/PicocliRunCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ void runCommandAllArguments() throws Exception {
RunCommandConfig config = parseForConfig("run",
TestHelper.getConnectionString(),
"-p=app.betwnstr,app.basic",
"--tags=tag1,tag.2",
"-d",
"-c",
"-q",
Expand Down Expand Up @@ -51,6 +52,7 @@ void runCommandAllArguments() throws Exception {

assertNotNull(config.getConnectString());
assertThat( config.getSuitePaths(), is(new String[]{"app.betwnstr", "app.basic"}));
assertThat( config.getTags(), is(new String[]{"tag1", "tag.2"}));
assertTrue( config.isOutputAnsiColor() );
assertEquals( LoggerConfiguration.ConfigLevel.NONE, config.getLogConfigLevel());
assertEquals( 10, config.getFailureExitCode());
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/utplsql/cli/RunCommandArgumentsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public void allArgumentsAreRecognized() {
"-f=ut_sonar_test_reporter",
"-o=sonar_result.xml",
"-s",
"--tags=tag1,tag2",
"-d",
"-c",
"--failure-exit-code=10",
Expand Down