xref: /aosp_15_r20/external/jacoco/jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh (revision 7e63c1270baf9bfa84f5b6aecf17bd0c1a75af94)
1/*******************************************************************************
2 * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
3 * This program and the accompanying materials are made available under
4 * the terms of the Eclipse Public License 2.0 which is available at
5 * http://www.eclipse.org/legal/epl-2.0
6 *
7 * SPDX-License-Identifier: EPL-2.0
8 *
9 * Contributors:
10 *    Evgeny Mandrikov - initial API and implementation
11 *
12 *******************************************************************************/
13import java.io.*;
14import org.codehaus.plexus.util.*;
15
16String projectReportsPage = FileUtils.fileRead( new File( basedir, "target/site/project-reports.html" ) );
17if ( projectReportsPage.indexOf( "JaCoCo Coverage Report." ) < 0 ) {
18    throw new RuntimeException( "project-reports.html does not contain link to JaCoCo report" );
19}
20
21File htmlReportFile = new File( basedir, "target/site/jacoco/index.html" );
22if ( !htmlReportFile.isFile() ) {
23    throw new RuntimeException( "HTML report was not created" );
24}
25
26File xmlReportFile = new File( basedir, "target/site/jacoco/jacoco.xml" );
27if ( !xmlReportFile.isFile() ) {
28    throw new RuntimeException( "XML report was not created" );
29}
30
31File csvReportFile = new File( basedir, "target/site/jacoco/jacoco.csv" );
32if ( !csvReportFile.isFile() ) {
33    throw new RuntimeException( "CSV report was not created" );
34}
35
36if ( projectReportsPage.indexOf( "JaCoCo IT Coverage Report." ) < 0 ) {
37    throw new RuntimeException( "project-reports.html does not contain link to JaCoCo Integration report" );
38}
39
40File htmlReportFile = new File( basedir, "target/site/jacoco-it/index.html" );
41if ( !htmlReportFile.isFile() ) {
42    throw new RuntimeException( "Integration HTML report was not created" );
43}
44
45File xmlReportFile = new File( basedir, "target/site/jacoco-it/jacoco.xml" );
46if ( !xmlReportFile.isFile() ) {
47    throw new RuntimeException( "Integration XML report was not created" );
48}
49
50File csvReportFile = new File( basedir, "target/site/jacoco-it/jacoco.csv" );
51if ( !csvReportFile.isFile() ) {
52    throw new RuntimeException( "Integration CSV report was not created" );
53}
54