Skip to main content

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:

  1. Emit journey events from the client using the platform SDK.
  2. Run SmartTests with @testchimp/playwright, installTestChimp on your merged test fixture, and TESTCHIMP_API_KEY on the runner.
  3. Set TESTCHIMP_PROJECT_TYPE to web, ios, or android so the reporter attaches test identity the way each platform expects (see below).

SDK repositories

PlatformSDKRepository
Web@testchimp/rum-jstestchimp-rum-js
iOSTestChimpRum (Swift Package)testchimp-rum-ios
AndroidTestChimpRum (Kotlin)testchimp-rum-android
Tests / CI@testchimp/playwrightplaywright-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/playwright and apply installTestChimp from @testchimp/playwright/runtime to the same merged test instance your specs import from tests/fixtures/index.js (or equivalent).
  • Set TESTCHIMP_PROJECT_TYPE=web on every run (local and CI).
  • Ensure TESTCHIMP_API_KEY is present in the process that runs npx 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=ios when running @testchimp/playwright with Mobilewright.
  • Register the testchimp-rum URL scheme and forward URLs to TestChimpRum.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=android on the test runner.
  • Declare an intent-filter for testchimp-rum://truecoverage/... and call TestChimpRum.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.