LiveCycle Designer ES includes three primary methods for testing and debugging your calculations and scripts:
Using the LiveCycle Designer ES workspace palettes. For more information, see “Using the workspace to debug calculations and scripts”.
The host model and event model provide functionality that lets you interact with either the host application or the various form events. These models are useful for returning information that can assist you in debugging calculation and scripts.
For example, the following script returns a message at run time indicating the name of the event on which the script is placed. This indicates that a particular event has fired:
xfa.host.messageBox(xfa.event.name)  // FormCalc
xfa.host.messageBox(xfa.event.name); // JavaScript
Another example of using the host model and event model methods is to obtain the value of a field on an interactive form before a user manually changed it. This is useful for observing how the objects on your form design respond to user-entered data:
xfa.host.messageBox(xfa.event.prevText)  // FormCalc
xfa.host.messageBox(xfa.event.prevText); // JavaScript
See also 

Testing and debugging calculations and scripts