File tree 2 files changed +63
-1
lines changed
main/java/org/scalatest/tools/maven
test/scala/org/scalatest/tools/maven
2 files changed +63
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,18 @@ abstract class AbstractScalaTestMojo extends AbstractMojo {
108
108
*/
109
109
boolean parallel ;
110
110
111
+ /**
112
+ * Set to true to enable suite sorting, this only takes effect if parallel is set to true.
113
+ * @parameter property="suiteSorting"
114
+ */
115
+ boolean suiteSorting ;
116
+
117
+ /**
118
+ * Set the thread count for parallel tests execution, this only takes effect if parallel is set to true.
119
+ * @parameter property="threadCount"
120
+ */
121
+ int threadCount ;
122
+
111
123
/**
112
124
* Comma separated list of packages containing suites to execute
113
125
* @parameter property="membersOnlySuites"
@@ -507,7 +519,13 @@ private List<String> tagsToExclude() {
507
519
}
508
520
509
521
private List <String > parallel () {
510
- return parallel ? unmodifiableList (singletonList ("-P" )) : Collections .<String >emptyList ();
522
+ if (parallel ) {
523
+ String useSuiteSorting = suiteSorting ? "S" : "" ;
524
+ String useThreadCount = threadCount == 0 ? "" : ("" + threadCount );
525
+ return unmodifiableList (singletonList ("-P" + useSuiteSorting + useThreadCount ));
526
+ }
527
+ else
528
+ return Collections .<String >emptyList ();
511
529
}
512
530
513
531
//
Original file line number Diff line number Diff line change @@ -123,6 +123,50 @@ final class PluginTest
123
123
configure(_.parallel = false ) should not contain (" -P" )
124
124
}
125
125
126
+ def testConcurrentSuiteSorting {
127
+ configure { m =>
128
+ m.parallel = true
129
+ m.suiteSorting = true
130
+ } should containSlice(" -PS" )
131
+ }
132
+
133
+ def testConcurrentThreadCount {
134
+ configure { m =>
135
+ m.parallel = true
136
+ m.threadCount = 4
137
+ } should containSlice(" -P4" )
138
+ }
139
+
140
+ def testConcurrentSuiteSortingThreadCount {
141
+ configure { m =>
142
+ m.parallel = true
143
+ m.suiteSorting = true
144
+ m.threadCount = 4
145
+ } should containSlice(" -PS4" )
146
+ }
147
+
148
+ def testSuiteSorting {
149
+ // Suite sorting count should have no effect if parallel is not set to true.
150
+ configure { m =>
151
+ m.suiteSorting = true
152
+ } shouldNot containSlice (" -PS" )
153
+ }
154
+
155
+ def testSuiteSortingThreadCount {
156
+ // Suite sorting and thread count should have no effect if parallel is not set to true.
157
+ configure { m =>
158
+ m.suiteSorting = true
159
+ m.threadCount = 4
160
+ } shouldNot containSlice (" -PS4" )
161
+ }
162
+
163
+ def testThreadCount {
164
+ // Thread count should have no effect if parallel is not set to true.
165
+ configure { m =>
166
+ m.threadCount = 4
167
+ } shouldNot containSlice (" -P4" )
168
+ }
169
+
126
170
def testSuites {
127
171
val suites : String = comma(" a " ,
128
172
" b" ,
You can’t perform that action at this time.
0 commit comments