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