For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • Get started
    • Overview
    • Onboarding
    • Get started
    • Launch Insights
    • LaunchDarkly architecture
    • LaunchDarkly vocabulary
  • AgentControl
    • AgentControl
    • Manage AgentControl
  • Feature flags
    • Create flags
    • Target with flags
      • Targeting rules
      • Converting rules into segments
      • Testing changes to flag targeting
    • Flag templates
    • Manage flags
    • Code references
    • Contexts
    • Segments
  • Releases
    • Releasing features with LaunchDarkly
    • Release policies
    • Percentage rollouts
    • Progressive rollouts
    • Guarded rollouts
    • Feature monitoring
    • Release pipelines
    • Engineering insights
    • Release management tools
    • Applications and app versions
    • Change history
    • Restoring previous flag versions
  • Observability
    • Observability
    • Session replay
    • Error monitoring
    • Logs
    • Traces
    • Observability metrics
    • Product analytics events
    • LLM observability
    • Alerts
    • Dashboards
    • Service map
    • Vega for auto-remediation
    • Observability MCP server
    • Search specification
    • Observability settings
    • Observability integrations
  • Experimentation
    • Experimentation
    • Experiment metric types
    • Experiment configuration
    • Managing experiments
    • Analyzing experiments
    • Multi-armed bandits
    • Holdouts
  • Metrics and events
    • Metrics in LaunchDarkly
    • Creating metrics
    • Metric groups
    • Events
    • Autogenerated metrics
  • Warehouse native
    • Warehouse native metrics
    • Setting up external warehouses
    • Creating experiments using warehouse native metrics
  • Infrastructure
    • Connect apps and services to LaunchDarkly
    • LaunchDarkly in China and Pakistan
    • LaunchDarkly in the European Union (EU)
    • LaunchDarkly in federal environments
    • Public IP list
  • Your account
    • Projects
    • Views
    • Environments
    • Tags
    • Teams
    • Members
    • Roles
    • Account security
    • Feature previews
    • Billing and usage
    • Changelog
Sign inTry it free
LogoLogo
On this page
  • Overview
  • Test variations received by individual contexts
  • Test what percentage of contexts will receive a variation
Feature flagsTarget with flags

Testing changes to flag targeting

Was this page helpful?
Previous

Flag templates

Next
Built with

Overview

This topic explains how to use the test run feature to find out how changes to your flag targeting will affect contexts and segments.

When you make a flag targeting change, you can view:

  • Which variation a particular context will receive after a targeting change
  • What percentage of contexts will receive each variation after a targeting change

Testing changes to flag targeting helps ensure that contexts receive the flag variations you expect after you make changes.

Test variations received by individual contexts

To test which variation an individual context will receive after you make a flag targeting change:

  1. From the Flags list, open the flag you want to preview.
  2. If the flag is off and the rules are hidden, click View targeting rules.
  3. Make any needed changes to the flag rules.
  4. Click the fingerprint test run icon. The “Test run a context” section appears.
  5. Search for and select the context you want to preview, or edit the JSON object to supply the context kind and key.

The "Test run a context" section, populated with an example context.

The "Test run a context" section, populated with an example context.

The “Based on current targeting” section populates with the variation that the context is currently receiving. If you have unsaved targeting changes, the “Based on unsaved changes” section populates with the variation that the context will receive after you save your changes.

Click Clear context to clear the JSON object and start a new search.

Test what percentage of contexts will receive a variation

Enable this feature using feature preview

To enable this feature, toggle on “Test run” in the feature preview menu. Feature previews are available to certain eligible LaunchDarkly accounts.

You can view the approximate percentage of contexts that will receive each flag variation after a targeting change, based on a sampling of contexts LaunchDarkly has seen in the last seven days.

To test a targeting change:

  1. From the Flags list, open the flag you want to modify.
  2. If the flag is off and the rules are hidden, click View targeting rules.
  3. Make any needed changes to the flag rules.
  4. Click Review and save. The “Save changes” dialog appears.
  5. Review your targeting changes, add comments, or request approval as needed.
  6. Click Test run. The “Test run” dialog appears.
  7. Review the percentage of contexts that will receive each variation after you save your changes.
  8. Click Back to return to the “Save changes” dialog.
  9. Click Save changes.

The "Save changes" dialog for a flag targeting change.

The "Test run" dialog for a flag targeting change.