SPONSORS:






User Tag List

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Dec 2001
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using telnet interactively through silktest

    I need to login into a machine using telnet
    and then invoke one command after another.
    Some commands finish execution quickly and
    some take longer. I am not sure what the
    most compute intensive command would be.

    How can I wait (after sending a command using TelnetWindow.TypeKeys ("command text <ENTER>") ) till the command has finished
    execution and the control is back at the command prompt.




    ------------------

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Location
    San Diego,CA,USA
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using telnet interactively through silktest

    If you have written your own telnet client then just add the feature that the cursor shape changes when the command is being executed. that way you can wait until the cursor returns to expected type other wise there is another very ugly method that I could think of which is as follows:

    The only way I could think of is to make sure that the telnet window has come back to the command prompt which will be something like this :[user@hostName folder]$

    so after passing the command you will select and copy the last line in the telnet window which will be something else while the command is being executed and check the clipboard data againts the expected data you can keep doing it until the data matches the expected data. Once telent finishes the command then the data will match and your loop will end.

    it will look something like following only thing is you will have to change the locations which are hard coded in the test case right now

    [-] testcase TELNet() appstate none
    [ ] Telnet.SetActive ()
    [ ] Telnet.TypeKeys("ls")
    [ ] Telnet.TypeKeys("<enter>")
    [ ] sleep(2)
    [ ]
    [ ]
    [ ] boolean bReady=true
    [ ] string strCLPtext
    [ ] list of string lsCLPDATA
    [-] while bReady
    [ ]
    [ ] print(Cursor.GetPosition())
    [ ] Telnet.Click (1, 155, 367)
    [ ] Telnet.PressMouse (1, 155, 367)
    [ ] Telnet.MoveMouse (2, 367)
    [ ] print(Cursor.GetPosition())
    [ ] Telnet.ReleaseMouse(1, 2, 367)
    [ ] sleep(5)
    [-] if Telnet.Edit.Copy.IsEnabled ()
    [ ] Telnet.Edit.Copy.Pick()
    [ ] Telnet.Click (1, 155, 367)
    [ ] lsCLPDATA=Clipboard.GetText()
    [ ] strCLPtext=lsCLPDATA[listCount(lsCLPDATA)]
    [-] if Left(strCLPtext,Len("[User@Machine Folder"))=="[User@Machine Folder"
    [ ] bReady=false
    [-] Agent.DisplayMessage("","I am done")

    ------------------


    [This message has been edited by AUTOMATION_GURU (edited 05-16-2002).]

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    186
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using telnet interactively through silktest

    If you have a telnet client that will log the output to a file, there is a workaround. I have done scripts where I follow the contents of a text file until the last line is the prompt. That way I can tell when the command is finished processing. Here is a link to the telnet client that I use. It's very easy to declare.
    http://hp.vector.co.jp/authors/VA002416/teraterm.html

    ------------------
    Tom
    Tom

  4. #4
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using telnet interactively through silktest

    First off, don't use time delays; they are very prone to failure.

    Secondly, call Segue Support and ask for a copy of their CUI (Character user interface) document. It dates from QA Partner days; my faxed copy is dated June 1995.

    Essentially that document describes how to use cursor offset tags to obtain non-object data from DOS windows using copy/paste. Everything above the base driver will look like standard Silk window.method calls. Its a short step from there to what you'll need.

    John


    ------------------

  5. #5
    Senior Member
    Join Date
    Jun 2000
    Location
    Chicago, IL USA
    Posts
    383
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using telnet interactively through silktest

    For simplicity, I use the Telnet that comes with Windows NT4 (not the Windows 2000 DOS-style interface).

    Each time SilkTest starts Telnet, it logs the session to a file in the C:\temp\ directory. SilkTest reads command responses from the file. Whenever I execute a command that will take some time, I have a loop that waits, types enter once and looks to see if the command prompt appears in the file. It is a little messy when the command does complete, but it is very robust.


    ------------------
    Rob Kapteyn

    [This message has been edited by RobKapteyn (edited 05-17-2002).]
    Rob Kapteyn, CSTE
    RobKapteyn@gmail.com

  6. #6
    Senior Member
    Join Date
    Jul 2000
    Posts
    186
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using telnet interactively through silktest

    Mine is just like Rob's except it uses a different client. I think that is the way to go...

    ------------------
    Tom
    Tom

  7. #7
    Member
    Join Date
    Sep 2001
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using telnet interactively through silktest

    I am trying to use the same method as Tom and Rob but I keep running into a sharing violation issue when opening the Log file . It looks like the telnet client has a handle to the log file so my OS will not allow silk test to open it at the same time.

    This is the error:

    [ ] *** Error: Unable to open C:\Program Files\LogFiles\Session2.log -- Sharing violation
    Occurred in FileOpen


    I still need to investigate this further but I was just wondering what would be the best way around this issue. Any Ideas?

    - Joe

    ------------------

  8. #8
    Senior Member
    Join Date
    Mar 2000
    Location
    pisctaway, NJ USA
    Posts
    188
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using telnet interactively through silktest

    I too have successfully used SILK to interact with a telnet window. My concept in quite simple but took some time to figure out. Forget about logging, etc. You want to use the plain old windows telnet client.

    Run telnet and turn the log setting to something high like 999. You are gonna send a command and wait for the command to be done. How is this done? How do humans know the command is done? Well we either look for the prompt or compare what we see to what was just seen. If the results are differnent the command is done...to some degree this is correct. OK. Anyhow, enough with the thought process.


    Let's say your gonna send a command "ls -l" but this will work for any command. I'll assume your connected and you have your fancy logic for determing a connection,., etc. Everything is done with typekeys. Typekeys a "clear&lt;enter&gt;" this will clear the screen and the buffer. You should now be sitting at JUST a prompt. Send your command and re-direct your output to a file, "ls -l &gt;/tmp/silk.out" You will now be sitting until your command is done. This is the key. While the screen looks like this you will sleep for some interval, I use 1 second. How do we know the screen is like this? Use the edit menu and the clipboard. Empty the clipboard (Clipboard.SetText({}))
    pick the "Select all" from the edit menu (Edit.SelectAll.Pick()), pick copy (Edit.Copy.Pick()), wait a few (sleep(2) ) now get the clipboard (Clipboard.GetText()). This assumes the command takes some time and this is sensitive based on your interval of sleep. Between checking the screen. Your basically gonna wait until the screen looks different.

    The concept is there- wait until the screen is NOT updating- when the screen is NOT updating your command is done.

    I apologize for not posting the "solution" code, but I do not like giving the solution- just the thought process to get there.

    Anthony


    ------------------


    [This message has been edited by Pontoriero (edited 10-05-2002).]

  9. #9
    Senior Member
    Join Date
    Jun 2000
    Location
    Chicago, IL USA
    Posts
    383
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using telnet interactively through silktest

    Joe:
    What Telnet client are you using ?

    Are you using FM_READ as your mode in FileOpen() ?

    I have seen plenty of file sharing problems, but never with the Windows Telnet logfile.


    ------------------
    Rob Kapteyn
    Rob Kapteyn, CSTE
    RobKapteyn@gmail.com

  10. #10
    Member
    Join Date
    Sep 2001
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using telnet interactively through silktest

    Anthony, thanks for the redirection idea I think I am going to go with that approach. However, I still have to verify some of the output. So I guess i will need to run another command to view the output. that is:

    cat /temp/silk.out or
    tail /temp/silk.out

    then do a select all again to get the output contents.


    Rob, I am not using the regular winNT telnet client so I guess this may be the problem. I was using the FM_READ mode to open the file but that did not solve the problem. I must be the telnet client that I am using that is not allowing me to access this file at the same time as it is writing to it.


    Thanks for the ideas

    ------------------

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:45 PM.

Copyright BetaSoft Inc.