File tree Expand file tree Collapse file tree
main/java/org/scalatest/tools/maven
test/scala/org/scalatest/tools/maven Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,6 +108,18 @@ abstract class AbstractScalaTestMojo extends AbstractMojo {
108108 */
109109 boolean parallel ;
110110
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+
111123 /**
112124 * Comma separated list of packages containing suites to execute
113125 * @parameter property="membersOnlySuites"
@@ -507,7 +519,13 @@ private List<String> tagsToExclude() {
507519 }
508520
509521 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 ();
511529 }
512530
513531 //
Original file line number Diff line number Diff line change @@ -123,6 +123,50 @@ final class PluginTest
123123 configure(_.parallel = false ) should not contain (" -P" )
124124 }
125125
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+
126170 def testSuites {
127171 val suites : String = comma(" a " ,
128172 " b" ,
You can’t perform that action at this time.
0 commit comments