Test Kitchen/Overriding experiment enrollment
For QA purposes, there are two ways to override the experiment enrollment assigned by the bucketing algorithm that TestKitchen extension runs. That way you can assign any specific value to any variant for the current user.
Using a Javascript function
You can set any value for a given variant using the
mw.testKitchen.overrideExperimentGroup
function.
For example, if you have an experiment called
test-mediawiki-article-toc-exp
with a
homepage_module
variant, you can enrol the user to that group as follows:
mw.testKitchen.overrideExperimentGroup('test-mediawiki-article-toc-exp', 'homepage_module');
To revert all changes done by the previous function in one or several variants, after your QA process, you can just run:
mw.testKitchen.clearExperimentOverrides()
Passing a query parameter
You can also pass a query parameter in the URL to set any specific value for a variant of a given experiment.
The name of the query parameter must be
mpo
and the format to override a variant using this way is
mpo=name_of_the_experiment:name_of_the_variant
. For example, if we want to enrol the user to the
homepage_module
variant of our
test-mediawiki-article-toc-exp
experiment when visiting
https://es.wikipedia.org/wiki/Bicicleta
, we must go to the following URL:
https://es.wikipedia.org/wiki/Bicicleta?mpo=test-mediawiki-article-toc-exp:homepage_module
To undo the overriden value, just visit the wiki without passing any
mpo
query parameter and the values assigned to any variant will be the ones that the TestKitchen extension has assigned while running the bucketing algorithm as usual.