Skip to main content
Testing and debugging an action

Find out how to run a test in your application’s actions and undertake debugging with the help of the log message step functionality.

Updated over a week ago

Test run

Whenever your application needs to be tested, you can run tests via actions manually to validate if they produce the expected results and perform the desired logic. Any action flow can be executed using the built-in GraphQL playground tool.

To open the playground, simply press the ‘Test run’ button in the top-right corner of the builder interface of actions.

A modal screen is displayed after you click the ‘Test run’. This screen shows the instructions for configuring the playground to enable the action’s execution.

The modal displays three elements:

1) ‘Go to playground' button that enables opening the playground

2) Mutation - a piece of code that one has to copy into the playground

3) Variables - a configuration of the variables that are needed for the action to run correctly

After clicking the ‘Go to playground’ button, the actual playground is opened in a new window:

4) Code of the mutation needs to be copied in the top left area.

5) Variable configuration needs to be copied into the ‘Query variables’ in the bottom left area.

The action can be run by pressing the play icon in the center of your screen. The result of the actions will be displayed in the right area of the playground in JSON format. If the execution of the action is a success, the result will show a JSON structure containing the value of the output variable as configured in the 'Finish' step.

In case of failed execution of the action, the result will be shown as an error message in the JSON structure. It can be later used to debug the action.

Warning! By running the action this way, the logic in the action is actually executed. This means that database records will be created or removed if you have configured these steps in your action. Running the action does not use dummy data.

Debug logging

After you have tested your action and it didn’t return the desired results, debugging will be your next step to undertake. Adding debug logging to your action will make it possible to obtain more information about the state of your action at a certain point.

The ‘Log message’ step is provided “out-of-the-box” to log a static text or the contents of a variable to the application logs.

This step can be used anywhere in your action flow, applied by drag-and-dropping into the desired position.

The output of the log step (your message or the value of a variable) can be viewed in the application’s logs. To open the application logs, go to the ‘Tools’ section from the bottom of the builder bar and select ‘Logs’.

In the application logs, you can view your own log and debug messages of the platform while compiling an action. Depending on what type of logging is specified you'll see the corresponding chip. An example would be when you have the false flow of a condition step you might want to see why it didn't go through the true flow. By adding a log message with an error chip you can specify exactly what you want to see in the message, by adding the variables that you need to see.

Note: When changing the action, please, wait a minute before triggering the action using the playground again. The action compiler needs some amount of time to process these changes before the action can be run again.

Did this answer your question?