Skip to content

Commit ea0d137

Browse files
author
Changjian Wang
committed
Exclude generated Sample integration tests from JaCoCo coverage
The auto-generated Sample*Test.java files are integration tests that require real Azure credentials to run. In CI/CD pipelines without credentials, these tests are skipped, which causes JaCoCo coverage checks to fail (0% coverage). Solution: Exclude the Sample*Test.class files from JaCoCo coverage reporting, since they are environment-specific integration tests and cannot be accurately measured in all CI/CD environments. This allows the coverage checks to pass while still maintaining proper coverage of the actual library code.
1 parent e5d7a9a commit ea0d137

File tree

1 file changed

+16
-0
lines changed
  • sdk/contentunderstanding/azure-ai-contentunderstanding

1 file changed

+16
-0
lines changed

sdk/contentunderstanding/azure-ai-contentunderstanding/pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
<jacoco.min.branchcoverage>0.30</jacoco.min.branchcoverage>
4848
<!-- Exclude generated sample files from Checkstyle validation -->
4949
<checkstyle.excludes>**/generated/Sample*Test.java,**/samples/Sample*.java</checkstyle.excludes>
50+
<!-- Exclude generated sample test files from JaCoCo coverage (they are integration tests requiring credentials) -->
51+
<jacoco.maven.plugin.excludes>**/generated/Sample*Test.class</jacoco.maven.plugin.excludes>
5052
</properties>
5153
<dependencies>
5254
<dependency>
@@ -72,4 +74,18 @@
7274
<scope>test</scope>
7375
</dependency>
7476
</dependencies>
77+
78+
<build>
79+
<plugins>
80+
<plugin>
81+
<groupId>org.jacoco</groupId>
82+
<artifactId>jacoco-maven-plugin</artifactId>
83+
<configuration>
84+
<excludes>
85+
<exclude>${jacoco.maven.plugin.excludes}</exclude>
86+
</excludes>
87+
</configuration>
88+
</plugin>
89+
</plugins>
90+
</build>
7591
</project>

0 commit comments

Comments
 (0)