Testing and debugging event scripts on components is easy. Open up the Output Console in the Designer and sprinkle your code with print statements to see what is going on.
This approach doesn't work as well with gateway scripts because print statements are not output to the Output Console in the Designer.
A gateway script is any Python script that runs in the Gateway and not in a designer or client. Here are a variety of tools to use for testing and debugging gateway scripts: