Skip to content

Instantly share code, notes, and snippets.

@parker
Last active December 24, 2015 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parker/3bb0e94b9b238b48429f to your computer and use it in GitHub Desktop.
Save parker/3bb0e94b9b238b48429f to your computer and use it in GitHub Desktop.
{
"testType" : "USER",
"description" : "Example test definition for 0-ExampleGroups.json",
"version" : 0,
"constants" : {
},
"rule" : null,
"salt" : "bgcolortst",
"buckets" : [ {
"name" : "inactive",
"value" : -1,
"description" : "Inactive"
}, {
"name" : "altcolor1",
"value" : 0,
"description" : "Background color 1"
}, {
"name" : "altcolor2",
"value" : 1,
"description" : "Background color 2"
}, {
"name" : "altcolor3",
"value" : 2,
"description" : "Background color 3"
}, {
"name" : "altcolor4",
"value" : 3,
"description" : "Background color 4"
}],
"allocations" : [ {
"rule" : null,
"ranges" : [ {
"length" : 0.5,
"bucketValue" : -1
}, {
"length" : 0.25,
"bucketValue" : 0
}, {
"length" : 0.25,
"bucketValue" : 1
} ]
} ]
}
{
"tests" : {
"bgcolortst": {
"buckets":{
"inactive":-1,
"altcolor1":0,
"altcolor2":1,
"altcolor3":2,
"altcolor4":3
},
"fallbackValue": -1
}
}
}
{
"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
} ]
} ]
}
{
"tests" : {
"bgcolortst": {
"buckets": {
"inactive":-1,
"altcolor1":0,
"altcolor2":1,
"altcolor3":2,
"altcolor4":3
},
"fallbackValue": -1,
"payload": {
"type": "stringValue",
"validator": "${fn:startsWith(value, '#') && fn:length(value) == 7}"
}
}
}
}
{
"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
} ]
} ]
}
{
"tests" : {
"bgcolortst": {
"buckets": {
"inactive":-1,
"altcolor1":0,
"altcolor2":1,
"altcolor3":2,
"altcolor4":3
},
"fallbackValue": -1
}
},
"providedContext": {
"country": "String",
"loggedIn": "boolean",
"language": "String",
"ua": "com.indeed.example.UserAgent"
}
}
package com.indeed.example;
public interface UserAgent {
int getVersion();
boolean isMobile();
boolean isAndroid();
boolean isIPad();
boolean isIPhone();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment