Functional testing allows you to test your backend functions individually, making it easier to find and resolve bugs.
The code editor comes with a quick-test environment for functional testing, which speeds up the development process by reducing the need to manually trigger and test your backend code by calling functions from the frontend.
You can test your backend functions with functional testing using the editor (Wix Studio and Wix Editor).
You can access functional testing from the following code files in your site's backend:
Note: Functional testing only works for functions that are exported.
The functional testing environment opens as a new tab in the code editor for each function you test. To test your functions, add sample input parameter values as a JSON object on the left.
When you run the function, the output is displayed on the right side, where the call statement always appears. If there are no errors, the return statement and console logs generated by the function are displayed. If there is a problem with your code or the input parameter values, an error message will appear instead. This setup helps you easily debug and improve your functions by providing clear feedback in the form of call statements, return values, console logs, or error messages.
The output you see in the functional testing tab is the same as the output you would see in the Developer Console if you previewed your site and triggered the function. Testing backend functions in the code editor has other similarities to testing in Preview mode: