1   package org.apache.maven.surefire.its;
2   
3   
4   import junit.framework.TestCase;
5   import org.apache.maven.it.Verifier;
6   import org.apache.maven.it.util.ResourceExtractor;
7   
8   import java.io.File;
9   import java.util.ArrayList;
10  import java.util.List;
11  
12  /**
13   * Test report aggregation
14   * 
15   * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
16   * 
17   */
18  public class AggregateReportTest
19      extends TestCase
20  {
21      public void testAggregateReport ()
22          throws Exception
23      {
24          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/aggregate-report" );
25  
26          Verifier verifier = new Verifier( testDir.getAbsolutePath() );
27          List goals = new ArrayList();
28          goals.add( "jxr:test-jxr" );
29          goals.add( "surefire-report:report" );
30          verifier.executeGoals( goals );
31          //DGF even though the build will succeed, the log will contain errors (from the failure)
32          //verifier.verifyErrorFreeLog();
33          verifier.resetStreams();
34          
35          File surefireReportHtml = new File( testDir, "target/site/surefire-report.html");
36          assertTrue( "surefire report missing: " + surefireReportHtml.getAbsolutePath(), surefireReportHtml.exists() );
37          
38          // TODO HtmlUnit tests on the surefire report
39          
40          File[] testDirs = new File[2];
41          testDirs[0] = new File( testDir, "child1" );
42          testDirs[1] = new File( testDir, "child2" );
43          ITSuiteResults suite = HelperAssertions.parseTestResults( testDirs );
44          HelperAssertions.assertTestSuiteResults( 2, 0, 1, 0, suite );        
45      }
46  }