Skip to content

Commit defec89

Browse files
committed
Document ExPlat experiment setup steps
1 parent 402d612 commit defec89

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/EXPERIMENTS.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Experiments
22

3-
This framework allows us to develop and test experimental features with different build configurations in release and debug builds. The framework also supports more advanced experimentation with AB testing, using ExPlat in the Tracks library.
3+
This framework allows us to develop and test experimental features with different build configurations in release and debug builds. The framework also supports more advanced experimentation with AB testing, using the Experimentation Platform (ExPlat) in the Tracks library.
44

55
## Dependencies
66

@@ -11,6 +11,7 @@ This framework allows us to develop and test experimental features with differen
1111
- Enum `FeatureFlag`: where we define feature flag cases for all the experimental features
1212
- Protocol `FeatureFlagService` and default implementation `DefaultFeatureFlagService`. The protocol allows mocking feature flag states in unit tests, and the default implementation is based on build configurations
1313
- Enum `BuildConfiguration`: the current build configuration `BuildConfiguration.current` is currently used in logging
14+
- Enum `ABTest`: where we define experiment cases for A/B testing
1415

1516
## Build configurations
1617

@@ -21,3 +22,17 @@ The project has three build configurations to match the WooCommerce app: `Debug`
2122
- `Release-Alpha` build configuration: `ALPHA` value is set. Used for one-off installable builds for internal testing, which we can trigger from a commit in a pull request
2223

2324
In the default implementation of `FeatureFlagService`, some of the feature flags are based on build configurations - enabled in `Debug` and `Release-Alpha` configurations, and disabled in `Release` builds.
25+
26+
## Run an A/B test
27+
28+
To add an ExPlat experiment to the app, add a new case to the `ABTest` enum in the `Experiments` framework.
29+
30+
Once the experiment is added to the app, define the behavior for each variation:
31+
32+
```
33+
if ABTest.experimentName.variation == .control {
34+
// Control logic
35+
} else {
36+
// Treatment logic
37+
}
38+
```

0 commit comments

Comments
 (0)