| |||||||||||
tcl sleep command Posted by crystal (crystal), 27 July 2006 I am trying to log into a file what i have exectuted but after i use a sleep command in between my program , it does not log any thing further . I have used telnet to connect to a remote machine. and need to put some delays in between as the execution of certain commands take sometime . what can i change so that i can incorporate the delays and be able to log everything thats taking place. besides this i have only used expect and send commands .... Posted by admin (Graham Ellis), 27 July 2006 You can delay a Tcl process with the after command - give the number of milliseconds you want to delay as a parameter. ThusCode:
Posted by crystal (crystal), 27 July 2006 Hi, this is the code that i am using , but the command "hello\r" before after 1 is not being displayed , the same was the case when using sleep. also it does not log properly, i tried using expect "C:\>" set file [open fnch a+] log_file -a -open $file instead of exec script testlog.txt ,but it would log only to the point just before using the sleep command ,and using the exec script command would creat the file but not log anything #!/home/pub/bin/expect -c #THIS IS TO CHECK IS SCRIPT COMMAND CAN BE USED TO LOG #PLEASE PROVIDE THE IP OF THE PASSIVE NODE HERE. spawn telnet 172.16.61.161 #echo "telnet done" expect "Login Name" send "administrator\r" #PLEASE PROVIDE THE PASSWORD FOR THE STP. expect "password:" send "Administrator1@\r" expect "Windows NT Domain:" send "\r" expect "C:\>" expect "Please choose (1-5):" send "2\r" exec script testlog.txt send "hello\r" after 1 send "hello2\r" expect "C:\>" send "prcstate\r" expect "C:\>" exit Posted by admin (Graham Ellis), 27 July 2006 1ms is a tiny delay ... why bother But I suspect that there's something else wrong in your question and answer sequence ... if the first "hello" doesn't appear, the remote system probably isn't echoing it back. What you need to do is to check the sequence of send and receives; you'll probably find something very slightly incorrect in there that's causing it to lock. Posted by crystal (crystal), 27 July 2006 well i was using it with a 900s delay so i just reduced it to see if thats the problem i have only started to use tcl for test case automation and am not sure how to check the sequence... Posted by crystal (crystal), 27 July 2006 These are my requirements for doing the test case automation , please suggest a good way to go about acheiving this. I dont have any experience so i dont know where to start ....1.Scripts supporting the windows platform [Win NT and Windows 2003 ] with coding in TCL. 2.Scripts should be such that,minimal modifications are done by the end user. 3.Script can be a batch file which will use the input file for STP details. 4.Script a batch file can be directly run from either the host machine or the STP. 5.Script can be any kind of file which can be executed easily with no specific environment to be used. Posted by admin (Graham Ellis), 27 July 2006 It's good to lay down the objectives like that but I'm not sure that I understand properly what the scripts will do. I feel I'm having a load of adjectives and adverbs tossed my way but no nouns or verbs.First stage - get a "spike" solution working. Work out what you need to do manually, make a note of each step, and program it. Perhaps break out to an interact command in your Tcl as you go through step by step to work it out. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |