Instrumenting your app for TrueCoverage
This page is the authoritative reference for wiring RUM and test runs yourself (no /testchimp init required). The same event model powers how TrueCoverage works and the dashboard.
Platforms: TrueCoverage applies to web (browser), iOS, and Android when you:
- Emit journey events from the client using the platform SDK.
- Run SmartTests with
@testchimp/playwright,installTestChimpon your mergedtestfixture, andTESTCHIMP_API_KEYon the runner. - Set
TESTCHIMP_PROJECT_TYPEtoweb,ios, orandroidso the reporter attaches test identity the way each platform expects (see below).
SDK repositories
| Platform | SDK | Repository |
|---|---|---|
| Web | @testchimp/rum-js | testchimp-rum-js |
| iOS | TestChimpRum (Swift Package) | testchimp-rum-ios |
| Android | TestChimpRum (Kotlin) | testchimp-rum-android |
| Tests / CI | @testchimp/playwright | playwright-testchimp-reporter |
For product concepts and analytics, start at Introduction to TrueCoverage.
Web (browser)
1. Install RUM in the app bundle
In the frontend or app under test (not only your test package):
npm install @testchimp/rum-js
2. Initialize once, then emit journey events
At bootstrap, call testchimp.init() with at least projectId, apiKey, and environment (see the rum-js README). Prefer one helper that wraps testchimp.emit({ title, metadata? }) for semantic steps (e.g. checkout-completed), not noisy low-level UI events.
Use the optional config object for volume limits and sampling (captureEnabled, maxEventsPerSession, etc.).
3. Wire Playwright / SmartTests
- Add
@testchimp/playwrightand applyinstallTestChimpfrom@testchimp/playwright/runtimeto the same mergedtestinstance your specs import fromtests/fixtures/index.js(or equivalent). - Set
TESTCHIMP_PROJECT_TYPE=webon every run (local and CI). - Ensure
TESTCHIMP_API_KEYis present in the process that runsnpx playwright test(not only in IDE MCP config).
The reporter injects CI / test metadata into the page so RUM emits during tests carry test identity, aligned with production emits. Details: playwright-testchimp-reporter README.
iOS (native)
1. Add the Swift package
Use Swift Package Manager with the public Git URL (no separate registry for consumers):
- Xcode: File → Add Package Dependencies… →
https://github.com/testchimphq/testchimp-rum-ios.git - Pin a SemVer git tag (e.g.
0.1.0) via “Up to Next Major” or an exact version.
See testchimp-rum-ios for Package.swift examples and release tagging.
2. Initialize and emit
Call TestChimpRum.initialize(...) once early in app lifecycle, then TestChimpRum.emit(...) at journey milestones. Optional config mirrors the JS SDK (sampling, batching, endpoints).
3. TrueCoverage automation URLs (SmartTests / Mobilewright)
So test runs can attach the same test identity as on web:
- Set
TESTCHIMP_PROJECT_TYPE=ioswhen running@testchimp/playwrightwith Mobilewright. - Register the
testchimp-rumURL scheme and forward URLs toTestChimpRum.handleAutomationURL(_:)(UIKit or SwiftUI).
Default automation URLs match Android and Playwright (see the iOS repo README). Optional env overrides on the runner: TESTCHIMP_RUM_AUTOMATION_SET_PREFIX, TESTCHIMP_RUM_AUTOMATION_CLEAR_URL.
Full steps: testchimp-rum-ios README — TrueCoverage (Mobilewright).
Android (native)
1. Add the library
For public installs, JitPack is the default (add maven("https://jitpack.io")). Coordinates match JitPack’s page for this repo—for SemVer tags, use com.github.testchimphq:testchimp-rum-android: plus your tag (e.g. 0.1.0); for branch builds you may use master-SNAPSHOT as JitPack documents:
dependencies {
implementation("com.github.testchimphq:testchimp-rum-android:0.1.0")
}
Use the version string JitPack shows for your git tag (e.g. 0.1.0), or a snapshot such as master-SNAPSHOT per JitPack — testchimp-rum-android. Prefer the site’s copy-paste line after the build succeeds.
Alternatives (local Gradle module, Maven Central when published): testchimp-rum-android README.
2. Initialize and emit
In Application.onCreate, call TestChimpRum.initialize(...), then TestChimpRum.emit(...) from your UI code. Use TestChimpRumConfig.Options for the same tuning knobs as the JS SDK.
3. TrueCoverage automation (SmartTests / Mobilewright)
- Set
TESTCHIMP_PROJECT_TYPE=androidon the test runner. - Declare an
intent-filterfortestchimp-rum://truecoverage/...and callTestChimpRum.handleAutomationIntent(...)from the receiving activity.
Full steps: testchimp-rum-android README — TrueCoverage (Mobilewright).
Shared rules (all platforms)
- Same project in TestChimp: use the project
projectId/ API keys your RUM SDK expects (from TestChimp → Project Settings). - Metadata: Prefer low-cardinality, product-meaningful keys for slicing (see metadata guidance). Avoid raw IDs and high-cardinality text in keys/values.
- Coverage scope: In the product, set base vs coverage execution scopes so “real usage” and “test-tagged emits” compare correctly—see Dashboard.
If you use the TestChimp skill for init, it encodes the same contracts in repo plans; this page is the canonical technical reference for teams wiring instrumentation directly.