Skip to content

Commit

Permalink
fix: Default value for test methods command line option (#925)
Browse files Browse the repository at this point in the history
* fix: add a default value for test-methods command line options to avoid __no_default_value__ to be used by piccocli

* doc: update doc with new default values and distinction between classes and cases
  • Loading branch information
danglotb authored Nov 26, 2019
1 parent c0296ef commit 9c2f6cc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Usage: eu.stamp_project.Main [-hvV] [--allow-path-in-assertions] [--clean] [--ex
--automatic-builder=<automaticBuilder>
Specify the automatic builder to be used. Valid values: Maven, Gradle Default value: Maven
-c, --cases, --test-cases, --test-methods=<testCases>[,<testCases>...]
Specify the test cases to amplify.
Specify the test cases to amplify.By default, DSpot selects all the tests methods.
--cache-size=<cacheSize>
Specify the size of the memory cache in terms of the number of store entries Default
value: 10000
Expand Down Expand Up @@ -305,7 +305,7 @@ Usage: eu.stamp_project.Main [-hvV] [--allow-path-in-assertions] [--clean] [--ex
-t, --test=<testClasses>[,<testClasses>...]
Fully qualified names of test classes to be amplified. If the value is all, DSpot will
amplify the whole test suite. You can also use regex to describe a set of test classes.
By default, DSpot selects all the tests.
By default, DSpot selects all the tests classes.
--target-module=<targetModule>
Specify the module to be amplified. This value must be a relative path from value
specified by --absolute-path-to-project-root command-line option. If your project is
Expand All @@ -322,7 +322,7 @@ Usage: eu.stamp_project.Main [-hvV] [--allow-path-in-assertions] [--clean] [--ex
value: false
-v, --verbose Enable verbose mode of DSpot. Default value: false
-V, --version Print version information and exit.
--with-comment Enable comment on amplified test: details steps of the Amplification. Default value: false
--with-comment Enable comment on amplified test: details steps of the Amplification. Default value: falseg
```

For options that take list, the used separator is a comma `,`, whatever the platform you use.
Expand Down
4 changes: 4 additions & 0 deletions dspot/src/main/java/eu/stamp_project/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ public static void run(InputConfiguration inputConfiguration) {
);
final List<CtType<?>> testClassesToBeAmplified = testFinder.findTestClasses(inputConfiguration.getTestClasses());
final List<String> testMethodsToBeAmplifiedNames = inputConfiguration.getTestCases();
if (testMethodsToBeAmplifiedNames.size() == 1 &&
testMethodsToBeAmplifiedNames.get(0).isEmpty()) {
testMethodsToBeAmplifiedNames.clear();
}
final TestSelector testSelector =
inputConfiguration.getSelector().buildSelector(automaticBuilder, inputConfiguration);
final List<Amplifier> amplifiers = inputConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public class InputConfiguration {
description = "Fully qualified names of test classes to be amplified. " +
"If the value is all, DSpot will amplify the whole test suite. " +
"You can also use regex to describe a set of test classes. " +
"By default, DSpot selects all the tests."
"By default, DSpot selects all the tests classes."
)
private List<String> testClasses;

Expand All @@ -134,7 +134,9 @@ public class InputConfiguration {
@CommandLine.Option(
names = {"-c", "--cases", "--test-methods", "--test-cases"},
split = ",",
description = "Specify the test cases to amplify."
defaultValue = "",
description = "Specify the test cases to amplify." +
"By default, DSpot selects all the tests methods."
)
private List<String> testCases = new ArrayList<>();

Expand Down

0 comments on commit 9c2f6cc

Please sign in to comment.