Submit a ticketCall us

Looking to compare latest NPM features with previous versions of NPM?
The NPM new feature summary offers a comparison of new features and improvements offered with this release.

 

Home > Success Center > Kiwi CatTools > Kiwi CatTools 3.11 Administrator Guide > Activities > Creating a custom activity > Testing your custom activity

Testing your custom activity

Table of contents
No headers
Created by Caroline Juszczak, last modified by Caroline Juszczak on Jun 28, 2016

Views: 2 Votes: 0 Revisions: 1

 

Testing your custom activity is relatively straight forward.

 

Once you have the activity type (.ini) file, the activity main script and client script (.txt) files setup and have also created the device .custom file containing the device specific code for your custom activity; you simply create a new activity in CatTools, selecting your custom activity from the activity 'Type' drop-down list field, then in the 'Devices' tab you select the device which you created the .custom file for.

 

There are several testing aids available in CatTools.

 

1. Info Log messages

 

Within the Info Log pane you see messages appear while an activity is running. The level of messages that appear can be filtered by the drop-down list near the bottom of the Info Log window. By selecting level "4) Show Debug events and above" you get to see all the cl.log messages being displayed during the running of an activity.

 

You should be aware that all the Info Log messages are logged to a file called InfoLog.txt in the root CatTools folder. This file can get very large very quickly, so can be purged by selecting the File | Delete | Delete lnfolog.txt file menu item from the CatTools File menu.

 

The client script function cl.Log 4,"message" is found throughout device scripts to display level 4 messages which help assist in troubleshooting device specific issues.

 

The most likely Info Log error (level 1 - error) you will encounter when testing your new custom activity script is:

  • "Client script error: Type Mismatch: [activity name] on line: [line number]"

 

This error will occur if:

  • The device you have selected to run your custom activity against does not have a .custom file defined for it.
  • The .custom file for the device does not contain a function which has been defined in your custom activity client script.
  • A function defined in the .custom file contains an error within the code.
 

If CatTools finds an associated .custom file for the device, you should see an Info Log (level 4 - debug) message of

 

"Loading custom activities for device"

 

If you do not see this message for your device (note: you must have set your Info Log pane to "4) Show Debug events and above" ), then CatTools was unable to find a .custom file either because it did not exist, it could not be opened (check permissions), or a typo error has been made when naming the .custom file.

 

If you see the debug message above, then check the contents of the .custom file to ensure that the custom activity function exists, has been spelled correctly and that the code does not contain errors (maybe add additional ??cl.log 4, "..." Info Log debug messages at strategic points in your code to find where the script is failing).

 

If the selected device does not support the custom activity, either deselect the device in the activity setup Devices tab, or add the following code to the custom activity Function within the .custom file for the device:

 

Function [YourCustomActivityFunctionName]()

Call cl.CatToolsNoSupport

End Function

 

Now when you run this activity, the function will be called, but the cl.CatToolsNoSupport internal CatTools function will return an Info Log message (level 2 - Warning) of :

 

"Device type: [SCRIPT_NAME constant] has not had this functionality added yet. Skipping this device"

 

Other errors you may encounter are:

  • "Client script error: Variable is undefined: '[variable name]' on line: [line number]"

This error will occur if:

  • Your code contains a variable which has not been declared. Ensure you Dim or Redim you variables correctly (check for typo errors in your variable declarations).
  • Your code contains a call or reference to an internal CatTools variable or function (cl. or ct.), or to a class or type you have defined, but you mistyped 'cl.' or 'ct.' or the class name.

 

  • "Client script error: Object doesn't support this property or method: '[property or method]' on line: ??[line number]"
 

This error will occur if:

  • You are making a Function call or Sub routine call within the .custom file, but the Function or Sub routine does not exist. ??(check for typo errors in your code).
  • "Client script error: Wrong number of arguments or invalid property assignment: '[Function or Sub name]' on line: [line number]"
 

 

This error will occur if:

  • You are making a Function call or Sub routine call within the .custom file, but have supplied an incorrect number of arguments to the Function or Sub routine.

 

 

2. Debug log

 

Under the File menu of CatTools there is an entry Enable Capture Mode.  This turns on the logging of the conversation between CatTools and the end device and creates a disk file in the \Debug sub folder of the communications. This can be extremely useful when the script does not appear to be communicating correctly with the device after making its initial connection. The scripting mechanism waits for known prompts and issues commands to the device at these points. It eventually times out if an expected prompt fails to appear. The debug log capture file shows what the device is actually sending to CatTools, so you can adjust your code accordingly.

 

Last modified
07:20, 28 Jun 2016

Tags

Classifications

Public