> This page is for Docs.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://zuora.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://zuora.ferndocs.com/_mcp/server.

# Test a function

> Learn how to test a function when creating or updating it.

Learn how to test a function when creating or updating it.

To ensure the return value of a function meets your expectations, it is a good practice to test a function before activating it.

You can test a function during the creation or update.

Click **Test** when creating or updating a function. The **Input** and **Output** fields are displayed. All custom fields of the current object are pre-populated in the **Input** field with the `null` value.

![test function](/_fern-img/b2b6aade105b6cb9e1b4956abc63ec34760a6e40b4b24debc6537ae11721cfa9.webp)

Optional: Edit field names in the **Input** field. You can also add standard fields if the context object is a standard object.

Specify field values in the **Input** field for testing. After changes to the **Input** field are detected, Zuora calls this function with the data in the **Input** field as input value and displays the return value in the **Output** field.

![test function failure](/_fern-img/d6a6fb2ef3d6224fad95e17ceba4f17b1d28a9e1b8ccbbe6c113b88f7ecfdcdc.webp)![test function success](/_fern-img/a477c6ad05fa899f0293191bbb93c308dec4a81ca29c314654a45dcc88c1b5ad.webp)

If the return value is not as you expected, revise the JavaScript code in the **Enter Script** field and repeat steps 2 and 3.