Avalanche Automation: How to Generate TCL Test files from Avalanche Commander GUI? (Export a working test into TCL Files)

Knowledge Base - FAQ

Avalanche Automation: How to Generate TCL Test files from Avalanche Commander GUI? (Export a working test into TCL Files)
• Converting an Avalanche Commander working Test to a Tcl Script/Files: • To convert a test from the Avalanche Commander GUI into a Tcl script, we can use the Avalanche Tcl Test Generator. This tool creates both a Tcl test configuration file (config.tcl) and a runtime executable file (test.tcl) along with a "data" folder containing all relevant files to the test. These two (.tcl) files constitute one single test, and the test.tcl file is the entry point or controller of the test. Once we convert a test to a Tcl script, we can further edit the script, and import it back into the Commander GUI.   • To convert a test to a Tcl script we need to follow below steps: • Select the test that needs to be converted to TCL.   • Select File > Generate Tcl Test, or right-click the selected test, and then click Generate Tcl Test. The Tcl Test Generator window appears. • Select either Compact or Detailed scripts. Detailed is recommended.   • Compact: All the test configuration information is self-contained within the project file (.spf). The conversion process simply exports the GUI test configuration to generate the .spf file, with no configuration command calls (av::config) in the generated Tcl test configuration file (config.tcl). We can run the test in the usual manner using the runtime executable file (test.tcl), but we cannot change configuration settings, since the compact script is encapsulated/hidden within the .spf file.   • Detailed: All the relevant test configuration information is included in the config.tcl file, using a configuration command call (av::config) for each and every test configuration entry. Thus, we can edit detailed scripts and change configuration settings for more granular control.   • In the VIAVI Tcl API Dir field, if the default installation directory is the location of the Tcl scripting API, leave this field as is. Otherwise, click the Browse button to locate and select the directory in which the Tcl scripting API is installed. For example the following paths are valid, depending just on the installation order of Avalanche Commander Application and VIAVI TestCenter.:  "C:\Program Files\VIAVI Communications\Avalanche Commander 5.51\Avalanche Commander\TclAPI" // "C:\Program Files\VIAVI Communications\VIAVI TestCenter 5.50\Avalanche Commander\TclAPI"   When Avalanche Commander was installed first and then VIAVI Test Center: Installation Path: C:\Program Files\VIAVI Communications\Avalanche Commander 5.51\Avalanche Commander\TclAPI When VIAVI Test Center was installed first and then Avalanche Commander : Installation Path: C:\Program Files\VIAVI Communications\VIAVI TestCenter 5.50\Avalanche Commander\TclAPI   NOTE: For further details on where does Avalanche Commander gets installed, please see KB Article: Avalanche: Where can I find the installation folder (path) for Avalanche Commander in Windows PC ?   • In the Tcl Test Output Dir field, if the default output directory is where we want to store the resulting Tcl test files, leave this field as is. Otherwise, click the Browse button to locate and select the directory in which we want to store the Tcl test files.   • Select Portable Test if we want to generate a portable Tcl test. For example, we can generate a test in Windows, and then execute it on another operating system or computer. We must also set certain system environment variables on every computer on which we intend to run the test. See the Avalanche Automation Programmers' Reference for more information.   • Select Include Defaults to include all configuration entries in the Tcl test configuration file. If we do not select this checkbox, the configuration entries that are set to their default values are omitted from the file.   • Click the Generate Tcl Test button to start the conversion process. Informational messages and errors appear in the console (text area below the buttons). When the conversion process is complete, the directory and filename of the converted Tcl test configuration file and runtime executable file appear. The directory and filenames indicate the name of the converted test. Any errors appear in red text. • To save console messages, click Save Console button to locate a directory and specify a filename.   • To remove all messages from the console, click Clear Console button.   • Click Close button to close the Tcl Test Generator window.   Locating the Exported TCL Files: • Go to the destination folder. • List the files and confirm you got the files (Config.tcl, Test.tcl) and data folder.