An A/B test randomly splits the audience into control and variant and compares a target metric to find out whether the difference is not random. QA checks the cleanliness of the experiment: a stable group assignment, working functionality and analytics in every variant, and a single exposure event. A deviation from the planned split (sample ratio mismatch) usually means a defect, and duration is set before the start.
Product Engineering · Experiments
Variant B got ahead of control on day two and the team wants to stop the test. What does QA say?
A test of a new payment page is set for 14 days. On day two variant B shows +9% conversion, and someone writes in the chat: "let us roll it out already". QA knows there are two risks at this moment: the win may be random, and the test itself may be broken, in which case something other than intended is being compared. This lesson is about what QA checks in an A/B test and why "the numbers look good" does not mean "the experiment is right".
How it works and why. An A/B test is an experiment in which the audience is randomly split into groups: control (the current experience) and one or more variants (the change). Then the target metric (conversion, retention) is compared and statistics check whether the difference is not random. It answers "does the change actually help", not "do we like it". Randomness is needed so that the groups differ only by the change: if more active users land in B, the audience produces the difference, not the idea.
In practice "random" means deterministic: the group is computed from a hash of the user identifier and the experiment name. Then a person always lands in the same group, and different experiments are distributed independently of each other:
A user’s life in an experiment
Figure 1. QA checks steps 1-3 most: if they are wrong, the metric at step 4 compares the wrong people.
Example: assignment stability. The simplest scheme and a check that it works:
Key: the user id plus the experiment name. The same input always gives the same group, and another experiment splits people independently.
Threshold: 50 out of 100 sets the group ratio. Changing the number changes the test plan.
Check: the share of variant over 10,000 ids should be close to 0.5, and a second call gives the same groups.
Figure 2. The numbers mark three places QA checks in a group assignment.
Two checks are useful here. The same userId gives the same group at every call and after a reload. And on a large sample the distribution is close to 50/50. If it deviates noticeably, it is a sample ratio mismatch: for example, 5,000 each were expected and 5,400 and 4,600 came out. On such a sample the difference is not random, and it is almost always a defect (one variant crashes more often, exposure is counted in only one group, bots fall into one of the groups). The result of such a test deserves no trust until the cause is found.
What else QA should know:
Assignment stability. After a reload, a sign-in from another device (if there is an identifier) or a new session, the person sees the same variant. If they see A, then B, their data distorts the result, and the experience looks like a bug;
Check all variants. Every variant is a separate version of the product. Functionality, layout, analytics, localisation and accessibility need tests in each. A common mistake is to test only "the new";
Forced assignment. For testing you need a way to get into a variant (a query parameter, a cookie, an internal tool) instead of waiting for chance. Such a mechanism must not be open to everyone in production;
The exposure event (the user saw the variant) is sent once and with the group name. Otherwise the metrics compare the wrong people;
Overlapping experiments. Two tests on one screen can influence each other. They are separated (mutually exclusive groups, layers) or accounted for in the analysis;
Quality of variants. A variant that breaks some browsers or slows the page loses because of a defect, not because of the idea. QA protects the purity of the experiment.
Do not peek at the result. The duration and the required sample size are set before the start. If you stop the test as soon as a variant pulls ahead, there is a high chance of a false "win" due to random fluctuations: on small numbers the difference appears and disappears. The principle of sample size is: the smaller the expected difference and the higher the required confidence, the more users and time are needed. A few days on low traffic usually prove nothing. QA's role here is not to compute p-values but to hold back early conclusions and to remind about the agreed plan.
When to stop a test
Wrong
Stop as soon as B pulls ahead
A difference on day two may be noise. The decision rests on chance and later "does not reproduce".
Right
Stop according to the plan
The term and the sample are set before the start. The conclusion is drawn once, when the data is collected.
Figure 3. Stopping rules are written down before the start, not fitted to the result.
Limits and alternatives. An A/B test needs enough traffic: on a small product it will run for months, and then qualitative methods (interviews, usability tests) or a gradual rollout with metric monitoring are more useful. There are statistical methods that allow interim looks (sequential tests), but the tool itself supports them, and peeking "by hand" is still not allowed. A test does not answer "why": it only says that a difference exists. And a novelty effect may fade within a week, so very short tests mislead.
Common mistakes.
Testing only "the new" and not checking the old variant: control has defects too after code changes.
Leaving forced assignment open in production: anyone can pick a variant and distort the data.
Counting exposure on every render rather than once per user.
Ignoring a deviation from the planned group ratio (sample ratio mismatch).
Allowing a stop "when it wins".
Running two tests on one screen without accounting for the influence.
Check yourself
A user opens the site on a phone and sees variant A, then on a laptop after signing in sees B. What is it and why is it a problem?
Answer
The assignment is unstable: the group is not computed from a stable identifier (for an anonymous user across devices it is expected, for a signed-in one it is not). Their data lands in different groups and distorts the result, and the experience itself looks like a bug. Check that after sign-in the assignment is tied to the user and does not change.
A 50/50 split with 5,000 users per group was planned, in fact 5,400 and 4,600. What do you do with the test result?
Answer
Do not trust it until the cause is found: it is a sample ratio mismatch, and a difference of that size on this sample is not random. Look for defects: one variant crashes more often or loads slower, exposure is recorded in only one group, bots land in one group.
Related lessons: “Feature flags: combinations, kill switch, cleanup”, “How to test analytics events and the tracking plan”, “DAU, MAU, conversion, funnel, retention, churn”.
In an interview.Junior: An A/B test splits the audience into control and variant and compares a metric. QA checks that a user stably sees their group, that every variant works, that the exposure event is sent once and that forced assignment for tests is not open in production. Middle/Senior: I look at the purity of the experiment: sample ratio mismatch, overlap with other tests, the quality of variants and the analytics. I do not push for an early conclusion: the duration and sample are set before the start, because a win on day two may be noise. I understand that a test says "is there a difference" but not "why".
Feature flags: combinations, kill switch, cleanup
A feature flag is a configuration switch that turns a feature on or off without a new deploy, so several versions of behaviour live in production at once. Both states are tested (especially off), the transition between them with existing data and the flag value in production, and of the combinations only real and related ones. A kill switch is verified before an incident, and an old flag removed after full release.
Product Engineering · Experiments
The flag was turned off, but a user still has an order from the old path. What happens to it?
The team ships a new checkout behind the new-checkout flag. All is well on the staging stand, and in production the flag is turned on for 10% of Ukrainian users. An hour later the metrics are better, but an error appears: some people who started checkout while the flag was on and finish it after it was turned off get a hanging order. The "flag off" test and the "flag on" test both passed, but nobody tested the transition between states. This lesson is about testing features behind flags: states, transitions, combinations, emergency switch-off and cleanup.
How it works and why. A feature flag is a switch in configuration that turns functionality on or off without a new deploy. They are managed by custom configs or services such as LaunchDarkly or Unleash. Flags separate two moments that used to be one: deploying code and enabling the feature for people. So you can merge unfinished code, open a feature gradually, enable it for part of the users and switch it off quickly if something goes wrong. The price of the flexibility: several versions of behaviour live in production at the same time, and all of them must work.
Flags differ, and the type decides their life and testing. A release flag enables a feature gradually and must disappear after the full rollout. An experiment flag holds an A/B test. An ops flag (kill switch) switches off a risky feature in an emergency. A permission flag opens a feature to certain groups, for example paying users. The first two are temporary by design, the last two can live for years.
How to test a feature behind a flag.
Both states. Flag off: behaviour as before (no regression); on: the new one. The first is often forgotten;
Transition. What happens when the flag is turned on and the user already has data created by the old logic? What when it is turned off in the middle of a session, as in the opening example?
Targeting. The rules (percentage, country, role, app version) work as intended, including on the boundaries and for unauthenticated users;
Combinations. n flags give 2n states;
Environments. A flag is configured differently in dev, staging and production. Before a release its value in production is checked, not only the test one.
Example: combinations of two flags. The team has two flags: new-checkout and express-pay, the latter adds a quick-pay button to the new checkout. In theory four states:
new-checkout
express-pay
What it is
off
off
Current production. Regression
on
off
An intermediate rollout stage
on
on
The target state
off
on
Invalid: express-pay needs the new checkout
The three real combinations (those existing in production at different stages) get a full test. The fourth is unreal, so a robustness check is enough for it: if someone configures it wrongly, the app must not break. The expected behaviour: express-pay without the new checkout is silently ignored or explicitly forbidden by configuration validation. The selection principle: take combinations that really coexist in production and pairs of flags that touch the same area of code. This way the 2n do not have to be enumerated.
The team also has discipline in describing a flag. A configuration fragment with an owner and a review date (the structure is illustrative, not the format of a particular service):
A dead code branch and tests for it, plus the risk that someone turns the flag off "to try" and brings the old path back.
Right
An owner and a review date from day one
After the full rollout the old path and the flag are removed. Deliberately long-lived flags have an owner and a purpose.
Figure 1. Every flag is temporary complexity until proven otherwise.
A kill switch is a flag meant to switch off a risky feature in an emergency (payment through a new provider, a heavy query). It is checked in advance: the switch-off really works fast, without a restart; the app behaves correctly (there is a fallback path or a clear message), does not crash and does not lose data created while the feature was on. A kill switch is worth nothing if nobody has ever tested it: the check is done before an incident.
Cleanup. Every flag is temporary complexity. A flag that has long been on for everybody leaves a dead code branch and tests for it, and a trap: someone will switch it off "to try". So when a flag is created an owner and a review date are assigned. After the full rollout the flag and the old path are removed. Deliberately long-lived flags (a kill switch, access to paid features) stay, but also with an owner. Long "forgotten" flags are technical debt that QA should remind about.
Limits and alternatives. A flag does not replace testing on the stand: "off in production" does not mean the code is safe, because imports and migrations still run. Database schema changes behind a flag need compatibility in both directions (see the lesson on safe releases). A separate branch in the repository gives a simpler picture, but long-unmerged code is hard to merge, which is why flags are popular for big changes. In mobile apps a flag does not replace an update: old versions without the new code will never see it, and the flag value is cached.
Common mistakes.
Checking only the "on" state: nobody sees the regression in the off one.
Not checking the transition: switching off mid-session or with existing data.
Testing the flag only in the test environment and not checking its production value before release.
Creating a flag without an owner and a review date.
Not checking the kill switch in advance: at the moment of an incident it turns out to require a restart.
Trying to enumerate all 2n combinations instead of choosing the real and related ones.
Check yourself
You have three flags. How many states are there in theory and how do you decide which to test?
Answer
In theory 2 to the power of 3, that is eight. Test the combinations that really coexist in production at different rollout stages and the pairs of flags that touch the same area of code. Invalid combinations are checked separately, so that a configuration error does not break the app.
A kill switch for a new payment provider was turned off during an incident. What should already have been checked in advance?
Answer
That the switch-off works fast and without a restart, that the app has a fallback path (the old provider) or a clear message, that it does not crash and does not lose orders created while the feature worked. It is checked before an incident, not under its pressure.
Related lessons: “A/B tests from the QA point of view”, “Canary, gradual rollout, blue-green, rollback”, “Bug or feature, risk by business impact, MVP”.
In an interview.Junior: A feature flag turns a feature on or off without a new deploy. I test both states, especially the off one (regression), and the targeting rules. Before a release I check the flag value in production. Middle/Senior: I also check the transition between states with data already created, limit the combinations to the real and related ones instead of 2n, and check the kill switch in advance: that it works without a restart and without data loss. Flags have an owner and a review date, and after the full rollout the old path is removed. Deliberately long-lived flags (a kill switch, access) stay, but also with an owner.