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
Prev Previous commit
Next Next commit
New parameter -seed
  • Loading branch information
pesse committed Apr 4, 2019
commit 144adf02478d2cb7b7c3e2dc15529a9c22df8f71
9 changes: 8 additions & 1 deletion src/main/java/org/utplsql/cli/RunCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ public class RunCommand implements ICommand {
)
private boolean randomTestOrder = false;

@Parameter(
names = {"-seed", "--random_test_order_seed"},
description = "Sets the seed to use for random test execution order. If set, it sets -random to true"
)
private Integer randomTestOrderSeed;

private CompatibilityProxy compatibilityProxy;
private ReporterFactory reporterFactory;
private ReporterManager reporterManager;
Expand Down Expand Up @@ -248,7 +254,8 @@ TestRunner newTestRunner( List<Reporter> reporterList) {
.skipCompatibilityCheck(skipCompatibilityCheck)
.includeObjects(getObjectList(includeObjects))
.excludeObjects(getObjectList(excludeObjects))
.randomTestOrder(randomTestOrder);
.randomTestOrder(randomTestOrder)
.randomTestOrderSeed(randomTestOrderSeed);
}

private ArrayList<String> getObjectList(String includeObjects) {
Expand Down
10 changes: 10 additions & 0 deletions src/test/java/org/utplsql/cli/RunCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,14 @@ void randomOrder_withoutSeed() {
assertThat(options.randomTestOrder, equalTo(true));
assertThat(options.randomTestOrderSeed, nullValue());
}

@Test
void randomOrder_withSeed() {
RunCommand runCmd = TestHelper.createRunCommand(TestHelper.getConnectionString(),
"-seed=42");

TestRunnerOptions options = runCmd.newTestRunner(new ArrayList<>()).getOptions();
assertThat(options.randomTestOrder, equalTo(true));
assertThat(options.randomTestOrderSeed, equalTo(42));
}
}