Skip to content

Commit b271085

Browse files
test: add JaCoCo coverage + 83% line gate, raise coverage to ~85%
The SDK had no coverage instrumentation. The existing SdkTest aborts at @BeforeAll without a live Firefox, so almost no logic was measured (~33% floor). This adds JaCoCo (prepare-agent + report + check) and a new mock/HTTP-based PercyLogicTest (43 tests) that covers the SDK logic without a browser, lifting non-driver line coverage to ~84.7% (the CI browser run reaches ~87.8%). Gate: jacoco:check bound to the test phase, LINE minimum 0.83 — the honest floor for the unit-testable logic. The remaining uncovered lines are live-WebDriver-only (the JS-execution/cookie body of snapshot(), changeWindowDimensionAndWait CDP/resize, processFrame iframe recovery, the responsive-capture sleep) and are exercised by SdkTest on the browser CI (MOZ_HEADLESS=1 npx percy exec -- mvn test). PercyLogicTest covers: createRegion variants, snapshot/screenshot dispatch + guards, web DOM post + automate session metadata + region element conversion, responsive width-config HTTP, readiness config + waitForReady disabled paths, getSerializedDOM (cookies, cross-origin iframe, readiness diagnostics), healthcheck branches, log, Environment, setClientInfo, DriverMetadata + Cache. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 53a64df commit b271085

2 files changed

Lines changed: 1081 additions & 0 deletions

File tree

pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,51 @@
184184
<useSystemClassLoader>false</useSystemClassLoader>
185185
</configuration>
186186
</plugin>
187+
<plugin>
188+
<groupId>org.jacoco</groupId>
189+
<artifactId>jacoco-maven-plugin</artifactId>
190+
<version>0.8.12</version>
191+
<executions>
192+
<execution>
193+
<id>prepare-agent</id>
194+
<goals>
195+
<goal>prepare-agent</goal>
196+
</goals>
197+
</execution>
198+
<execution>
199+
<id>report</id>
200+
<phase>test</phase>
201+
<goals>
202+
<goal>report</goal>
203+
</goals>
204+
</execution>
205+
<execution>
206+
<id>check</id>
207+
<phase>test</phase>
208+
<goals>
209+
<goal>check</goal>
210+
</goals>
211+
<configuration>
212+
<rules>
213+
<rule>
214+
<element>BUNDLE</element>
215+
<limits>
216+
<limit>
217+
<counter>LINE</counter>
218+
<value>COVEREDRATIO</value>
219+
<!-- Honest floor for the unit-testable (non-driver) logic.
220+
The live-WebDriver paths in SdkTest add headroom to
221+
~0.88 on the browser CI, but the deterministic
222+
mock/HTTP-covered logic alone clears 0.83. -->
223+
<minimum>0.83</minimum>
224+
</limit>
225+
</limits>
226+
</rule>
227+
</rules>
228+
</configuration>
229+
</execution>
230+
</executions>
231+
</plugin>
187232
<plugin>
188233
<artifactId>maven-jar-plugin</artifactId>
189234
<version>3.3.0</version>

0 commit comments

Comments
 (0)