To pause an isolated test and move through commands, see Live debugging.
In Twidget, you can easily test your endpoints and functions directly within our code builder. This guide will walk you through the steps to efficiently test your functions to ensure they meet your requirements.
-
To start testing, follow these steps:
Open Code Builder:
Click Test:
In the test sidebar, you have the option to define the input values that your function will be tested with:
Input Fields:
Assertions are used to validate the results of your function tests. You can add multiple assertions to ensure thorough testing:
Assertions Section:
Types of Assertions:
Equality: Check if the result equals a specific value.
Comparison: Validate if the result is greater than, less than, etc.
Multiple Assertions: Add multiple conditions to fully test your function's logic.
Test Success: A test will pass only if all the assertions specified are true.
Test Failure: If any assertion is false, the test will fail.
Use execution tracing to see which commands ran, how long they took, and where a run encountered an error.
Open Test for your endpoint, function or event.
Select Trace execution before starting the next run.
Optionally select Include variable values when you need to inspect available recorded variable changes.
Run the test and open its results.
Review the Execution trace list. Select a step to open its details.

Tracing is optional. Turning it on applies to the next run; it does not add details to an earlier result. Your test's ordinary output, errors and assertions remain available.
Use Search trace to find a command or error, or select Only errors to narrow the list. Nested commands and loop iterations help you follow repeated work.
Select a recorded step to see its status, duration, start time, location and any captured error or variable values. Previous and Next move between recorded steps in the current filtered list. Reviewing these steps does not run the commands again.

When a step matches a command in your current workflow, Show current command takes you to that command. If it cannot be matched, the recorded details remain available. The current command may have changed since the test was run.
A step marked Handled error encountered an error that the workflow handled while the overall run completed successfully. Review the step and the final output to check that your recovery behaved as intended.

For a Database Transaction, a child command marked Success only shows that the child finished its work. If a transaction failed or was cancelled, its successful child steps are shown as Executed, and its details explain that commit was not confirmed. This does not prove that changes were saved or rolled back. See Save Changes Together.
If the run times out, close any error dialog to review an available partial trace of the steps captured before it stopped. The timeout warning remains visible, and the run did not complete. A partial trace may not include every step or its final outcome.

Leave Include variable values off unless you need those details. Common sensitive fields, such as passwords, tokens and keys, are hidden; large values are shortened. Some values are intentionally omitted after sensitive operations or when their origin cannot be safely confirmed. Use sample data and review captured values before sharing a trace.
A trace captures up to 500 steps for a test, with additional limits on the total capture size. When a limit is reached, the result explains that steps were omitted. Missing or shortened details are not evidence that a command did not run. Narrow the test case and run it again if you need a more focused result.

Twidget allows you to save your tests for future use and manage multiple tests efficiently:
Save Tests: After configuring your test inputs and assertions, you can save the test for future runs.
Create Multiple Tests: You can create as many tests as needed to cover different scenarios.
Run Tests Individually or All at Once:
Individual Run: Execute a single test to check specific functionality.
Run All: Execute all the tests at once to quickly verify multiple conditions.
On narrow sidebars, each saved test shows its name above one row of actions. Use the play, debug, rename, duplicate or delete buttons; hover or focus a button to read its label. Long test names wrap inside the card.

By following these guidelines, you can ensure your functions and endpoints perform as expected in various scenarios.
Inputs
Overview. In Twidget, inputs are essential elements that allow you to configure endpoints and functions. Events do not use inputs. Endpoint Inputs. Endpoint inputs are used to retrieve data from requests. The available types of endpoint inputs are: 1. Path: Variables that are part of the URL path. 2...
Live debugging
Pause an isolated editor test before a command runs, move through it one step at a time, and inspect its recorded outputs. Use this to find where a calculation or decision begins to differ from what you expected. Start a debug test. 1. Open a server function, endpoint or event and choose Test. 2. Ch...
Workflow templates
Keep reusable workflows in a private library within your workspace. Save a useful endpoint, function, middleware or event, then install independent draft copies when you need the same starting point again. Related workflows are included automatically where supported. Open Workflow templates from the...
Command Output
Some commands in Twidget return outputs, which are essential for dynamic and conditional logic within your workflows. These outputs are displayed next to the command and are prefixed with an "as" to indicate the variable name. Using Output Variables. Once a command returns an output, you can use the...
Safer Releases
Move a reviewed set of published workflows from a Dev workspace to a Prod workspace. Releases let you review the changes together, keep a release history and review a rollback if you need to restore the previous workflows. Prepare your workspaces. Use two existing workspaces in the same organization...