Creating Extensions

Functionize Extensions, or microservice endpoints, provide powerful flexibility and control over test executions by exposing the runtime object model. Extensions enable users to manipulate runtime values such as input data, uploaded/downloaded files, screenshots, variables, orchestration information, and more. This makes test executions fully programmable and customizable, with virtually limitless use cases.

Extensions are independent services that process test step objects outside of the test’s virtual machine. They can be used to evaluate and modify data, and return the result back to the test for the current action. Unlike single-use Custom JS, Extensions are reusable across your account or team and can be registered to run before or after test actions.

When creating and using extensions, keep the following best practices in mind:

  • Keep extension scopes modular and simple
  • Use descriptive names for clarity
  • Document the purpose and expected input/output for future maintainers

Accessing Extensions

  1. Click on Extension Management in the top menu bar.
  2. From here, you can create, modify, test, and delete both Internal and External Extensions.

Creating an Internal Extension

Internal Extensions are hosted within the Functionize Cloud and run as serverless cloud functions. Supported runtimes include NodeJS 18, Python 3.11, Go 1.20, and Java 17. Libraries may be included to extend functionality.

Steps to Create an Internal Extension:

  1. Click Create Extension.
  2. Select Internal from the Type dropdown.
  3. Enter the Extension Name.
  4. The Function to Execute defaults to helloWorld. This is the starting point function for execution and can be renamed. If you choose to rename this function, be sure to use the same function name within the code also.
  5. Select the Privacy level:
    • Private: Only accessible to you.
    • Team: Shared across your team and projects.
  6. Select the runtime language.
  7. Review the sample code provided (e.g., toLowerCase function, which converts inputs to lowercase).
    • Format Requirements: The extension must handle objects with the following structure:
      • updates
      • action
      • attributes
      • value
    • The package.json file (for NodeJS) or equivalent setup for Go, Python, or Java may be modified as needed. Input and response interface guidelines are detailed in the Extension Samples section of the User Guide.
  8. Update the code to perform your desired logic.
  9. Click Confirm.
  10. The new Internal Extension will appear in your Extension list.

Note: Internal Extensions are subject to Google Cloud Function limits for payload size, execution time, and runtime capabilities.

Creating an External Extension

External Extensions are hosted in your own environment and can be integrated with Functionize via registered endpoints.

Steps to Create an External Extension:

  1. Click Create Extension.
  2. Select External from the Type dropdown.
  3. Enter an Extension Name (alphanumeric only).
  4. Input the POST Endpoint for your API.
    • The endpoint must follow the same input and output format used by Internal Extensions.
  5. Click Confirm.
  6. The new External Extension will appear in your Extension list.

Testing an Extension

Internal and External Extensions are tested the same way.

  1. From the Extension list, click on an Extension to open the testing modal.
  2. Add various input parameters (e.g., Action Types such as Inputs, Clicks, etc.).
  3. Click Run.
  4. Review the returned output to verify that the extension behaves as expected.

Deleting an Extension

Extensions can either be unmapped from specific test actions or permanently deleted.

  • To unmap an Extension from an action, use the Mapping dialog described in the User Guide.
  • To delete an Extension completely:
    1. Go to Extension Management.
    2. Click the Delete icon next to the extension.
    3. Confirm the deletion.

Important: Deleting an Extension that is already mapped to test cases will also remove those mappings. Tests that depended on the extension may fail until updated.

Key Benefits of Extensions

  • Reusability: Write once, use across multiple tests and projects.
  • Flexibility: Programmatically alter execution flow and runtime values.
  • Integration: Connect Functionize with internal systems, APIs, and external services.
  • Scalability: Manage logic centrally, reducing duplication across test suites.