Automated Testing-TCL scripting language
TCL is a scripting language. It was first called "Tool Command Language" "Tool Command Language", but it does not mean it now, but we still call it TCL. Created by John Ousterhout. TCL is very studious and powerful. TCL is often used for rapid prototyping, Script Programming, GUI and testing.
Tcl is an interpreted language. Unlike other advanced languages that need to be compiled and joined, it directly interprets and executes each statement in sequence like other shell languages.
The Tcl data type is simple. For Tcl, there is only one type of data to be processed-a string. Tcl stores variable values in the form of strings, regardless of their actual usage type.
The embedded toolkit provides simple and rich graphic functions, allowing you to easily create a simple graphic interface.
Tcl provides interactive command interfaces, including tclsh and wish. Tclsh only supports Tcl commands, while wish supports Tcl and Tk commands. Through the interactive interface, we can execute commands one by one, just like running UNIX shell commands, and get the execution results instantly.
Tcl/Tk provides cross-platform support. The Tcl language can run on most popular UNIX, WINDOWS, and Macintosh systems, and the commands are common, but the startup details are somewhat different.
Good compatibility between Tcl/Tk and C/C ++. The Tcl/Tk script can be well integrated into C/C ++ programs.
1. Install TCL
Please refer to the software homepage: http://www.tcl.tk/. the latest version is tcl/tk 8.6.4.
2. Use TCL
After the installation is complete, open tclsh.exe to be the tcl interpreter. Enter simple characters.
3. Simple Example
Test. tcl source code
#! /Bin/sh # simple example set foo "john" puts "Hi my name is $ foo" set month 2 set day 3 set year 97 set date "$ month: $ day: $ year "puts $ dateset foo" puts hi "eval $ foo
for {set i 0} {$i < 10} {incr i 1} {puts "In the for loop, and i == $i"}
Enter tclsh test. tcl in the command line to execute