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.junit.Test;
25  
26  /**
27   * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
28   * @see <a href="https://issues.apache.org/jira/browse/SUREFIRE-1490">SUREFIRE-1490</a>
29   * @since 3.0.0-M1
30   */
31  public class Surefire1490ReportTitleDescriptionIT extends SurefireJUnit4IntegrationTestCase {
32      @Test
33      public void shouldHaveDefaultReportTitleAndDescription() {
34          OutputValidator validator =
35                  prepare("default").addGoal("verify").execute("site").verifyErrorFreeLog();
36  
37          validator
38                  .getSiteFile("project-reports.html")
39                  .assertContainsText("Surefire")
40                  .assertContainsText("Report on the test results of the project.")
41                  .assertContainsText("Failsafe")
42                  .assertContainsText("Report on the integration test results of the project.");
43  
44          validator
45                  .getSiteFile("failsafe-report.html")
46                  .assertContainsText("Failsafe Report")
47                  .assertContainsText("Surefire1490IT");
48  
49          validator
50                  .getSiteFile("surefire-report.html")
51                  .assertContainsText("Surefire Report")
52                  .assertContainsText("Surefire1490Test");
53      }
54  
55      @Test
56      public void shouldHaveCustomizedReportTitleAndDescription() {
57          OutputValidator validator =
58                  prepare("custom").addGoal("verify").execute("site").verifyErrorFreeLog();
59  
60          validator
61                  .getSiteFile("project-reports.html")
62                  .assertContainsText("surefire name")
63                  .assertContainsText("surefire desc")
64                  .assertContainsText("failsafe name")
65                  .assertContainsText("failsafe desc");
66  
67          validator
68                  .getSiteFile("failsafe-report.html")
69                  .assertContainsText("failsafe title")
70                  .assertContainsText("Surefire1490IT");
71  
72          validator
73                  .getSiteFile("surefire-report.html")
74                  .assertContainsText("surefire title")
75                  .assertContainsText("Surefire1490Test");
76      }
77  
78      public SurefireLauncher prepare(String suffix) {
79          SurefireLauncher unpack = unpack("surefire-1490-" + suffix);
80          unpack.sysProp("user.language", "en").maven().execute("clean");
81          return unpack;
82      }
83  }