View Javadoc
1   package org.apache.maven.plugin.surefire;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.File;
23  import java.util.Arrays;
24  import java.util.Collections;
25  import java.util.List;
26  import org.apache.maven.plugin.MojoExecutionException;
27  import org.apache.maven.plugin.MojoFailureException;
28  import org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator;
29  import org.apache.maven.plugins.annotations.LifecyclePhase;
30  import org.apache.maven.plugins.annotations.Mojo;
31  import org.apache.maven.plugins.annotations.Parameter;
32  import org.apache.maven.plugins.annotations.ResolutionScope;
33  import org.apache.maven.surefire.extensions.ForkNodeFactory;
34  import org.apache.maven.surefire.api.suite.RunResult;
35  
36  import static org.apache.maven.plugin.surefire.SurefireHelper.reportExecution;
37  
38  /**
39   * Run tests using Surefire.
40   *
41   * @author Jason van Zyl
42   */
43  @Mojo( name = "test", defaultPhase = LifecyclePhase.TEST, threadSafe = true,
44         requiresDependencyResolution = ResolutionScope.TEST )
45  public class SurefirePlugin
46      extends AbstractSurefireMojo
47      implements SurefireReportParameters
48  {
49  
50      /**
51       * The directory containing generated classes of the project being tested. This will be included after the test
52       * classes in the test classpath.
53       */
54      @Parameter( defaultValue = "${project.build.outputDirectory}" )
55      private File classesDirectory;
56  
57      /**
58       * Set this to "true" to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on
59       * occasion.
60       */
61      @Parameter( property = "maven.test.failure.ignore", defaultValue = "false" )
62      private boolean testFailureIgnore;
63  
64      /**
65       * Base directory where all reports are written to.
66       */
67      @Parameter( defaultValue = "${project.build.directory}/surefire-reports" )
68      private File reportsDirectory;
69  
70      @SuppressWarnings( "checkstyle:linelength" )
71      /**
72       * Specify this parameter to run individual tests by file name, overriding the parameter {@code includes} and
73       * {@code excludes}. Each pattern you specify here will be used to create an include pattern formatted like
74       * <code>**{@literal /}${test}.java</code>, so you can just type {@code -Dtest=MyTest} to run a single test called
75       * "foo/MyTest.java". The test patterns prefixed with a <em>!</em> will be excluded.
76       * <br>
77       * This parameter overrides the parameter {@code includes}, {@code excludes}, and the TestNG parameter
78       * {@code suiteXmlFiles}.
79       * <br>
80       * Since 2.7.3, you can execute a limited number of methods in the test by adding <i>#myMethod</i> or
81       * <i>#my*ethod</i>. For example, {@code -Dtest=MyTest#myMethod}. This is supported for junit 4.x and TestNg.<br>
82       * <br>
83       * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
84       * <pre><code>"-Dtest=???Test, !Unstable*, pkg{@literal /}**{@literal /}Ci*leTest.java, *Test#test*One+testTwo?????, #fast*+slowTest"</code></pre>
85       * or e.g.
86       * <pre><code>"-Dtest=Basic*, !%regex[.*.Unstable.*], !%regex[.*.MyTest.class#one.*|two.*], %regex[#fast.*|slow.*]"</code></pre>
87       * <br>
88       * The Parameterized JUnit runner {@code describes} test methods using an index in brackets, so the non-regex
89       * method pattern would become: {@code #testMethod[*]}.
90       * If using <code>@Parameters(name="{index}: fib({0})={1}")</code> and selecting the index e.g. 5 in pattern, the
91       * non-regex method pattern would become {@code #testMethod[5:*]}.
92       */
93      @Parameter( property = "test" )
94      private String test;
95  
96      /**
97       * Option to print summary of test suites or just print the test cases that have errors.
98       */
99      @Parameter( property = "surefire.printSummary", defaultValue = "true" )
100     private boolean printSummary;
101 
102     /**
103      * Selects the formatting for the test report to be generated. Can be set as "brief" or "plain".
104      * Only applies to the output format of the output files  (target/surefire-reports/testName.txt)
105      */
106     @Parameter( property = "surefire.reportFormat", defaultValue = "brief" )
107     private String reportFormat;
108 
109     /**
110      * Option to generate a file test report or just output the test report to the console.
111      */
112     @Parameter( property = "surefire.useFile", defaultValue = "true" )
113     private boolean useFile;
114 
115     /**
116      * Set this to "true" to cause a failure if none of the tests specified in -Dtest=... are run. Defaults to
117      * "true".
118      *
119      * @since 2.12
120      */
121     @Parameter( property = "surefire.failIfNoSpecifiedTests", defaultValue = "true" )
122     private boolean failIfNoSpecifiedTests;
123 
124     /**
125      * Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach
126      * on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure
127      * arbitrary debuggability options (without overwriting the other options specified through the {@code argLine}
128      * parameter).
129      *
130      * @since 2.4
131      */
132     @Parameter( property = "maven.surefire.debug" )
133     private String debugForkedProcess;
134 
135     /**
136      * Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never
137      * timing out.
138      *
139      * @since 2.4
140      */
141     @Parameter( property = "surefire.timeout" )
142     private int forkedProcessTimeoutInSeconds;
143 
144     /**
145      * Forked process is normally terminated without any significant delay after given tests have completed.
146      * If the particular tests started non-daemon Thread(s), the process hangs instead of been properly terminated
147      * by {@code System.exit()}. Use this parameter in order to determine the timeout of terminating the process.
148      * <a href="http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html">see the documentation:
149      * http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html</a>
150      * Turns to default fallback value of 30 seconds if negative integer.
151      *
152      * @since 2.20
153      */
154     @Parameter( property = "surefire.exitTimeout", defaultValue = "30" )
155     private int forkedProcessExitTimeoutInSeconds;
156 
157     /**
158      * Stop executing queued parallel JUnit tests after a certain number of seconds.
159      * <br>
160      * Example values: "3.5", "4"<br>
161      * <br>
162      * If set to 0, wait forever, never timing out.
163      * Makes sense with specified {@code parallel} different from "none".
164      *
165      * @since 2.16
166      */
167     @Parameter( property = "surefire.parallel.timeout" )
168     private double parallelTestsTimeoutInSeconds;
169 
170     /**
171      * Stop executing queued parallel JUnit tests
172      * and {@code interrupt} currently running tests after a certain number of seconds.
173      * <br>
174      * Example values: "3.5", "4"<br>
175      * <br>
176      * If set to 0, wait forever, never timing out.
177      * Makes sense with specified {@code parallel} different from "none".
178      *
179      * @since 2.16
180      */
181     @Parameter( property = "surefire.parallel.forcedTimeout" )
182     private double parallelTestsTimeoutForcedInSeconds;
183 
184     @SuppressWarnings( "checkstyle:linelength" )
185     /**
186      * A list of {@literal <include>} elements specifying the tests (by pattern) that should be included in testing.
187      * When not specified and when the {@code test} parameter is not specified, the default includes will be
188      * <pre><code>
189      * {@literal <includes>}
190      *     {@literal <include>}**{@literal /}Test*.java{@literal </include>}
191      *     {@literal <include>}**{@literal /}*Test.java{@literal </include>}
192      *     {@literal <include>}**{@literal /}*Tests.java{@literal </include>}
193      *     {@literal <include>}**{@literal /}*TestCase.java{@literal </include>}
194      * {@literal </includes>}
195      * </code></pre>
196      * Each include item may also contain a comma-separated sub-list of items, which will be treated as multiple
197      * {@literal <include>} entries.<br>
198      * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
199      * <pre><code>
200      * {@literal <include>}%regex[.*[Cat|Dog].*], Basic????, !Unstable*{@literal </include>}
201      * {@literal <include>}%regex[.*[Cat|Dog].*], !%regex[pkg.*Slow.*.class], pkg{@literal /}**{@literal /}*Fast*.java{@literal </include>}
202      * </code></pre>
203      * <br>
204      * This parameter is ignored if the TestNG {@code suiteXmlFiles} parameter is specified.<br>
205      * <br>
206      * <b>Notice that</b> these values are relative to the directory containing generated test classes of the project
207      * being tested. This directory is declared by the parameter {@code testClassesDirectory} which defaults
208      * to the POM property {@code ${project.build.testOutputDirectory}}, typically
209      * <code>{@literal src/test/java}</code> unless overridden.
210      */
211     @Parameter( property = "surefire.includes" )
212     // TODO use regex for fully qualified class names in 3.0 and change the filtering abilities
213     private List<String> includes;
214 
215     /**
216      * A list of {@literal <exclude>} elements specifying the tests (by pattern) that should be excluded in testing.
217      * When not specified and when the {@code test} parameter is not specified, the default excludes will be <br>
218      * <pre><code>
219      * {@literal <excludes>}
220      *     {@literal <exclude>}**{@literal /}*$*{@literal </exclude>}
221      * {@literal </excludes>}
222      * </code></pre>
223      * (which excludes all inner classes).
224      * <br>
225      * This parameter is ignored if the TestNG {@code suiteXmlFiles} parameter is specified.
226      * <br>
227      * Each exclude item may also contain a comma-separated sub-list of items, which will be treated as multiple
228      * {@literal <exclude>} entries.<br>
229      * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
230      * <pre><code>
231      * {@literal <exclude>}%regex[pkg.*Slow.*.class], Unstable*{@literal </exclude>}
232      * </code></pre>
233      * <br>
234      * <b>Notice that</b> these values are relative to the directory containing generated test classes of the project
235      * being tested. This directory is declared by the parameter {@code testClassesDirectory} which defaults
236      * to the POM property <code>${project.build.testOutputDirectory}</code>, typically
237      * <code>{@literal src/test/java}</code> unless overridden.
238      */
239     @Parameter( property = "surefire.excludes" )
240     // TODO use regex for fully qualified class names in 3.0 and change the filtering abilities
241     private List<String> excludes;
242 
243     /**
244      * Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking.
245      * Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's
246      * ClassLoader.
247      *
248      * @since 2.3
249      */
250     @Parameter( property = "surefire.useSystemClassLoader", defaultValue = "true" )
251     private boolean useSystemClassLoader;
252 
253     /**
254      * By default, Surefire forks your tests using a manifest-only JAR; set this parameter to "false" to force it to
255      * launch your tests with a plain old Java classpath. (See the
256      * <a href="http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html">
257      *     http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html</a>
258      * for a more detailed explanation of manifest-only JARs and their benefits.)
259      * <br>
260      * Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long.
261      *
262      * @since 2.4.3
263      */
264     @Parameter( property = "surefire.useManifestOnlyJar", defaultValue = "true" )
265     private boolean useManifestOnlyJar;
266 
267     /**
268      * The character encoding scheme to be applied while generating test report
269      * files (see target/surefire-reports/yourTestName.txt).
270      * The report output files (*-out.txt) are encoded in UTF-8 if not set otherwise.
271      *
272      * @since 3.0.0-M1
273      */
274     @Parameter( property = "surefire.encoding", defaultValue = "${project.reporting.outputEncoding}" )
275     private String encoding;
276 
277     /**
278      * (JUnit 4+ providers and JUnit 5+ providers since 3.0.0-M4)
279      * The number of times each failing test will be rerun. If set larger than 0, rerun failing tests immediately after
280      * they fail. If a failing test passes in any of those reruns, it will be marked as pass and reported as a "flake".
281      * However, all the failing attempts will be recorded.
282      */
283     @Parameter( property = "surefire.rerunFailingTestsCount", defaultValue = "0" )
284     private int rerunFailingTestsCount;
285 
286     /**
287      * Set this to a value greater than 0 to fail the whole test set if the cumulative number of flakes reaches
288      * this threshold. Set to 0 to allow an unlimited number of flakes.
289      *
290      * @since 3.0.0-M6
291      */
292     @Parameter( property = "surefire.failOnFlakeCount", defaultValue = "0" )
293     private int failOnFlakeCount;
294 
295     /**
296      * (TestNG) List of &lt;suiteXmlFile&gt; elements specifying TestNG suite xml file locations. Note that
297      * {@code suiteXmlFiles} is incompatible with several other parameters of this plugin, like
298      * {@code includes} and {@code excludes}.<br>
299      * This parameter is ignored if the {@code test} parameter is specified (allowing you to run a single test
300      * instead of an entire suite).
301      *
302      * @since 2.2
303      */
304     @Parameter( property = "surefire.suiteXmlFiles" )
305     private File[] suiteXmlFiles;
306 
307     /**
308      * Defines the order the tests will be run in. Supported values are {@code alphabetical},
309      * {@code reversealphabetical}, {@code random}, {@code hourly} (alphabetical on even hours, reverse alphabetical
310      * on odd hours), {@code failedfirst}, {@code balanced} and {@code filesystem}.
311      * <br>
312      * <br>
313      * Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a
314      * multi-module build.
315      * <br>
316      * <br>
317      * Failed first will run tests that failed on previous run first, as well as new tests for this run.
318      * <br>
319      * <br>
320      * Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the
321      * overall execution time. Initially a statistics file is created and every next test run will reorder classes.
322      * <br>
323      * <br>
324      * Note that the statistics are stored in a file named <b>.surefire-XXXXXXXXX</b> beside <i>pom.xml</i> and
325      * should not be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire
326      * configuration, so different configurations will have different statistics files, meaning if you change any
327      * configuration settings you will re-run once before new statistics data can be established.
328      *
329      * @since 2.7
330      */
331     @Parameter( property = "surefire.runOrder", defaultValue = "filesystem" )
332     private String runOrder;
333 
334     /**
335      * Sets the random seed that will be used to order the tests if {@code surefire.runOrder} is set to {@code random}.
336      * <br>
337      * <br>
338      * If no seeds are set and {@code surefire.runOrder} is set to {@code random}, then the seed used will be
339      * outputted (search for "To reproduce ordering use flag -Dsurefire.runOrder.random.seed").
340      * <br>
341      * <br>
342      * To deterministically reproduce any random test order that was run before, simply set the seed to
343      * be the same value.
344      *
345      * @since 3.0.0-M6
346      */
347     @Parameter( property = "surefire.runOrder.random.seed" )
348     private Long runOrderRandomSeed;
349 
350     /**
351      * A file containing include patterns. Blank lines, or lines starting with # are ignored. If {@code includes} are
352      * also specified, these patterns are appended. Example with path, simple and regex includes:
353      * <pre><code>
354      * *{@literal /}test{@literal /}*
355      * **{@literal /}NotIncludedByDefault.java
356      * %regex[.*Test.*|.*Not.*]
357      * </code></pre>
358      * <br>
359      * Since 3.0.0-M6, method filtering support is provided in the inclusions file as well, example:
360      * <pre><code>
361      * pkg.SomeTest#testMethod
362      * </code></pre>
363      *
364      * @since 2.13
365      */
366     @Parameter( property = "surefire.includesFile" )
367     private File includesFile;
368 
369     /**
370      * A file containing exclude patterns. Blank lines, or lines starting with # are ignored. If {@code excludes} are
371      * also specified, these patterns are appended. Example with path, simple and regex excludes:<br>
372      * <pre><code>
373      * *{@literal /}test{@literal /}*
374      * **{@literal /}DontRunTest.*
375      * %regex[.*Test.*|.*Not.*]
376      * </code></pre>
377      *
378      * Since 3.0.0-M6, method filtering support is provided in the exclusions file as well, example:
379      * <pre><code>
380      * pkg.SomeTest#testMethod
381      * </code></pre>
382      *
383      * @since 2.13
384      */
385     @Parameter( property = "surefire.excludesFile" )
386     private File excludesFile;
387 
388     /**
389      * Set to error/failure count in order to skip remaining tests.
390      * Due to race conditions in parallel/forked execution this may not be fully guaranteed.<br>
391      * Enable with system property {@code -Dsurefire.skipAfterFailureCount=1} or any number greater than zero.
392      * Defaults to "0".<br>
393      * See the prerequisites and limitations in documentation:<br>
394      * <a href="http://maven.apache.org/plugins/maven-surefire-plugin/examples/skip-after-failure.html">
395      *     http://maven.apache.org/plugins/maven-surefire-plugin/examples/skip-after-failure.html</a>
396      *
397      * @since 2.19
398      */
399     @Parameter( property = "surefire.skipAfterFailureCount", defaultValue = "0" )
400     private int skipAfterFailureCount;
401 
402     /**
403      * After the plugin process is shutdown by sending <i>SIGTERM signal (CTRL+C)</i>, <i>SHUTDOWN command</i> is
404      * received by every forked JVM.
405      * <br>
406      * The value is set to ({@code shutdown=exit}) by default (changed in version 3.0.0-M4).
407      * <br>
408      * The parameter can be configured with other two values {@code testset} and {@code kill}.
409      * <br>
410      * With({@code shutdown=testset}) the test set may still continue to run in forked JVM.
411      * <br>
412      * Using {@code exit} forked JVM executes {@code System.exit(1)} after the plugin process has received
413      * <i>SIGTERM signal</i>.
414      * <br>
415      * Using {@code kill} the JVM executes {@code Runtime.halt(1)} and kills itself.
416      *
417      * @since 2.19
418      */
419     @Parameter( property = "surefire.shutdown", defaultValue = "exit" )
420     private String shutdown;
421 
422     /**
423      * When {@code true}, uses the modulepath when executing with JDK 9+ and <i>module-info.java</i> is
424      * present. When {@code false}, always uses the classpath.
425      * <br>
426      * Defaults to {@code true}.
427      *
428      * @since 3.0.0-M2
429      */
430     @Parameter( property = "surefire.useModulePath", defaultValue = "true" )
431     private boolean useModulePath;
432 
433     /**
434      * This parameter configures the forked node. Currently, you can select the communication protocol, i.e. process
435      * pipes or TCP/IP sockets.
436      * The plugin uses process pipes by default which will be turned to TCP/IP in the version 3.0.0.
437      * Alternatively, you can implement your own factory and SPI.
438      * <br>
439      * See the documentation for more details:<br>
440      * <a href="https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html">
441      *     https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html</a>
442      *
443      * @since 3.0.0-M5
444      */
445     @Parameter( property = "surefire.forkNode" )
446     private ForkNodeFactory forkNode;
447 
448     /**
449      * You can selectively exclude individual environment variables by enumerating their keys.
450      * <br>
451      * The environment is a system-dependent mapping from keys to values which is inherited from the Maven process
452      * to the forked Surefire processes. The keys must literally (case sensitive) match in order to exclude
453      * their environment variable.
454      * <br>
455      * Example to exclude three environment variables:
456      * <br>
457      * <i>mvn test -Dsurefire.excludedEnvironmentVariables=ACME1,ACME2,ACME3</i>
458      *
459      * @since 3.0.0-M4
460      */
461     @Parameter( property = "surefire.excludedEnvironmentVariables" )
462     private String[] excludedEnvironmentVariables;
463 
464     /**
465      * Since 3.0.0-M4 the process checkers are disabled.
466      * You can enable them namely by setting {@code ping} and {@code native} or {@code all} in this parameter.
467      * <br>
468      * The checker is useful in situations when you kill the build on a CI system and you want the Surefire forked JVM
469      * to kill the tests asap and free all handlers on the file system been previously used by the JVM and by the tests.
470      *
471      * <br>
472      *
473      * The {@code ping} should be safely used together with ZGC or Shenandoah Garbage Collector.
474      * Due to the {@code ping} relies on timing of the PING (triggered every 30 seconds), slow GCs may pause
475      * the timers and pretend that the parent process of the forked JVM does not exist.
476      *
477      * <br>
478      *
479      * The {@code native} is very fast checker.
480      * It is useful mechanism on Unix based systems, Linux distributions and Alpine/BusyBox Linux.
481      * See the JIRA <a href="https://issues.apache.org/jira/browse/SUREFIRE-1631">SUREFIRE-1631</a> for Windows issues.
482      *
483      * <br>
484      *
485      * Another useful configuration parameter is {@code forkedProcessTimeoutInSeconds}.
486      * <br>
487      * See the Frequently Asked Questions page with more details:<br>
488      * <a href="http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm">
489      *     http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm</a>
490      * <br>
491      * <a href="http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm">
492      *     http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm</a>
493      *
494      * <br>
495      *
496      * Example of use:
497      * <br>
498      * <i>mvn test -Dsurefire.enableProcessChecker=all</i>
499      *
500      * @since 3.0.0-M4
501      */
502     @Parameter( property = "surefire.enableProcessChecker" )
503     private String enableProcessChecker;
504 
505     @Parameter( property = "surefire.systemPropertiesFile" )
506     private File systemPropertiesFile;
507 
508     /**
509      * Provide the ID/s of an JUnit engine to be included in the test run.
510      *
511      * @since 3.0.0-M6
512      */
513     @Parameter( property = "includeJUnit5Engines" )
514     private String[] includeJUnit5Engines;
515 
516     /**
517      * Provide the ID/s of an JUnit engine to be excluded in the test run.
518      *
519      * @since 3.0.0-M6
520      */
521     @Parameter( property = "excludeJUnit5Engines" )
522     private String[] excludeJUnit5Engines;
523 
524     @Override
525     protected int getRerunFailingTestsCount()
526     {
527         return rerunFailingTestsCount;
528     }
529 
530     @Override
531     public int getFailOnFlakeCount()
532     {
533         return failOnFlakeCount;
534     }
535 
536     @Override
537     public void setFailOnFlakeCount( int failOnFlakeCount )
538     {
539         this.failOnFlakeCount = failOnFlakeCount;
540     }
541 
542     @Override
543     protected void handleSummary( RunResult summary, Exception firstForkException )
544         throws MojoExecutionException, MojoFailureException
545     {
546         reportExecution( this, summary, getConsoleLogger(), firstForkException );
547     }
548 
549     @Override
550     protected boolean isSkipExecution()
551     {
552         return isSkip() || isSkipTests() || isSkipExec();
553     }
554 
555     @Override
556     protected String getPluginName()
557     {
558         return "surefire";
559     }
560 
561     @Override
562     protected String[] getDefaultIncludes()
563     {
564         return new String[]{ "**/Test*.java", "**/*Test.java", "**/*Tests.java", "**/*TestCase.java" };
565     }
566 
567     @Override
568     protected String getReportSchemaLocation()
569     {
570         return "https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd";
571     }
572 
573 
574     public File getSystemPropertiesFile()
575     {
576         return systemPropertiesFile;
577     }
578 
579 
580     public void setSystemPropertiesFile( File systemPropertiesFile )
581     {
582         this.systemPropertiesFile = systemPropertiesFile;
583     }
584 
585 
586     // now for the implementation of the field accessors
587 
588     @Override
589     public boolean isSkipTests()
590     {
591         return skipTests;
592     }
593 
594     @Override
595     public void setSkipTests( boolean skipTests )
596     {
597         this.skipTests = skipTests;
598     }
599 
600     @Override
601     public boolean isSkipExec()
602     {
603         return skipExec;
604     }
605 
606     @Override
607     public void setSkipExec( boolean skipExec )
608     {
609         this.skipExec = skipExec;
610     }
611 
612     @Override
613     public boolean isSkip()
614     {
615         return skip;
616     }
617 
618     @Override
619     public void setSkip( boolean skip )
620     {
621         this.skip = skip;
622     }
623 
624     @Override
625     public boolean isTestFailureIgnore()
626     {
627         return testFailureIgnore;
628     }
629 
630     @Override
631     public void setTestFailureIgnore( boolean testFailureIgnore )
632     {
633         this.testFailureIgnore = testFailureIgnore;
634     }
635 
636     @Override
637     public File getBasedir()
638     {
639         return basedir;
640     }
641 
642     @Override
643     public void setBasedir( File basedir )
644     {
645         this.basedir = basedir;
646     }
647 
648     @Override
649     public File getTestClassesDirectory()
650     {
651         return testClassesDirectory;
652     }
653 
654     @Override
655     public void setTestClassesDirectory( File testClassesDirectory )
656     {
657         this.testClassesDirectory = testClassesDirectory;
658     }
659 
660     @Override
661     public File getMainBuildPath()
662     {
663         return classesDirectory;
664     }
665 
666     @Override
667     public void setMainBuildPath( File mainBuildPath )
668     {
669         classesDirectory = mainBuildPath;
670     }
671 
672     @Override
673     public File getReportsDirectory()
674     {
675         return reportsDirectory;
676     }
677 
678     @Override
679     public void setReportsDirectory( File reportsDirectory )
680     {
681         this.reportsDirectory = reportsDirectory;
682     }
683 
684     @Override
685     public String getTest()
686     {
687         return test;
688     }
689 
690     @Override
691     public boolean isUseSystemClassLoader()
692     {
693         return useSystemClassLoader;
694     }
695 
696     @Override
697     public void setUseSystemClassLoader( boolean useSystemClassLoader )
698     {
699         this.useSystemClassLoader = useSystemClassLoader;
700     }
701 
702     @Override
703     public boolean isUseManifestOnlyJar()
704     {
705         return useManifestOnlyJar;
706     }
707 
708     @Override
709     public void setUseManifestOnlyJar( boolean useManifestOnlyJar )
710     {
711         this.useManifestOnlyJar = useManifestOnlyJar;
712     }
713 
714     @Override
715     public String getEncoding()
716     {
717         return encoding;
718     }
719 
720     @Override
721     public void setEncoding( String encoding )
722     {
723         this.encoding = encoding;
724     }
725 
726     @Override
727     public boolean getFailIfNoSpecifiedTests()
728     {
729         return failIfNoSpecifiedTests;
730     }
731 
732     @Override
733     public void setFailIfNoSpecifiedTests( boolean failIfNoSpecifiedTests )
734     {
735         this.failIfNoSpecifiedTests = failIfNoSpecifiedTests;
736     }
737 
738     @Override
739     public int getSkipAfterFailureCount()
740     {
741         return skipAfterFailureCount;
742     }
743 
744     @Override
745     public String getShutdown()
746     {
747         return shutdown;
748     }
749 
750     @Override
751     public boolean isPrintSummary()
752     {
753         return printSummary;
754     }
755 
756     @Override
757     public void setPrintSummary( boolean printSummary )
758     {
759         this.printSummary = printSummary;
760     }
761 
762     @Override
763     public String getReportFormat()
764     {
765         return reportFormat;
766     }
767 
768     @Override
769     public void setReportFormat( String reportFormat )
770     {
771         this.reportFormat = reportFormat;
772     }
773 
774     @Override
775     public boolean isUseFile()
776     {
777         return useFile;
778     }
779 
780     @Override
781     public void setUseFile( boolean useFile )
782     {
783         this.useFile = useFile;
784     }
785 
786     @Override
787     public String getDebugForkedProcess()
788     {
789         return debugForkedProcess;
790     }
791 
792     @Override
793     public void setDebugForkedProcess( String debugForkedProcess )
794     {
795         this.debugForkedProcess = debugForkedProcess;
796     }
797 
798     @Override
799     public int getForkedProcessTimeoutInSeconds()
800     {
801         return forkedProcessTimeoutInSeconds;
802     }
803 
804     @Override
805     public void setForkedProcessTimeoutInSeconds( int forkedProcessTimeoutInSeconds )
806     {
807         this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
808     }
809 
810     @Override
811     public int getForkedProcessExitTimeoutInSeconds()
812     {
813         return forkedProcessExitTimeoutInSeconds;
814     }
815 
816     @Override
817     public void setForkedProcessExitTimeoutInSeconds( int forkedProcessExitTimeoutInSeconds )
818     {
819         this.forkedProcessExitTimeoutInSeconds = forkedProcessExitTimeoutInSeconds;
820     }
821 
822     @Override
823     public double getParallelTestsTimeoutInSeconds()
824     {
825         return parallelTestsTimeoutInSeconds;
826     }
827 
828     @Override
829     public void setParallelTestsTimeoutInSeconds( double parallelTestsTimeoutInSeconds )
830     {
831         this.parallelTestsTimeoutInSeconds = parallelTestsTimeoutInSeconds;
832     }
833 
834     @Override
835     public double getParallelTestsTimeoutForcedInSeconds()
836     {
837         return parallelTestsTimeoutForcedInSeconds;
838     }
839 
840     @Override
841     public void setParallelTestsTimeoutForcedInSeconds( double parallelTestsTimeoutForcedInSeconds )
842     {
843         this.parallelTestsTimeoutForcedInSeconds = parallelTestsTimeoutForcedInSeconds;
844     }
845 
846     @Override
847     public void setTest( String test )
848     {
849         this.test = test;
850     }
851 
852     @Override
853     public List<String> getIncludes()
854     {
855         return includes;
856     }
857 
858     @Override
859     public void setIncludes( List<String> includes )
860     {
861         this.includes = includes;
862     }
863 
864     @Override
865     public List<String> getExcludes()
866     {
867         return excludes;
868     }
869 
870     @Override
871     public void setExcludes( List<String> excludes )
872     {
873         this.excludes = excludes;
874     }
875 
876     @Override
877     public File[] getSuiteXmlFiles()
878     {
879         return suiteXmlFiles.clone();
880     }
881 
882     @Override
883     @SuppressWarnings( "UnusedDeclaration" )
884     public void setSuiteXmlFiles( File[] suiteXmlFiles )
885     {
886         this.suiteXmlFiles = suiteXmlFiles.clone();
887     }
888 
889     @Override
890     public String getRunOrder()
891     {
892         return runOrder;
893     }
894 
895     @Override
896     @SuppressWarnings( "UnusedDeclaration" )
897     public void setRunOrder( String runOrder )
898     {
899         this.runOrder = runOrder;
900     }
901 
902     @Override
903     public Long getRunOrderRandomSeed()
904     {
905         return runOrderRandomSeed;
906     }
907 
908     @Override
909     public void setRunOrderRandomSeed( Long runOrderRandomSeed )
910     {
911         this.runOrderRandomSeed = runOrderRandomSeed;
912     }
913 
914     @Override
915     public File getIncludesFile()
916     {
917         return includesFile;
918     }
919 
920     @Override
921     public File getExcludesFile()
922     {
923         return excludesFile;
924     }
925 
926     @Override
927     protected boolean useModulePath()
928     {
929         return useModulePath;
930     }
931 
932     @Override
933     protected void setUseModulePath( boolean useModulePath )
934     {
935         this.useModulePath = useModulePath;
936     }
937 
938     @Override
939     protected final List<File> suiteXmlFiles()
940     {
941         return hasSuiteXmlFiles() ? Arrays.asList( suiteXmlFiles ) : Collections.<File>emptyList();
942     }
943 
944     @Override
945     protected final boolean hasSuiteXmlFiles()
946     {
947         return suiteXmlFiles != null && suiteXmlFiles.length != 0;
948     }
949 
950     @Override
951     protected final String[] getExcludedEnvironmentVariables()
952     {
953         return excludedEnvironmentVariables == null ? new String[0] : excludedEnvironmentVariables;
954     }
955 
956     void setExcludedEnvironmentVariables( String[] excludedEnvironmentVariables )
957     {
958         this.excludedEnvironmentVariables = excludedEnvironmentVariables;
959     }
960 
961     @Override
962     protected final String getEnableProcessChecker()
963     {
964         return enableProcessChecker;
965     }
966 
967     @Override
968     protected final ForkNodeFactory getForkNode()
969     {
970         return forkNode;
971     }
972 
973     @Override
974     protected void warnIfIllegalFailOnFlakeCount() throws MojoFailureException
975     {
976         if ( failOnFlakeCount < 0 )
977         {
978             throw new MojoFailureException( "Parameter \"failOnFlakeCount\" should not be negative." );
979         }
980         if ( failOnFlakeCount > 0 && rerunFailingTestsCount < 1 )
981         {
982             throw new MojoFailureException( "\"failOnFlakeCount\" requires rerunFailingTestsCount to be at least 1." );
983         }
984     }
985 
986     @Override
987     protected void addPluginSpecificChecksumItems( ChecksumCalculator checksum )
988     {
989         checksum.add( skipAfterFailureCount );
990     }
991 
992     public String[] getIncludeJUnit5Engines()
993     {
994         return includeJUnit5Engines;
995     }
996 
997     @SuppressWarnings( "UnusedDeclaration" )
998     public void setIncludeJUnit5Engines( String[] includeJUnit5Engines )
999     {
1000         this.includeJUnit5Engines = includeJUnit5Engines;
1001     }
1002 
1003     public String[] getExcludeJUnit5Engines()
1004     {
1005         return excludeJUnit5Engines;
1006     }
1007 
1008     @SuppressWarnings( "UnusedDeclaration" )
1009     public void setExcludeJUnit5Engines( String[] excludeJUnit5Engines )
1010     {
1011         this.excludeJUnit5Engines = excludeJUnit5Engines;
1012     }
1013 }