Resource Variables

Resource Variables Overview

Resource Variables are used to validate network calls that a page makes and to verify that it loads as expected. For example, a user may want to use resource variables to perform technical verifications. Resource variables offer a lot of flexibility.

Sample, simple Use Case: Verify that all network calls are loading as expected.

Sample, complex use case: Validating information within the DOM/source code to ensure that data matches the visual elements displayed on a page. Further, ensure that the segmentation is working as expected, and the correct subset of users is having the correct experience based on the information that is loading.

Note: If your use case involves capturing data from recurring API calls with Resource Variables, see this example.

Resource Variables are accessible within Architect.

To begin, it is important to set up which URLs are acceptable to show in the Resource Variable drop-down menu in the Architect.


To Set Up (Add) the Resource Variable URL's in Architect

  1. Go to the Team tab in Functionize
    Note: the Team tab is only available to an Functionize Admin.
  2. Click on Resource Tracker and then click + Add New Resource to define what URLs should show in the Resource Variable drop-down in Architect

  3. This is the Resource Tracker Whitelist
  4. Please specify the URL of the resource(s) that need to be tracked in Architect
    Note: Each Resource will be tracked for requestHeaders, responseHeaders, QueryString and associated parameters. 
  5. If Regex is selected, use the syntax as example:* or ** -- as wildcards
  6. When ready, click Save resources
  7. These will now be available when using a Resource Variable during test creation
  8. In order for Resource Variables to be used during test execution, you have to ensure that the Capture network logs setting is ON under Test Settings > Advanced TAB

To Apply a Resource Variable

  1. Click the icon in the Architect
  2. Click the Variables button

  3. Select Resource Variables radio button

  4. Select the appropriate URL for verification from the URL drop-down menu

  5. Select the Attribute name, in this example, the user is selecting statusCode

  6. Select the Operator -  if you need to use one of the following functions on the data from the Resource Variable:
    • Substring
    • ToLowerCase
    • ToUpperCase
    • Extract Numbers
    • Extract Float
    • Regex

  7. The Value will auto populate with the current Resource Variable value
  8. Click Set Target to enter the Resource Variable Result into the an input field on the website

Capture a Resource Variable in a Local/Project Variable

  1. Click the Variables icon button in the Architect
  2. Click the + Add Variable button

  3. Select the variable Scope, enter a variable Name and select variable Type as Resource Variable

  4. Select the URL from the drop-down list and select the Resource Variable Attribute, in this example 'statusCode' and if you need to select one of the following functions on the data from the Resource Variable:
    • Substring
    • ToLowerCase
    • ToUpperCase
    • Extract Numbers
    • Extract Float
    • Regex

  5. Click Save button to store Resource Variable in your Local/Project variable

  6. See additional details on how Local/Project Variables can then be used to validate Resource Variables


Resource Variable Examples

Functionize Resource Variables has the capability to retrieve data from your requestHeaders and responseHeaders, store in Functionize Variables (Local and Project) and use throughout your test execution.  Here are some samples of how to use Resource Variables:

//Retrieve Resource Variable statusCode
fze.local.StatusCode = fze.resource[''].statusCode;

//Retrieve Resource Variable requestHeader data
fze.local.RequestHeader = fze.resource[''].requestHeaders['User-Agent'];

//Retrieve Resource Variable responseHeader data
fze.local.ResponseHeader = fze.resource[''];