mirror of https://github.com/apache/maven.git
PR: MNG-978, 979, 964
Submitted by: Johnny R. Ruiz III Reviewed by: Brett Porter added parameters printSummary, reportFormat, and useFile to configure the reporting format. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@293194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c5acaded88
commit
5c48727b18
|
@ -142,6 +142,30 @@ public class SurefirePlugin
|
||||||
*/
|
*/
|
||||||
private List pluginArtifacts;
|
private List pluginArtifacts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option to print summary of test suites or just print the test cases that has errors.
|
||||||
|
*
|
||||||
|
* @parameter expression="${surefire.printSummary}"
|
||||||
|
* default-value="true"
|
||||||
|
*/
|
||||||
|
private boolean printSummary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the formatting for the test report to be generated. Can be set as brief, plain, or xml.
|
||||||
|
*
|
||||||
|
* @parameter expression="${surefire.reportFormat}"
|
||||||
|
* default-value="brief"
|
||||||
|
*/
|
||||||
|
private String reportFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option to generate a file test report or just output the test report to the console.
|
||||||
|
*
|
||||||
|
* @parameter expression="${surefire.useFile}"
|
||||||
|
* default-value="true"
|
||||||
|
*/
|
||||||
|
private boolean useFile;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
|
@ -253,12 +277,7 @@ public class SurefirePlugin
|
||||||
surefireBooter.addClassPathUrl( artifact.getFile().getAbsolutePath() );
|
surefireBooter.addClassPathUrl( artifact.getFile().getAbsolutePath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
surefireBooter.addReport( "org.codehaus.surefire.report.ConsoleReporter" );
|
addReporters(surefireBooter);
|
||||||
|
|
||||||
surefireBooter.addReport( "org.codehaus.surefire.report.FileReporter" );
|
|
||||||
|
|
||||||
surefireBooter.addReport( "org.codehaus.surefire.report.XMLReporter");
|
|
||||||
|
|
||||||
|
|
||||||
boolean success;
|
boolean success;
|
||||||
|
|
||||||
|
@ -345,4 +364,48 @@ public class SurefirePlugin
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> Adds Reporters that will generate reports with different formatting.
|
||||||
|
* <p> The Reporter that will be added will be based on the value of the parameter
|
||||||
|
* useFile, reportFormat, and printSummary.
|
||||||
|
*
|
||||||
|
* @param surefireBooter The surefire booter that will run tests.
|
||||||
|
*/
|
||||||
|
private void addReporters(SurefireBooter surefireBooter)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( useFile )
|
||||||
|
{
|
||||||
|
if ( printSummary )
|
||||||
|
{
|
||||||
|
surefireBooter.addReport( "org.codehaus.surefire.report.ConsoleReporter" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
surefireBooter.addReport( "org.codehaus.surefire.report.SummaryConsoleReporter" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( reportFormat.equals( "brief" ) )
|
||||||
|
{
|
||||||
|
surefireBooter.addReport( "org.codehaus.surefire.report.BriefFileReporter" );
|
||||||
|
}
|
||||||
|
else if ( reportFormat.equals( "plain" ) )
|
||||||
|
{
|
||||||
|
surefireBooter.addReport( "org.codehaus.surefire.report.FileReporter" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( reportFormat.equals( "brief" ) )
|
||||||
|
{
|
||||||
|
surefireBooter.addReport( "org.codehaus.surefire.report.BriefConsoleReporter" );
|
||||||
|
}
|
||||||
|
else if ( reportFormat.equals( "plain" ) )
|
||||||
|
{
|
||||||
|
surefireBooter.addReport( "org.codehaus.surefire.report.DetailedConsoleReporter" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
surefireBooter.addReport( "org.codehaus.surefire.report.XMLReporter" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue