View Javadoc

1   package org.apache.maven.plugin.failsafe;
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.BufferedOutputStream;
23  import java.io.File;
24  import java.io.FileOutputStream;
25  import java.io.IOException;
26  import java.io.OutputStreamWriter;
27  import java.io.Writer;
28  import java.util.HashMap;
29  import java.util.List;
30  import java.util.Map;
31  import java.util.Properties;
32  import org.apache.maven.artifact.factory.ArtifactFactory;
33  import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
34  import org.apache.maven.artifact.repository.ArtifactRepository;
35  import org.apache.maven.artifact.resolver.ArtifactResolver;
36  import org.apache.maven.execution.MavenSession;
37  import org.apache.maven.plugin.MojoExecutionException;
38  import org.apache.maven.plugin.MojoFailureException;
39  import org.apache.maven.plugin.surefire.AbstractSurefireMojo;
40  import org.apache.maven.plugin.surefire.Summary;
41  import org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator;
42  import org.apache.maven.project.MavenProject;
43  import org.apache.maven.surefire.booter.ProviderConfiguration;
44  import org.apache.maven.surefire.failsafe.model.FailsafeSummary;
45  import org.apache.maven.surefire.failsafe.model.io.xpp3.FailsafeSummaryXpp3Writer;
46  import org.apache.maven.surefire.suite.RunResult;
47  import org.apache.maven.toolchain.ToolchainManager;
48  import org.codehaus.plexus.util.ReaderFactory;
49  import org.codehaus.plexus.util.StringUtils;
50  
51  /**
52   * Run integration tests using Surefire.
53   *
54   * @author Jason van Zyl
55   * @author Stephen Connolly
56   * @requiresProject true
57   * @requiresDependencyResolution test
58   * @goal integration-test
59   * @phase integration-test
60   * @threadSafe
61   * @noinspection JavaDoc
62   */
63  public class IntegrationTestMojo
64      extends AbstractSurefireMojo
65  {
66  
67      /**
68       * Set this to "true" to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite
69       * convenient on occasion.
70       *
71       * @parameter default-value="false" expression="${skipTests}"
72       * @since 2.4
73       */
74      private boolean skipTests;
75  
76      /**
77       * Set this to "true" to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but
78       * quite convenient on occasion.
79       *
80       * @parameter expression="${skipITs}"
81       * @since 2.4.3-alpha-2
82       */
83      private boolean skipITs;
84  
85      /**
86       * This old parameter is just like <code>skipTests</code>, but bound to the old property "maven.test.skip.exec".
87       *
88       * @parameter expression="${maven.test.skip.exec}"
89       * @since 2.3
90       * @deprecated Use skipTests instead.
91       */
92      private boolean skipExec;
93  
94      /**
95       * Set this to "true" to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you enable it using
96       * the "maven.test.skip" property, because maven.test.skip disables both running the tests and compiling the tests.
97       * Consider using the <code>skipTests parameter</code> instead.
98       *
99       * @parameter default-value="false" expression="${maven.test.skip}"
100      */
101     private boolean skip;
102 
103     /**
104      * The base directory of the project being tested. This can be obtained in your integration test via
105      * System.getProperty("basedir").
106      *
107      * @parameter default-value="${basedir}"
108      */
109     private File basedir;
110 
111     /**
112      * The directory containing generated test classes of the project being tested. This will be included at the
113      * beginning of the test classpath.
114      *
115      * @parameter default-value="${project.build.testOutputDirectory}"
116      */
117     private File testClassesDirectory;
118 
119     /**
120      * The directory containing generated classes of the project being tested. This will be included after the test
121      * classes in the test classpath.
122      *
123      * @parameter default-value="${project.build.outputDirectory}"
124      */
125     private File classesDirectory;
126 
127     /**
128      * The Maven Project Object.
129      *
130      * @parameter default-value="${project}"
131      * @readonly
132      */
133     private MavenProject project;
134 
135     /**
136      * List of dependencies to exclude from the test classpath. Each dependency string must follow the format
137      * <i>groupId:artifactId</i>. For example: <i>org.acme:project-a</i>
138      *
139      * @parameter
140      * @since 2.6
141      */
142     private List classpathDependencyExcludes;
143 
144     /**
145      * A dependency scope to exclude from the test classpath. The scope should be one of the scopes defined by
146      * org.apache.maven.artifact.Artifact. This includes the following:
147      * <p/>
148      * <ul>
149      * <li><i>compile</i> - system, provided, compile
150      * <li><i>runtime</i> - compile, runtime
151      * <li><i>compile+runtime</i> - system, provided, compile, runtime
152      * <li><i>runtime+system</i> - system, compile, runtime
153      * <li><i>test</i> - system, provided, compile, runtime, test
154      * </ul>
155      *
156      * @parameter default-value=""
157      * @since 2.6
158      */
159     private String classpathDependencyScopeExclude;
160 
161     /**
162      * Additional elements to be appended to the classpath.
163      *
164      * @parameter
165      * @since 2.4
166      */
167     private List additionalClasspathElements;
168 
169     /**
170      * Base directory where all reports are written to.
171      *
172      * @parameter default-value="${project.build.directory}/failsafe-reports"
173      */
174     private File reportsDirectory;
175 
176     /**
177      * The test source directory containing test class sources.
178      *
179      * @parameter default-value="${project.build.testSourceDirectory}"
180      * @required
181      * @since 2.2
182      */
183     private File testSourceDirectory;
184 
185     /**
186      * Specify this parameter to run individual tests by file name, overriding the <code>includes/excludes</code>
187      * parameters. Each pattern you specify here will be used to create an include pattern formatted like
188      * <code>**&#47;${test}.java</code>, so you can just type "-Dit.test=MyTest" to run a single test called
189      * "foo/MyTest.java".<br/>
190      * This parameter overrides the <code>includes/excludes</code> parameters, and the TestNG <code>suiteXmlFiles</code>
191      * parameter.
192      * <p/>
193      * since 2.7.3 You can execute a limited number of method in the test with adding #myMethod or #my*ethod. Si type
194      * "-Dtest=MyTest#myMethod" <b>supported for junit 4.x and testNg</b>
195      *
196      * @parameter expression="${it.test}"
197      */
198     private String test;
199 
200     /**
201      * A list of &lt;include> elements specifying the tests (by pattern) that should be included in testing. When not
202      * specified and when the <code>test</code> parameter is not specified, the default includes will be <code><br/>
203      * &lt;includes><br/>
204      * &nbsp;&lt;include>**&#47;IT*.java&lt;/include><br/>
205      * &nbsp;&lt;include>**&#47;*IT.java&lt;/include><br/>
206      * &nbsp;&lt;include>**&#47;*ITCase.java&lt;/include><br/>
207      * &lt;/includes><br/>
208      * </code>
209      * <p/>
210      * Each include item may also contain a comma-separated sublist of items, which will be treated as multiple
211      * &nbsp;&lt;include> entries.<br/>
212      * <p/>
213      * This parameter is ignored if the TestNG <code>suiteXmlFiles</code> parameter is specified.
214      *
215      * @parameter
216      */
217     private List includes;
218 
219     /**
220      * A list of &lt;exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not
221      * specified and when the <code>test</code> parameter is not specified, the default excludes will be <code><br/>
222      * &lt;excludes><br/>
223      * &nbsp;&lt;exclude>**&#47;*$*&lt;/exclude><br/>
224      * &lt;/excludes><br/>
225      * </code> (which excludes all inner classes).<br>
226      * This parameter is ignored if the TestNG <code>suiteXmlFiles</code> parameter is specified.
227      * <p/>
228      * Each exclude item may also contain a comma-separated sublist of items, which will be treated as multiple
229      * &nbsp;&lt;exclude> entries.<br/>
230      *
231      * @parameter
232      */
233     private List excludes;
234 
235     /**
236      * ArtifactRepository of the localRepository. To obtain the directory of localRepository in unit tests use
237      * System.getProperty("localRepository").
238      *
239      * @parameter expression="${localRepository}"
240      * @required
241      * @readonly
242      */
243     private ArtifactRepository localRepository;
244 
245     /**
246      * List of System properties to pass to the JUnit tests.
247      *
248      * @parameter
249      * @deprecated Use systemPropertyVariables instead.
250      */
251     private Properties systemProperties;
252 
253     /**
254      * List of System properties to pass to the JUnit tests.
255      *
256      * @parameter
257      * @since 2.5
258      */
259     private Map systemPropertyVariables;
260 
261     /**
262      * List of System properties, loaded from a file, to pass to the JUnit tests.
263      *
264      * @parameter
265      * @since 2.8.2
266      */
267     private File systemPropertiesFile;
268 
269     /**
270      * List of properties for configuring all TestNG related configurations. This is the new preferred method of
271      * configuring TestNG.
272      *
273      * @parameter
274      * @since 2.4
275      */
276     private Properties properties;
277 
278     /**
279      * Map of plugin artifacts.
280      *
281      * @parameter expression="${plugin.artifactMap}"
282      * @required
283      * @readonly
284      */
285     private Map pluginArtifactMap;
286 
287     /**
288      * Map of project artifacts.
289      *
290      * @parameter expression="${project.artifactMap}"
291      * @required
292      * @readonly
293      */
294     private Map projectArtifactMap;
295 
296     /**
297      * The summary file to write integration test results to.
298      *
299      * @parameter expression="${project.build.directory}/failsafe-reports/failsafe-summary.xml"
300      * @required
301      */
302     private File summaryFile;
303 
304     /**
305      * Option to print summary of test suites or just print the test cases that have errors.
306      *
307      * @parameter expression="${failsafe.printSummary}" default-value="true"
308      */
309     private boolean printSummary;
310 
311     /**
312      * Selects the formatting for the test report to be generated. Can be set as "brief" or "plain".
313      *
314      * @parameter expression="${failsafe.reportFormat}" default-value="brief"
315      */
316     private String reportFormat;
317 
318     /**
319      * Add custom text into report filename: TEST-testClassName-reportNameSuffix.xml,
320      * testClassName-reportNameSuffix.txt and testClassName-reportNameSuffix-output.txt.
321      * File TEST-testClassName-reportNameSuffix.xml has changed attributes 'testsuite'--'name'
322      * and 'testcase'--'classname' - reportNameSuffix is added to the attribute value.
323      *
324      * @parameter expression="${surefire.reportNameSuffix}" default-value=""
325      */
326     private String reportNameSuffix;
327 
328     /**
329      * Option to generate a file test report or just output the test report to the console.
330      *
331      * @parameter expression="${failsafe.useFile}" default-value="true"
332      */
333     private boolean useFile;
334 
335     /**
336      * Set this to "true" to redirect the unit test standard output to a file (found in
337      * reportsDirectory/testName-output.txt).
338      *
339      * @parameter expression="${maven.test.redirectTestOutputToFile}" default-value="false"
340      * @since 2.3
341      */
342     private boolean redirectTestOutputToFile;
343 
344     /**
345      * Set this to "true" to cause a failure if there are no tests to run. Defaults to "false".
346      *
347      * @parameter expression="${failIfNoTests}"
348      * @since 2.4
349      */
350     private Boolean failIfNoTests;
351 
352     /**
353      * Option to specify the forking mode. Can be "never", "once" or "always". "none" and "pertest" are also accepted
354      * for backwards compatibility. "always" forks for each test-class.
355      *
356      * @parameter expression="${forkMode}" default-value="once"
357      * @since 2.1
358      */
359     private String forkMode;
360 
361     /**
362      * Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the
363      * jvm will be a new instance of the same VM as the one used to run Maven. JVM settings are not inherited from
364      * MAVEN_OPTS.
365      *
366      * @parameter expression="${jvm}"
367      * @since 2.1
368      */
369     private String jvm;
370 
371     /**
372      * Arbitrary JVM options to set on the command line.
373      *
374      * @parameter expression="${argLine}"
375      * @since 2.1
376      */
377     private String argLine;
378 
379     /**
380      * Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach
381      * on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure
382      * arbitrary debuggability options (without overwriting the other options specified through the <code>argLine</code>
383      * parameter).
384      *
385      * @parameter expression="${maven.failsafe.debug}"
386      * @since 2.4
387      */
388     private String debugForkedProcess;
389 
390     /**
391      * Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never
392      * timing out.
393      *
394      * @parameter expression="${failsafe.timeout}"
395      * @since 2.4
396      */
397     private int forkedProcessTimeoutInSeconds;
398 
399     /**
400      * Additional environment variables to set on the command line.
401      *
402      * @parameter
403      * @since 2.1.3
404      */
405     private Map environmentVariables = new HashMap();
406 
407     /**
408      * Command line working directory.
409      *
410      * @parameter expression="${basedir}"
411      * @since 2.1.3
412      */
413     private File workingDirectory;
414 
415     /**
416      * When false it makes tests run using the standard classloader delegation instead of the default Maven isolated
417      * classloader. Only used when forking (forkMode is not "none").<br/>
418      * Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the
419      * Java 5 provider parser.
420      *
421      * @parameter expression="${childDelegation}" default-value="false"
422      * @since 2.1
423      */
424     private boolean childDelegation;
425 
426     /**
427      * (TestNG/JUnit47 provider with JUnit4.8+ only) Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will
428      * be included in test run, if specified.<br/>For JUnit, this parameter forces the use of the 4.7 provider<br/>
429      * This parameter is ignored if the <code>suiteXmlFiles</code> parameter is specified.
430      *
431      * @parameter expression="${groups}"
432      * @since 2.2
433      */
434     private String groups;
435 
436     /**
437      * (TestNG/JUnit47 provider with JUnit4.8+ only) Excluded groups. Any methods/classes/etc with one of the groups specified in this list will
438      * specifically not be run.<br/>For JUnit, this parameter forces the use of the 4.7 provider<br/>
439      * This parameter is ignored if the <code>suiteXmlFiles</code> parameter is specified.
440      *
441      * @parameter expression="${excludedGroups}"
442      * @since 2.2
443      */
444     private String excludedGroups;
445 
446     /**
447      * (TestNG only) List of &lt;suiteXmlFile> elements specifying TestNG suite xml file locations. Note that
448      * <code>suiteXmlFiles</code> is incompatible with several other parameters of this plugin, like
449      * <code>includes/excludes</code>.<br/>
450      * This parameter is ignored if the <code>test</code> parameter is specified (allowing you to run a single test
451      * instead of an entire suite).
452      *
453      * @parameter
454      * @since 2.2
455      */
456     private File[] suiteXmlFiles;
457 
458     /**
459      * Allows you to specify the name of the JUnit artifact. If not set, <code>junit:junit</code> will be used.
460      *
461      * @parameter expression="${junitArtifactName}" default-value="junit:junit"
462      * @since 2.3.1
463      */
464     private String junitArtifactName;
465 
466     /**
467      * Allows you to specify the name of the TestNG artifact. If not set, <code>org.testng:testng</code> will be used.
468      *
469      * @parameter expression="${testNGArtifactName}" default-value="org.testng:testng"
470      * @since 2.3.1
471      */
472     private String testNGArtifactName;
473 
474     /**
475      * (TestNG/JUnit 4.7 provider only) The attribute thread-count allows you to specify how many threads should be
476      * allocated for this execution. Only makes sense to use in conjunction with the <code>parallel</code> parameter.
477      *
478      * @parameter expression="${threadCount}"
479      * @since 2.2
480      */
481     private int threadCount;
482 
483     /**
484      * (JUnit 4.7 provider) Indicates that threadCount is per cpu core.
485      *
486      * @parameter expression="${perCoreThreadCount}" default-value="true"
487      * @since 2.5
488      */
489     private boolean perCoreThreadCount;
490 
491     /**
492      * (JUnit 4.7 provider) Indicates that the thread pool will be unlimited. The <code>parallel</code> parameter and
493      * the actual number of classes/methods will decide. Setting this to "true" effectively disables
494      * <code>perCoreThreadCount</code> and <code>threadCount</code>. Defaults to "false".
495      *
496      * @parameter expression="${useUnlimitedThreads}" default-value="false"
497      * @since 2.5
498      */
499     private boolean useUnlimitedThreads;
500 
501     /**
502      * (TestNG only) When you use the <code>parallel</code> attribute, TestNG will try to run all your test methods in
503      * separate threads, except for methods that depend on each other, which will be run in the same thread in order to
504      * respect their order of execution.
505      * <p/>
506      * (JUnit 4.7 provider) Supports values "classes"/"methods"/"both" to run in separate threads, as controlled by
507      * <code>threadCount</code>.
508      *
509      * @parameter expression="${parallel}"
510      * @todo test how this works with forking, and console/file output parallelism
511      * @since 2.2
512      */
513     private String parallel;
514 
515     /**
516      * Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.
517      *
518      * @parameter expression="${trimStackTrace}" default-value="true"
519      * @since 2.2
520      */
521     private boolean trimStackTrace;
522 
523     /**
524      * Resolves the artifacts needed.
525      *
526      * @component
527      */
528     private ArtifactResolver artifactResolver;
529 
530     /**
531      * Creates the artifact.
532      *
533      * @component
534      */
535     private ArtifactFactory artifactFactory;
536 
537     /**
538      * The remote plugin repositories declared in the POM.
539      *
540      * @parameter expression="${project.pluginArtifactRepositories}"
541      * @since 2.2
542      */
543     private List remoteRepositories;
544 
545     /**
546      * For retrieval of artifact's metadata.
547      *
548      * @component
549      */
550     private ArtifactMetadataSource metadataSource;
551 
552     private Properties originalSystemProperties;
553 
554     /**
555      * systemPropertyVariables + systemProperties
556      */
557     private Properties internalSystemProperties = new Properties();
558 
559     /**
560      * Flag to disable the generation of report files in xml format.
561      *
562      * @parameter expression="${disableXmlReport}" default-value="false"
563      * @since 2.2
564      */
565     private boolean disableXmlReport;
566 
567     /**
568      * Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking.
569      * Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's
570      * classloader.
571      *
572      * @parameter expression="${failsafe.useSystemClassLoader}" default-value="true"
573      * @since 2.3
574      */
575     private boolean useSystemClassLoader;
576 
577     /**
578      * By default, Surefire forks your tests using a manifest-only JAR; set this parameter to "false" to force it to
579      * launch your tests with a plain old Java classpath. (See
580      * http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html for a more detailed explanation
581      * of manifest-only JARs and their benefits.)
582      * <p/>
583      * Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long.
584      *
585      * @parameter expression="${failsafe.useManifestOnlyJar}" default-value="true"
586      * @since 2.4.3
587      */
588     private boolean useManifestOnlyJar;
589 
590     /**
591      * By default, Surefire enables JVM assertions for the execution of your test cases. To disable the assertions, set
592      * this flag to "false".
593      *
594      * @parameter expression="${enableAssertions}" default-value="true"
595      * @since 2.3.1
596      */
597     private boolean enableAssertions;
598 
599     /**
600      * The current build session instance.
601      *
602      * @parameter expression="${session}"
603      * @required
604      * @readonly
605      */
606     private MavenSession session;
607 
608     /**
609      * (TestNG only) Define the factory class used to create all test instances.
610      *
611      * @parameter expression="${objectFactory}"
612      * @since 2.5
613      */
614     private String objectFactory;
615 
616     /**
617      * The character encoding scheme to be applied.
618      *
619      * @parameter expression="${encoding}" default-value="${project.reporting.outputEncoding}"
620      */
621     private String encoding;
622 
623     /**
624      * @parameter default-value="${session.parallel}"
625      * @readonly
626      */
627     private Boolean parallelMavenExecution;
628 
629     /**
630      * Defines the order the tests will be run in. Supported values are "alphabetical", "reversealphabetical", "random",
631      * "hourly" (alphabetical on even hours, reverse alphabetical on odd hours), "failedfirst", "balanced" and "filesystem".
632      * <p/>
633      * <p/>
634      * Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a
635      * multi-module build.
636      * <p/>
637      * Failed first will run tests that failed on previous run first, as well as new tests for this run.
638      * <p/>
639      * Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests to
640      * make all tests complete at the same time, reducing the overall execution time.
641      * <p/>
642      * Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml, and should not
643      * be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration,
644      * so different configurations will have different statistics files, meaning if you change any config
645      * settings you will re-run once before new statistics data can be established.
646      *
647      * @parameter default-value="filesystem"
648      * @since 2.7
649      */
650     private String runOrder;
651 
652     /**
653      * @component
654      */
655     private ToolchainManager toolchainManager;
656 
657     protected void handleSummary( Summary summary )
658         throws MojoExecutionException, MojoFailureException
659     {
660         FailsafeSummary failsafeSummary = createFailsafeSummaryFromSummary( summary );
661         writeSummary( failsafeSummary );
662     }
663 
664     private FailsafeSummary createFailsafeSummaryFromSummary( Summary summary )
665     {
666         FailsafeSummary failsafeSummary = new FailsafeSummary();
667         if ( summary.isErrorFree() )
668         {
669             RunResult result = summary.getResultOfLastSuccessfulRun();
670             if ( result != null )
671             {
672                 failsafeSummary.setResult( result.getForkedProcessCode() );
673             }
674         }
675         else
676         {
677             failsafeSummary.setResult( ProviderConfiguration.TESTS_FAILED_EXIT_CODE );
678             failsafeSummary.setException( summary.getFirstException().getMessage() );
679         }
680         return failsafeSummary;
681     }
682 
683     private void writeSummary( FailsafeSummary summary )
684         throws MojoExecutionException
685     {
686         File summaryFile = getSummaryFile();
687         if ( !summaryFile.getParentFile().isDirectory() )
688         {
689             summaryFile.getParentFile().mkdirs();
690         }
691         try
692         {
693             FileOutputStream fileOutputStream = new FileOutputStream( summaryFile );
694             BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( fileOutputStream );
695             Writer writer = new OutputStreamWriter( bufferedOutputStream, getEncodingOrDefault() );
696             FailsafeSummaryXpp3Writer xpp3Writer = new FailsafeSummaryXpp3Writer();
697             xpp3Writer.write( writer, summary );
698             writer.close();
699             bufferedOutputStream.close();
700             fileOutputStream.close();
701         }
702         catch ( IOException e )
703         {
704             throw new MojoExecutionException( e.getMessage(), e );
705         }
706     }
707 
708     private String getEncodingOrDefault()
709     {
710         if ( StringUtils.isEmpty( encoding ) )
711         {
712             getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING +
713                                ", i.e. build is platform dependent!" );
714             return ReaderFactory.FILE_ENCODING;
715         }
716         else
717         {
718             return encoding;
719         }
720     }
721 
722     protected boolean isSkipExecution()
723     {
724         return isSkip() || isSkipTests() || isSkipITs() || isSkipExec();
725     }
726 
727     protected String getPluginName()
728     {
729         return "failsafe";
730     }
731 
732     protected String[] getDefaultIncludes()
733     {
734         return new String[]{ "**/IT*.java", "**/*IT.java", "**/*ITCase.java" };
735     }
736 
737     public boolean isSkipTests()
738     {
739         return skipTests;
740     }
741 
742     public void setSkipTests( boolean skipTests )
743     {
744         this.skipTests = skipTests;
745     }
746 
747     public boolean isSkipITs()
748     {
749         return skipITs;
750     }
751 
752     public void setSkipITs( boolean skipITs )
753     {
754         this.skipITs = skipITs;
755     }
756 
757     public boolean isSkipExec()
758     {
759         return skipExec;
760     }
761 
762     public void setSkipExec( boolean skipExec )
763     {
764         this.skipExec = skipExec;
765     }
766 
767     public boolean isSkip()
768     {
769         return skip;
770     }
771 
772     public void setSkip( boolean skip )
773     {
774         this.skip = skip;
775     }
776 
777     public File getBasedir()
778     {
779         return basedir;
780     }
781 
782     public void setBasedir( File basedir )
783     {
784         this.basedir = basedir;
785     }
786 
787     public File getTestClassesDirectory()
788     {
789         return testClassesDirectory;
790     }
791 
792     public void setTestClassesDirectory( File testClassesDirectory )
793     {
794         this.testClassesDirectory = testClassesDirectory;
795     }
796 
797     public File getClassesDirectory()
798     {
799         return classesDirectory;
800     }
801 
802     public void setClassesDirectory( File classesDirectory )
803     {
804         this.classesDirectory = classesDirectory;
805     }
806 
807     public MavenProject getProject()
808     {
809         return project;
810     }
811 
812     public void setProject( MavenProject project )
813     {
814         this.project = project;
815     }
816 
817     public List getClasspathDependencyExcludes()
818     {
819         return classpathDependencyExcludes;
820     }
821 
822     public void setClasspathDependencyExcludes( List classpathDependencyExcludes )
823     {
824         this.classpathDependencyExcludes = classpathDependencyExcludes;
825     }
826 
827     public String getClasspathDependencyScopeExclude()
828     {
829         return classpathDependencyScopeExclude;
830     }
831 
832     public void setClasspathDependencyScopeExclude( String classpathDependencyScopeExclude )
833     {
834         this.classpathDependencyScopeExclude = classpathDependencyScopeExclude;
835     }
836 
837     public List getAdditionalClasspathElements()
838     {
839         return additionalClasspathElements;
840     }
841 
842     public void setAdditionalClasspathElements( List additionalClasspathElements )
843     {
844         this.additionalClasspathElements = additionalClasspathElements;
845     }
846 
847     public File getReportsDirectory()
848     {
849         return reportsDirectory;
850     }
851 
852     public void setReportsDirectory( File reportsDirectory )
853     {
854         this.reportsDirectory = reportsDirectory;
855     }
856 
857     public File getTestSourceDirectory()
858     {
859         return testSourceDirectory;
860     }
861 
862     public void setTestSourceDirectory( File testSourceDirectory )
863     {
864         this.testSourceDirectory = testSourceDirectory;
865     }
866 
867     public String getTest()
868     {
869         if ( StringUtils.isBlank( test ) )
870         {
871             return null;
872         }
873         int index = test.indexOf( '#' );
874         if ( index >= 0 )
875         {
876             return test.substring( 0, index );
877         }
878         return test;
879     }
880 
881     public void setTest( String test )
882     {
883         this.test = test;
884     }
885 
886     /**
887      * @since 2.7.3
888      */
889     public String getTestMethod()
890     {
891         if ( StringUtils.isBlank( test ) )
892         {
893             return null;
894         }
895         int index = this.test.indexOf( '#' );
896         if ( index >= 0 )
897         {
898             return this.test.substring( index + 1, this.test.length() );
899         }
900         return null;
901     }
902 
903     public List getIncludes()
904     {
905         return includes;
906     }
907 
908     public void setIncludes( List includes )
909     {
910         this.includes = includes;
911     }
912 
913     public List getExcludes()
914     {
915         return excludes;
916     }
917 
918     public void setExcludes( List excludes )
919     {
920         this.excludes = excludes;
921     }
922 
923     public ArtifactRepository getLocalRepository()
924     {
925         return localRepository;
926     }
927 
928     public void setLocalRepository( ArtifactRepository localRepository )
929     {
930         this.localRepository = localRepository;
931     }
932 
933     public Properties getSystemProperties()
934     {
935         return systemProperties;
936     }
937 
938     public void setSystemProperties( Properties systemProperties )
939     {
940         this.systemProperties = systemProperties;
941     }
942 
943     public Map getSystemPropertyVariables()
944     {
945         return systemPropertyVariables;
946     }
947 
948     public void setSystemPropertyVariables( Map systemPropertyVariables )
949     {
950         this.systemPropertyVariables = systemPropertyVariables;
951     }
952 
953     public File getSystemPropertiesFile()
954     {
955         return systemPropertiesFile;
956     }
957 
958     public void setSystemPropertiesFile( File systemPropertiesFile )
959     {
960         this.systemPropertiesFile = systemPropertiesFile;
961     }
962 
963     public Properties getProperties()
964     {
965         return properties;
966     }
967 
968     public void setProperties( Properties properties )
969     {
970         this.properties = properties;
971     }
972 
973     public Map getPluginArtifactMap()
974     {
975         return pluginArtifactMap;
976     }
977 
978     public void setPluginArtifactMap( Map pluginArtifactMap )
979     {
980         this.pluginArtifactMap = pluginArtifactMap;
981     }
982 
983     public Map getProjectArtifactMap()
984     {
985         return projectArtifactMap;
986     }
987 
988     public void setProjectArtifactMap( Map projectArtifactMap )
989     {
990         this.projectArtifactMap = projectArtifactMap;
991     }
992 
993     public File getSummaryFile()
994     {
995         return summaryFile;
996     }
997 
998     public void setSummaryFile( File summaryFile )
999     {
1000         this.summaryFile = summaryFile;
1001     }
1002 
1003     public boolean isPrintSummary()
1004     {
1005         return printSummary;
1006     }
1007 
1008     public void setPrintSummary( boolean printSummary )
1009     {
1010         this.printSummary = printSummary;
1011     }
1012 
1013     public String getReportFormat()
1014     {
1015         return reportFormat;
1016     }
1017 
1018     public void setReportFormat( String reportFormat )
1019     {
1020         this.reportFormat = reportFormat;
1021     }
1022 
1023     public String getReportNameSuffix()
1024     {
1025         return reportNameSuffix;
1026     }
1027 
1028     public void setReportNameSuffix( String reportNameSuffix )
1029     {
1030         this.reportNameSuffix = reportNameSuffix;
1031     }
1032 
1033     public boolean isUseFile()
1034     {
1035         return useFile;
1036     }
1037 
1038     public void setUseFile( boolean useFile )
1039     {
1040         this.useFile = useFile;
1041     }
1042 
1043     public boolean isRedirectTestOutputToFile()
1044     {
1045         return redirectTestOutputToFile;
1046     }
1047 
1048     public void setRedirectTestOutputToFile( boolean redirectTestOutputToFile )
1049     {
1050         this.redirectTestOutputToFile = redirectTestOutputToFile;
1051     }
1052 
1053     public Boolean getFailIfNoTests()
1054     {
1055         return failIfNoTests;
1056     }
1057 
1058     public void setFailIfNoTests( Boolean failIfNoTests )
1059     {
1060         this.failIfNoTests = failIfNoTests;
1061     }
1062 
1063     public String getForkMode()
1064     {
1065         return forkMode;
1066     }
1067 
1068     public void setForkMode( String forkMode )
1069     {
1070         this.forkMode = forkMode;
1071     }
1072 
1073     public String getJvm()
1074     {
1075         return jvm;
1076     }
1077 
1078     public void setJvm( String jvm )
1079     {
1080         this.jvm = jvm;
1081     }
1082 
1083     public String getArgLine()
1084     {
1085         return argLine;
1086     }
1087 
1088     public void setArgLine( String argLine )
1089     {
1090         this.argLine = argLine;
1091     }
1092 
1093     public String getDebugForkedProcess()
1094     {
1095         return debugForkedProcess;
1096     }
1097 
1098     public void setDebugForkedProcess( String debugForkedProcess )
1099     {
1100         this.debugForkedProcess = debugForkedProcess;
1101     }
1102 
1103     public int getForkedProcessTimeoutInSeconds()
1104     {
1105         return forkedProcessTimeoutInSeconds;
1106     }
1107 
1108     public void setForkedProcessTimeoutInSeconds( int forkedProcessTimeoutInSeconds )
1109     {
1110         this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
1111     }
1112 
1113     public Map getEnvironmentVariables()
1114     {
1115         return environmentVariables;
1116     }
1117 
1118     public void setEnvironmentVariables( Map environmentVariables )
1119     {
1120         this.environmentVariables = environmentVariables;
1121     }
1122 
1123     public File getWorkingDirectory()
1124     {
1125         return workingDirectory;
1126     }
1127 
1128     public void setWorkingDirectory( File workingDirectory )
1129     {
1130         this.workingDirectory = workingDirectory;
1131     }
1132 
1133     public boolean isChildDelegation()
1134     {
1135         return childDelegation;
1136     }
1137 
1138     public void setChildDelegation( boolean childDelegation )
1139     {
1140         this.childDelegation = childDelegation;
1141     }
1142 
1143     public String getGroups()
1144     {
1145         return groups;
1146     }
1147 
1148     public void setGroups( String groups )
1149     {
1150         this.groups = groups;
1151     }
1152 
1153     public String getExcludedGroups()
1154     {
1155         return excludedGroups;
1156     }
1157 
1158     public void setExcludedGroups( String excludedGroups )
1159     {
1160         this.excludedGroups = excludedGroups;
1161     }
1162 
1163     public File[] getSuiteXmlFiles()
1164     {
1165         return suiteXmlFiles;
1166     }
1167 
1168     public void setSuiteXmlFiles( File[] suiteXmlFiles )
1169     {
1170         this.suiteXmlFiles = suiteXmlFiles;
1171     }
1172 
1173     public String getJunitArtifactName()
1174     {
1175         return junitArtifactName;
1176     }
1177 
1178     public void setJunitArtifactName( String junitArtifactName )
1179     {
1180         this.junitArtifactName = junitArtifactName;
1181     }
1182 
1183     public String getTestNGArtifactName()
1184     {
1185         return testNGArtifactName;
1186     }
1187 
1188     public void setTestNGArtifactName( String testNGArtifactName )
1189     {
1190         this.testNGArtifactName = testNGArtifactName;
1191     }
1192 
1193     public int getThreadCount()
1194     {
1195         return threadCount;
1196     }
1197 
1198     public void setThreadCount( int threadCount )
1199     {
1200         this.threadCount = threadCount;
1201     }
1202 
1203     public boolean getPerCoreThreadCount()
1204     {
1205         return perCoreThreadCount;
1206     }
1207 
1208     public void setPerCoreThreadCount( boolean perCoreThreadCount )
1209     {
1210         this.perCoreThreadCount = perCoreThreadCount;
1211     }
1212 
1213     public boolean getUseUnlimitedThreads()
1214     {
1215         return useUnlimitedThreads;
1216     }
1217 
1218     public void setUseUnlimitedThreads( boolean useUnlimitedThreads )
1219     {
1220         this.useUnlimitedThreads = useUnlimitedThreads;
1221     }
1222 
1223     public String getParallel()
1224     {
1225         return parallel;
1226     }
1227 
1228     public void setParallel( String parallel )
1229     {
1230         this.parallel = parallel;
1231     }
1232 
1233     public boolean isTrimStackTrace()
1234     {
1235         return trimStackTrace;
1236     }
1237 
1238     public void setTrimStackTrace( boolean trimStackTrace )
1239     {
1240         this.trimStackTrace = trimStackTrace;
1241     }
1242 
1243     public ArtifactResolver getArtifactResolver()
1244     {
1245         return artifactResolver;
1246     }
1247 
1248     public void setArtifactResolver( ArtifactResolver artifactResolver )
1249     {
1250         this.artifactResolver = artifactResolver;
1251     }
1252 
1253     public ArtifactFactory getArtifactFactory()
1254     {
1255         return artifactFactory;
1256     }
1257 
1258     public void setArtifactFactory( ArtifactFactory artifactFactory )
1259     {
1260         this.artifactFactory = artifactFactory;
1261     }
1262 
1263     public List getRemoteRepositories()
1264     {
1265         return remoteRepositories;
1266     }
1267 
1268     public void setRemoteRepositories( List remoteRepositories )
1269     {
1270         this.remoteRepositories = remoteRepositories;
1271     }
1272 
1273     public ArtifactMetadataSource getMetadataSource()
1274     {
1275         return metadataSource;
1276     }
1277 
1278     public void setMetadataSource( ArtifactMetadataSource metadataSource )
1279     {
1280         this.metadataSource = metadataSource;
1281     }
1282 
1283     public Properties getOriginalSystemProperties()
1284     {
1285         return originalSystemProperties;
1286     }
1287 
1288     public void setOriginalSystemProperties( Properties originalSystemProperties )
1289     {
1290         this.originalSystemProperties = originalSystemProperties;
1291     }
1292 
1293     public Properties getInternalSystemProperties()
1294     {
1295         return internalSystemProperties;
1296     }
1297 
1298     public void setInternalSystemProperties( Properties internalSystemProperties )
1299     {
1300         this.internalSystemProperties = internalSystemProperties;
1301     }
1302 
1303     public boolean isDisableXmlReport()
1304     {
1305         return disableXmlReport;
1306     }
1307 
1308     public void setDisableXmlReport( boolean disableXmlReport )
1309     {
1310         this.disableXmlReport = disableXmlReport;
1311     }
1312 
1313     public boolean isUseSystemClassLoader()
1314     {
1315         return useSystemClassLoader;
1316     }
1317 
1318     public void setUseSystemClassLoader( boolean useSystemClassLoader )
1319     {
1320         this.useSystemClassLoader = useSystemClassLoader;
1321     }
1322 
1323     public boolean isUseManifestOnlyJar()
1324     {
1325         return useManifestOnlyJar;
1326     }
1327 
1328     public void setUseManifestOnlyJar( boolean useManifestOnlyJar )
1329     {
1330         this.useManifestOnlyJar = useManifestOnlyJar;
1331     }
1332 
1333     public boolean isEnableAssertions()
1334     {
1335         return enableAssertions;
1336     }
1337 
1338     public void setEnableAssertions( boolean enableAssertions )
1339     {
1340         this.enableAssertions = enableAssertions;
1341     }
1342 
1343     public MavenSession getSession()
1344     {
1345         return session;
1346     }
1347 
1348     public void setSession( MavenSession session )
1349     {
1350         this.session = session;
1351     }
1352 
1353     public String getObjectFactory()
1354     {
1355         return objectFactory;
1356     }
1357 
1358     public void setObjectFactory( String objectFactory )
1359     {
1360         this.objectFactory = objectFactory;
1361     }
1362 
1363     public ToolchainManager getToolchainManager()
1364     {
1365         return toolchainManager;
1366     }
1367 
1368     public void setToolchainManager( ToolchainManager toolchainManager )
1369     {
1370         this.toolchainManager = toolchainManager;
1371     }
1372 
1373     // the following will be refactored out once the common code is all in one place
1374 
1375     public boolean isTestFailureIgnore()
1376     {
1377         return true; // ignore
1378     }
1379 
1380     public void setTestFailureIgnore( boolean testFailureIgnore )
1381     {
1382         // ignore
1383     }
1384 
1385     public boolean isMavenParallel()
1386     {
1387         return parallelMavenExecution != null && parallelMavenExecution.booleanValue();
1388     }
1389 
1390     public String getRunOrder()
1391     {
1392         return runOrder;
1393     }
1394 
1395     public void setRunOrder( String runOrder )
1396     {
1397         this.runOrder = runOrder;
1398     }
1399 
1400     protected void addPluginSpecificChecksumItems( ChecksumCalculator checksum )
1401     {
1402         checksum.add( skipITs );
1403         checksum.add( summaryFile );
1404     }
1405 
1406 }