Testing your Configurations on Statsig
Statsig increases your engineering velocity. This page has pointers to features across the product that enable you to test while moving fast.
Overrides: Testing a specific feature or experiment
You can create overrides for features, experiments or holdouts. Overrides are excluded from analysis in Pulse results so they don't bias results. Experiments overrides can include Segments that target pre-prod environments or employees.
Unit Tests
Server SDKs let you enable localMode
which causes the SDK to never hit the network, and only return default values. This is perfect for dummy environments or test environments that should not access the network. You can set overrideGate
and overrideConfig
APIs to set overrides for a specific user, or for all users.
function overrideGate(
gateName: string,
value: boolean,
userID?: string,
): void;
function overrideConfig(
configName: string,
value: object,
userID?: string,
): void
See example on Node.js Server SDK or JavaScript Client SDK.
Environments
If there is no environment associated with feature or experiment checks or metrics, Statsig assumes they're for Production. You can explicitly add an environment to checks and metrics and target them using rules in Feature Gates or Segments. Non-production events are visible in diagnostics, but are not included in Pulse results.
You can choose to map your environments to the environments directly supported in Statsig - Development, Staging and Production or override them and use what you want. Many customers choose to create a logical mapping (e.g. Dev One boxes to Development, Early Access (special 1% slice of production) to Production).