Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  1. First define a utility method in Project Configuration >> Utility Methods section. vREST automatically provides the following first two parameters to this utility method automatically. Use supplied parameters will be automatically appended after these two parameters.
    1. response: Test Case Response in string format. If the API is returning JSON response then the response parameter will be stringified JSON. You may overwrite the response parameter for JSON response using the below line:

      Code Block
      response = JSON.parse(response);
    2. opts: Options object 
      1. opts object is a simple JSON object which contains the following keys
        1.  "headers" and value contains the JSON object of response headers.
        2. "statusCode" and value contains the HTTP response status code.
      2. to extract variables from response headers, use the opts.headers object.
      3. to use status code information, use the opts.statusCode.

    Write your utility method like below:

  2. Use this utility method in variable extractor tab like this.

    Any parameters passed to this utility method will get appended after two parameters (response and opts) in the utility method. In the above figure, value of var1 will be extracted via utility method varExtractUtility. Here value "hello" will be passed to "userDefinedParam1" parameter and "world" will be passed to "userDefinedParam2" parameter of the utility method defined in step 1.