Functionize.com

Extension Action Tutorial | Functionize

Functionize is a low-code intelligent testing platform that allows you to create automated tests without code. Test engineers who wish to customize test with code can use reusable code snippets called Extensions. Architect has a new advanced action type called Extension Action, which can be used to make calls out to an external site. The response can then be verified against the UI to build a rich end-to-end test. Watch this video to learn how to do this. This example uses an extension action for curl requests.

Extension Action Tutorial | Functionize

Yes, Functionize is a low-code intelligent testing platform that allows you to create automated tests without code. It also allows test engineers to customize tests with code using reusable code snippets called Extensions.

The new Extension Action type in Functionize Architect allows you to make calls out to an external site and verify the response against the UI to build a rich end-to-end test. This is useful for testing complex interactions with external systems, such as APIs or databases.

To use an Extension Action for curl requests, you can follow these steps:

  1. Create a new Extension Action by clicking the “+” button in the Architect editor.
  2. Select the “Extension Action” type and click “Create”.
  3. Enter a name for the Extension Action and select the “Curl Request” action type.
  4. In the “Curl Request” section, enter the URL of the external site that you want to make a request to.
  5. You can also specify the HTTP method, request headers, and request body.
  6. Click the “Test” button to test the Extension Action.
  7. Once the Extension Action is working correctly, you can use it in your test cases by dragging and dropping it onto the test case canvas.

Here is an example of a simple test case that uses an Extension Action for a curl request to test a login endpoint:

# Create a new test case.
test_case = fze.testcase("Login to Website")

# Create an Extension Action for the curl request.
login_extension_action = fze.extension_action("LoginExtensionAction")

# Set the URL of the login endpoint.
login_extension_action.set_url("https://example.com/login")

# Set the HTTP method to POST.
login_extension_action.set_http_method("POST")

# Set the request headers.
login_extension_action.set_request_headers({
  "Content-Type": "application/json"
})

# Set the request body.
login_extension_action.set_request_body({
  "username": "username",
  "password": "password"
})

# Execute the Extension Action.
login_extension_action.execute()

# Verify that the user is logged in.
fze.action("VerifyUserLoggedIn").execute()

Extension Actions are a powerful tool that can be used to customize and extend the capabilities of Functionize. By using Extension Actions, you can automate complex interactions with external systems and build rich end-to-end tests.

Extension Action Tutorial for Functionize

Extension Actions in Functionize are a powerful way to customize and extend the capabilities of the platform. By using Extension Actions, you can automate complex tasks and build rich end-to-end tests.

Creating an Extension Action

To create an Extension Action, follow these steps:

  1. Open Functionize Architect and click the “+” button to create a new item.
  2. Select the Extension Action type and click “Create”.
  3. Enter a name for the Extension Action and select the programming language that you want to use to write the code.
  4. In the code editor, write the code for your Extension Action.
  5. Click the “Test” button to test the Extension Action.
  6. Once the Extension Action is working correctly, click the “Save” button.

Using an Extension Action in a Test Case

To use an Extension Action in a test case, follow these steps:

  1. Open the test case in Functionize Architect.
  2. Drag and drop the Extension Action onto the test case canvas.
  3. Configure the Extension Action by setting the input parameters.
  4. Connect the Extension Action to other actions in the test case using arrows.
  5. Run the test case to execute the Extension Action.

Example Extension Action

The following is a simple example of an Extension Action that uses the Python programming language to make a curl request:

Python
import requests

def execute(self, input_parameters):
  url = input_parameters["url"]
  method = input_parameters["method"]
  headers = input_parameters["headers"]
  body = input_parameters["body"]

  response = requests.request(method, url, headers=headers, data=body)

  return response.content

This Extension Action can be used in a test case to make a curl request to any external site. For example, the following test case uses the Extension Action to test a login endpoint:

# Create a new test case.
test_case = fze.testcase("Login to Website")

# Create an Extension Action for the curl request.
login_extension_action = fze.extension_action("LoginExtensionAction")

# Set the URL of the login endpoint.
login_extension_action.set_url("https://example.com/login")

# Set the HTTP method to POST.
login_extension_action.set_http_method("POST")

# Set the request headers.
login_extension_action.set_request_headers({
  "Content-Type": "application/json"
})

# Set the request body.
login_extension_action.set_request_body({
  "username": "username",
  "password": "password"
})

# Execute the Extension Action.
login_extension_action.execute()

# Verify that the user is logged in.
fze.action("VerifyUserLoggedIn").execute()

Conclusion

Extension Actions are a powerful tool that can be used to customize and extend the capabilities of Functionize. By using Extension Actions, you can automate complex tasks and build rich end-to-end tests.

Leave a Comment