Debugging Automation Scripts

Innovation Studio offers several options for debugging automation scripts from the development and testing environments.

Debugging Log

The Debugging Log adds information in the log file and continues the automation script execution.

If the script breaks due to a throwException or to an unexpected error, the log information will be written in the log file.

Example of how you can use the use log for debugging:
Copy

log("log 1"); 
log(newQuoteValabilityStartDate);
log("offer number" + '' +quote.Name);
log("test function"+birthDay +" "+ gender);
log("quote = " + serialize(quote));

Throw Exceptions

Break the automation script execution and display the message as specified within the throwException statement.

When the throwException method is called in an automation script, the passed error message is available to users.

Examples of how throwException can be used for debugging purposes:

Copy

throwException(serialize("test"));
throwException(serialize(result.TotalNetProfit));
throwException(serialize(context));
throwException(String(Topic[0].a_Topic));
throwException(JSON.stringify(result));
throwException(JSON.parse(result));

JavaScript Exceptions

When parsing invalid Xml in automation scripts, JavaScript Exceptions are caught by try catch in JavaScript:

Copy
try
        {
        // load invalid XML
        var doc = server.Xml.Load( '<a> ... <' );
}
catch(err)
        {
        // handle error
 }

Console Debugging

Server-side errors are displayed by the developer tools. During development and testing phases, engineers are able to track errors raised on the server-side directly in the browser's Developer Tools.

Browser developer tools to use for debugging automation scripts:

The error output displayed in the Console is particularly useful when raising issues. Include the error output in the issue description to provide a complete overview of the error and reduce the investigation time.

NOTE  
Console debugging can be used ONLY on development machines and in testing environments.