Skip to content

Commit 277091a

Browse files
committed
New parameter -random
1 parent 02aa121 commit 277091a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ public class RunCommand implements ICommand {
126126
)
127127
private boolean enableDbmsOutput = false;
128128

129+
@Parameter(
130+
names = {"-random", "--random_test_order"},
131+
description = "Enables random order of test executions (default: DISABLED)"
132+
)
133+
private boolean randomTestOrder = false;
134+
129135
private CompatibilityProxy compatibilityProxy;
130136
private ReporterFactory reporterFactory;
131137
private ReporterManager reporterManager;
@@ -241,7 +247,8 @@ TestRunner newTestRunner( List<Reporter> reporterList) {
241247
.failOnErrors(true)
242248
.skipCompatibilityCheck(skipCompatibilityCheck)
243249
.includeObjects(getObjectList(includeObjects))
244-
.excludeObjects(getObjectList(excludeObjects));
250+
.excludeObjects(getObjectList(excludeObjects))
251+
.randomTestOrder(randomTestOrder);
245252
}
246253

247254
private ArrayList<String> getObjectList(String includeObjects) {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.List;
99

1010
import static org.hamcrest.CoreMatchers.equalTo;
11+
import static org.hamcrest.CoreMatchers.nullValue;
1112
import static org.hamcrest.MatcherAssert.assertThat;
1213
import static org.junit.jupiter.api.Assertions.*;
1314

@@ -104,5 +105,6 @@ void randomOrder_withoutSeed() {
104105

105106
TestRunnerOptions options = runCmd.newTestRunner(new ArrayList<>()).getOptions();
106107
assertThat(options.randomTestOrder, equalTo(true));
108+
assertThat(options.randomTestOrderSeed, nullValue());
107109
}
108110
}

0 commit comments

Comments
 (0)