Test strategy and audit

How to test feature flags and gradual rollouts

A new feature may be present in a deployed application before users can see it. A feature flag is a configuration switch that decides which branch of behavior the application uses. For a team with frequent releases, testing therefore covers the feature’s code, the switch’s rules, and transitions between states.

Releasing code and enabling a feature are separate decisions

A switch can enable a new form for an internal team, selected customers, or a gradually expanding group. The disabled branch remains part of the product until the team deliberately removes it. If automated tests run only with the feature enabled, the older path may stop working just when you need it after switching off the feature.

Before writing scenarios, state the flag’s purpose. A temporary release switch, an experiment with multiple variants, and an operational kill switch have different lifecycles. Record the owner, expected default state, and removal condition. A switch with no clear purpose eventually creates more combinations that the team cannot explain.

Include the scope of these checks in the test strategy. Choose coverage according to the impact of failure, such as whether a flag changes only the display or also how business data is written. Giving every switch the same number of tests would ignore those differences.

Test the outcome of both branches

For the enabled state, define what users can complete and what result should be produced. For the disabled state, describe the valid original path or the deliberately unavailable feature. Checking that a button exists is only part of the test. Also verify server calls, persisted data, and subsequent screens.

Prepare a test that sets the state explicitly. Do not make it depend on the current configuration of a shared environment. Restore the original configuration after the run or use separate test rules. During parallel runs, one test may change another test’s state and produce a result that cannot be reproduced.

For multiple flags, map their dependencies. If a new editor requires a new persistence mechanism, the combination of the new editor and old write behavior needs an expected outcome or must be forbidden by configuration. Do not mechanically test every combination of independent switches. Focus on shared flows, risky dependencies, and configurations used during rollout.

Define user groups from product rules

Access may depend on the account, organization, role, or client version. Create dedicated test identities in both eligible and ineligible groups. Include missing context data and switching organizations within one session. Check that a previous decision does not remain cached for the wrong context.

The OpenFeature evaluation context specification describes a subject identifier called the targeting key. A particular provider, the component that supplies flag values to the application library, may require it for targeting or percentage allocation. Test rules using the data the app actually passes.

For percentage rollouts, do not treat a few random accounts as evidence of the correct proportion. In functional tests, use known identities with an expected branch. Separately verify the allocation rule and assignment stability if the product requires it. Signing out or refreshing the page should not change the variant unless the requirements say otherwise.

A feature flag does not replace authorization checks. If the client hides a button, the server must still decide whether the user is allowed to perform the operation. A negative test should therefore attempt a direct request with an account lacking the relevant access and verify the agreed rejection.

Default values and unavailable configuration

Find out what happens with a missing flag, an incorrect value type, an evaluation error, and startup without configuration. A safe fallback depends on the feature. The original path may suit a new editor, while returning to an enabled state may defeat the purpose of an operational kill switch.

The OpenFeature flag evaluation API requires a default value and returns it when evaluation fails. This alone does not determine whether a configuration service outage becomes an error or causes cached configuration to be used. Check the behavior of the specific SDK, the library used by the application, and its provider.

Test cold startup without configuration and an outage after a successful load. Distinguish a value cached in memory from a new decision. Record the flag identifier, selected branch, and available evaluation reason in diagnostics. Avoid collecting unnecessary personal data from the user context.

Check service recovery while a session is open. Define whether the application uses the new value immediately, after a page refresh, or on the next action. A change during an unfinished form needs its own expectation so that input is not lost simply because configuration has recovered.

A disabled feature and a configuration error can look the same

For order-editor-v2, false can mean a valid decision for an organization outside the pilot or a fallback result after an error. Users see the original editor in both cases. A screen test alone therefore does not prove that targeting worked.

Prepare three separate cases:

Setup Expected result in the illustrative editor
Valid configuration, organization outside the pilot Original editor and successful rule evaluation.
Valid configuration, organization in the pilot New editor and successful rule evaluation.
Controlled evaluation error, default value false Original editor and an error captured in the available diagnostics.

OpenFeature’s detailed result distinguishes the value, an optional reason and, when evaluation fails, an error code. Reasons and other metadata may not be available from every provider. Adapt expectations to what your integration supplies. Check diagnostics alongside the business result. Do not record the entire user context on every evaluation if a flag identifier and a limited record are enough to explain the error.

In a controlled test, also check that the application connected to the intended provider. Default values may keep the flow working, but do not establish that rules for the pilot group were loaded.

An illustrative scenario: a new order editor

Imagine a switch named order-editor-v2 that enables a new order editor for a selected organization. In this example, both editors must be able to read new and existing orders. A user in the pilot organization should create and save an order through the new path. A user outside that group should complete the same task through the original path.

Prepare an order with the same items and check its server content in both states. Then move the user between groups through the supported procedure and check the next session. This distinguishes a group-rule error from an editor error. The user’s access permissions remain subject to a separate check.

Next comes a configuration outage and switching off the flag during an unfinished order. The team defines the expectation beforehand, such as allowing the open form to be completed or preserving a draft on the original path. The test must not choose the more convenient answer itself. It checks the agreed outcome and content already created.

The frontend and backend must agree

The frontend, the user interface, and the backend, the server side, may receive new configuration at different times. Prepare mismatches in both directions. A new interface may send a request to a server that has not enabled the feature yet, or an old interface may use a server with new behavior.

Check whether the server clearly rejects the request or preserves the agreed compatibility. The interface should handle the result correctly without reporting success for an unsaved change. Also check older client versions if they remain supported. A switch in a new version does not automatically resolve the behavior of clients that do not know about it.

For a sensitive write, define where the decision is evaluated. Switching off a feature during a longer operation may affect new requests while work already started is allowed to finish. The test should confirm that rule and establish whether multiple server steps use compatible decisions.

Gradual rollout needs observation

Before expanding a group, decide which signals to observe and when to stop. For an order editor, these may include write failures, completion of the business flow, and availability of the older path. Interpret group comparisons in light of different users and usage patterns. A difference in a metric alone does not explain its cause.

In the test environment, repeat the progression from a small group to a wider one and back. Check configuration propagation into the application components in use and record where an older value remains. If the team needs a propagation limit, it must define and measure one. A successful click in an administration interface does not confirm a change across all clients.

Attach the configuration used, or its available version identifier, to each run. Also record the application build and test group. If someone later changes the rules, you can still explain the original result. Check environment separation as well so that changing a test rule does not change production state. With shared configuration, the team must decide who can modify it during testing and how to restore the agreed settings afterward. This reduces the risk of a successful run applying only to an accidental combination of rules.

Switching off a flag does not restore changed data

After the editor is switched off, the orders it created remain. Check whether the original path can read and update them as required. If a feature changed a data format or downstream processes, or sent an external event, the switch alone will not undo those effects.

Handle data restoration or compensation separately. In the example scenario, first create an order with the new editor, switch off the flag, and then open it with the original editor. Include processes that depend on the order. This establishes whether switching off is a usable operational step or needs further preparation.

Split the tests and finish the flag’s lifecycle

Check both branches with fast tests using controlled inputs. OpenFeature also describes an in-memory provider for testing that uses predefined flags. Verify support in the particular SDK before using it. This substitute does not check actual configuration propagation or integration with the operational system.

Keep a smaller number of integration tests and complete user scenarios for real configuration, targeting, and switching off. After rollout has completed and the feature is stable, remove the temporary flag according to the agreed plan and update related tests. First verify that no supported flow still depends on the older branch.

The team gains evidence of which branches work, who the rules allow to access the feature, and what switching it off can handle. Start with one flag that affects a business outcome. Prepare enabled, disabled, and fallback states, two test groups, and a shutdown scenario after data has been created. Use the results to add dependencies and checks of the real rollout.

Related topics

You might also be interested in

Let's clarify where automation has the greatest expected benefit

We will assess your testing process and suggest what to automate, what to keep manual and what to start with.