Connect To Putty through QTP and Run Some events in PUTTY from QTP

769 views
Skip to first unread message

RamaKrishna Gondrala

unread,
Jul 2, 2013, 7:21:51 AM7/2/13
to mercu...@googlegroups.com

Hi All,

I want to Open Putty from QTP and run some events in Putty through QTP. I have some commands to be executed for running events. Can any one please help me in doing it?

Thanks,
Rama Krishna.

Gautham Maroli

unread,
Jul 2, 2013, 7:26:44 AM7/2/13
to mercu...@googlegroups.com
I have done some automation with QTP And PuTTy,.. let me know your requirements


--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
 
---
You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mercuryqtp+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

RamaKrishna Gondrala

unread,
Jul 2, 2013, 9:10:13 AM7/2/13
to mercu...@googlegroups.com
I want to connect to Putty and run commands on Putty from QTP. And I want to Run one event by using some command and edit the files in vi editor?

Does all these possible?

Venkat Kandula

unread,
Jul 3, 2013, 6:45:56 AM7/3/13
to mercu...@googlegroups.com
Hi Rama Krishna,

Below Functions will work as per your requiremnt and you can down load the text or vi editor  file from putty to your loca drive using File transfer 

protocol(FTP) through command prompt

''******'*******************************************************************************************************************
'Function Name Putty_conn
'Description   To Connect the Putty  
''*************************************************************************************************************************
Public Function Putty_conn()
SystemUtil.Run Environment.Value("PuttyConnection") 
End Function
'***************************************************************************************************************************
'Function Name Putty
'Description   Click open Button
'*************************************************************************************************************************
Public Function Putty()
Call OWindow1("PuTTY Configuration","PuTTY Configuration")
window(OWindow).winEdit("attached text:=Host.*","nativeclass:=Edit").Set "vdl6"
Call Win_Button1("&Open")
window(OWindow).winbutton(Win_Button).Click
End Function
'******'*******************************************************************************************************************
'Function Name Putty_UserName_PWD
'Description   Passing the user name and password
'*************************************************************************************************************************
Public Function Putty_UserName_PWD()
wait(5)
Call OWindow1("vdl6.tru.com - PuTTY","PuTTY")
User=Environment.Value("User")
window(OWindow).Type User
window(OWindow).Type micReturn
wait(3)
'set AES1 = DotNetFactory.CreateInstance ("QTPES03Encryption.EncryptionMethods", "QTPES03Encryption")
'Password=Environment.Value("PassWord")
'pwd = AES1.DecryptString(Password, "mypass")
Password=Environment.Value("pwd")
window(OWindow).Type Password 
window(OWindow).Type micReturn
End Function

'***********************************************************************************************************************
'Function Name GEC_V11_Automation_data
'Description   To change the Directory
'*************************************************************************************************************************
Public Function GEC_V11_Automation_data()
   Call OWindow1("sweeper@vdl6:/usr/apps/qc/prod/GEC_V11_Automation","sweeper@vdl6:/usr/apps/qc/prod/GEC_V11_Automation")
window(OWindow).Type Environment.Value("GEC_V11_Automation_data")
window(OWindow).Type micReturn
End Function
'************************************************************************************************************************** 

'***********************************************************************************************************************************************************
'Function Name  File_Ftp
'Description To connect  the CMD
'*******************************************************************************************************************************************************
Function File_Ftp()
Set appCMD=CreateObject("Wscript.shell")
appCMD.Sendkeys "cd \"
appCMD.Sendkeys "~" 
Wait 2
appCMD.Sendkeys "D:"
appCMD.Sendkeys "~" 
Wait 2
appCMD.Sendkeys "cd D:\GEC V11 Automation Scripts\Text Files" 
appCMD.Sendkeys "~" 
Wait 2 
appCMD.Sendkeys "ftp vdl6"
appCMD.Sendkeys "~" 
Wait 2
appCMD.SendKeys Environment.Value("User")
appCMD.Sendkeys "~" 
Wait 2
appCMD.Sendkeys Environment.Value("pwd")
appCMD.Sendkeys "~" 
Wait 2
appCMD.Sendkeys Environment.Value("GEC_V11_Automation_bin")& Environment.Value("auto_m")
appCMD.Sendkeys "~" 
Wait 2
End Function

'***********************************************************************************************************************************************************
'Function Name   CMD 
'Description Exit  CMD
'*******************************************************************************************************************************************************
Function CMD_Exit()
   Set appCMD=CreateObject("Wscript.shell")
Wait 2
appCMD.Sendkeys "bye"
appCMD.Sendkeys "~" 
appCMD.Sendkeys "exit"
appCMD.Sendkeys "~" 
End Function

'******************************************************************************************************************************************************

Hope it helpful for you.

Thanks,
Venkat

Darshan Nagdive

unread,
Jan 20, 2015, 9:25:24 AM1/20/15
to mercu...@googlegroups.com

Best option is to use Plink, and Connect to unix server, send commands on the Unix server. You can also write Shell scripts which will reside on the server at specific path and then run that shell scripts on the Unix server using plink from QTP.

 

So suppose you wanna run Command1 and then Command2. You can write the shell script (let the name be "RunTwoCommands.sh")which will have first Command1 and then Command2.

 

Then you can run  "RunTwoCommands.sh" script using Plink and then get the result. 

Reply all
Reply to author
Forward
0 new messages