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 vehicle data?
You can test the scripting in the editor. Choose the track point from the track point list, and the value of the vehicle will be loaded into the script console automatically.
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.
How I can troubleshoot if the scripting is running in the correct logic as expected?
The log() method! It is very useful 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.
When you test run the script in the editor, log() writes messages to the output console.
When you are testing the click script, log() writes messages to the App Console. You can find it from Admin > Development > App Console.
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