View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.surefire.its.jiras;
20  
21  import org.apache.maven.surefire.its.fixture.OutputValidator;
22  import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
23  import org.apache.maven.surefire.its.fixture.SurefireLauncher;
24  import org.apache.maven.surefire.its.fixture.TestFile;
25  import org.junit.Test;
26  
27  /**
28   * Test Surefire-570 Multiple report directories
29   *
30   * @author Kristian Rosenvold
31   */
32  public class Surefire570MultipleReportDirectoriesIT extends SurefireJUnit4IntegrationTestCase {
33  
34      @Test
35      public void testReportWithAggregate() {
36  
37          SurefireLauncher surefireLauncher = unpack().failNever();
38          surefireLauncher.executeTest();
39          surefireLauncher.addGoal("-Daggregate=true");
40          OutputValidator validator = surefireLauncher.executeSurefireReport();
41          TestFile siteFile = validator.getSiteFile("surefire-report.html");
42          siteFile.assertContainsText("MyModule1ClassTest");
43          siteFile.assertContainsText("MyModule2ClassTest");
44          siteFile.assertContainsText("MyDummyClassM1Test");
45      }
46  
47      @Test
48      public void testReportWithoutAggregate() throws Exception {
49          SurefireLauncher surefireLauncher = unpack().failNever();
50          surefireLauncher.executeTest();
51          surefireLauncher.reset();
52          surefireLauncher.executeSurefireReport();
53          OutputValidator module1 = surefireLauncher.getSubProjectValidator("module1");
54          TestFile siteFile = module1.getSiteFile("surefire-report.html");
55          siteFile.assertContainsText("MyModule1ClassTest");
56          siteFile.assertContainsText("MyDummyClassM1Test");
57      }
58  
59      public SurefireLauncher unpack() {
60          return unpack("/surefire-570-multipleReportDirectories");
61      }
62  }