robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 1 | # Field Trial Testing Configuration |
| 2 | |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 3 | This directory contains the `fieldtrial_testing_config.json` configuration file, |
| 4 | which is used to ensure test coverage of active field trials. |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 5 | |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 6 | For each study, the first available experiment after platform filtering is used |
| 7 | as the default experiment for Chromium builds. This experiment is also used for |
| 8 | perf bots and browser tests in the waterfall. |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 9 | |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 10 | > Note: This configuration applies specifically to Chromium developer builds. |
| 11 | > Chrome branded / official builds do not use these definitions. |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 12 | |
Hiroshige Hayashizaki | ac2fc0c | 2018-12-03 19:20:50 | [diff] [blame] | 13 | > Note: This configuration is NOT used for content_browsertests or other test |
| 14 | > targets based on content_shell. |
| 15 | |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 16 | ## Config File Format |
| 17 | |
| 18 | ```json |
| 19 | { |
| 20 | "StudyName": [ |
| 21 | { |
| 22 | "platforms": [Array of Strings of Valid Platforms for These Experiments], |
| 23 | "experiments": [ |
| 24 | { |
| 25 | "//0": "Comment Line 0. Lines 0-9 are supported.", |
| 26 | "name": "ExperimentName", |
| 27 | "params": {Dictionary of Params}, |
| 28 | "enable_features": [Array of Strings of Features], |
| 29 | "disable_features": [Array of Strings of Features] |
| 30 | }, |
| 31 | ... |
| 32 | ] |
| 33 | }, |
| 34 | ... |
| 35 | ], |
| 36 | ... |
| 37 | } |
| 38 | ``` |
| 39 | |
| 40 | The config file is a dictionary at the top level mapping a study name to an |
Carlos Knippschild | e12741b | 2019-12-12 01:26:23 | [diff] [blame] | 41 | array of *study configurations*. The study name in the configuration file |
| 42 | **must** match the FieldTrial name used in the Chromium client code. |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 43 | |
| 44 | > Note: Many newer studies do not use study names in the client code at all, and |
| 45 | > rely on the [Feature List API][FeatureListAPI] instead. Nonetheless, if a |
Carlos Knippschild | e12741b | 2019-12-12 01:26:23 | [diff] [blame] | 46 | > study has a server-side configuration, the study `name` specified here |
| 47 | > must still match the name specified in the server-side configuration; this is |
| 48 | > used to implement sanity-checks on the server. |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 49 | |
| 50 | ### Study Configurations |
| 51 | |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 52 | Each *study configuration* is a dictionary containing `platforms` and |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 53 | `experiments`. |
| 54 | |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 55 | `platforms` is an array of strings, indicating the targetted platforms. The |
Dominik Röttsches | 1243e0f | 2019-07-08 18:49:56 | [diff] [blame] | 56 | strings may be `android`, `android_webview`, `chromeos`, `ios`, `linux`, `mac`, |
| 57 | or `windows`. |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 58 | |
| 59 | `experiments` is an array containing the *experiments*. |
| 60 | |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 61 | The converter uses the `platforms` array to determine which experiment to use |
| 62 | for the study. The first experiment matching the active platform will be used. |
| 63 | |
| 64 | > Note: While `experiments` is defined as an array, currently only the first |
| 65 | > entry is used*\**. We would love to be able to test all possible study |
| 66 | > configurations, but don't currently have the buildbot resources to do so. |
| 67 | > Hence, the current best-practice is to identify which experiment group is the |
| 68 | > most likely candidate for ultimate launch, and to test that configuration. If |
| 69 | > there is a server-side configuration for this study, it's typically |
| 70 | > appropriate to copy/paste one of the experiment definitions into this file. |
| 71 | > |
| 72 | > *\** |
| 73 | > <small> |
| 74 | > Technically, there is one exception: If there's a forcing_flag group |
| 75 | > specified in the config, that group will be used if there's a corresponding |
| 76 | > forcing_flag specified on the command line. You, dear reader, should |
| 77 | > probably not use this fancy mechanism unless you're <em>quite</em> sure you |
| 78 | > know what you're doing =) |
| 79 | > </small> |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 80 | |
| 81 | ### Experiments (Groups) |
| 82 | Each *experiment* is a dictionary that must contain the `name` key, identifying |
Ilya Sherman | 8422599 | 2020-02-28 00:39:21 | [diff] [blame^] | 83 | the experiment group name. |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 84 | |
Ilya Sherman | 8422599 | 2020-02-28 00:39:21 | [diff] [blame^] | 85 | > Note: Studies should typically use the [Feature List API][FeatureListAPI]. For |
| 86 | > such studies, the experiment `name` specified in the testing config is still |
| 87 | > required (for legacy reasons), but it is ignored. However, the lists of |
| 88 | > `enable_features`, `disable_features`, and `params` **must** match the server |
| 89 | > config. This is enforced via server-side Tricorder checks. |
| 90 | > |
| 91 | > For old-school studies that do check the actual experiment group name in the |
| 92 | > client code, the `name` **must** exactly match the client code and the server |
| 93 | > config. |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 94 | |
Ilya Sherman | 8422599 | 2020-02-28 00:39:21 | [diff] [blame^] | 95 | The remaining keys -- `enable_features`, `disable_features`, and `params` -- are |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 96 | optional. |
| 97 | |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 98 | `enable_features` and `disable_features` indicate which features should be |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 99 | enabled and disabled, respectively, through the |
| 100 | [Feature List API][FeatureListAPI]. |
| 101 | |
Ilya Sherman | 8422599 | 2020-02-28 00:39:21 | [diff] [blame^] | 102 | `params` is a dictionary mapping parameter name to parameter value. |
| 103 | |
isherman | a509c185 | 2017-03-23 21:11:35 | [diff] [blame] | 104 | > Reminder: The variations framework does not actually fetch any field trial |
| 105 | > definitions from the server for Chromium builds, so any feature enabling or |
| 106 | > disabling must be configured here. |
| 107 | |
| 108 | [FeatureListAPI]: https://cs.chromium.org/chromium/src/base/feature_list.h |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 109 | |
| 110 | #### Comments |
| 111 | |
| 112 | Each experiment may have up to 10 lines of comments. The comment key must be of |
| 113 | the form `//N` where `N` is between 0 and 9. |
| 114 | |
| 115 | ```json |
| 116 | { |
| 117 | "AStudyWithExperimentComment": [ |
| 118 | { |
Paul Miller | ad77b789 | 2018-07-11 20:07:43 | [diff] [blame] | 119 | "platforms": ["chromeos", "linux", "mac", "windows"], |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 120 | "experiments": [ |
| 121 | { |
| 122 | "//0": "This is the first comment line.", |
| 123 | "//1": "This is the second comment line.", |
| 124 | "name": "DesktopExperiment" |
| 125 | } |
| 126 | ] |
| 127 | } |
| 128 | ] |
| 129 | } |
| 130 | ``` |
| 131 | |
| 132 | ### Specifying Different Experiments for Different Platforms |
| 133 | Simply specify two different study configurations in the study: |
| 134 | |
| 135 | ```json |
| 136 | { |
| 137 | "DifferentExperimentsPerPlatform": [ |
| 138 | { |
Paul Miller | ad77b789 | 2018-07-11 20:07:43 | [diff] [blame] | 139 | "platforms": ["chromeos", "linux", "mac", "windows"], |
robliao | 2ff5332 | 2016-09-23 19:28:24 | [diff] [blame] | 140 | "experiments": [{ "name": "DesktopExperiment" }] |
| 141 | }, |
| 142 | { |
| 143 | "platforms": ["android", "ios"], |
| 144 | "experiments": [{ "name": "MobileExperiment" }] |
| 145 | } |
| 146 | ] |
| 147 | } |
| 148 | ``` |
| 149 | |
| 150 | ## Presubmit |
| 151 | The presubmit tool will ensure that your changes follow the correct ordering and |
| 152 | format. |