Test Definition
The test definition describes a test’s buckets, allocations, eligibility rules, allocations and constants. Each test’s definition.json
file should be under revision control.
.
├── test-definitions
| ├── your-test-name
| ├── definition.json
JSON Schema
JSON Property | Description |
---|---|
testType |
The Identifier to use for this test. |
version |
The version for this test. |
salt |
A salt in the hashing function used to map String identifiers to integer values. A good convention is to use the test name. Salts that start with “&” allow you to align bucket assignments by using identical salts. |
description |
Description of the tests and the features impacted by this test. |
rule |
(Optional) eligibility rule for this test. |
constants |
(Optional) Collection of variables available in the rules for this test. |
buckets |
An array of buckets for this test. |
allocations |
An array of allocations for this test. |
Bucket Schema
JSON Property | Description |
---|---|
name |
The human-readable name for this bucket. By convention, this is the same as the name in the application’s specification. |
value |
The integer value for this bucket. This bucket must map to a bucket value of an application’s specification. |
description |
The human-readable description for the behavior this bucket defines. |
payload.{payloadType} |
(Optional) Payload data. The payloadType must be consistent with the payload.type defined in the application’s specification. |
Allocation Schema
JSON Property | Description |
---|---|
rule |
(Optional) rule for this allocation. |
ranges |
An array of bucketValue , length pairs describing the bucket distribution. |
ranges[i].bucketValue |
The bucket value for this part of the distribution. |
ranges[i].length |
The group size, [0, 1.0] , for the given bucket value. |
Example: Single Allocation
Property | Value |
---|---|
testType |
USER |
rule |
null |
buckets |
inactive, altcolor1, altcolor2, altcolor3, altcolor4 |
constants |
{} |
allocations |
1 allocation |
Rule | Allocation | ||||||
---|---|---|---|---|---|---|---|
Default ( |
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"testType" : "USER", | |
"description" : "Example test definition for 1-ExampleGroups-payloads.json illustrating payload values", | |
"version" : 0, | |
"constants" : { | |
}, | |
"rule" : null, | |
"salt" : "bgcolortst", | |
"buckets" : [ { | |
"name" : "inactive", | |
"value" : -1, | |
"description" : "Inactive", | |
"payload": { | |
"stringValue": "#000000" | |
} | |
}, { | |
"name" : "altcolor1", | |
"value" : 0, | |
"description" : "Background color 1", | |
"payload": { | |
"stringValue": "#000000" | |
} | |
}, { | |
"name" : "altcolor2", | |
"value" : 1, | |
"description" : "Background color 2", | |
"payload": { | |
"stringValue": "#FFBFEF" | |
} | |
}, { | |
"name" : "altcolor3", | |
"value" : 2, | |
"description" : "Background color 3", | |
"payload": { | |
"stringValue": "#FFBF00" | |
} | |
}, { | |
"name" : "altcolor4", | |
"value" : 3, | |
"description" : "Background color 4", | |
"payload": { | |
"stringValue": "#53BDFF" | |
} | |
}], | |
"allocations" : [ { | |
"rule" : null, | |
"ranges" : [ { | |
"length" : 0.25, | |
"bucketValue" : 0 | |
}, { | |
"length" : 0.50, | |
"bucketValue" : -1 | |
}, { | |
"length" : 0.25, | |
"bucketValue" : 1 | |
} ] | |
} ] | |
} |
Example: Multiple Allocations with Rules
Property | Value |
---|---|
testType |
USER |
buckets |
inactive, altcolor1, altcolor2, altcolor3, altcolor4 |
rule |
${proctor:contains(COUNTRIES, country)} |
constants |
"COUNTRIES" : ["US", "CA"] |
allocations |
3 allocations |
Rule | Allocation | ||||||||
---|---|---|---|---|---|---|---|---|---|
${ua.android && ua.version > 4} |
|
||||||||
${ua.IPhone && ua.version > 7} |
|
||||||||
Default ( |
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"testType" : "USER", | |
"description" : "Example test definition for 2-ExampleGroups-context.json illustrating context rules and constants", | |
"version" : 0, | |
"constants" : { | |
"COUNTRIES" : ["US", "CA"] | |
}, | |
"rule" : "${proctor:contains(COUNTRIES, country)}", | |
"salt" : "bgcolortst", | |
"buckets" : [ { | |
"name" : "inactive", | |
"value" : -1, | |
"description" : "Inactive", | |
"payload": { | |
"stringValue": "#000000" | |
} | |
}, { | |
"name" : "altcolor1", | |
"value" : 0, | |
"description" : "Background color 1", | |
"payload": { | |
"stringValue": "#000000" | |
} | |
}, { | |
"name" : "altcolor2", | |
"value" : 1, | |
"description" : "Background color 2", | |
"payload": { | |
"stringValue": "#FFBFEF" | |
} | |
}, { | |
"name" : "altcolor3", | |
"value" : 2, | |
"description" : "Background color 3", | |
"payload": { | |
"stringValue": "#FFBF00" | |
} | |
}, { | |
"name" : "altcolor4", | |
"value" : 3, | |
"description" : "Background color 4", | |
"payload": { | |
"stringValue": "#53BDFF" | |
} | |
}], | |
"allocations" : [ { | |
"rule" : "${ua.android && ua.version > 4}", | |
"ranges" : [ { | |
"length" : 0.5, | |
"bucketValue" : 0 | |
}, { | |
"length" : 0.5, | |
"bucketValue" : 1 | |
} ] | |
}, { | |
"rule" : "${ua.IPhone && ua.version > 7}", | |
"ranges" : [ { | |
"length" : 0.5, | |
"bucketValue" : 2 | |
}, { | |
"length" : 0.5, | |
"bucketValue" : 3 | |
} ] | |
}, { | |
"rule" : null, | |
"ranges" : [ { | |
"length" : 0.0, | |
"bucketValue" : -1 | |
}, { | |
"length" : 0.25, | |
"bucketValue" : 0 | |
}, { | |
"length" : 0.25, | |
"bucketValue" : 1 | |
}, { | |
"length" : 0.25, | |
"bucketValue" : 2 | |
}, { | |
"length" : 0.25, | |
"bucketValue" : 3 | |
} ] | |
} ] | |
} |