Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The JSON Schema that we place into the Initial Script
- // section of the Runscope Radar test.
- var rosterResponse = {
- "definitions": {
- "player": {
- "id": "player",
- "type": "object",
- "required": ["player_number","guid","name"],
- "properties": {
- "player_number": { "type": "integer" },
- "guid": { "type": "string" },
- "name": { "type": "string" }
- }
- }
- },
- "title": "roster schema v1",
- "type": "object",
- "required": ["roster"],
- "properties": {
- "roster": {
- "type": "array",
- "items": { "$ref": "#/definitions/player" }
- }
- }
- };
- variables.set("rosterResponse",rosterResponse);
- // The JavaScript assertion that picks up the rosterResponse
- // global variable from above, and the Chai-JSON assertion..
- // This we paste into the Scripts section of the request
- // step.
- var rosterResponse = variables.get("rosterResponse");
- var data = JSON.parse(response.body);
- assert.jsonSchema(data, rosterResponse);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement