Printer FriendlyEmail Article Link

Avalanche: How to Generate TCL Test from GUI?

Environment/Versions
  • Avalanche
     
  • TCL
     
  • Automation
Answer
  • Converting a Test to a Tcl Script
  • 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). These two 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:
  1. Select the test that needs to be converted to TCL.
     
  2. Select File > Generate Tcl Test, or right-click the selected test, and then click Generate Tcl Test. The Tcl Test Generator window appears.
     
  3. Select either Compact or Detailed scripts.

    1. 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.
       
    2. 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.
       
  4. In the Spirent 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.
     
  5. 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.
     
  6. 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.
     
  7. 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.
     
  8. 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.


     
  9. To save console messages, click Save Console button to locate a directory and specify a filename.
     
  10. To remove all messages from the console, click Clear Console button.
     
  11. Click Close button to close the Tcl Test Generator window.

NOTE: Only advanced tests can be converted to a Tcl script. To can convert a quick or EZ test into TCL, we need to first convert it to an advanced test.


Product : Avalanche