TestChimp empowers teams to capture what happens in their entire stack during manual testing / prod sessions, and create repeatable full-stack automation tests that cover the entire stack.
TestChimp SDK consists of frontend and backend libraries for different technologies enabling TestChimp’s full stack capturing capabilities. Teams simply need to install the relevant SDKs (and configure) in the tech stack. After that, via TestChimp platform, you can then create automated full stack tests from the captured sessions.
While Frontend SDK is sufficient for capturing UI + API interactions, to enable Full Stack capture, TestChimp relies on OpenTelemetry instrumentation in your backend stack. Refer to guide here for more details on setting up OTel and configuring an exporter for TestChimp.
The sdk is organized as follows:
- frontend/ : This includes SDKs for enabling frontend recording
- backend/ : This includes SDKs for enabling backend service recording
- protos/ : Defines proto structure for communicating payloads (this is used by different backend SDKs to communicate payloads consistently in a tech-stack agnostic manner).
- Run:
npm install testchimp-js - Include the following code snippet (with updated configuration as detailed below) in your initial loading js file (index.js or equivalent) to configure the sdk.
import TestChimpSDK from "testchimp-js";
document.addEventListener('DOMContentLoaded', function() {
window.TestChimpSDK = TestChimpSDK;
TestChimpSDK.startRecording({
projectId: "[PROJECT ID]",
sessionRecordingApiKey: "[SESSION RECORDING API KEY]",
untracedUriRegexListToTrack: ".*\\.your-domain\\.com.*$",
environment:"QA"
});
});
-
Call
TestChimpSDK.setCurrentUserId()(Recommended)Call
TestChimpSDK.setCurrentUserId(<USER_ID)to register a human readable user id (such as email) at any point during the session (for instance, after login step). This will enable querying by the test user id to fetch related sessions for easier session filtering. -
Call
TestChimpSDK.endTrackedSession()to end the current session recording (Recommended)
By default, the session id is reset only after the browser window is closed. If you want it to be cleared upon the user signing out from your application, you can call TestChimpSDK.endTrackedSession() when the user logs out.
The SDK behaviour can be configured with the following config params:
projectId: (Required) This is the project id for your project in TestChimp Platform (Access via Project Settings -> General -> Project ID)
sessionRecordingApiKey: (Required) This is the session recording api key for your project (Access via Project Settings -> General -> Session Recording API key) - Note: Not Api Key (which is used for data api access for integration with your CI / CD pipelines etc.)
tracedUriRegexListToTrack: If you have enabled full stack recording with backend TestChimp SDKs, add regex of your backend entrypoints called by the client for this attribute. Eg: ".://your-domain.$" Default: "/^$/" (No matched urls)
untracedUriRegexListToTrack: If you have NOT enabled full stack recording with backend TestChimp SDKs, add regex of your backend entrypoints called by the client for this attribute. Eg: ".://your-domain.$" This will capture the API layer interactions, allowing you to create tests covering the API layer from recorded sessions. If you have enabled backend tracing, no need to specify this. Default: "/^$/" (No matched urls)
enableRecording: (Optional) This flag helps selectively disable recording (for instance, based on environment). Default: true
samplingProbability: (Optional) This is the probability an arbitrary session will be recorded. Set this to 1.0 to capture all sessions (recommended setting for test environments). Default: 1.0
samplingProbabilityOnError: (Optional) This is the probability of recording if an error occurs. Useful for capturing erroring scenario recordings in production. <eventWindowToSaveOnError> number of preceding events will be recorded if being sampled on error. Default: 0.0
maxSessionDurationSecs: (Optional) Maximum number of seconds of a session to be recorded. Default: 300
eventWindowToSaveOnError: (Optional) number of events to be recoded preceding an error. Default: 200
excludedUriRegexList: (Optional) URIs matching regexes in this list will not be captured. Default: [] (No uris excluded).
enableOptionsCallTracking: (Optional) Enables tracking OPTIONS http calls. Default: false
If you are only interested in recording the UI layer along with API interactions initiated by the UI (and creating tests covering only the API layer), installing just the frontend SDK is sufficient. To enable recording of the complete stack (and creation of tests covering the entire stack):
- Enable OpenTelemetry in your backend services.
- Install and configure TestChimp SDK for each backend service.
Currently, TestChimp SDK is supported for the following tech stacks:
- Java Spring - Documentation
- NodeJS - Documentation
If your preferred tech stack is not supported, feel free to raise a feature request.