Package org.apache.maven.plugin.failsafe
Class VerifyMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugin.failsafe.VerifyMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
,SurefireReportParameters
@Mojo(name="verify", defaultPhase=VERIFY, requiresProject=true, threadSafe=true) public class VerifyMojo extends org.apache.maven.plugin.AbstractMojo implements SurefireReportParameters
Verify integration tests ran using Surefire.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File
basedir
The base directory of the project being tested.private java.util.Collection<CommandLineOption>
cli
private PluginConsoleLogger
consoleLogger
private java.lang.String
encoding
Deprecated.since of 2.20.1private boolean
failIfNoTests
Set this to "true" to cause a failure if there are no tests to run.private int
failOnFlakeCount
Set this to a value greater than 0 to fail the whole test set if the cumulative number of flakes reaches this threshold.private org.codehaus.plexus.logging.Logger
logger
private java.io.File
reportsDirectory
Base directory where all reports are written to.private org.apache.maven.execution.MavenSession
session
The current build session instance.private boolean
skip
Set this to 'true' to bypass unit tests entirely.private boolean
skipExec
Deprecated.Use -DskipTests instead.private boolean
skipITs
Set this to 'true' to skip running integration tests, but still compile them.private boolean
skipTests
Set this to 'true' to skip running tests, but still compile them.private java.io.File
summaryFile
The summary file to read integration test results from.private java.io.File[]
summaryFiles
Additional summary files to read integration test results from.private java.io.File
testClassesDirectory
The directory containing generated test classes of the project being tested.private boolean
testFailureIgnore
Set this to true to ignore a failure during testing.
-
Constructor Summary
Constructors Constructor Description VerifyMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private java.util.Collection<CommandLineOption>
commandLineOptions()
void
execute()
private boolean
existsSummary()
private boolean
existsSummaryFile()
private boolean
existsSummaryFiles()
java.io.File
getBasedir()
private java.lang.Exception
getBooterForkException(RunResult summary)
private PluginConsoleLogger
getConsoleLogger()
protected java.lang.String[]
getDefaultIncludes()
boolean
getFailIfNoTests()
int
getFailOnFlakeCount()
protected java.lang.String
getPluginName()
java.io.File
getReportsDirectory()
org.apache.maven.execution.MavenSession
getSession()
java.io.File
getSummaryFile()
java.io.File
getTestClassesDirectory()
boolean
isSkip()
boolean
isSkipExec()
Deprecated.boolean
isSkipITs()
boolean
isSkipTests()
boolean
isTestFailureIgnore()
private void
logDebugOrCliShowErrors(java.lang.String s)
private RunResult
readSummary(java.io.File summaryFile)
void
setBasedir(java.io.File basedir)
void
setFailIfNoTests(boolean failIfNoTests)
void
setFailOnFlakeCount(int failOnFlakeCount)
(package private) void
setLogger(org.codehaus.plexus.logging.Logger logger)
void
setReportsDirectory(java.io.File reportsDirectory)
void
setSession(org.apache.maven.execution.MavenSession session)
void
setSkip(boolean skip)
void
setSkipExec(boolean skipExec)
Deprecated.void
setSkipITs(boolean skipITs)
void
setSkipTests(boolean skipTests)
void
setSummaryFile(java.io.File summaryFile)
void
setTestClassesDirectory(java.io.File testClassesDirectory)
void
setTestFailureIgnore(boolean testFailureIgnore)
protected boolean
verifyParameters()
-
-
-
Field Detail
-
skipTests
@Parameter(property="skipTests") private boolean skipTests
Set this to 'true' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.- Since:
- 2.4
-
skipITs
@Parameter(property="skipITs") private boolean skipITs
Set this to 'true' to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.- Since:
- 2.4.3-alpha-2
-
skipExec
@Deprecated @Parameter(property="maven.test.skip.exec") private boolean skipExec
Deprecated.Use -DskipTests instead.This old parameter is just like skipTests, but bound to the old property maven.test.skip.exec.- Since:
- 2.3
-
skip
@Parameter(property="maven.test.skip", defaultValue="false") private boolean skip
Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you enable it using the "maven.test.skip" property, because maven.test.skip disables both running the tests and compiling the tests. Consider using the skipTests parameter instead.
-
testFailureIgnore
@Parameter(property="maven.test.failure.ignore", defaultValue="false") private boolean testFailureIgnore
Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
-
basedir
@Parameter(defaultValue="${basedir}") private java.io.File basedir
The base directory of the project being tested. This can be obtained in your unit test by System.getProperty("basedir").
-
testClassesDirectory
@Parameter(defaultValue="${project.build.testOutputDirectory}") private java.io.File testClassesDirectory
The directory containing generated test classes of the project being tested. This will be included at the beginning the test classpath.
-
reportsDirectory
@Parameter(defaultValue="${project.build.directory}/failsafe-reports") private java.io.File reportsDirectory
Base directory where all reports are written to.
-
summaryFile
@Parameter(defaultValue="${project.build.directory}/failsafe-reports/failsafe-summary.xml", required=true) private java.io.File summaryFile
The summary file to read integration test results from.
-
summaryFiles
@Parameter private java.io.File[] summaryFiles
Additional summary files to read integration test results from.- Since:
- 2.6
-
failIfNoTests
@Parameter(property="failIfNoTests", defaultValue="false") private boolean failIfNoTests
Set this to "true" to cause a failure if there are no tests to run. Defaults to "false".- Since:
- 2.4
-
failOnFlakeCount
@Parameter(property="failsafe.failOnFlakeCount", defaultValue="0") private int failOnFlakeCount
Set this to a value greater than 0 to fail the whole test set if the cumulative number of flakes reaches this threshold. Set to 0 to allow an unlimited number of flakes.- Since:
- 3.0.0-M6
-
encoding
@Parameter(property="encoding", defaultValue="${project.reporting.outputEncoding}") private java.lang.String encoding
Deprecated.since of 2.20.1The character encoding scheme to be applied. Deprecated since 2.20.1 and used encoding UTF-8 infailsafe-summary.xml
.
-
session
@Parameter(defaultValue="${session}", readonly=true) private org.apache.maven.execution.MavenSession session
The current build session instance.
-
logger
@Component private org.codehaus.plexus.logging.Logger logger
-
cli
private java.util.Collection<CommandLineOption> cli
-
consoleLogger
private volatile PluginConsoleLogger consoleLogger
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Specified by:
execute
in interfaceorg.apache.maven.plugin.Mojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
getBooterForkException
private java.lang.Exception getBooterForkException(RunResult summary)
-
setLogger
void setLogger(org.codehaus.plexus.logging.Logger logger)
-
getConsoleLogger
private PluginConsoleLogger getConsoleLogger()
-
readSummary
private RunResult readSummary(java.io.File summaryFile) throws java.lang.Exception
- Throws:
java.lang.Exception
-
verifyParameters
protected boolean verifyParameters() throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
getPluginName
protected java.lang.String getPluginName()
-
getDefaultIncludes
protected java.lang.String[] getDefaultIncludes()
-
isSkipTests
public boolean isSkipTests()
- Specified by:
isSkipTests
in interfaceSurefireReportParameters
-
setSkipTests
public void setSkipTests(boolean skipTests)
- Specified by:
setSkipTests
in interfaceSurefireReportParameters
-
isSkipITs
public boolean isSkipITs()
-
setSkipITs
public void setSkipITs(boolean skipITs)
-
isSkipExec
@Deprecated public boolean isSkipExec()
Deprecated.- Specified by:
isSkipExec
in interfaceSurefireReportParameters
-
setSkipExec
@Deprecated public void setSkipExec(boolean skipExec)
Deprecated.- Specified by:
setSkipExec
in interfaceSurefireReportParameters
-
isSkip
public boolean isSkip()
- Specified by:
isSkip
in interfaceSurefireReportParameters
-
setSkip
public void setSkip(boolean skip)
- Specified by:
setSkip
in interfaceSurefireReportParameters
-
isTestFailureIgnore
public boolean isTestFailureIgnore()
- Specified by:
isTestFailureIgnore
in interfaceSurefireReportParameters
-
setTestFailureIgnore
public void setTestFailureIgnore(boolean testFailureIgnore)
- Specified by:
setTestFailureIgnore
in interfaceSurefireReportParameters
-
getBasedir
public java.io.File getBasedir()
- Specified by:
getBasedir
in interfaceSurefireReportParameters
-
setBasedir
public void setBasedir(java.io.File basedir)
- Specified by:
setBasedir
in interfaceSurefireReportParameters
-
getTestClassesDirectory
public java.io.File getTestClassesDirectory()
- Specified by:
getTestClassesDirectory
in interfaceSurefireReportParameters
-
setTestClassesDirectory
public void setTestClassesDirectory(java.io.File testClassesDirectory)
- Specified by:
setTestClassesDirectory
in interfaceSurefireReportParameters
-
getReportsDirectory
public java.io.File getReportsDirectory()
- Specified by:
getReportsDirectory
in interfaceSurefireReportParameters
-
setReportsDirectory
public void setReportsDirectory(java.io.File reportsDirectory)
- Specified by:
setReportsDirectory
in interfaceSurefireReportParameters
-
getSummaryFile
public java.io.File getSummaryFile()
-
setSummaryFile
public void setSummaryFile(java.io.File summaryFile)
-
getFailIfNoTests
public boolean getFailIfNoTests()
- Specified by:
getFailIfNoTests
in interfaceSurefireReportParameters
-
setFailIfNoTests
public void setFailIfNoTests(boolean failIfNoTests)
- Specified by:
setFailIfNoTests
in interfaceSurefireReportParameters
-
getFailOnFlakeCount
public int getFailOnFlakeCount()
- Specified by:
getFailOnFlakeCount
in interfaceSurefireReportParameters
-
setFailOnFlakeCount
public void setFailOnFlakeCount(int failOnFlakeCount)
- Specified by:
setFailOnFlakeCount
in interfaceSurefireReportParameters
-
getSession
public org.apache.maven.execution.MavenSession getSession()
-
setSession
public void setSession(org.apache.maven.execution.MavenSession session)
-
existsSummaryFile
private boolean existsSummaryFile()
-
existsSummaryFiles
private boolean existsSummaryFiles()
-
existsSummary
private boolean existsSummary()
-
commandLineOptions
private java.util.Collection<CommandLineOption> commandLineOptions()
-
logDebugOrCliShowErrors
private void logDebugOrCliShowErrors(java.lang.String s)
-
-