tcl sleep command
Posted by crystal (crystal), 27 July 2006I 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 2006You can delay a Tcl process with the after command - give the number of milliseconds you want to delay as a parameter. Thus
Posted by crystal (crystal), 27 July 2006Hi,
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
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
#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"
#PLEASE PROVIDE THE PASSWORD FOR THE STP.
expect "Windows NT Domain:"
expect "Please choose (1-5):"
exec script testlog.txt
Posted by admin (Graham Ellis), 27 July 20061ms 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 2006well 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 2006These 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 2006It'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.
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho