172
Tuesday, April 19, 2011 using Childnodes For the given XML File to read data below is the code Set xm=CreateObject("Microsoft.XMLDOM") xm.load "e:\xmlf\book.xml" Set c1=xm.documentElement.childNodes For i=0 to c1.length-1 msgbox c1.item(i).nodeName set c2=c1.item(i).childNodes for j=0 to c2.length-1 msgbox c2.item(j).text next Next Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:29 AM 0 comments Monday, April 18, 2011 manipulate XML File using Microsoft.XMLDOM Example :Existing xml file "book.xml" ========================== ==========================

QTP Codes

Embed Size (px)

DESCRIPTION

QTP

Citation preview

  • Tuesday, April 19, 2011

    using Childnodes

    For the given XML File to read data below is the code

    Set xm=CreateObject("Microsoft.XMLDOM")

    xm.load "e:\xmlf\book.xml"

    Set c1=xm.documentElement.childNodes

    For i=0 to c1.length-1

    msgbox c1.item(i).nodeName

    set c2=c1.item(i).childNodes

    for j=0 to c2.length-1

    msgbox c2.item(j).text

    next

    Next

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:29 AM 0

    comments

    Monday, April 18, 2011

    manipulate XML File using Microsoft.XMLDOM

    Example :Existing xml file "book.xml"

    ==========================

    ==========================

  • '''''Create new elements in XML File

    dim xm

    set xm=CreateObject("Microsoft.XMLDOM")

    xm.load "e:\book.xml"

    for i=1 to 3

    s=inputbox("Enter the book title")

    set newele=xm.CreateElement("Title")

    set newtxt=xm.CreateTextNode(s)

    newele.appendChild(newtxt)

    set e=xm.DocumentElement

    e.appendChild(newele)

    set e=e.lastChild

    Next

    xm.save "e:\book.xml"

    =============================================

    ''''''''''''Read data from xml file

    dim xm

    set xm=CreateObject("Microsoft.XMLDOM")

    xm.load "e:\book.xml"

    set x=xm.getelementsbytagname("Title")

    For i=0 to x.length-1

    set c=x(i).childnodes(0)

    msgbox c.nodevalue

    Next

    =============================================

    '''''''Read data from existing file and update with new values

    Dim xm

    Set xm=CreateObject("Microsoft.XMLDOM")

    xm.load "e:\book.xml"

    set x=xm.getelementsbytagname("Title")

    For i=0 to x.length-1

    set c=x(i).childnodes(0)

    t=inputbox("Enter title")

    c.nodevalue=t

    Next

  • xm.save "e:\book.xml"

    ===========================================

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 1:15 AM 0

    comments

    Microsoft.XMLDOM

    Below are the methods used to access and manipulate XML documents via the XML DOM

    implementation

    Reference : http://msdn.microsoft.com/en-us/library/ms757828(v=vs.85).aspx

    Method Description

    abort (DOMDocument) Aborts an asynchronous download in

    progress.

    abort (IXMLHTTPRequest) Cancels the current HTTP request.

    abort (ServerXMLHTTP/IServerXMLHTTPRequest) Cancels the current HTTP request.

    add Adds a new schema to the schema

    collection and associates the given

    namespace URI with the specified schema.

    addCollection Adds schemas from another collection into

    the current collection and replaces any

    schemas that collide on the same

    namespace URI.

    addObject Adds objects to a style sheet.

    addParameter Adds parameters to a style sheet.

    appendChild Appends a new child node as the last child

  • of the node.

    appendData Appends the supplied string to the existing

    string data.

    clone Clones a copy of the current

    IXMLDOMSelection, with the same position

    and context.

    cloneNode Clones a new node.

    createAttribute Creates a new attribute with the specified

    name.

    createCDATASection Creates a CDATA section node that

    contains the supplied data.

    createComment Creates a comment node that contains the

    supplied data.

    createDocumentFragment Creates an empty

    IXMLDOMDocumentFragment object.

    createElement Creates an element node using the

    specified name.

    createEntityReference Creates a new EntityReference object.

    createNode Creates a node using the supplied type,

    name, and namespace.

    createProcessingInstruction Creates a processing instruction node that

    contains the supplied target and data.

    createProcessor Creates a rental-model IXSLProcessor

    object that will use this template.

    createTextNode Creates a text node that contains the

    supplied data.

  • errorParameters Returns the parameter value for a given

    index.

    deleteData Deletes specified data.

    DllSetProperty Sets a global property for the DLL.

    get Returns a read-only XML Document Object

    Model (DOM) node that contains the

    element.

    getAllResponseHeaders (IXMLHTTPRequest) Retrieves the values of all the HTTP

    headers.

    getAllResponseHeaders

    (ServerXMLHTTP/IServerXMLHTTPRequest)

    Retrieves the values of all the HTTP

    headers.

    getAttribute Gets the value of the attribute.

    getAttributeNode Gets the attribute node.

    getDeclaration Returns the declaration of the DOM node

    that is sent to the function.

    getElementsByTagName (DOMDocument) Returns a collection of elements that have

    the specified name.

    getElementsByTagName (IXMLDOMElement) Returns a list of all descendant elements

    that match the supplied name.

    getNamedItem Retrieves the attribute with the specified

    name.

    getOption Returns the value of the specified option.

    getProperty (IXMLDOMDocument2) Returns the default properties.

    getProperty (IXMLDOMSelection) Returns a property.

  • getQualifiedItem Method Returns the attribute with the specified

    namespace and attribute name.

    getResponseHeader (IXMLHTTPRequest) Retrieves the value of an HTTP header from

    the response body.

    getResponseHeader

    (ServerXMLHTTP/IServerXMLHTTPRequest)

    Retrieves the value of an HTTP header from

    the response body.

    getSchema Method Returns an ISchema object.

    hasChildNodes Provides a fast way to determine whether a

    node has children.

    hasFeature Indicates support for the specified feature.

    importNode Clones a node from a different DOM object.

    insertBefore Inserts a child node to the left of the

    specified node or at the end of the list.

    insertData Inserts a string at the specified offset.

    item (IXMLDOMNodeList) Allows random access to individual nodes

    within the collection.

    item (IXMLDOMNamedNodeMap) Allows random access to individual nodes

    within the collection.

    load Loads an XML document from the specified

    location.

    loadXML Loads an XML document using the supplied

    string.

    matches Checks if the node that is passed is

    contained in the current collection.

    nextNode (IXMLDOMNodeList) Returns the next node in the collection.

  • nextNode (IXMLDOMNamedNodeMap) Returns the next node in the collection.

    nodeFromID Returns the node that matches the ID

    attribute.

    normalize Normalizes all descendant elements by

    combining two or more adjacent text nodes

    into one unified text node.

    open (IXMLHTTPRequest) Initializes an MSXML2.XMLHTTP request

    and specifies the method, URL, and

    authentication information for the request.

    open (ServerXMLHTTP/IServerXMLHTTPRequest) Initializes a request and specifies the

    method, URL, and authentication

    information for the request.

    peekNode Gets the next node that the nextNode

    method will return without advancing the

    list position.

    remove Removes the specified namespace from a

    collection.

    removeAll Removes all the nodes from the collection

    described by the IXMLDOMSelection.

    removeAttribute Removes or replaces the named attribute.

    removeAttributeNode Removes the specified attribute from this

    element.

    removeChild Removes the specified child node from the

    list of children and returns it.

    removeNamedItem Removes an attribute from the collection.

    removeNext Removes the next node.

  • removeQualifiedItem Removes the attribute with the specified

    namespace and attribute name.

    replaceChild Replaces the specified old child node with

    the supplied new child node.

    replaceData Replaces the specified number of

    characters with the supplied string.

    reset (IXMLDOMNamedNodeMap) Resets the iterator.

    reset (IXMLDOMNodeList) Resets the iterator.

    reset (IXMLDOMParseErrorCollection) Resets the internal position to start, so that

    the next method will return the first error

    in the list.

    reset (IXSLProcessor) Resets the state of the processor to the

    state it was in prior to calling the transform

    method.

    save Saves an XML document to the specified

    location.

    selectNodes Applies the specified pattern-matching

    operation to this node's context and

    returns the list of matching nodes as

    IXMLDOMNodeList.

    selectSingleNode Applies the specified pattern-matching

    operation to this node's context and

    returns the first matching node.

    send (IXMLHTTPRequest) Sends an HTTP request to the server and

    receives a response.

    send (ServerXMLHTTP/IServerXMLHTTPRequest) Sends an HTTP request to the server and

    receives a response.

  • setAttribute Sets the value of the named attribute.

    setAttributeNode Sets or updates the supplied attribute node

    on this element.

    setNamedItem Adds the supplied node to the collection.

    setOption Sets the specified option.

    setProperty Sets the SelectionLanguage,

    ServerHTTPRequest, SelectionNamespaces

    or NewParser internal properties (flags).

    setProxy Sets the proxy configuration.

    setProxyCredentials Sets the proxy authentication credentials.

    setRequestHeader (IXMLHTTPRequest) Specifies the name of an HTTP header.

    setRequestHeader

    (ServerXMLHTTP/IServerXMLHTTPRequest)

    Specifies the name of an HTTP header.

    setStartMode Performs a subset of a larger XSLT

    transformation by selecting the XSLT mode

    with which to start.

    setTimeouts Specifies timeout settings for resolving the

    domain name, establishing the connection

    to the server, sending the data, and

    receiving the response.

    splitText Splits this text node into two text nodes at

    the specified offset and inserts the new

    text node into the tree as a sibling that

    immediately follows this node.

    substringData Retrieves a substring of the full string from

    the specified range.

  • transform Starts the transformation process or

    resumes a previously failed transformation.

    transformNode Processes this node and its children using

    the supplied XSL Transformations (XSLT)

    style sheet and returns the resulting

    transformation.

    transformNodeToObject Processes this node and its children using

    the supplied XSLT style sheet, and returns

    the resulting transformation in the supplied

    object.

    validate Performs run-time validation on the

    currently loaded document using the

    currently loaded DTD, schema, or schema

    collection.

    validate

    (IXMLDOMSchemaCollection2/XMLDOMSchemaCollection

    Performs run-time validation on the

    documents in the schema cache that have

    not been compiled and validated.

    validateNode Validates a specified DOM fragment.

    waitForResponse Allows the requesting server to suspend

    execution while waiting for an

    asynchronous send operation to complete.

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 12:48 AM

  • Wednesday, April 13, 2011

    Registeruserfunc

    Register user function to TestObject

    TestObjects are the objects in the Repository and these Objects are used in the Test ( Script),,, see any

    object in the repository are under TestObject Structure

    Learn the step by step procedure how to Register user created function to any test object and when

    writing the Script our Created function is also displayed in the Intellisence

    1. Open Notepad

    2. Write the Required Function

    3. Write statement to Register the userfunction to the required testobject

    4. Save the file as Filename.vbs

    =========================

    For the above 4 steps in notepad (sample function fn_sample is Defined and registered as below)

    In Notepad

    public Function fn_sample

    msgbox "Hello"

    End Function

    Registeruserfunc "WinButton","myfunc","fn_sample"

    Save it as function libary ( filename.vbs)

  • In the above code fn_sample is registered for WinButton and in the script in Intellisence "myfunc" is

    displayed

    ===========================

    5. After saving the file,,, associate the library to the QTP Test

    File menu---Settings---Resource----Associate function library (and select the above created library and

    associate)

    6. In the Test ( add any WinButton from application into Repository)

    for example Add (OK,Cancel buttons in Flight application "Login" dialogbox)

    7. Write script

    Dialog("Login").winButton("OK").myfunc

    Dialog("Login").WinButton("Cancel").myfunc

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 10:58 AM 0

    comments

    Tuesday, April 12, 2011

    using Dotnetfactory Examples

    ''''Write Text into the file

    Dim df

    Set df=Dotnetfactory.CreateInstance("System.IO.File")

    df.writealltext "d:\online\data.txt","this is sample"

    '''Read text from the file

    Dim df,s

    Set df=Dotnetfactory.CreateInstance("System.IO.File")

    s=df.readalltext("d:\online\data.txt")

    msgbox s

    '''Convert the date into req format

  • Dim df , d

    Set df=Dotnetfactory.CreateInstance("System.DateTime")

    Set d=df.Parse("Tue, 12 Apr 2011")

    msgbox d.Day & "/" & d.Month & "/" & d.Year

    Note : for more Classes, Methods Refer msdn.microsoft.com

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 3:53 AM 0

    comments

    Reg QTP 10 and Firefox 3.6 browser

    Hi ,,

    some of the students are trying to run the scripts on firefox browser and facing problems,,, Like working

    with IE you cannot directly work with Firfox browser,,,, the below patch need to be downloaded and

    installed in you system

    and for complete list of environments supported by QTP is available in QTP Readme file.

    Note: To enable QuickTest to run tests in Firefox 3.6 on a machine with UAC enabled, you need to start

    QuickTest

    once using "Run as administrator" after installing the patch and Firefox 3.6.

    Additional information about this patch and the patch download are available at the HP Software

    Support Online website:

    http://h20230.www2.hp.com/selfsolve/document/FID/DOCUMENTUM_QTPWEB_00059

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 3:38 AM 0

    comments

    using Instr Function

    Count the number of times "is" repeated in the below string

    s="This is sample"

    p=1

    cnt=0

    while instr(p,s,"is")>0

    cnt=cnt+1

    p=instr(p,s,"is")+len("is")

  • wend

    msgbox "Is repeated times are "&cnt

    ==================================

    ''''Another logic

    s="This is sample"

    a=split(s,"is")

    msgbox "Is is repated for "&ubound(a)

    ====================================

    '''Another Logic

    s="This is sample"

    cnt=0

    For i=1 to len(s)

    a=mid(s,i,2)

    If a="is" Then

    cnt=cnt+1

    End If

    Next

    msgbox "is repeated for "&cnt

  • Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 3:29 AM 0

    comments

    Friday, December 24, 2010

    Script to close all the browsers

    1. ''Suppose there are 10 browser ;;; write script to close all the browsers ''The below script will close

    all the open browser

    dim d

    set d=Description.Create

    d("micclass").value="Browser"

    set a=Desktop.ChildObjects(d)

    for i=0 to a.count-1

    a(i).close

    Next

    2. There are 10 browsers and in that 1 browser is mercury tours website.... except mercury tours

    browser all the other browsers should be closed

    '' Get all the browsers and for each browser get the title

    '' in the title if "mercury" word is not there then close

    dim d

    set d=Description.Create

    d("micclass").value="Browser"

    set a=Desktop.ChildObjects(d)

    for i=0 to a.count-1

    s=a(i).getROProperty("title")

    if instr(1,s,"Mercury")=0 Then

    a(i).close

    End if

    Next

    Publish Post

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

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 1:21 AM 0

    comments

  • Calling DLLs in QTP

    DLL--Dynamic Link Library

    It has basically programs, these can be called from any application, by creating instance for the dll /

    reference to the DLL.

    The DLLs can be developed in c,c++,java,.net...etc

    Usually all the dlls related to Windows OS are available in C:\WINDOWS\system32 folder and we can

    refer MSDN help to know the system DLLs and the functions available in these DLLs

    User created dlls are also should be copied into this folder and should be registered before using.

    To register usercreated dlls regsvr32 can be used.

    To call the methods or properties in the DLL

    1. using DotnetFactory

    ''below is the syntax to refer DLL and call the methods

    Dim myobj

    Set myobj=DOTNetFactory.CreateInstance("namespace.class", "path of the dll")

    myobj.method ''to call the method

    myobj.property '' to access the property

    2. Using Extern Object

    ' The below script will check Notepadwindow is available or not

    'Here we are using user32.dll

    Extern.Declare micHwnd,"FindWindow","user32.dll","FindWindow", micString, micString

    hwnd = Extern.FindWindow("Notepad", vbNullString)

    if hwnd = 0 then

    MsgBox "Notepad window not found"

  • else

    MsgBox "Notepad window found"

    end if

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

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 12:55 AM 0

    comments

    Wednesday, December 15, 2010

    DotNetFactory Introduction---1

    DotNetFactory

    This utility object is available from QTP 9.2 onwards and all the versions after 9.2,

    This utility object you can see in Insert menu--->Step Generator---->utility object Category---->Select in

    Object List

    This Object Provides QTP scripting to access methods and properties of a .NET object by creating an

    instance for this object.

    Syntax :

    Dim d

    set d=CreateInstance(Typename,assembly,parameters)

    Typename : name of the object

    assembly (optional): if it is already preloaded assembly then no need to specify else we have to specify

    the assembly ie. the DLL which has the typename

    parameters: specify the parameters if typename has any input parameters.

    Note : Refer in msdn.microsoft.com for all the System Namespace and its classess, .Net Class Library

    list,,, below is the link

    http://msdn.microsoft.com/en-us/library/d11h6832(v=VS.71).aspx.....

    Few Examples :

    Example 1:

    ' Display our own message Created from System.Windows.Forms.MessageBox --Typename ,, which

    belong to System.Windows.Forms Assembly

  • Dim msg

    Set msg = DotNetFactory.CreateInstance("System.Windows.Forms.MessageBox",

    "System.Windows.Forms")

    msg.show "This is Venkat","Sample"

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

    Example :2

    'Display our own window /Form

    Dim frm1

    Set frm1 = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms")

    frm1.Text = "Venkat"

    frm1.Maximizebox = True

    frm1.Minimizebox = True

    frm1.Width = 500

    frm1.Height =200

    frm1.Location.X = 50

    frm1.Location.Y = 200

    frm1.Show

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

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:51 PM

  • Tuesday, December 14, 2010

    QC API and QTP AOM Scripts

    Connect to QC and Add a New Defect

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

    Dim qccon

    Set qccon=CreateObject("TDApiOle80.TDConnection")

    qccon.InitConnectionEx "http://qcserverurl:8080/qcbin"

    qccon.login "username","password"

    qccon.Connect "DEFAULT","QualityCenter_Demo"

    Set BugFactory = qccon.BugFactory

    Set Bug = BugFactory.AddItem(Nothing)

    Bug.Status = "New"

    Bug.Summary = "Error in login"

    Bug.Priority = "4-Very High"

    Bug.AssignedTo ="user1"

    Bug.DetectedBy = "venkat"

    Bug.Post

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

    Connect to QC and Read all the Defects and Write in Excel

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

    Dim qc,bgf,bglist,xl,ws,b,r

    Set qc=CreateObject("TDApiOle80.TDConnection")

    qc.InitConnectionEx "http://localhost:8080/qcbin"

    qc.login "admin", "mindq"

    qc.Connect "DEFAULT","QualityCenter_Demo"

    Set bgf = qc.BugFactory

    Set bglist = bgf.NewList("")

    Set xl=CreateObject("Excel.Application")

    xl.WorkBooks.Add()

    Set ws=xl.ActiveSheet

    r=1

    For Each b In bglist

    ws.Cells(r, 1).Value =b.Field("BG_BUG_ID")

    ws.Cells(r, 2).Value = b.Summary

    ws.Cells(r, 3).Value = b.DetectedBy

  • ws.Cells(r, 4).Value = b.Priority

    ws.Cells(r, 5).Value = b.Status

    ws.Cells(r, 6).Value = b.AssignedTo

    r=r+1

    Next

    xl.ActiveWorkbook.SaveAs("C:\QC_Demo_defects.xls")

    xl.Quit

    ===========================================

    To open QTP Test and count the number of repositories associated

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

    Dim app

    set app=CreateObject("QuickTest.Application")

    app.launch

    app.visible=True

    app.open "c:\test1",False

    set r=app.Test.Actions("Action1").ObjectRepositories

    msgbox "Total ORs :"&r.count

    for i=1 to r.count

    msgbox "Path of OR :"&r.item(i)

    next

    app.quit

    set r=nothing

    set app=nothing

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

    To count the recovery scenarios associated to the test

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

    dim app

    set app=CreateObject("QuickTest.Application")

    app.launch

    app.open "c:\test1",false

    app.visible=True

    set rs=app.Test.settings.Recovery

    if rs.count>0 then

    redim a(rs.count)

    for i=0 to rs.count

    a(i)=rs.item(i+1).name

    i=i+1

    next

    end if

    print "The recovery scenarios associated to the test are"

    for i=0 to ubound(a)

    print a(i)

  • next

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

    script to display the list of actions and their details

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

    Dim app

    set app=CreateObject("QuickTest.Application")

    app.launch

    app.visible=True

    app.open "c:\test1"

    redim a(app.Test.Actions.count)

    for i=1 to app.Test.Actions.count

    a(i-1)=app.Test.Actions.item(i).name&" "&app.Test.Actions.item(i).type&"

    "&app.Test.Actions.item(i).location

    next

    for i=0 to ubount(a)

    print a(i)

    next

    =========================================

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 11:06 PM

  • Friday, September 24, 2010

    Class room excel script

    Dim xl,wb,ws

    Set xl=CreateObject("Excel.Application")

    Set wb=xl.Workbooks.Open("f:\data.xls")

    Set ws=wb.Worksheets("Sheet1")

    For i=2 to 5

    e=ws.cells(i,6)

    td=ws.cells(i,9)

    a=split(td,",")

    Systemutil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"

    Dialog("Login").WinEdit("Agent Name:").Set a(0)

    Dialog("Login").WinEdit("Password:").Set a(1)

    Dialog("Login").WinButton("OK").Click

    If window("Flight Reservation").Exist Then

    f=1

    window("Flight Reservation").Close

    else

    f=0

    Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click

    Dialog("Login").Close

    End If

    If (f=1 and e="Login") or (f=0 and e="Error") Then

    ws.cells(i,7)="Expected and actual are same"

    ws.cells(i,8)="Passed"

    ws.cells(i,8).interior.colorindex=4

    else

    ws.cells(i,7)="Expected and actual are not same"

    ws.cells(i,8)="Failed"

    ws.cells(i,8).interior.colorindex=3

    End If

    Next

    wb.Save

    wb.Close

    Set xl=nothing

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 8:08 AM 0

    comments

    Friday, August 13, 2010

  • VBScript to write data in excel and Format

    Dim xl

    Set xl= CreateObject("Excel.Application")

    xl.Visible = True

    xl.Workbooks.Add

    xl.Cells(1, 1).Value = "Name"

    xl.Cells(1,2).value="Score"

    Set r=xl.Range("A1","B1")

    r.Font.Bold = TRUE

    r.Interior.ColorIndex = 3

    r.Font.ColorIndex = 2

    xl.Cells(2, 1).Value = "venkatadri naidu"

    xl.Cells(2, 2).Value = "80"

    xl.Cells(3, 1).Value = "james"

    xl.Cells(3, 2).Value = "70"

    xl.Cells(4, 1).Value = "kiran"

    xl.Cells(4, 2).Value = "60"

    xl.Cells(5, 1).Value = "harish"

    xl.Cells(5, 2).Value = "65"

    Set r = xl.Range("A1","B5")

    r.Font.Size = 14

    Set r = xl.Range("A2","B5")

    r.Interior.ColorIndex = 4

    Set r = xl.ActiveCell.EntireColumn

    r.AutoFit()

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 12:55 AM 0

    comments

    Tuesday, June 22, 2010

    Descriptve code for Flight application

    'Script for Login

  • Systemutil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"

    with Dialog("text:=Login")

    .WinEdit("attached text:=Agent Name:").set "abcd"

    .WinEdit("attached text:=Password:").set "mercury"

    .WinButton("text:=OK").click

    End with

    'Script for Insert new Record

    With Window("text:=Flight Reservation")

    .WinMenu("menuobjtype:=2").Select "File;New Order"

    .ActiveX("acx_name:=MaskEdBox").Type "062610"

    .WinCombobox("attached text:=Fly From:").Select "Denver"

    .WinComboBox("attached text:=Fly To:").Select "Paris"

    .WinButton("text:=FLIGHT").Click

    .Dialog("text:=Flights Table").WinList("attached text:=From","nativeclass:=ListBox").Select 1

    .Dialog("text:=Flights Table").WinButton("text:=OK").Click

    .WinEdit("attached text:=Name:","nativeclass:=Edit").Set "james"

    .WinButton("text:=&Insert Order").click

    End With

    'Script for open Record

    With window("text:=Flight Reservation")

    .WinMenu("menuobjtype:=2").Select "File;Open Order..."

    with .Dialog("text:=Open Order")

    .WinCheckBox("text:=&Order No.").Set "ON"

    .WinEdit("window id:=1016").Set "1"

    .WinButton("text:=OK").Click

    End With

    End With

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 1:28 AM 0

    comments

    Saturday, June 19, 2010

    Spy Web Objects

    Alternative Spy For Web Applications instead of QTP Object Spy

    IE Developer ToolBar ( for IE)

  • DOM Inspector (for IE)

    FireBug (for Firefox)

    Internet Explorer Developer Toolbar (sometimes shortened to IE Developer Toolbar or even IE DevBar),

    is an add-on for Internet Explorer 6 and Internet Explorer 7 that aims to aid in design and debugging of

    web pages. It allows validating of CSS and HTML, previewing page layout at various resolutions, and also

    offers a ruler (measuring in pixels) to aid in positioning the elements. It allows viewing the source of the

    entire page, color coded for ease of navigation, or selected elements of it, as well as view the DOM

    source and the CSS selectors that are applied to the element. It also enables viewing the properties and

    styles of individual elements and also trace styles of elements to its declaration.

    The toolbar includes a toggleable pane at the bottom of the window . The pane shows the structure of

    the web page; and for each structure, the properties and styles. It exposes its features through a menu

    hierarchy, and also includes toolbar buttons for quick access to features like clearing the browser cache

    and enable selecting elements by clicking in the rendered page, rather than navigating through the

    visual representation of the DOM tree

    Example IE DevBar

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 6:54 PM 0

    comments

    Thursday, May 27, 2010

  • Create Graph in Excel

    'Create Graph in Excel using VBScript

    dim xl,wb

    set xl=createobject("Excel.Application")

    xl.Visible = true

    set wb = xl.workbooks.add

    dim arr(19,9)

    for i = 1 to 20

    for j = 1 to 10

    arr(i-1,j-1) = i*j

    next

    next

    dim rng

    set rng = wb.Activesheet.Range("A1").Resize(20,10)

    rng.value = arr

    wb.Charts.Add

    wb.ActiveChart.ChartType =66

    wb.ActiveChart.SetSourceData rng, 2

    wb.ActiveChart.Location 2, "Sheet1"

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:17 AM 0

    comments

    Friday, May 21, 2010

    Cloud Computing

    Cloud Computing

    Cloud computing is a general term for anything that involves delivering hosted services over the

    Internet. These services are broadly divided into three categories:

    Infrastructure-as-a-Service (IaaS),

    Platform-as-a-Service (PaaS)

    Software-as-a-Service (SaaS).

    The name cloud computing was inspired by the cloud symbol that's often used to represent the Internet

    in flowcharts and diagrams.

  • A cloud service has three distinct characteristics that differentiate it from traditional hosting. It is sold on

    demand, typically by the minute or the hour; it is elastic -- a user can have as much or as little of a

    service as they want at any given time; and the service is fully managed by the provider (the consumer

    needs nothing but a personal computer and Internet access). Significant innovations in virtualization and

    distributed computing, as well as improved access to high-speed Internet and a weak economy, have

    accelerated interest in cloud computing.

    A cloud can be private or public. A public cloud sells services to anyone on the Internet. (Currently,

    Amazon Web Services is the largest public cloud provider.) A private cloud is a proprietary network or a

    data center that supplies hosted services to a limited number of people. When a service provider uses

    public cloud resources to create their private cloud, the result is called a virtual private cloud. Private or

    public, the goal of cloud computing is to provide easy, scalable access to computing resources and IT

    services.

    Infrastructure-as-a-Service like Amazon Web Services provides virtual server instances with unique IP

    addresses and blocks of storage on demand. Customers use the provider's application program interface

    (API) to start, stop, access and configure their virtual servers and storage. In the enterprise, cloud

    computing allows a company to pay for only as much capacity as is needed, and bring more online as

    soon as required. Because this pay-for-what-you-use model resembles the way electricity, fuel and

    water are consumed, it's sometimes referred to as utility computing.

    Platform-as-a-service in the cloud is defined as a set of software and product development tools hosted

    on the provider's infrastructure. Developers create applications on the provider's platform over the

    Internet. PaaS providers may use APIs, website portals or gateway software installed on the customer's

    computer. Force.com, (an outgrowth of Salesforce.com) and GoogleApps are examples of PaaS.

    Developers need to know that currently, there are not standards for interoperability or data portability

    in the cloud. Some providers will not allow software created by their customers to be moved off the

    provider's platform.

    In the software-as-a-service cloud model, the vendor supplies the hardware infrastructure, the software

    product and interacts with the user through a front-end portal. SaaS is a very broad market. Services can

    be anything from Web-based email to inventory control and database processing. Because the service

    provider hosts both the application and the data, the end user is free to use the service from anywhere.

    Tools for Cloud Testing : http://www.pushtotest.com/

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:09 AM 0

    comments

  • Future Testing

    New trends in testing

    New and emerging technologies such as Service Oriented Architecture (SOA), Software-as-a-Service

    (SaaS), Cloud Computing, virtualization and advent of mobile technologies are radically changing the

    trends in application testing. Some of the recent trends in software testing domain indicate an

    upsurge in:

    a) SOA Testing

    b) Security testing

    c) Testing in Cloud Computing environments

    d) Tool based regression automation and performance testing

    e) On-demand testing services

    f) Risk-Based testing

    g) VoIP application testing

    h) Health care

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:44 AM

  • Tuesday, May 18, 2010

    Few Additonal Scripts

    'Shell Script- Open Notepad-write data and save file

    Dim x

    Set x=CreateObject("WScript.Shell")

    x.Run "notepad.exe"

    wait(5)

    x.SendKeys "venkatgn"

    wait(3)

    x.SendKeys "^{s}"

    wait(2)

    x.SendKeys "file2"

    wait(2)

    x.SendKeys "{ENTER}"

    ==================================

    'Read data from XML File

    Set xd=CreateObject ( "Microsoft.XMLDOM")

    xd.Async = "false"

    xd.Load ( "e:\GVenkat\book.xml")

    For Each b In xmlDoc.selectNodes ( "/Books/Book")

    t= b.selectSingleNode ( "Title"). text

    p=b.selectSingleNode ( "Price"). text

    d=b.selectSingleNode ( "date"). text

    MsgBox "Name:" & t & vbcrlf &"Price:" & p & vbcrlf & "Date " &d

    Next

    Set xd=nothing

    ===========================================

    'Read Data from Database and save the read data into XML File

    Dim cn,rs

    Set cn=CreateObject("ADODB.Connection")

    Set rs=CreateObject("ADODB.RecordSet")

    cn.Open "Provider=SQLOLEDB;Server=sys;database=Northwind;Trusted_Connection=yes"

    rs.Open "select employeeid,lastname,firstname,title from Employees ",cn

    rs.Save "e:\r.xml",1

    rs.Close

    cn.Close

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 3:05 AM 0

    comments

  • Friday, May 14, 2010

    Decision Table

    Decision Table show sets of conditions and the actions resulting from them when the logic can be easily

    expressed in a table format

    Developing Decision Tables

    In order to build decision tables, you need to determine the maximum size of the table, eliminate any

    impossible situations, inconsistencies, or redundancies, and simplify the table as much as possible. The

    following steps provide offer some guidelines to developing decision tables:

    1. Determine the number of conditions that may affect the decision. Combine rows that overlap, for

    example, conditions that are mutually exclusive. The number of conditions becomes the number of rows

    in the top half of the decision table.

    2. Determine the number of possible actions that can be taken. This becomes the number of rows in the

    lower half of the decision table.

    3. Determine the number of condition alternatives for each condition. In the simplest form of decision

    table, there would be two alternatives (Y or N) for each condition. In an extended-entry table, there may

    be many alternatives for each condition.

    4. Calculate the maximum number of columns in the decision table by multiplying the number of

    alternatives for each condition.

    you can refer

    http://www.ibm.com/developerworks/rational/library/jun06/vauthier/

    http://www.cems.uwe.ac.uk/jharney/table.html

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:47 AM 0

    comments

    Bank, Insurance

    Good website links to understand BANKING,INSURANCE...etc

    http://money.howstuffworks.com/personal-finance/banking/bank.htm

    http://health.howstuffworks.com/health-insurance1.htm

  • Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:01 AM 0

    comments

    Thursday, May 13, 2010

    Conv WR Script to QTP

    WinQuick

    WinQuick is a comprehensive HP WinRunner to QuickTest Pro migration platform that converts over

    90% of the WinRunner code to QTP automatically. It is the fastest, most comprehensive and cost

    effective technology to re-architect and migrate WinRunner based code and artifacts to QTP.

    WinQuick is the only HP validated solution with proven customer track record.

    WinQuick is HP PSOs recommended tool/service offering for WR to QTP migration.

    Read More..http://www.win-quick.com/faq.html

    QTPGenie

    QTPGenie combined with Sierra Atlantics offshore services provide a 100% migration solution.

    WinRunner scripts fed to QTPGenie are scanned and analyzed thoroughly to produce the most accurate

    corresponding QTP output. In spite of the significant differences between WinRunner and QTP, the

    logical test flow is preserved.

    ReadMore:

    http://www.sierraatlantic.com/downloads/products/Sierra_Atlantic_QTPGenie_Datasheet.pdf

    WR2QTP

    There are two approaches that one can take for migration:

    1. Perform the conversion manually: This is a costly and error-prone process as the logic of each TSL

    script has to be understood, the object map manually recorded and then the QTP scripts constructed.

    This approach works only if the code base is small.

    2. Build a language translator that automatically converts WinRunners GUI-map files and scripts to

    QTPs object map files and scripts. Two companies have already built such translators in the past,

    however, both these translators (Win-Quick and QTP Genie) convert only around 80% of the code. Rest

    of the conversion has to be

    done manually. This manual conversion step requires understanding the script code in order to correct

    it. Significant investment of time is needed. One could argue that a translation-based approach that is

    not nearly 100% automatic is no better than the manual approach.

    INTEROPERATES DISRUPTIVE WR2QTP TRANSLATOR

    Interoperate has recently developed a translator that converts WinRunner scripts to QTP with nearly

    100% automation. Interoperates translator relies on a path-breaking Technology based on formal

    semantics and rule-based languages that allows translators for the most complex languages to be

    constructed in a few months as opposed to a few years.

    ReadMore: http://www.interoperate.biz/Interoperate_WhitePaper%20WR2QTP.pdf

  • Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 10:11 PM 0

    comments

    Sunday, May 9, 2010

    DOM and AOM Scripts

    'Display all the Elements Tags and Text in the objects in Webpage

    Set d=Browser("Google").Page("Google").Object

    For Each e In d.all

    TagName= e.TagName

    InnerText = e.innerText

    print TagName&" "&InnerText

    Next

    'Open Gmail and set the text in the Edit Box

    systemutil.Run "www.google.com"

    Set obj= Browser("name:=Google").Page("name:=Google").Object.getElementsByTagName("INPUT")

    n=obj.Length-1

    For i=0 to n

    If obj(i).Name="q" and obj(i).Type="text" Then

    Browser("name:=Google").Page("name:=Google").Object.getElementsByTagName("INPUT")(i).Value="V

    enkatgn"

    End If

    Next

    ' Open the Script in QTP from QC and Run, Close the Test, QTP

    Set app=CreateObject("QuickTest.Application")

    app.Launch

    app.Visible = True

    Set qtpres=CreateObject("QuickTest.RunResultsOptions")

    app.Open "[QualityCenter] Subject\Requirements\Login\tst_login", True

    qtpres.ResultsLocation = "d:\qtpresults"

    app.Test.Run

    app.Test.Close

    app.quit

    set qtpres = Nothing

    Set app = Nothing

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 10:23 PM 0

    comments

    Wednesday, May 5, 2010

  • DOM Scripts

    Try the below Scripts using Document Object Model on Google web page

    ADD Google webpage in Repository

    s=Browser("Google").Page("Google").Object.cookie

    msgbox s

    s=Browser("Google").Page("Google").Object.documentElement.innerhtml

    msgbox s

    s=Browser("Google").Page("Google").Object.documentElement.innertext

    msgbox s

    s=Browser("Google").Page("Google").Link("Hindi").Object.currentStyle.color

    msgbox s

    s=Browser("Google").Page("Google").Link("Hindi").Object.currentStyle.fontfamily

    msgbox s

    s=Browser("Google").Page("Google").Object.readyState

    msgbox s

    s=Browser("Google").Page("Google").Object.url

    msgbox s

    s=Browser("Google").Page("Google").Object.getElementsByName("INPUT")

    msgbox s

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 8:57 PM 0

    comments

    Sunday, May 2, 2010

    Descriptive Example

    ''' Descriptive Code for Flight Application Login

    Dim a,p,k

    Set dl=fn_createobj("text:=Login")

    Set a=fn_createobj("attachedtext:=Agent Name:,nativeclass:=Edit")

    Set p=fn_createobj("attachedtext:=Password:,nativeclass:=Edit")

    Set k=fn_createobj("text:=OK")

  • with Dialog(dl)

    .WinEdit(a).set "abcd"

    .WinEdit(p).set "mercury"

    .WinButton(k).Click

    End With

    Function fn_createobj(s)

    Dim d

    Set d=Description.Create

    n=split(s,",")

    For i=0 to ubound(n)

    m=split(n(i),":=")

    d(m(0)).value=m(1)

    Next

    Set fn_createobj=d

    End Function

    =============================

    '' Descriptive code to Enter Venkatgn in Google and read the results

    with Browser("CreationTime:=0").page("micclass:=Page")

    .WebEdit("name:=q","html tag:=INPUT","type:=text").Set "Venkatgn"

    .WebButton("name:=Google Search","type:=Submit").Click

    r= .webelement("innertext:=(\d*,\d*){1,}").getROProperty("innertext")

    End With

    msgbox "Total Results "&r

    Browser("CreationTime:=0").Back

    =================================

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 8:59 PM

  • Tuesday, April 27, 2010

    WMI--Work With Registry

    '''''''''''Read values from registry

    HKEY_LOCAL_MACHINE = &H80000002

    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&"."&

    "\root\default:StdRegProv")

    strKeyPath = "System\CurrentControlSet\Control\hivelist"

    oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath,arrValueNames, arrValueTypes

    For i=0 To UBound(arrValueNames)

    print "File Name: " & arrValueNames(i)

    oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,arrValueNames(i),strValue

    print "Location: " & strValue

    Next

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

    ''''''''' Create a new registry Key and values

    HKEY_LOCAL_MACHINE = &H80000002

    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&"." &

    "\root\default:StdRegProv")

    strKeyPath = "SOFTWARE\Regnewv1"

    oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath

    strValueName = "vname1"

    strValue = "venkat"

    oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

    strValueName = "DWORD Value Name"

    dwValue = 82

    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

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

    '''''''''''Delete Registry key Values

    HKEY_LOCAL_MACHINE = &H80000002

    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &"."&

    "\root\default:StdRegProv")

    strKeyPath = "SOFTWARE\Regnewv1"

    strDWORDValueName = "DWORD Value Name"

    strExpandedStringValueName = "Expanded String Value Name"

    strStringValueName = "vname1"

    oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDWORDValueName

    oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strExpandedStringValueName

    oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName

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

  • '''''''Delete registry key

    HKEY_LOCAL_MACHINE = &H80000002

    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &"."&

    "\root\default:StdRegProv")

    strKeyPath = "SOFTWARE\Regnewv1"

    oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath

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

    '''''''''Display List of softwares installed in the system

    Set wmi=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &"." &"\root\cimv2")

    Set sc=wmi.ExecQuery("SELECT * FROM Win32_Product")

    If sc.Count > 0 Then

    Set fs=CreateObject("Scripting.FileSystemObject")

    Set f=fs.CreateTextFile("d:\SoftwareList.txt", True)

    For Each sl in sc

    f.WriteLine sl.Caption & vbtab &sl.Version

    Next

    f.Close

    Else

    Msgbox "Cannot retrieve software from this computer."

    End If

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 7:38 AM 0

    comments

    Friday, April 23, 2010

    QTP AOM Scripts

    'Script To open QTP and run Test

    Dim app

    set app=CreateObject("QuickTest.Application")

    app.launch

    app.visible=True

    app.open "E:\venkatgn\Test1"

    ''Script to connect to Quality Center From QTP

    Set app=CreateObject("QuickTest.Application")

    app.Launch

    app.Visible = True

    app.TDConnection.Connect "QCURL","DOMAIN","PROJECT","USERNAME","PASSWORD",False

    ''Example : app.TDConnection.Connect

  • "http://192.168.1.1:8080/qcbin","Default","proj1","venkat",,false

    '''Script to Connect to QC and Add a new Defect in QC from QTP

    Dim qccon

    Set qccon=CreateObject("TDApiOle.TDConnection")

    qccon.InitConnection "http://qcserverurl:8080/qcbin"

    qccon.ConnectProject "proj1","venkat",""

    If qccon.Connected Then

    Msgbox "Connected to QC Server

    Else

    MsgBox "Not Connected"

    End If

    Set BugFactory = qccon.BugFactory

    Set Bug = BugFactory.AddItem(Nothing)

    Bug.Status = "New"

    Bug.Summary = "Error in login"

    Bug.Priority = "4-Very High"

    Bug.AssignedTo ="user1"

    Bug.DetectedBy = "venkat"

    Bug.Post

    ' Close QTP After execution of the Test

    set wm=GetObject("winmgmts:\\.\root\CIMV2")

    Set pros=wmi.ExecQuery("Select * from Win32_Process Where Name = 'QTPro.exe'")

    For Each p in pros

    p.Terminate()

    Next

    Set wmi=Nothing

    Set pros=Nothing

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 5:11 AM 0

    comments

    Monday, April 19, 2010

    Interview Scripts---3

    1. How to return multiple values from a function ( VBScript)

    2. How to load object repository during runtime

  • 3. how to handle exceptions in VBScript

    4. How do you parameterize data to your test

    5. What is the Executable file of QTP

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:40 AM 0

    comments

    Friday, April 16, 2010

    Interview Scripts-Try-2

    1. Write Script to Import data from Excel To Datatable

    2. Write Script to invoke Application

    3. Write Script to read data from datatable

    4. Write Script to connect to SQL server Database and read data from emp table

    5. What is Difference between SystemUtil.Run & InvokeApplication

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 8:10 AM 0

    comments

    Thursday, April 15, 2010

    VBScript - Excel Programming

    ''' Set the Color to the Cells in Excel

    Set xl = CreateObject("Excel.Application")

    xl.Visible = True

    xl.Workbooks.Add

    For i = 1 to 56

    xl.Cells(i, 1).Value = i

    xl.Cells(i, 1).Interior.ColorIndex = i

    Next

    ''Read Data from MS-Excel using ADODB.Connection and RecordSet

  • '' Take few records of emp details in cells A1 to C4 for practise like eno, ename,sal

    Dim cn,sSQL,rs,vRows, strtext

    Set cn=CreateObject("ADODB.Connection")

    Set rs = CreateObject("ADODB.Recordset")

    cn.open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=e:\gvenkat\data.xls ;Extended

    Properties=Excel 8.0"

    rs.open "SELECT * FROM [Sheet1$A1:c4]", cn

    i=0

    while rs.eofTrue

    for each field in rs.fields

    if Trim(strtext)="" then

    strtext=strtext & field.value

    else

    strtext=strtext & " " & field.value

    end if

    next

    i=i+1

    rs.moveNext()

    Wend

    rs.close

    cn.close

    vRows=Split(strtext,vbTab)

    For i=0 to ubound(vRows)

    print vRows(i)

    Next

  • Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:48 AM 0

    comments

    Wednesday, April 14, 2010

    Desc Ex : Calculator

    sub TypeKey(vkey)

    Select Case vKey

    Case "*"

    vKey = "\*"

    End Select

    With Window("nativeclass:=SciCalc")

    .WinButton("text:=" & vKey).Click

    End With

    End Sub

    TypeKey 5

    TypeKey "*"

    TypeKey 9

    TypeKey "="

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 9:07 PM 0

    comments

    Tuesday, April 13, 2010

    Descriptive Examples

    ' Script to Close the Recent browser opened

    Dim d,brlist,idx

    Set d=Description.Create

    d("micclass").value="Browser"

    Set brlist=Desktop.ChildObjects(d)

    idx=brlist.count-1

    Browser("creationtime:="&idx).close

    Set d=Nothing

    Set brlist=Nothing

  • '''' VBScript to Display All the Properties of All the objects in WebPage

    Set d=Description.Create

    Set App = CreateObject("QuickTest.Application")

    Set qtIdent = App.Options.ObjectIdentification

    qtIdent.ResetAll

    set objList=browser("micclass:=Browser").page("micclass:=Page").ChildObjects(d)

    For i=0 to objList.count-1

    objList(i).highlight

    oClassName=objList(i).getroproperty("micclass")

    Set qtObject = qtIdent.Item(oClassName)

    set PropColl=qtObject.AvailableProperties

    print "*******************************************************"

    For oPropCount=1 to PropColl.count

    print PropColl.item(oPropCount) & ":="& objList(i).getroproperty(PropColl.item(oPropCount))

    Next

    print "*******************************************************"

    Next

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 9:23 PM

  • Monday, April 12, 2010

    Scripts Try-1

    1. Write Script to get the count of values in WinCombobox

    2. Write Script to get the x and y coordinates of a button

    3. Write Script to find the Page Load Time

    4. Write Script to search for a city in the wincombobox

    5. Write script to check window is visible on the desktop or not.

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 10:08 AM 0

    comments

    QTP TIPS

    QTP Tips

    There are lot of QTP tips file in QTP installation folder which is developed by HP.

    If you have installed QTP in your machine then find the file in this path QTP installation Folder -->Dat -->

    Tips.txt.

    The RegisterUserFunc statement now has an optional argument that you can use to set a

    function as the default operation for a test object.

    You can use the new Function Definition Generator to easily generate user-defined functions

    (Insert > Function Definition Generator).

    NEW!! You can manage the availability of keywords used to create keyword-driven components

    using the new Keywords pane in the application area of QuickTest Professional.

    NEW!! You can associate a function library with the open test by opening the function library

    and choosing File > Associate Library 'library_name' with 'test_name'.

    NEW!! You can check syntax errors by clicking CTRL + F7. If your script contains errors you can

    view them in the new Information pane.

    The Select Object for Step dialog box enables you to select a new object from your application. If

    you select an object in your application that is not in the object repository, the object is added

    to the object repository when you insert the new step.

    You can select an object in the object repository and locate it quickly in your application using

    the Highlight button in the ORM or ORE.

  • NEW!! You can locate an object in the object repository by pointing to an object in your

    application. If the object exists in the object repository, it is highlighted.

    NEW!! You can now add new objects to the object repository using filtering capabilities. For

    example, you can choose to add only a selected type of object residing in a window or a web

    page/frame.

    NEW!! You can now associate multiple object repositories with an action or application area. In

    previous versions of QuickTest Professional, you could associate only a single object repository

    with a test asset.

    NEW!! You can export object repository content to an XML file and import a new object

    repository from an XML file.

    The list of Utility objects available when you open the Step Generator from the Keyword View is

    a sub-group of the list available when you open the Step Generator from the Expert View.

    Open XML format used for report information now enables you to easily customize run reports

    and integrate result information with other applications. Refer to the QuickTest online

    documentation for a detailed description of the report's XML elements.

    You can export test results to an HTML file to easily view the test results when you are not

    working in a QuickTest environment.

    You can write automation scripts to control virtually every QuickTest feature and capability

    using the objects, methods, and properties included in the QuickTest Professional automation

    object model.

    Test object and method names are not case sensitive.

    When you type VBScript keywords in the Expert View, the relevant VBScript syntax or blocks are

    added to the test script.

    You can now locate specified text strings in the Expert View, and replace them with text strings

    that you specify. You can search for literal text or use advanced options to fine-tune your

    search.

    NEW!! You can select a block in the Expert View and press CTRL + M to comment this block.

    Press SHFT + CTRL + M to uncomment the block.

    NEW!! You can select a block in the Expert View and indent or outdent it by clicking the Indent

    or Outdent toolbar buttons.

    NEW!! You can control the layout of the QuickTest Professional Window by dragging and

    dropping panes to a dockable, floating, and tabbed mode.

  • NEW!! To move a dockable pane without snapping it into place, press CTRL while dragging it to

    the required location.

    NEW!! To auto-hide all the tabbed panes, select the title bar of the active tabbed pane, right-

    click and choose Auto Hide.

    NEW!! When you rename a test object, you can choose whether to automatically update all

    occurrences of the test object, or manually change the names in steps that use the renamed test

    objects.

    NEW!! You can copy objects from a shared object repository to the local object repository in

    order to modify them.

    NEW!! You can use the Object Repository Merge Tool to merge objects from two shared object

    repositories into a single object repository.

    NEW!! You can associate shared object repositories with multiple actions simultaneously, using

    the Associate Repositories dialog box.

    NEW!! You can resolve missing resources (such as missing object repositories and actions), using

    the new Missing Resources pane.

    You can use the Advanced Windows Applications Options dialog box to modify how QuickTest

    records and runs tests on Windows applications. Choose Tools > Options > Windows

    Applications tab > Advanced.

    You can save the resulting data from the run-time Data Table to a file by inserting a

    DataTable.Export statement to the end of your test.

    To instruct QuickTest to wait for an object to open or appear during test run, use an Exist or

    Wait statement.

    To stop an analog step in the middle of a test run, click Ctrl + Esc, and then click the Stop toolbar

    button.

    If you want to create a bitmap checkpoint of multiple objects, select the object in the Object

    Selection dialog box that includes all the objects you want your bitmap checkpoint to contain.

    If you need to recover Active Screen files after you save a test without Active Screen files, re-

    record the necessary steps or use the Update Run option to recapture screens for all steps in

    your test.

    You can use a PathFinder.Locate statement in your test to retrieve the complete path that

    QuickTest uses for a specified relative path based on the folders specified in the Folders tab.

    To maximize performance, load only the add-ins you need.

  • You can define a recovery scenario to handle unexpected behavior during your run session.

    You can add new objects to the Object Repository from the Active Screen or using the Add

    Objects option in the Object Repository dialog box and pointing to the object in your

    application.

    To record keyboard input, mouse clicks, and the exact path the mouse travels, switch to Analog

    Recording mode or Low Level Recording mode.

    If it takes time for an object you are checking to load all of its data, you can increase the

    checkpoint timeout.

    You can insert XML output values to your script.

    You can verify that your XML is structured according to a specific schema.

    You can specify a relative path when calling actions, functions, and other external files

    associated with or referenced by a test or business component.

    NEW!! You can create library files (containing VBScript functions, subroutines, classes, modules,

    and so forth) in QuickTest Professional and associate them with your test or application area.

    You can then call these functions (or other elements) from within your test assets.

    NEW!! You can debug functions, subroutines and classes defined in a function library file in

    QuickTest Professional.

    You can create a user-defined function and register it as a test object method in order to

    overwrite or add to existing test object functionality.

    You can use the Reporter object to disable or enable messages to the Test Results.

    You can record a test on one version of Microsoft Internet Explorer and then run it on other

    browsers or versions.

    To transfer control to the application while spying or inserting checkpoints on objects, press the

    CTRL key.

    You can check the content of an image in a Web page when you create an image checkpoint

    using the Compare Image Content option.

    You can use the Data Table to run the test several times, each time using different data.

    By default, in order to conserve disk space, QuickTest does not save screen captures with your

    test results for steps that pass. You can change the default setting in the Tools > Options > Run

    tab.

  • The Active Screen loads faster if you clear the Load Images check box in the Web Page

    Appearance dialog box (Tools > Options > Active Screen tab > Advanced button).

    You can teach QuickTest to recognize any area of your application as an object by defining it as a

    virtual object.

    From QuickTest, you can run WinRunner tests and call TSL functions in compiled modules. The

    results of the WinRunner test or function are integrated into the QuickTest test results.

    To modify the text used for a text checkpoint, click the Configure button in the Text Checkpoint

    Properties dialog box.

    You can configure an action for repeated use in your test and in other tests. Select the Reusable

    Action check box in the Action Properties dialog box (Edit > Action > Action Properties).

    You can use the ExitAction statement to terminate an action before it finishes running, based on

    conditions you specify in your test.

    You can set breakpoints in your test, and then use the Debug Viewer pane to view, set, or

    modify the current value of objects or variables.

    You can call methods and retrieve and set COM object properties from the Expert View using

    the .Object property.

    You can configure how QuickTest records events in Web applications. Choose Tools > Web Event

    Recording Configuration.

    You can define custom environment variables for use in your test.

    You can add logic to a checkpoint by using a Data Table formula.

    You can use the Window Script Host and the VBScript Runtime Library to further extend your

    test. For more information choose Help > QuickTest Professional Help > VBScript Reference.

    You can use the Object Identification dialog box to configure the way QuickTest learns and

    recognizes objects.

    You can run your test in Update mode to update values in your test or business component. You

    can choose to update checkpoint data, Active Screen images, and/or the descriptions of the

    objects in the object repository. Choose Automation > Update Run Mode.

    If you want to add the same comment to every action that you create, you can add the

    comment to an action template.

    You can define test or action parameter variables using the Parameter object and its methods in

    the Expert View.

  • You can create test, action, or component parameter output values that retrieve values during

    the run session and store them for use at another point in the run session. You can then use

    these output values to parameterize a step in your test or business component.

    NEW!! You can create object repository parameters. When associating an object repository to a

    test asset, you map this parameter to a constant or a test asset parameter (test, action, or

    business component).

    In addition to Data Table output values, you can output values to environment variables or store

    a retrieved value in a test, action, or component parameter.

    You can use the Data Driver Wizard to automatically parameterize constants in your action or

    business component.

    You can set a parameter to use a random numeric value.

    You can specify test, action, or component parameters to pass values to and from your test or

    business component, and between actions in your test.

    Keyword view tips

    The Operation item appears in the Keyword View only when functions are defined in function

    library files associated with the components application area.

    When adding a new step using the Keyword View or Step Generator, you can select a new

    object from your application and it is automatically added to your object repository.

    You can specify which columns you want to display in the Keyword View. Choose Tools > View

    Options or right-click any column header in the Keyword View.

    You can specify the order in which columns are displayed in the Keyword View. Choose Tools >

    View Options or drag a column header to a new location in the Keyword View.

    You can print the contents of the Keyword View to your Windows default printer, or preview it

    on screen before printing. Click the Print button or choose File > Print.

    You can copy and paste or drag and drop steps in order to move them to a different location

    within the Keyword View.

    You can enter a comment about a step in the Keyword View by clicking in the Comment cell. You

    can also enter a comment on a new line below the currently selected step by choosing Insert >

    Comment.

    You can view the Documentation column in the Keyword View to read a summary of what the

    step does, in an easy-to-understand sentence.

  • The Function Definition Generator enables you to add documentation that specifies exactly

    what a step using your function does. This description is shown in the Documentation column of

    the Keyword View for steps that use the function.

    NEW!! You can copy the content of the Documentation column to the Clipboard by right-clicking

    any column header in the Keyword View and choosing Copy Documentation to Clipboard.

    You can print a single action or business component from the Keyword View (in table format) or

    from the Expert View (in statement format).

    You can create a custom report message from the Keyword View by choosing Insert > Report.

    Tips When connected with QC

    You can create multiple application areas to suit different components.

    NEW!! Business components associated with an application area use only the resources and

    settings that are defined in the application area. In previous versions of QuickTest Professional,

    business components could have custom settings.

    Iterations for a business component are defined in Quality Center.

    If you are connected to Quality Center, you can view the current Quality Center connection by

    pointing to the Quality Center icon in the status bar. To open the Quality Center Connection

    dialog box, double-click the Quality Center icon.

    If a Quality Center test or shared file (such as a shared object repository or Data Table file) is

    open when you disconnect from Quality Center, then QuickTest closes it.

    To access QuickTest tests or components from Quality Center, select the 'Allow other Mercury

    products to run tests and components' check box (Tools > Options) and install the QuickTest

    Add-in for Quality Center (from the QuickTest Professional CD-ROM).

    NEW!! If a business component is currently open, clicking the New toolbar button creates a new

    business component document (and not a new test document). This also applies if an

    application area or function library is open.

    NEW!! You can open a recently used business component, application area, or function library

    by selecting it from the Recent Files list in the File menu.

    You can run QuickTest tests from a Quality Center project and pass parameter values to the test.

    You can choose a Web server accessible via a Local Area Network (LAN) or a Wide Area Network

    (WAN) when connecting to Quality Center. Click the Quality Center Connection button or choose

    File > Quality Center Connection.

  • The Open Test from Quality Center Project dialog box displays icons that indicate the version

    control status of each test in your project.

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 10:03 AM 0

    comments

    Saturday, April 10, 2010

    VBScript Examples

    ''Example on Internet Explorer

    Set ie = CreateObject("InternetExplorer.Application")

    'set the ie properties

    ie.ToolBar = 0

    ie.StatusBar = 1

    ie.Width = 999

    ie.Height = 999

    ie.Left = 0

    ie.Top = 0

    ie.Visible = 1

    'navigate to a web page

    ie.Navigate("http://www.google.com")

    ===================================

    ''Example on using Excel, VBScript

    dim ex,wb,ws,row,column

    set ex=CreateObject("Excel.Application")

    ex.visible=true

    set wb=ex.Workbooks.add

    set ws=wb.Sheets("Sheet1")

    for row=1 to 5

    for column=1 to 10

    ws.cells(row,column).value="Cell(" & row & "," & column & ")"

    next

    next

    dim val

    for row=1 to 5

    for column=1 to 10

    with ws.cells(row,column)

  • .value="updated_" & .value

    end with

    next

    next

    for column=1 to 10

    ws.columns(column).AutoFit()

    next

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 10:58 PM 0

    comments

    FAQ-4

    1. what is executable file of QTP

    2. What is error, defect, bug and failure

    3. Explain Defect life cycle

    4. what is SDLC and STLC

    5. What is project Testing and Application Testing

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 1:35 AM 0

    comments

    Wednesday, April 7, 2010

    FAQ-3

    1. How to run QTP Scripts from QC

    2. How to Export TCs from Excel to QC

    3. What is Fuzz Testing

    4. What is Story board Testing

    5. What is defect Triaze, defect density,defect clustering

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 6:15 AM 0

    comments

    Saturday, April 3, 2010

  • FAQ-2

    1. What is difference between QTP 9.2 , QTP 9.5 and 10.00

    2. What is difference between low level recording and analog recording.

    3. How to parameterize data to the QTP.

    4. how to load Object Repository during RunTime

    5. what is local and shared repository.

    6. what is the extension of QTP Script file

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:31 AM 0

    comments

    Friday, April 2, 2010

    Manual FAQ-1

    1. what is Defect Triaze

    Triaze meeting is conducted to list all the open defects and list which are possible to fix and not possible

    to fix because of schedule.

    2. Defect cluster

    Defects are found in groups

    3. Explain Defect life cycle

    4. Explain the levels of Testing

    unit testing, integration testing, system testing

    5. what is alpha testing and beta testing

    6. What is verification and validation

    7. what is prototype

    8. What is project TEsting and product TEsting

    9. What is webservice

    10. What is intranet and Internet

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:00 AM

  • Monday, March 29, 2010

    Diff b/w QTP 9.2, 9.5, 10.00

    Differences between QTP 9.2, QTP 9.5 and QTP 10.00

    Hi,

    Below are the differences you can tell between the QTP versions; those who are putting up QTP

    experience; in the project point of you it is suggested to put QTP 9.2 / 9.5 but you can mention in the

    Skill set that QTP 10.00 you have knowledge

    Note: All the new Features of QTP 9.5 are available in QTP 10.00 and QTP 10.00 has new features

    compared to QTP 9.5

    New Features of QTP 9.5 which are not in QTP 9.2

    Maintenance Run Mode :

    Repair the object properties in the Repository if the properties are changed in the application in new

    build.

    Process Guidance :

    This is little more than more accessible help files. Maybe this is good for when you are first learning to

    record a test, but it doesnt seem to add much utility.

    Test Flow Pane

    Display the list of Actions in the Test and the sequence they are executed

    Available Keywords Pane

    All Test Objects and functions in are displayed.Rapid test development with drag & drop of objects,

    functions into expert view. And Object repository now also supports drag & drop

    Resources Pane :

    All resources associated with the test. You can see all your library file in this pane

  • Missing Resources Pane

    Display the List of resources associated to the test but not available in the location during runtime

    Relative Path Helper

    Improved Bitmap Checkpoint

    Bitmpap Checkpoint has Tollerence values for pixels and color

    Web Extensibility :

    1.Anyone can add support for new web controls

    2.Rapid development in JavaScript

    3.Solid infrastructure supplied by the Web add-in

    4.Extensibility objects are first class citizens

    5.Built-in toolkit: ASPAjax

    Tabbed browsing :

    Tabs identified as separate browsers.Same test compatible with tabbed and non tabbed browsers.

    New Technologies :

    1.PowerBuilder

    2. Delphi

    3. Oracle Forms 10 Apps 12

    4.StingRay Objective Grid 10, 114. PeopleSoft 9.0

    5.New Terminal Emulator versions

    6.NET 3.5 (beta)

    New environments :

    1.Windows Vista 64 bit

    2. Eclipse 3.2, 3.3

    3.Record on SWT

  • 4. Firefox 3.0

    5.Netscape 9

    New Features of QTP 10.00

    1. Centrally Manage and Share Testing Assets, Dependencies, and Versions in Quality Center 10.00

    In the earlier version of QC, the Test Assets like ( Repository, Library, Recoveries ) are placed in the

    Attachments and if these assets are associated to the Test there is no dependencies information.

    In QC 10.00 there is a new Section called Test Resources in the section we can place all the Assets and

    associate these to the Test Script. The QC tool maintains the dependencies information between the

    Assets and Test Script.

    It also provides build in Version control; when the Test case/ scripts ...etc is checkout and checkin into

    QC it will maintain a new version which is similar concept in VSS.

    2. Perform Single-User Local System Monitoring While Running Your Tests

    we can observe the performance of the local system when the script is executed. Like usage of memory,

    GDI objects, Thread counters.

    Navigation: To select the Local System Motitoring

    File menu-->Settings--> Local System Monitoring

    Select the Enable Local System Monitoring every seconds

    Select the Application name

    Select the counter and Limit size

    After the Test Run, the status is shown in the Test Results

    3. Improve Portability by Saving Copies of Tests Together with Their Resource Files

    When we save the test from QC into local system ; all the associated assets like Object Repositories,

    Function Libraries, Recovery Scenarios are also copied to the local system and we can run the script

    from local system with out any change in the assoication assets path / with out any changes.

    Steps :

    Open the Test in QTP which is in the QC

    File menu select Save Test with Resources

    Following type of details are displayed

    select the location in local system to save the file and save

    4. Call Actions Dynamically During the Test Run

    we can dynamically load and run actions instead of Call to Existing action and associating the reusable

    Actions. These action is loaded into memory and run only when the statement is executed and not

    during the Test / Action open.

    Syntax: Loadandrunaction Path of QTP test,Actioname

    5. Develop Your Own Bitmap Checkpoint Comparison Algorithm

    6. Centrally Manage Your Work Items and ToDo Tasks in the To Do Pane

    we can make a note of all the tasks to be perfomed in the TODO Pane

    View menu--> To Do List

    7. Improve Test Results Analysis with New Reporting Functionality

  • A. Export Results Report

    The results can be exported to DOC, PDF files also apart from HTML.

    In the Results window ; File menu--> Export Report

    B. Reporter.ReportEvent

    During the script execution for any failed steps we can capture the bitmap and display it in the results

    window along with Reporter.ReportEvent method

    Example:

    If condition is falied then

    Window(Flight Reservation).CaptureBitmap b1.bmp

    Reporter.ReportEvent 1,Error,The error message in the window,b1.bmp

    End if

    C. Jumping to a Step in QuickTest

    We can view the step in QuickTest that corresponds to a node in the run results tree.

    To view the step in the test that corresponds to a node:

    Select a node in the run results tree.

    Perform one of the following:

    Click the Jump to Step in QuickTest button from the Run Results toolbar.

    Right-click and select Jump to Step in QuickTest from the context-sensitive menu.

    Select View > Jump to Step in QuickTest.

    The QuickTest window is activated and the step is highlighted.

    8. Test Standard and Custom Delphi Objects Using the Delphi Add-in and Delphi Add-in Extensibility

    We can use the QuickTest Professional Delphi Add-in to test objects in Delphi applications. We can

    create and run tests and components on these objects, as well as check their properties. We create and

    run tests and components on Delphi applications in much the same way as you do for other Windows-

    based applications.

    The Delphi Add-in provides test objects, methods, and properties that can be used when testing objects

    in Delphi applications

    Product Enhancements

    1.Upgrade from QuickTest 9.5

    If QuickTest 9.5 is installed on the computer, we can choose to upgrade to QuickTest version 10.00. This

    enables us to continue using many of the configurations and options we have already set in QuickTest

    9.5. We can also use an msi silent installation command line to upgrade from QuickTest 9.5.

    2.Improved IntelliSense Functionality

    QuickTest now provides full IntelliSense for the following types of objects:

    Objects created by a step or function (for example, by calling the CreateObject method)

    Variables to which an object is assigned

    Reserved objects

    COM objects

    3.Added Control for Editing and Managing Actions in Automation Scripts

    The QuickTest Professional Automation Object Model has a new set of objects and methods for

  • manipulating test actions and action parameters. We can now use automation scripts to create new

    actions, modify and validate the syntax of action scripts, create and modify action parameters, and

    more.

    4.Improved Debugger Pane Design and Functionality

    The Debug Viewer pane has a new look, including icons to help us identify the type of information

    displayed.

    The Watch tab and Variable tab now display the types of expressions or variables, in addition to their

    names and values.

    The Command tab now displays the command history (in read-only format) in addition to the command

    line, enabling us to view previously-run commands and select commands to reuse.

    In addition, a right-click context menu in the Command tab enables us to:

    copy from the command history and edit the command line using the clipboard.

    clear the command history.

    5.New Object Identification Solutions in Maintenance Run Mode

    In addition to helping us update the steps and object repositories when objects in the application

    change, the Maintenance Run Wizard can now help to solve the following problems:

    The step failed because the object in the test is missing from the action's associated object repositories.

    The object in the step exists in the application, but can be identified only through Smart Identification.

    6.Additional Configuration Settings for Text Recognition Mechanism

    We can now set all text recognition configuration settings from the QuickTest Options Dialog Box (Tools

    > Options > General > Text Recognition), including new options for selecting the text block mode and

    specifying the languages to be used with the OCR mechanism. This makes it easier to make any

    necessary adjustments and to optimize the way that QuickTest identifies text in the application.

    7.New Look for Options, Settings, and File Dialog Boxes

    8.QuickTest Toolbar Customization Options

    We can use the new Customize Dialog box (Tools > Customize) to customize the appearance of existing

    menus and toolbars, and to create our own user-defined menus, toolbar buttons, and shortcuts.

    We can also add new commands to the QuickTest Tools menu so that we can launch an application

    directly from the menu. For example, we can use this option to create a shortcut to the application we

    want to test or to an automation script.

    9.Improved Web Extensibility

    10. .NET Add-in and Extensibility Improvements

    11.New Terminal Emulator Configuration Validation

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 5:01 AM 1

    comments

    Friday, March 19, 2010

    Good Websites

    Good websites to know more knowledge on Banking domain and Insurance Domain

  • http://www.howbankswork.com/

    http://www.irdaindia.org/

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:09 AM 0

    comments

    Tuesday, March 9, 2010

    QTP File Extensions

    QTP Script File : .mts ( mercury test script)

    QTP Local Repository : .bdb ( berkely database)

    Shared Repository : .tsr ( test shared repository)

    Load test configuration file :Default.cfg

    Load test configuration file :Default.usp

    Test.Tsp ---- Test Settings File

    Parameters.mtr-------- Test Parameters file

    Default.xls-------- Datatable ( Excel file)

    Resource.mtr-------- contain the resources associated information like function library, recovery,

    shared repository

    Recovery Scenario -------- .qrs

    Function library-----------.vbs / .qfl / .tst

    Test Batch--------------- .mtb

    Action Template--------- .mst ( mercury shared template)

    Virutal Object---------- .vot ( virtual object template)

    lock.lck------------- Created when the QTP test is open

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 5:15 AM 0

    comments

    QTP best Practises

    QTP Best Practices

  • Just record-and-playback is never the solution for any project.

    Launch QTP using a .vbs file and not the QTP desktop icon. You will notice a substantial increase

    in speed.

    For large tests, always define variables; function in an external .vbs file and not inside a reusable

    action. Attach these files with your test scripts.

    If you define a variable or a function in an action, on every iteration of your test run, memory

    (RAM) will be allocated to those variables/functions and would not be released. Now as your

    script starts consuming more and more RAM, your System Under Test (SUT) will tend to become

    slower.

    While running, QTP consumes a lot of memory by itself. It is always advisable to have lots of

    available RAM (much more than what is recommended by HP) and good processor speed on a

    system where you intend to install QTP.

    When you have tests (and hence QTP) running for a prolonged period if time, there are chances

    of memory leaks. To avoid memory leakages always restart QTP at some intervals of time. Using

    AOM you can automate this process. [If you want to go into details of effect of RAM on speed of

    computer read the post on RAM, Memory Usage thoroughly]

    Avoid using hard coded wait(x) statement. Wait statement waits for full x seconds, even if the

    event has already occurred. Instead use .sync or exist statement. While using exists statement

    always has a value inside it.

    For ex: .Exist(10) Here QTP will wait max till 10 seconds and if it finds the object at (say) 3 secs ,

    it will resume the execution immediately thereby saving your precious time. On the other hand

    if you leave the parenthesis blank, QTP would wait for object synchronization timeout you have

    mentioned under File > Test Settings > Run Tab.

    Make full use of what HP-QTP has provided you in the tool IDE. Use Automatically Generate

    With statements after recording option present under Tools > Options > General Tab. This

    will not only make your code look neater but also make your scripts perform better.

    Make your own judgment whether you want to go for Descriptive Programming or Object

    Repository or mixed approach. Each approach has it own pros and cons that in turn is related to

    QTP performance.

    Unless absolutely required, uncheck the options Save still image capture to results and Save

    movie to results present under Tools > Options > Run tab. These options definitely have some

    bearing on QTP run time performance.

  • Make the Run Mode as fast. This setting is present under Tool > Options > Run tab. Note: If

    you intend to run your scripts from QC no need to worry about this option, as the scripts WILL

    run in fast mode whether you want or not.

    Make use of relative paths while calling reusable actions in your script. Using relative path would

    make your script portable and easy to manage. I will cover in detail how tos and whys of using

    relative paths in my next post.

    Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:46 AM 0

    comments

    Tuesday, March 2, 2010

    SQL Queries

    1. select all the records from titles table

    select * from titles

    2. select all the books price>=20 rupees

    s