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 command-line param --coverage-schemes
  • Loading branch information
pesse committed Mar 12, 2020
commit bbbdbb57b3e778be44fbdba40656cc1bb627cbd0
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 @@ -28,6 +28,11 @@ public class RunPicocliCommand implements IRunCommand {
split = ",")
private List<String> tags = new ArrayList<>();

@Option(names = {"--coverage-schemes"},
description = "comma-separated list of schemas on which coverage should be gathered",
split = ",")
private List<String> coverageSchemes = new ArrayList<>();


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

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

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

public String[] getSuitePaths() {
Expand Down Expand Up @@ -102,4 +104,6 @@ public boolean isRandomTestOrder() {
public Integer getRandomTestOrderSeed() {
return randomTestOrderSeed;
}

public String[] getCoverageSchemes() { return coverageSchemes; }
}
4 changes: 3 additions & 1 deletion src/test/java/org/utplsql/cli/PicocliRunCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ void runCommandAllArguments() throws Exception {
"-type_mapping=\"tsql=PACKAGE BODY\"",
"-owner_subexpression=1",
"-type_subexpression=2",
"-name_subexpression=3");
"-name_subexpression=3",
"--coverage-schemes=schema1,other_schema");

assertNotNull(config.getConnectString());
assertThat( config.getSuitePaths(), is(new String[]{"app.betwnstr", "app.basic"}));
Expand All @@ -65,6 +66,7 @@ void runCommandAllArguments() throws Exception {
assertEquals( 123, config.getRandomTestOrderSeed() );
assertNotNull( config.getReporters() );
assertEquals( 1, config.getReporters().length );
assertThat( config.getCoverageSchemes(), is(new String[]{"schema1", "other_schema"}) );

// Source FileMapping
assertNotNull(config.getSourceMapping());
Expand Down