|
42 | 42 | <!-- Directory where the copilot-sdk repo will be cloned for tests --> |
43 | 43 | <copilot.sdk.clone.dir>${project.build.directory}/copilot-sdk</copilot.sdk.clone.dir> |
44 | 44 | <copilot.tests.dir>${copilot.sdk.clone.dir}/test</copilot.tests.dir> |
| 45 | + <!-- Test coverage output locations --> |
| 46 | + <coverage.reports.dir>${project.build.directory}/coverage-reports</coverage.reports.dir> |
45 | 47 | </properties> |
46 | 48 |
|
47 | 49 | <dependencies> |
|
212 | 214 | <artifactId>maven-surefire-plugin</artifactId> |
213 | 215 | <version>3.5.4</version> |
214 | 216 | <configuration> |
| 217 | + <!-- Inject JaCoCo agent for coverage collection during test runs --> |
| 218 | + <argLine>${testExecutionAgentArgs}</argLine> |
215 | 219 | <systemPropertyVariables> |
216 | 220 | <copilot.tests.dir>${copilot.tests.dir}</copilot.tests.dir> |
217 | 221 | <copilot.sdk.dir>${copilot.sdk.clone.dir}</copilot.sdk.dir> |
|
237 | 241 | </java> |
238 | 242 | </configuration> |
239 | 243 | </plugin> |
| 244 | + <!-- Coverage tracking for CopilotClient/CopilotSession interactions with CLI --> |
| 245 | + <plugin> |
| 246 | + <groupId>org.jacoco</groupId> |
| 247 | + <artifactId>jacoco-maven-plugin</artifactId> |
| 248 | + <version>0.8.12</version> |
| 249 | + <executions> |
| 250 | + <!-- Instrument bytecode before E2ETestContext runs tests with CapiProxy --> |
| 251 | + <execution> |
| 252 | + <id>wire-up-coverage-instrumentation</id> |
| 253 | + <goals> |
| 254 | + <goal>prepare-agent</goal> |
| 255 | + </goals> |
| 256 | + <configuration> |
| 257 | + <!-- Store exec file alongside other build artifacts --> |
| 258 | + <destFile>${project.build.directory}/jacoco-test-results/sdk-tests.exec</destFile> |
| 259 | + <!-- Pass agent args via this property to surefire --> |
| 260 | + <propertyName>testExecutionAgentArgs</propertyName> |
| 261 | + <!-- Focus on SDK package, exclude test harness utilities --> |
| 262 | + <includes> |
| 263 | + <include>com/github/copilot/sdk/**</include> |
| 264 | + </includes> |
| 265 | + <excludes> |
| 266 | + <exclude>com/github/copilot/sdk/E2ETestContext*</exclude> |
| 267 | + <exclude>com/github/copilot/sdk/CapiProxy*</exclude> |
| 268 | + </excludes> |
| 269 | + </configuration> |
| 270 | + </execution> |
| 271 | + <!-- Generate HTML/XML reports after tests complete --> |
| 272 | + <execution> |
| 273 | + <id>build-coverage-report-from-tests</id> |
| 274 | + <goals> |
| 275 | + <goal>report</goal> |
| 276 | + </goals> |
| 277 | + <phase>verify</phase> |
| 278 | + <configuration> |
| 279 | + <dataFile>${project.build.directory}/jacoco-test-results/sdk-tests.exec</dataFile> |
| 280 | + <outputDirectory>${project.reporting.outputDirectory}/jacoco-coverage</outputDirectory> |
| 281 | + </configuration> |
| 282 | + </execution> |
| 283 | + </executions> |
| 284 | + </plugin> |
240 | 285 | <plugin> |
241 | 286 | <groupId>org.apache.maven.plugins</groupId> |
242 | 287 | <artifactId>maven-checkstyle-plugin</artifactId> |
|
366 | 411 | </reportSet> |
367 | 412 | </reportSets> |
368 | 413 | </plugin> |
| 414 | + <!-- Test coverage for CopilotClient, CopilotSession, JsonRpcClient and supporting classes --> |
| 415 | + <plugin> |
| 416 | + <groupId>org.jacoco</groupId> |
| 417 | + <artifactId>jacoco-maven-plugin</artifactId> |
| 418 | + <version>0.8.12</version> |
| 419 | + <reportSets> |
| 420 | + <reportSet> |
| 421 | + <reports> |
| 422 | + <report>report</report> |
| 423 | + </reports> |
| 424 | + </reportSet> |
| 425 | + </reportSets> |
| 426 | + </plugin> |
369 | 427 | </plugins> |
370 | 428 | </reporting> |
371 | 429 |
|
|
0 commit comments