How to test and troubleshoot scripting

When writing new scripting for event rules, the device mapper, and click scripts, learn how to ensure the scripting works as expected.

How can I test my script with real asset data?

You can test the scripting in the editor. Choose the track point from the track point list, and the value of the asset will be loaded into the script console automatically. 

Screenshot 2025-01-07 at 16.51.28.png

Can I simulate inputs/variables when testing the scripting? 

Of course! You can add any variable in the editor and input the value for your testing scenario. From the Script Editor window, on the right-hand side, there is the Fields category where you can select any variable and press add. 

ScreenRecording2025-01-08at08.53.21-ezgif.com-video-to-gif-converter.gif

How I can troubleshoot if the scripting is running in the correct logic as expected? 

The log() method! It is beneficial when troubleshooting scripts. Use the log() method to write down values and then check if they really are what they should be. log() writes down messages to the terminal when the event rule is running.

Terminal interface with GPS data logs.
When you test run the script in the editor, log() writes messages to the output console.

Script editor with code and test output.

Log () writes messages to the App Console when you are testing the click script. You can find it from Main Menu > Admin > Development > App Console.

App console showing vehicle messages

In summary, there are a few key things in the script editor that are the golden combination for script testing:

  • the Test Script button
  • setting variable values in the editor
  • using the log() method