Saturday, April 24

How to get started of VBscripting for QTP automation

For many who want to more of automation and just know how to use QTP a bit,  I thought i will just write few things you can start off which helped me to learn more of VBscript. 
I refereed book VBScript Programmer's Reference most of the time while learning. It helped to master things a bit

VBscript is all same as Visual Basic. Need not worry much about coding syntax etc. Just try get more familiar with loops, variable declaration, arrays that you also use in QTP scripting. If you are very new to QTP and not familiar with Programming logic, its best to brush up that piece a bit. Chapter 5 from the book  would be nice to glance through if you got hands on it

Once this done, I would suggest to use Editplus for VBscripts editing. Although you can write vbs files in any notepad kind of apps, Editplus gives better colour coding which help us while debugging, enhancing etc

Next thing would be to how Vbscript can create objects that QTP can also see and use. In Vbscript you can create runtime objects using funtion called create object. You would require one QTP application object and if you are trying use excel, then another excel object

Set appQTP=CreateObject("QuickTest.Application")
Set appExcel = CreateObject("Excel.Application")

Chapter 7 from the VBScript Programmer's Reference can reffered if you want to know more about common Vbscript runtime objects like Scripting.Dictionary, Scripting.FileSystemObjects.  But this just info. You may not require to use this objects for a while I guess.

Once this all you know, the first code you may like to write is how to launch qtp and get connected to QC. If you want to know the code details, I have blogged it in my blog series Creating Batch Run script using VBScript for QTP 
another simple sample script in the blog Simple VBscript All the best for your new step towards automation!


  1. Hi can you put some example codes

  2. Lohith,

    I have posted new blog Simple VBScript

    you can try this out



Related Posts Plugin for WordPress, Blogger...