Friday, February 7

What are Object Models, COM, DOM, AOM, TOM in QTP - Part-1

Hello friends,

I am sure many of you must be having some questions/doubts about COM, DOM, AOM and TOM in QTP (like me!) .

Here in this post we will try to understand what are COM, DOM, AOM and TOM in QTP and how to use these to make our life easy (or may be tough!!).

Okay, so firstly what they stand for, just to quickly refresh.. :)

COM - Component Object Model
(examples:- Excel objects, FSO objects)

DOM - Document Object Model
(examples:- Browser("").Page("").object.getElementsByTagName)

AOM - Automation Object Model
(examples:- Createobject("quicktest.application"))

TOM - Test Object Model 
(examples:- concept how qtp manage AUT objects)

Above examples should give you a high-level idea of what exactly there are. Have you noticed that "Object Model" is common in all!
So let's look into this first before going forward.

As you know, whole concept of QTP and automation roam around objects and properties.

Object model, as the name suggests, is a model around the objects of various types. Conceptually it's like an API which provides a capability to perform operations using a set of properties and methods into the model. 

We are going to discuss 4 types of models in this post as mentioned above.

To be continued..

Thursday, January 9

How to download a file from a url using vbscript/QTP

Hello Friends!!

In this post, we will see how to download a file from url/internet to your local drive.

' Path of the file you want to download

strFileUrl = ""

'Local drive's path where you want to save the file
strSaveFileTo = "C:\xxxxxxx\yyyyyyyyy\\"

' create a XMLHTTP object

Set oHTTP = CreateObject("MSXML2.XMLHTTP") "GET", strFileUrl, False

'create FSO object
Set oFSO = CreateObject("Scripting.FileSystemObject")

'If  strSaveFileTo file already exist, delete it
If oFSO.FileExists(strSaveFileTo) Then
End If

If oHTTP.Status = 200 Then
  Dim oADOStream
  Set oADOStream = CreateObject("ADODB.Stream")
  With oADOStream
    .Type = 1
    .Write oHTTP.ResponseBody
    .SaveToFile strSaveFileTo
  End With
  set oADOStream = Nothing
End If

If oFSO.FileExists(strSaveFileTo) Then
  Print "File has been downloaded successfully and save to  " & strSaveFileTo
End If

Above code will save any file to your loacal drive at the given path. Now if the file is a ZIP file, you will need to extract it.

Below code will help you to pick any file from local and extract it's content to given folder

'Local drive's path where you want to Extract the file (in case file is a ZIP file)


'If tstrExtractFileTo path does not exist on local drive, create it
Set oFSO = CreateObject("Scripting.FileSystemObject")

If NOT oFSO.FolderExists(strExtractFileTo) Then
End If

'Extract the contants of the zip file.

Set oShell = CreateObject("Shell.Application")
Set strZIPFiles=oShell.NameSpace(strSaveFileTo).items

'release objects
Set oFSO = Nothing
Set oShell = Nothing

Monday, November 11

How to prepare for PMP exam based on PMBOK 5! - Part-2

Hello Friends,

This post is Part-2 of the series of posts - How to prepare for PMP exam based on PMBOK 5!

Click here for Part-1.

In Part-1, we looked into following points-

1. Pre-requisites - Things you must be prepared for before you head towards PMP direction
2. Study Resources - Books and other resources I found most useful
3. Study Plan - Strategic steps, resources and tips for preparation and clear the exam!!

In this part (Part-2) of this post we will discuss more about the content, topics and areas that are most important and preparation strategy for the exam!!

Alright! I'll start with a very important point I've observed and might be quite helpful for you as well.

Look at the above table. Have you noticed that-

23 processes (in green) have 76% weightage in the exam and
24 processes (in orange) have only 24% weightage.

So, by preparing 23 processes, you can cover 76% of the exam!! :)

Needless to say that mastering 23 processes with all ITTOs is much easier then mastering all 47 :)

How about that?

to be continued....