Using Toggle in Test Automation and Debugging

August 29, 2024 by No Comments

Toggle is a tool for re-configuring specific service instances in the context of automated or manual tests and debugging. It can quickly become cumbersome to manage and maintain if it is used in production environments. To avoid this most teams use a centralized feature flag management system and build-out an admin UI for viewing and modifiying features flags and their configuration.

Toggles can also be used for multivariate testing or A/B testing. In this case the toggle buckets users into two groups and at runtime the Toggle Router will consistently send one cohort down a codepath and the other down a different codepath, allowing engineers to measure the effect of various changes on the user experience and determine which is more effective.

Some companies use a toggle to test new code with a select segment of their audience before rolling it out to all customers. This lets the engineering team see how a newly designed or redesigned feature will perform in the hands of real users and reduces the risk of a flop.

Savvy teams view their inventory of toggles as something that comes with a carrying cost and seek to keep it low. To do this they make sure to remove any toggles as soon as they’ve served their purpose. This can be done by adding a task to the team’s backlog or by building the process into their management platform. Some teams even put “expiration dates” on their toggles and will fail a test (or refuse to start an application!) if a toggle has not been removed after an appropriate amount of time.