Saturday, January 22, 2011

Advance QTP FAQ Part-1

Advance qtp scripting and qtp tips

Advance qtp scripting and qtp tips:
Friends, I want to share some solutions of problem that my junior colleague faced during automation using QTP.
I hope you will find this solution very helpful if you also stuck in similar kind of situation and also you will get more advance knowledge of QTP.

Problem:- 1. How to login in one machine using Telnet from QTP script.
Solution:- Following is the script for above problem.
------------------------------------------------------
Dim host,username,password

Host = myhost

Username = myname

Password = mypwd

Function do_telnet (host,username,password)

objSh.Run "telnet " & host

wscript.sleep 2000

objSh.AppActivate "telnet"

wscript.sleep 2000

objSh.SendKeys username+chr(13)

wscript.sleep 2000

objSh.SendKeys password+chr(13)

wscript.sleep 2000

objSh.SendKeys "exit"+chr(13)

end function
--------------------------------------------
Note: Please keep in mind that this script will not work, if you write it directly in “test” file of qtp. You have to make one function and embed this script in that function and you have to put it in VBS file.
Than just call that function from your "test" file of QTP. Don’t forget to attach this file to your test file of QTP. If you don’t know how to link VBS to test file of QTP, 

If you find any issue with this script, you can comment me. Please don’t forget to share your experience.
I also want to share some tips and tricks to you.

Tips and tricks 1:- After completion of development and 100% testing of your automation project, If your project consume huge memory, than you can delete snapshots folders from Action0 and Action1 folders.
(Snapshots folder contains the snapshots captured by QTP. Warning! – Don’t delete these folders if you want to create checkpoints in project.).
Your project size will be lesser by 60 to 70% percentages after deleting these folders.

This tip is very much useful for those, who have to frequently transfer the automation project between on-shore and off-shore.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

 
Powered by Blogger