You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-11Lines changed: 50 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,24 +50,43 @@ Add the following dependency to your Maven project:
50
50
</dependencies>
51
51
```
52
52
53
-
When coverage agents are running in multi-user mode or tests execute in parallel, browser requests must include the current test's`Baggage` header so that coverage can be correctly associated with the executing test.
53
+
When coverage agents are running in multi-user mode or tests execute in parallel, browser requests must include an additional HTTP`Baggage` header so that coverage can be correctly associated with the executing test. See [Browser Integrations](#browser-integrations) for more detail.
54
54
55
-
The following example retrieves the current `Baggage` header, creates a proxy that injects the header into browser requests, and configures the Chrome driver to use that proxy.
55
+
The following example retrieves the current `Baggage` header and creates a proxy that injects the header into HTTP requests.
// run test HTTP traffic through the coverage proxy
68
+
} // implicitly close the proxy at the end of the try-with-resources block
67
69
```
68
70
69
71
For rare standalone use cases, such as tests launched from a `main` method, use `CoverageApiClient` from the API module to start and stop sessions and tests directly.
Create a coverage-integration.properties file to configure communication with CTP during the testing workflow. This file also provides the information needed to publish test results and coverage after all tests have completed.
Enable per-test coverage isolation for JUnit parallel test execution (-Djunit.jupiter.execution.parallel.enabled=true) by setting the following in the coverage-integration.properties file:
202
+
203
+
```properties
204
+
# Note: Requires Parasoft CTP version 2026.2 or later.
Add the Maven dependency for the TestNG coverage integration:
@@ -220,6 +248,13 @@ Add both listeners to your `testng.xml` file as shown below:
220
248
</suite>
221
249
```
222
250
251
+
Enable per-test coverage isolation for TestNG parallel test execution (parallel="tests") by setting the following in the coverage-integration.properties file:
252
+
253
+
```properties
254
+
# Note: Requires Parasoft CTP version 2026.2 or later.
The `coverage-integration-cucumber` module automatically reports Cucumber 7.x scenario execution and coverage to CTP. It manages the coverage session for the duration of the Cucumber test run and reports each scenario as an individual test case.
@@ -404,6 +439,10 @@ To set explicit headers instead, use `configureCdpHeaders(driver, headers)`.
404
439
405
440
Call `configureCdpBaggageHeader` separately for each Chrome or Edge browser session used by parallel tests. The proxy-based approach works with all supported browsers. CDP is an alternative available only for Chrome and Edge.
406
441
442
+
> [!NOTE]
443
+
> Cross-container Selenium Grid
444
+
> Coverage isolation in multi-user or parallel testing with cross-container Selenium grid takes extra care to configure. The `SeleniumCoverageIntegration.configureCdpBaggageHeader(driver)` approach above is recommended for Google Chrome and Microsoft Edge. However, the Parasoft coverage proxy used with Firefox only binds to the loopback address `127.0.0.1` by default. Use the `ParasoftHeaderInjectingProxy` constructor from the API to bind the proxy to a different host.
445
+
407
446
## Logging
408
447
409
448
This project uses SLF4J and includes only the `slf4j-api` dependency. It does not provide or configure a logging backend, so debug logging is not shown by default. Applications that use this library control logging through their own SLF4J backend, such as Logback, Log4j 2, JUL, or `slf4j-simple`.
0 commit comments