Testing and debugging macros is perhaps the most important and most time-consuming portion of writing macros. There are specific techniques and features to make it easier to test and debug macros, ultimately speeding up deployment of Call Tree solutions.
Testing Macros from the Edit Node Window
During the discussion of the "Header Used to Test the VBScript Macro" field we learned that the header helps to define variables for the purposes of testing outside a call environment. To test a macro from the Edit Node window:
Use the "Build a Header" button to create a header.
Modify the variables in the header to emulate the state of a call when it reaches the current Node.
Use the Test the Macro button to see how the macro would execute during an actual call.
Testing complex macros in this way will save a lot of development time.
Use Message Boxes to Display Variables
It will often be useful to know the values of specific variables at specific points in the macros. Since Active Call Center does not include step-through debugging, the only way to "watch" variables is to display message boxes that show the values of the variables.
Scatter the MsgBox function throughout out a macro to watch variables change. The MsgBox function was discussed earlier in the Learning VBScript section.
The macro below shows how the MsgBox function can be used to watch the Message variable change:
Dim Message
MsgBox "Starting the example now."
Message = "Hello"
MsgBox Message
Message = Message & ", my name is John."
MsgBox "Final value: " & Message
Use the Call Simulator to Test Call Trees
Active Call Center includes a powerful call simulator that will duplicate the behavior of a phone call without requiring an actual phone call. To run the simulator, select Phone Calls... Simulate Call from the menu bar.
Color Syntax Editor for VBScripts
Active Call Center includes a sophisticated color syntax highlighting editor for the VBScript macros. The color coding scheme is as follows:
The color coding will help to quickly locate errant quotation marks and misspelled keywords.