Local Flag Testing

3 minute readDeveloper productivity

This feature is not available in all SDKs.

This feature is only available in the following SDKs:

  • iOS (Swift + Objective-c)

  • Android

  • JavaScript (Browser)

Local Flag Testing

Setting up the flags override view, and toggling flags locally.

Watch the video

The .net Client (C#) does not implement a UI support because there are many UI types. CloudBees will try to add support for specific types in the future. You can still use the Overrides feature via the SDK api.

Refer to C# SDK API - Rox.Overrides: SetOverride, HasOverride, ClearOverride, and GetOriginalValue for more information.

The Flags Override View is used for testing purposes. It allows developers to expose a view that shows the current status for each flag, and it allows the user to override these flags. This view is usually exposed to only developers, the QA team, and the product team.

If you override the value of a flag on a device, that override will persist until the app is removed from the device or until the override is reset using the view, see Resetting flag overrides for more information.

Enabling the flag override view

Use the following code to present the flag override view:

Swift
Objective-C
Android
Javascript
JavaScript SSR
self.navigationController!.pushViewController(ROX.flagsViewController(), animated: true)
[self.navigationController pushViewController:[ROX flagsViewController] animated:YES];
Intent intent = new Intent(context, FlagsListActivity.class); startActivity(intent);
Rox.showOverrides()
import {Rox} from 'rox-ssr'; Rox.showOverrides()

Using the Flags Override view

Value of the flag is changed locally

If you override the value of the flag, the value of the flag is only changed locally.

The following shows how flags are configured in the ROXFlags file:

Swift
Objective-C
Android
JavaScript
JavaScript SSR
import ROX public class Flags : RoxContainer { public let groupSupport = RoxFlag() public let resetButton = RoxFlag() public let flatNavigation = RoxFlag() public let greenCta = RoxFlag() public let apiVersionV2_0_0 = RoxFlag() }
#import <ROXCore/ROXCore.h> @interface Flags : ROXBaseContainer @property (nonatomic) ROXFlag* groupSupport; @property (nonatomic) ROXFlag* resetButton; @property (nonatomic) ROXFlag* flatNavigation; @property (nonatomic) ROXFlag* greenCta; @property (nonatomic) ROXFlag* apiVersionV2_0_0; @end #import "Flags.h" @implementation Flags - (instancetype)init { self = [super init]; if (self) { self.groupSupport = [[ROXFlag alloc] init]; self.resetButton = [[ROXFlag alloc] init]; self.flatNavigation = [[ROXFlag alloc] init]; self.greenCta = [[ROXFlag alloc] init]; self.apiVersionV2_0_0 = [[ROXFlag alloc] init]; } return self; } @end
import io.rollout.android.configuration.RoxContainer; import io.rollout.flags.RoxFlag; public class Flags extends RoxContainer { public RoxFlag groupSupport = new RoxFlag(); public RoxFlag resetButton = new RoxFlag(); public RoxFlag flatNavigation = new RoxFlag(); public RoxFlag greenCta = new RoxFlag(); public RoxFlag apiVersionV2_0_0 = new RoxFlag(); }
const myContainer = { groupSupport: new Rox.Flag(), resetButton: new Rox.Flag(), flatNavigation: new Rox.Flag(), greenCta: new Rox.Flag(), apiVersionV2_0_0: new Rox.Flag() }
import {Flag} from 'rox-ssr'; const myContainer = { groupSupport: new Flag(), resetButton: new Flag(), flatNavigation: new Flag(), greenCta: new Flag(), apiVersionV2_0_0: new Flag() }

The different states of a flag

In the Flags Override view, a flag can appear in the following states:

  • The flag is on state means the value from the server of a flag is on and isn’t overridden on the device.

  • The flag is off state means the value from the server of a flag is off and isn’t overridden on the device.

  • The flag is overridden state means the value from the server is overridden on this specific device.

Resetting flag overrides

There are two options to reset a flag override:

  1. Reset all—by pressing the "Reset All" button, you’ll set all flags to the state defined in the CloudBees Feature Management dashboard. In other words, the flag state on the device will be as defined by the currently running feature flag configuration.

  2. Reset one—depends on the platform, by choosing reset or by swiping the table cell to the left, you’ll expose the reset button. Clicking it will reset only the current flag.