> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chaintable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test and debug

> Set Function test inputs, save test cases, and debug using returned values and errors.

Run the current code in the Function editor to inspect its return value and logs. This guide uses `usdc_amount` from [Create a Function](/guides/functions/create).

## Run a test

1. Open the Function and find the `raw_amount` input below the editor.
2. Enter `1500000`, then press Tab or click elsewhere to apply the input.
3. Click **Run** and wait for completion.
4. In **Output → Return**, check that the result is `1.5`.

<Frame>
  <img src="https://mintcdn.com/opcodelabspteltd/TOA0bb8_WqdBuVVN/images/guides/functions/result.png?fit=max&auto=format&n=TOA0bb8_WqdBuVVN&q=85&s=83d122039044c8d5cf72329d4beccf6a" alt="usdc_amount test input and return value 1.5" width="1920" height="1080" data-path="images/guides/functions/result.png" />
</Frame>

`return` values appear under **Return**; `print()` output appears in the output area.

## Save test inputs

Hover over the parameter bar and click the flask icon with a plus sign, **Add to test cases**, to save the current inputs. The number on the flask button at the right shows the saved test case count.

Click that button to open the test-case list, select an entry to restore its parameters, and click **Run**.

<Frame>
  <img src="https://mintcdn.com/opcodelabspteltd/TOA0bb8_WqdBuVVN/images/guides/functions/test-cases.png?fit=max&auto=format&n=TOA0bb8_WqdBuVVN&q=85&s=f440b3abcc02bb72fcd5a06d9a0f8247" alt="A saved test case with raw_amount set to 1500000" width="1920" height="1080" data-path="images/guides/functions/test-cases.png" />
</Frame>

## Inspect an error and retest

Temporarily change the divisor `10 ** 6` to `0` and run with input `1500000`. This triggers `ZeroDivisionError`. The output includes `division by zero` and a traceback pointing to that line.

<Frame>
  <img src="https://mintcdn.com/opcodelabspteltd/TOA0bb8_WqdBuVVN/images/guides/functions/error.png?fit=max&auto=format&n=TOA0bb8_WqdBuVVN&q=85&s=2f132652690f6a0ddee93cc28a159afa" alt="Output shows division by zero and a traceback after the failed test" width="1920" height="1080" data-path="images/guides/functions/error.png" />
</Frame>

Restore the divisor to `10 ** 6`, save, and run again. The return value should be `1.5`.
