public void addReport( String report ) { addReport( report, null ); }
private void addArtifact(final SurefireBooter surefireBooter, final Artifact surefireArtifact) throws ArtifactNotFoundException, ArtifactResolutionException { final ArtifactResolutionResult result = resolveArtifact(null, surefireArtifact); for (final Object element : result.getArtifacts()) { final Artifact artifact = (Artifact) element; getLog().debug("Adding to surefire booter test classpath: " + artifact.getFile().getAbsolutePath()); surefireBooter.addSurefireBootClassPathUrl(artifact.getFile().getAbsolutePath()); } }
setSystemProperties( new File( args[1] ) ); Properties p = loadProperties( surefirePropertiesFile ); SurefireBooter surefireBooter = new SurefireBooter( true ); surefireBooter.setForkConfiguration( forkConfiguration ); surefireBooter.addReport( className, constructParamObjects( params, types ) ); surefireBooter.addTestSuite( className, constructParamObjects( params, types ) ); surefireBooter.addSurefireBootClassPathUrl( p.getProperty( name ) ); surefireBooter.setFailIfNoTests( value ); surefireBooter.addClassPathUrl( url ); surefireBooter.addSurefireClassPathUrl( url ); if ( testSet != null ) result = surefireBooter.runSuitesInProcess( testSet, p ); result = surefireBooter.runSuitesInProcess(); surefireBooter.writePropertiesFile( surefirePropertiesFile, "surefire", p );
private SurefireBooter constructSurefireBooter() throws MojoExecutionException, MojoFailureException { final SurefireBooter surefireBooter = new SurefireBooter(); surefireBooter.addTestSuite("org.apache.maven.surefire.testng.TestNGXmlTestSuite", new Object[] { this.suiteXmlFiles, this.testSourceDirectory.getAbsolutePath(), testNgArtifact.getBaseVersion(), testNgArtifact.getClassifier(), this.properties, this.reportsDirectory surefireBooter.addTestSuite("org.apache.maven.surefire.testng.TestNGDirectoryTestSuite", new Object[] { this.testClassesDirectory, includeList, excludeList, this.testSourceDirectory.getAbsolutePath(), testNgArtifact.getBaseVersion(), testNgArtifact.getClassifier(), this.properties, this.reportsDirectory surefireBooter.addTestSuite(junitDirectoryTestSuite, new Object[] { this.testClassesDirectory, includeList, excludeList }); surefireBooter.addClassPathUrl(classpathElement); surefireBooter.addClassPathUrl(classpathElement); surefireBooter.addClassPathUrl(narFile); surefireBooter.setFailIfNoTests(this.failIfNoTests == null ? false : this.failIfNoTests.booleanValue()); surefireBooter.setForkedProcessTimeoutInSeconds(this.forkedProcessTimeoutInSeconds); surefireBooter.setRedirectTestOutputToFile(this.redirectTestOutputToFile); surefireBooter.setForkConfiguration(fork); surefireBooter.setChildDelegation(this.childDelegation);
private void addProvider(final SurefireBooter surefireBooter, final String provider, final String version, final Artifact filteredArtifact) throws ArtifactNotFoundException, ArtifactResolutionException { final Artifact providerArtifact = this.artifactFactory.createDependencyArtifact("org.apache.maven.surefire", provider, VersionRange.createFromVersion(version), "jar", null, Artifact.SCOPE_TEST); final ArtifactResolutionResult result = resolveArtifact(filteredArtifact, providerArtifact); for (final Object element : result.getArtifacts()) { final Artifact artifact = (Artifact) element; getLog().debug("Adding to surefire test classpath: " + artifact.getFile().getAbsolutePath()); surefireBooter.addSurefireClassPathUrl(artifact.getFile().getAbsolutePath()); } }
SurefireBooter surefireBooter = new SurefireBooter(); surefireBooter.addTestSuite( "org.apache.maven.surefire.testng.TestNGXmlTestSuite", new Object[]{ getSuiteXmlFiles(), getTestSourceDirectory().getAbsolutePath(), testNgArtifact.getVersion(), testNgArtifact.getClassifier(), surefireBooter.addTestSuite( "org.apache.maven.surefire.testng.TestNGDirectoryTestSuite", new Object[]{ getTestClassesDirectory(), includes, excludes, getTestSourceDirectory().getAbsolutePath(), testNgArtifact.getVersion(), surefireBooter.addTestSuite( junitDirectoryTestSuite, new Object[]{ getTestClassesDirectory(), includes, excludes, getProperties() } ); surefireBooter.addTestSuite( junitDirectoryTestSuite, new Object[]{ getTestClassesDirectory(), includes, excludes} ); surefireBooter.addClassPathUrl( classpathElement ); surefireBooter.setFailIfNoTests( getFailIfNoTests() == null ? false : getFailIfNoTests().booleanValue() ); surefireBooter.setForkedProcessTimeoutInSeconds( getForkedProcessTimeoutInSeconds() ); surefireBooter.setRedirectTestOutputToFile( isRedirectTestOutputToFile() ); surefireBooter.setForkConfiguration( fork ); surefireBooter.setChildDelegation( isChildDelegation() );
private void addProvider( SurefireBooter surefireBooter, String provider, String version, Artifact filteredArtifact ) throws ArtifactNotFoundException, ArtifactResolutionException { Artifact providerArtifact = getArtifactFactory().createDependencyArtifact( "org.apache.maven.surefire", provider, VersionRange.createFromVersion( version ), "jar", null, Artifact.SCOPE_TEST ); ArtifactResolutionResult result = resolveArtifact( filteredArtifact, providerArtifact ); for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); ) { Artifact artifact = (Artifact) i.next(); getLog().debug( "Adding to " + getPluginName() + " test classpath: " + artifact.getFile().getAbsolutePath() + " Scope: " + artifact.getScope() ); surefireBooter.addSurefireClassPathUrl( artifact.getFile().getAbsolutePath() ); } }
if (this.printSummary) { if (forking) { surefireBooter.addReport(ForkingConsoleReporter.class.getName(), new Object[] { trimStackTrace }); } else { surefireBooter.addReport(ConsoleReporter.class.getName(), new Object[] { trimStackTrace }); surefireBooter.addReport(BriefFileReporter.class.getName(), new Object[] { this.reportsDirectory, trimStackTrace }); } else if (PLAIN_REPORT_FORMAT.equals(this.reportFormat)) { surefireBooter.addReport(FileReporter.class.getName(), new Object[] { this.reportsDirectory, trimStackTrace }); surefireBooter.addReport(BriefConsoleReporter.class.getName(), new Object[] { trimStackTrace }); } else if (PLAIN_REPORT_FORMAT.equals(this.reportFormat)) { surefireBooter.addReport(DetailedConsoleReporter.class.getName(), new Object[] { trimStackTrace }); surefireBooter.addReport(XMLReporter.class.getName(), new Object[] { this.reportsDirectory, trimStackTrace });
private void addArtifact( SurefireBooter surefireBooter, Artifact surefireArtifact ) throws ArtifactNotFoundException, ArtifactResolutionException { ArtifactResolutionResult result = resolveArtifact( null, surefireArtifact ); for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); ) { Artifact artifact = (Artifact) i.next(); getLog().debug( "Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath() + " Scope: " + artifact.getScope() ); surefireBooter.addSurefireBootClassPathUrl( artifact.getFile().getAbsolutePath() ); } }
surefireBooter.addReport( ForkingConsoleReporter.class.getName(), new Object[]{trimStackTrace} ); surefireBooter.addReport( ConsoleReporter.class.getName(), new Object[]{trimStackTrace} ); surefireBooter.addReport( BriefFileReporter.class.getName(), new Object[]{ getReportsDirectory(), trimStackTrace} ); surefireBooter.addReport( FileReporter.class.getName(), new Object[]{ getReportsDirectory(), trimStackTrace} ); surefireBooter.addReport( BriefConsoleReporter.class.getName(), new Object[]{trimStackTrace} ); surefireBooter.addReport( DetailedConsoleReporter.class.getName(), new Object[]{trimStackTrace} ); surefireBooter.addReport( XMLReporter.class.getName(), new Object[]{ getReportsDirectory(), trimStackTrace} );