Data Format of hook variables

Data passed to different types of hooks follows the following format:

  1. Pre Test Run Hook Data Format
    Hooks defined in the hook category "Pre Test Run Hooks" receives a variable $tr. Format of this variable is as follows:

    {
    	"details": {
    		"id": "<String>", //Test Run Id
    		"name": "<String>", //Name of the test run
    		"createdAt": "<String>",//Test Run Creation Date and Time
    		"executionSource": "<String>", //Execution Source, values can be one of vREST-APP or vrunner
    		"environment": "<String>", //Test Environment name configured in vREST
    		"executor": {
    			"name": "<String>", //Test Run Executor name
    			"email": "<String>" //Test Run executor email
    		}
    	}
    }
  2. Post Test Run Hook Data Format
    Hooks defined in the hook category "Post Test Run Hooks" receives the updated variable $tr. Format of this variable is as follows:

    {
    	"details": {
    		"id": "<String>", //Test Run Id
    		"name": "<String>", //Test Run name
    		"createdAt": "<String>",//Test Run Creation Date and Time
    		"executionSource": "<String>", //Execution Source, values can be one of vREST-APP or vrunner
    		"environment": "<String>", //Test Environment name configured in vREST
    		"executor": {
    			"name": "<String>", //Test Run Executor name
    			"email": "<String>" //Test Run executor email
    		}
    	},
    	"result": {
    		"totalCount": "<Number>", //Total number of test cases
    		"failedCount": "<Number>", //Count of failed test cases
    		"passedCount": "<Number>", //Count of passed test cases
    		"notExecutedCount": "<Number>", //Count of not executed test cases
    		"notRunnableCount": "<Number>", //Count of not runnable test cases
    		"remarks": "<String>", //Remarks if any
    		"resultLink": "<String>" //Link to view the results of test cases in the test run
    	}
    }
  3. Pre Test Case Hook Data Format
    Hooks defined in the hook category "Pre Test Case Hooks" receives a variable $tc. Format of this variable is as follows:

    {
    	"details": {
    		"id": "<String>", //Test Case Id
    		"summary": "<String>", //Test Case summary
    		"externalId": "<String>",//External Id of the test case if defined
    		"loopIndex": "<Number>" //Current loop index useful for test case having a loop
    	},
    	"request": { //Test Case request definition as specified by user
    		"method": "<String>", //Test Case request method, value can be one of GET, POST, PUT, PATCH, DELETE, OPTIONS.
    		"url": "<String>", //Test Case URL
    		"params": [
    			{
    				"id": "<String>", //Parameter Id
    				"name": "<String>", //Parameter name
    				"method": "String", //Parameter type, value can be one of query, body, path.
    				"value": "<String>", //Parameter value
    				"description": "<String>", //Parameter description
    				"paramType": "String" //Parameter data type, value can be one of string, number, boolean, object.
    			},
    			...
    		],
    		"headers": [
    			{
    				"id": "<String>", //Header Id
    				"name": "<String>", //Header name
    				"value": "<String>" //Header value
    			},
    			...
    		],
    		"rawBody": "<String>" //Raw body if specified, in string format
    	}
    }

    Note: This hook also receives the variable $tr (Format is same as Pre Test Run hook Data Format).
     

  4. Post Test Case Hook Data Format
    Hooks defined in the hook category "Post Test Case Hooks" receives the updated variable $tc. Format of this variable is as follows:

    {
    	"details": {
    		"id": "<String>", //Test Case Id
    		"summary": "<String>", //Test Case summary
    		"externalId": "<String>",//External Id of the test case if defined
    		"loopIndex": "<Number>" //Current loop index useful for test case having a loop
    	},
    	"request": { //Test Case request definition as specified by user
    		"method": "<String>", //Test Case request method, value can be one of GET, POST, PUT, PATCH, DELETE, OPTIONS.
    		"url": "<String>", //Test Case URL
    		"params": [
    			{
    				"id": "<String>", //Parameter Id
    				"name": "<String>", //Parameter name
    				"method": "String", //Parameter type, value can be one of query, body, path.
    				"value": "<String>", //Parameter value
    				"description": "<String>", //Parameter description
    				"paramType": "String" //Parameter data type, value can be one of string, number, boolean, object.
    			},
    			...
    		],
    		"headers": [
    			{
    				"id": "<String>", //Header Id
    				"name": "<String>", //Header name
    				"value": "<String>" //Header value
    			},
    			...
    		],
    		"rawBody": "<String>" //Raw body if specified, in string format
    	},
    	"execution": {
    		"request": {
    			"url": "<String>", //Test Case execution URL with query params
    			"method": "<String>", //Test Case request method, value can be one of GET, POST, PUT, PATCH, DELETE, OPTIONS.
    			"headers": "<String>", //JSON String containing request header names as keys and header values as values of those keys.
    			"body": "<String>" //Request body in string form
    		},
    		"response": {
    			"statusCode": "<Number>", //Response Status Code
    			"headers": "<String>", //JSON String containing response header names as keys and header values as values of those keys.
    			"body": "<String>" //Response body in string form
    		}
    	},
    	"result": {
    		"isExecuted": "<Boolean>", //Flag whether the test case is executed or not in the current test run.
    		"isPassed": "<Boolean>", //Flag whether the test case is passed or not in the current test run.
    		"isRunnable": "<Boolean>", //Flag whether the test case is runnable or not in the current test run.
    		"resultLink": "<String>" //Link to view the result of this test case in the current test run.
    	}
    }

    Note: This hook also receives the variable $tr (Format is same as Pre Test Run hook Data Format).

Â