Understanding the Extension Object Model

Extensions in Functionize expect an HTTPS POST request with a JSON payload as the function input. This payload provides complete context about the current test case, orchestration, variables, and step being executed.

 

Example Input Structure

{
  "orchestrationRunId": "",
  "testId": "903915",
  "TDMdataSetId": "",
  "orchestrationId": "0",
  "step": { ... },
  "previousSteps": [ ... ],
  "variables": {
    "project": {},
    "local": {}
  }
}

At the top level, the structure includes:

  • Test identifiers: testId, orchestrationId, and optional TDMdataSetId.
  • Step object: Details about the current action being executed.
  • Previous steps: An array of step objects with results from earlier in the test.
  • Variables: Current runtime variables, separated into project and local scope.

Step Object

Each step contains execution details for the current action:

"step": {
  "path": "",
  "optional": false,
  "action": { ... },
  "output": { ... }
}

Action Object

The action section contains metadata about the test step, such as type, attributes, or files involved. For example:

"action": {
  "fileName": "Vistex_POS Golden Data_JK_MassValidations.csv",
  "fileUrl": "https://functionize.storage.googleapis.com/test-903915%2Fdownloads%2F9828f2c7...",
  "id": "1668018653699_DVHVBC3OB0",
  "type": "UPLOAD",
  "fileData": "MjEyMjIzfEdvbGRlbiBEYXRhX0pLX01hc3N..."
}

Common attributes include:

  • type: The step type (e.g., UPLOAD, CLICK, PAGE_INIT).
  • fileUrl / fileName: If applicable, a reference to an uploaded/downloaded file.
  • id: A unique identifier for the action.

Output Object

The output object captures the results of executing the step:

"output": {
  "foundUrl": "https://www.functionizeapp.com/tools/fileviewer",
  "result": null,
  "baseFileName": "6_chrome_new_1668018653699_DVHVBC3OB0",
  "displayScreenshotPath": "",
  "verificationResults": [],
  "postScreenshot": { ... },
  "elementResult": { ... },
  "preScreenshot": { ... }
}

Output data may include:

  • foundUrl: The URL at which the action was executed.
  • preScreenshot and postScreenshot: Pre- and post-execution screenshots with metadata.
  • elementResult: Selection results for the element interacted with.
  • verificationResults: Assertions or checks performed.
  • result: Success/failure outcome details.

Full Example Input

Here is a complete example showing a test step and previous step results:

{
  "orchestrationRunId": "",
  "testId": "903915",
  "TDMdataSetId": "",
  "orchestrationId": "0",
  "step": {
    "path": "",
    "optional": false,
    "action": { ... },
    "output": { ... }
  },
  "variables": {
    "project": {},
    "local": {
      "pageTitle": "Functionize"
    }
  },
  "previousSteps": [
    { ... },
    { ... }
  ]
}

Manipulating Test Execution with Extensions

Extensions can modify the runtime behavior of a test by returning an updated JSON response. The updates object is used to overload values or override step results.

Example: Setting a Variable

This example adds a new local variable product with the value Jacket:

let result = {
  "updates": {
    "variables": {
      "local": {
        "product": "Jacket"
      }
    }
  }
};
res.status(200).send(result);

Example: Forcing a Step Failure

Extensions can override the outcome of a step, even if it would normally pass:

let result = {
  "updates": {
    "step": {
      "output": {
        "results": [
          { "result": "FAIL", "message": "Step failed in extension." }
        ]
      }
    }
  }
};
res.status(200).send(result);

Best Practices

  • Use local variables for temporary values relevant only to a single test.
  • Use project variables for values shared across multiple tests.
  • Be explicit when overriding results to avoid unintentional false failures.
  • Ensure your endpoint is HTTPS-enabled with a valid SSL certificate and reject insecure requests to protect sensitive test and execution data.
  • Always validate Extension response schemas against the required format (updates, action, attributes, value).