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