Thursday, 28 March 2013

Folder Structure and File extentions in QTP

Please note that below article is written for QTP 10.

When we save any test in QTP 10 below folders are created.

For example - If we save the test as book in c drive Then one folder will be created like c:\book. Under Book folder there will be below folders.

Action 0
Action 1  ' If we have one action in Test
Action 2  ' If we have two actions in Test and so on.....




Below mentioned files are also Created under main test (book) folder.
  • default.cfg                       - Text File - Web and network configuration
  • default.usp                       - Text File - Action Iteration Settings
  • default.xls                        - Datatable of the test
  • lock.lck
  • parameters.mtr                  - Binary File -
  • book.usr   (testname file)   - Text File
  • test.tsp                              - Binary file -  Test Settings
Under Each Action there will be one folder



  • Snapshots

  • Under Each Action there will be below files.
    • objectrepository.bdb        - Local Object Repository
    • resource.mtr                     -
    • script.mts                         - Actual Code of action - Text File
    • analogtracklist.dat             -
    Other Files and thier Extentions in QTP.
    • .vbs  - VBS library File
    • .txt    - Text Library File       
    • .qfl    - Quick test function library file
    • .qrs   - Quicktest Recovery Scenario File
    • .tsr    - Shared Object Repository file

    You may also like - 
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial
    Dear friend - What do you think on above topic? Express yourself via below comment box.

    Keyword Driven Automation Framework in QTP

    Keyword driven Automation Framework is most popular QTP framework. It is very easy to design and learn a keyword driven automation framework in QTP.

    In this article I will explain you all details about how we can design and use keyword driven automation framework in QTP with example. I will also explain the advantages and disadvantages of keyword driven automation framework in QTP.

    What is keyword driven automation framework in QTP?

    In keyword driven automation framework, focus is mainly on kewords/functions and not the test data. This means we focus on creating the functions that are mapped to the functionality of the application.

    For example -
    Suppose you have a flight reservation application which provides many features like
    • Login to the application
    • Search Flights
    • Book Flight tickets
    • Cancel Tickets
    • Fax Order
    • View Reports
    To implement the keyword driven automation framework for this kind of application we will create functions in vbscript for each functionality mentioned above. We pass the test data and test object details to these functions.

    What are the main components of keyword driven automation framework in QTP?

    Each keyword driven automation framework has some common components as mentioned below.


    As dispalyed in above image, We have 5 main components in keyword driven automation framework

    1. Scripts Library (.vbs, .txt, .qfl)
    2. OR - Object Repository
    3. Test Data (generally in excel format)
    4. QTP - Settings and Environment Variables
    5. Reports - (Generally in HTML format)
    6. Test Driver Script/ Test Engine
    We will see examples of each component in below section.

    1. Library Scripts (Files) in keyword driven automation framework in QTP.


    As I mentioned earlier, in keyword driven automation framework we develop the kewords that are mapped to the functionality of the application. In large automation projects  where there are many functionalities, We need to create lot of functions. Generally We create functions for each module in the application and store similar functions in seperate library files.

    For example -

    We can store login/logout related functions in authentication.vbs file.
    All functions related to booking could be stored in booking.vbs

    Sample function in authentication.vbs is given below. Please note that single vbs file may contain multiple functions.

    Function login()

    'Setting the user id 
    Dialog("Login").WinEdit("Agent Name:").Set uId
    Dialog("Login").WinEdit("Agent Name:").Type  micTab 

    'setting the password
    Dialog("Login").WinEdit("Password:").SetSecure password
    Dialog("Login").WinButton("OK").Click

    If Dialog("Login").WinEdit("Agent Name:").Exist(1) Then
    'Log the result saying login failed
    Else
    'log the result saying login passed/successful
    End If

    End Function

    Please note that we can store library files with 3 extentions i.e. .vbs, .txt and .qfl.
    QTP engineers prefer to store the library files in a file with extension .vbs as we can include vbs files using executefile statement and also find out the syntax errors by double clicking on the vbs file.
    QFL file long form is Quick test function library.

    Once you have created the library file with all functions in it, you can associate that file to test using resources setting.

    2. Object Repository in keyword driven automation framework in QTP.

    In QTP there are two types of Object Repository.
    • Local Object Repository (objectrepository.bdb for each action)
    • Shared Object Repository (.tsr extention)
    Out of these 2 object repositories, Shared object repository is very popular among QTP testers. Because we can have all test objects in single file. This helps us to maintain the object repository. To add/ edit objects inside shared object repository, you must go to Object Repository Manager and open the .tsr file and then make the changes in the shared object repository.

    3. Test Data (generally in excel format) in keyword driven automation framework in QTP.

    Generally automated test cases are stored in excel sheets. From QTP ,we read excel file and then row by row we execute the functions in a test case. Each test case is implemented as a set of keywords.
    Common columns in Data sheet are mentioned below.
    • Test case ID - Stores the Test Case ID mapped to Manual Test Cases.
    • Test Case Name - Name of the Test cases/ Scenario.
    • Execute Flag - if Marked Y -> Test case will be executed
    • Test_Step_Id - Steps in a test case
    • Keyword - Mapped to function in library file.
    • Object Types - Class of the object e.g winedit, webedit, swfbutton etc
    • Object Names -Names of objects in OR .
    • Object Values - Actual test data to be entered in the objects.
    • Parameter1 - This is used to control the execution flow in the function.








    Please note that this is just a sample data sheet that can be used in keyword driven framework. There could be customized data sheets for each project depending upon the requirement and design.
    For example there could be more parameters or test data is stored in the databases. 

    4. QTP Test Settings and Environment Variables in keyword driven automation framework in QTP.

    This is also one of the most important component of the keyword driven automation framework.
    In Test settings We need to do some setting before we execute any test suite. This could be one time set up or per execution request set up.

    List of Important Settings -
    • Object Synchronization timeout -
    • When Error Occurs during run session -
    • Resources - Associated library files
    • Environment - We need to set up some variables like folder path, User Id etc
    • Recovery - We must associate the recovery scenario file to the test. Recovery Scenario will handle unexpected events during execution. This will help for smooth execution using QTP.

    5. Reports in keyword driven automation framework in QTP.

    In actual projects we generally do not rely on the reports/results generated by the QTP. We usually create the reports in html formats using custom reporting function. We use filesystemobject to create html reports.
    Reports will display the total number of test cases executed, Total Pass Test cases, Total Failed test cases and total time required to execute the test cases. This will give better picture of QTP Execution. 

    Reports module may contain below functions.

    'Below function will create the folder in which reports are stored
    Function CreateReportFolder()
    Set Fo = createobject("Scripting.FilesystemObject")
    If Not Fo.FolderExists(Environment.Value("ResultPath")) Then
    Fo.CreateFolder (  Environment.Value("ResultPath") )
    End If
    '******************************************************************************

    'Below function will store the log of the test case in memory variable called templog until  it is written to file permanently.

    Function CreateTestCaseLog(log,intStatus)
    If intStatus = 1 Then
    strhtml = "<span style=""color:green""> Pass : </span> " 
    ElseIf  intStatus = 2 Then
    strhtml = "<span style=""color:red""> Fail &nbsp; : </span> " 
    ElseIf  intStatus = 3 Then
    strhtml = "<span style=""color:maroon""> Warning :  </span> " 
    ElseIf  intStatus = 4 Then
    strhtml = "<span> Info &nbsp; : </span> " 
    End If 
    templog = templog &  strhtml & log & "<br/>"
    End Function

    '******************************************************************************
    'Below function will write the log to html file permanently

    Function GenerateHtmlReport(byval testCount,byval Test_Id,byval Test_Name,byval Test_Status,byval Test_Description)

    If Test_Status = False Then
    Test_Status = "<span style=""color:red"">Fail</span>"
    Else
    Test_Status = "<span style=""color:green"">Pass</span>"
    End If

    If  testCount = 0 Then

    strDetailedHTML = "<html><head><title>Detailed Report Of Execution </title> " 
    strDetailedHTML = strDetailedHTML & css
    strDetailedHTML = strDetailedHTML & "</head> <body><table>" 
    strDetailedHTML =  strDetailedHTML  & "<tr><th colspan=5> HTML Report  </th></tr>"
    strDetailedHTML =  strDetailedHTML  & "<tr><th>No</th><th>Test_Case_Id</th><th>Test_Case_Name</th><th width='500px'>Test_Case_Log</th><th>Test_Case_Status</th></tr>"
    filepath = "Detailed.html"
    Call AppendFileData(filepath,strDetailedHTML)
    End If

    strDetailedHTML = "<tr><td> " & testCount & " </td><td>" & Test_Id & " </td><td> " & Test_Name & " </td><td style=""text-align:left;""> " & Test_Description & "</td><td>" & Test_Status & "</td></tr>"
    filepath = "Detailed.html"
    Call AppendFileData(filepath,strDetailedHTML)

    End Function

    '******************************************************************************
    'Below utility/helper function will append the data to existing html file

    Function AppendFileData(byval filepath, byval contents)
    filepath =  Environment.Value("ResultPath") & "\" & filepath
    Set Fo = createobject("Scripting.FilesystemObject")
    Set f = Fo.openTextFile(filepath,8,true)
    f.Write (contents)
    f.Close
    Set f = nothing
    End Function

    6. Test Driver Script/Test Engine Script

    This is the heart of keyword driven / data driven frameworks. This is the main script that interacts with all modules mentioned above.
    Main tasks that are accomplished by driver script are ->
    1. Read data from the Environment variables /File or from ini file.
    2. Call report module to create Report folders / files 
    3. Import Excel sheet to Data table.
    4. Read Excel file.
    5. Call the function mapped to keyword.
    6. Log the result
    Sample Driver Script is given below



    Function ExecuteTest()


    'Load Environment Variables
    Environment.Value("TestDirectory") = replace(Environment.Value("TestDir"),"Scripts\Driver Script","")
    Environment.LoadFromFile Environment.Value("TestDirectory") & "Environment Variable\Env.ini"
    strSheetName = Environment.Value("SheetName")
    Environment.Value("ResultFolderPath") = Environment.Value("TestDirectory") & "Results\" & formatdatetime(now,2)
    Environment.Value("ResultFolderPath") = replace(Environment.Value("ResultFolderPath"),"/","-")
    CreateReportFolder()
    gfilestamp = replace(replace(formatdatetime(now),":","-"),"/","-")

    If instr(strSheetName,"|")>0 Then
    arrSheet=split(strSheetName,"|")
    else
    arrSheet=array(strSheetName)
    End If

    For i=0 to ubound(arrSheet)

    gfilestamp = replace(replace(formatdatetime(now),":","-"),"/","-")
    TestStartTime = Now()
    l_strsheetname=arrSheet(i)
    intTestCaseCount=0

    tmpDataTbl = "xyz"
    tmpSheetLocation =  Environment.Value("TestDirectory")  & "Input Data\Mydatasheet.xls"
    DataTable.DeleteSheet(tmpDataTbl)
    DataTable.AddSheet tmpDataTbl
    DataTable.ImportSheet tmpSheetLocation, arrSheet(i), tmpDataTbl
    'Driver Script
    intTotalRows = DataTable.GetSheet(tmpDataTbl).GetRowCount

    dtRows = 1
    Call CreateTestCaseLog("--------------- <b>" & ucase(arrSheet(i))  & "</b>---------------",4)
    Call RunTest(TestStartTime,l_strsheetname)

    Next


    End Function

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

    Function RunTest(TestStartTime,l_strsheetname)

    TempLoginCredentials=""
    intFailCount=0
    intTestCaseCount=0


    For dtRows = 1 To intTotalRows

    ' Read Test Case data

    strExecutionflag = trim(ucase(DataTable("Exec_Flag", tmpDataTbl)))
    strExecutionflag = Replace(strExecutionflag, Chr(13), "")
    strExecutionflag = Replace(strExecutionflag, Chr(10), "")

    temprows = dtRows

    If ucase(trim(strExecutionflag)) = "Y" Then




    blnTestStepFlag = True
    blnOverallTestCaseStatus = True
    blnReportTestCaseStatus = True
    strTestCaseID = DataTable("ID", tmpDataTbl)
    strTest_Case_Name = DataTable("Test_Case_Name", tmpDataTbl)
    gtestcaselog = ""  ' Reinitialize the log for new test case


    startTime = Now
    Call CreateTestCaseLog("Test Start Time - " & replace(replace(formatdatetime(now),":","-"),"/","-")   ,4)


    Do While    blnTestStepFlag


    strTest_Step_ID = DataTable("Test_ID", tmpDataTbl)


    strControlType = DataTable("ObjectTypes", tmpDataTbl)
    strControlName = DataTable("ObjectNames", tmpDataTbl)
    strControlValues = DataTable("ObjectValues", tmpDataTbl)

    StrScenarioName=DataTable("Test_Step_ID", tmpDataTbl)
    BusinessKeyword =  DataTable("Keyword", tmpDataTbl)
    strParameter1 =  DataTable("Parameter1", tmpDataTbl)


    Call CreateTestCaseLog("******************<b>" & BusinessKeyword  & "</b>******************",4)

    ret = Eval (BusinessKeyword)
    If (ret = False) OR (ret = "") Then
    blnOverallTestCaseStatus = False
    blnReportTestCaseStatus = False
    tempstimestamp = replace(replace(formatdatetime(now),":","-"),"/","-")
    tempspath = Environment.Value("TestDirectory") & "Screenshots\" & tempstimestamp  & ".png"
    constobjParent.CaptureBitmap tempspath,True
    Call CreateTestCaseLog("Snapshot <br/> " & "<a target='_blank' href='" & tempspath & " '> Screenshot</a> <br/> "  ,2)

    Else

    Call CreateTestCaseLog("Function " & BusinessKeyword & " was  successful"  ,1)
    End If


    DataTable.GetSheet(tmpDataTbl).SetNextRow
    dtRows = dtRows + 1




    If DataTable("ID", tmpDataTbl) <> ""  or (blnOverallTestCaseStatus = False ) Then

    blnTestStepFlag = False      
    DataTable.GetSheet(tmpDataTbl).SetPrevRow
    dtRows = dtRows - 1

    If  Instr(1,ucase(strTestCaseID),"P") > 0 Then
    intPreTestCaseCount = intPreTestCaseCount + 1
    If  blnOverallTestCaseStatus = False Then
    intPreFailCount=intPreFailCount+1
    End If
    End If


    Call CreateTestCaseLog("Test End  Time - " & replace(replace(formatdatetime(now),":","-"),"/","-")   ,4)
    DurationOfCaseExecution = DateDiff("n",startTime,Now)  

    Call CreateTestCaseLog("Test Case Execution Time - " & DurationOfCaseExecution   ,4)


    Call GenerateDetailedHtmlReport(intTestCaseCount,strTestCaseID,strTest_Case_Name,blnOverallTestCaseStatus,gtestcaselog,l_strsheetname)


    End If

    Loop  'loop until test ends

    If instr(strTestCaseID,";")>0 Then
    l_scriptArray=split(strTestCaseID,";")
    intTestCaseCount = intTestCaseCount + ubound(l_scriptArray)+1
    If  blnOverallTestCaseStatus=false Then
    intFailCount=intFailCount+ ubound(l_scriptArray)+1
    End If
    else
    intTestCaseCount = intTestCaseCount +1
    If  blnOverallTestCaseStatus=false Then
    intFailCount=intFailCount+ 1
    End If
    End If
    End If
    DataTable.GetSheet(tmpDataTbl).SetNextRow
    Next

    TestEndTime = Now()
    intTestCaseCount=intTestCaseCount-intPreTestCaseCount
    intFailCount=intFailCount-intPreFailCount
    DurationOfTestExecution = DateDiff("n",TestStartTime,TestEndTime)      
    Call GenerateFinalReports(intTestCaseCount,intFailCount,DurationOfTestExecution,l_strsheetname)

    End Function
    '*****************************************************************************

    If you want to download the full source code, data sheets, sample scripts and examples, Please buy an e-book at below url.

    QTP/UFT Framework

    I will send you all the details along with pdf.

    You may also like -
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial
    4. UFT Master Page
    Dear friend -  What do you think about this topic? Please express your thoughts via comment box.

    Monday, 25 March 2013

    Important QTP Interview Questions

    On This blog you will find all important QTP questions that are asked in interview. Questions cover all concepts of QTP and Vbscript as well as WSH.

    Most of these QTP questions have been asked in below IT companies for QTP interview.

    You can follow below links to read most important QTP interview questions/Tutorial.

    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial
        Accenture
        Amazon.com
        Cognizant Technology Solutions
        Computer Sciences Corporation(CSC)
        Google
        Groupon
        Hexaware
        iGate
        Larsen & Toubro Infotech
        Logica
        Mahindra Satyam
        MindTree
        PayPal
        Sasken
        Tata Consultancy Services
        Tech Mahindra
        ThoughtWorks
        Wipro
        MphasiS
        Zynga
        Mahindra Satyam
        Mindfire Solutions
        Mindtree
        MphasiS
        NIIT
        Tata Consultancy Services
        Tech Mahindra
        Capgemini
        eBay
        Hexaware
        Cybage
        Deloitte Consulting
        Hexaware Technologies
        Mahindra Satyam
        Mastek
        Microsoft Corporation
        MindTree
        MphasiS
        Ness Technologies
        Patni Computer Systems
        Fiserv
        GlobalLogic
        Amdocs
        ADP
        Avaya
        Barclays Capital
        Zensar Technologies


    You can follow this link to read QTP questions .

    http://qtp-interview-questions.blogspot.in/ 

    RepositoriesCollection Object in QTP



     RepositoriesCollection Object is used to associate or disassociate shared object repositories to QTP at run time

    At the beginning of a run session, the RepositoriesCollection object contains the same set of object repository files as the Associated Repository Files tab of the Action Properties dialog box. The operations you perform on the RepositoriesCollection object affect only the run-time copy of the collection.

    You use the RepositoriesCollection object to associate or disassociate shared object repositories with an action during a run session.



    RepositoriesCollection Methods
       

    Add   - Add .tsr file to current action in test

    Find  - Find the index position of .tsr file in collection

    MoveToPos  - Change the position of  repository

    Remove   - Remove repository from current action in test

    RemoveAll  - Remove all repositories from current action in test


    RepositoriesCollection Properties
     
    Count   - Get the total number of .tsr files associated to current action in test

    Item   - gets the path of the tsr file located in the specified index position.

     We can add any number of .tsr files to current action in test at run time.

    Example -

    RepPath = "c:\Mercury\my.tsr"

    RepositoriesCollection.RemoveAll()

    RepositoriesCollection.Add(RepPath)

    Pos = RepositoriesCollection.Find(RepPath)

    RepositoriesCollection.Remove(Pos)

    RepositoriesCollection.Add(RepPath)    ' add tsr filr

    Window("Microso").WinObject("my").Click

    Pos = RepositoriesCollection.Find(RepPath)




    You may also like -
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial
    4. QTP (UFT) Master Page
    Dear friend -  What do you think about this topic? Please express your thoughts via comment box.

    Difference Between QTP 10 and 11

    In QTP 11 new features have been added. Below is the list of new features added in QTP11

    1. Identify objects Using CSS and Xpath

    2. Results viewer with pie charts, statics for both current and previous test runs, summary page.

    3. Normal object identification method has been updated with “Visual Relation Identifier” in addition to “ordinal identifier” features in which object identification which will depend on relation to neighboring objects and will be helpful to overcome weakness of ordinal identification feature only in QTP10.

    4. “LoadFunctionLibrary” - load function library at any step of runs instead of starting of run.

    5. Regular expression creation will be very easy

    6. Web 2.0 toolkit applications support.

    7. Support for recording using Firefox

    8. New Sliverlight Add-in is supported to test objects in sliverlight 2

    9. Regular Expression evaluator

    In QTP 10 you will not find these features . This is the difference between QTP 10 and 11. In 2012, HP announced the new version of QTP and named it as UFT. UFT stands for unified functional testing.

    You may also like - 
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial
    4. QTP (UFT) concepts on Master Page.
    Dear friend - what do you think on above topic? Please express your opinion.

    Reporter Object in QTP


    Reporter Object is used to report test case status in QTP.
    Reporter object is used for sending information to the test results.

    Reporter Methods
       

    ReportEvent

    Reporter Properties
       

    Filter

     ReportPath

    RunStatus

    Syntax -



    Reporter.ReportEvent EventStatus, ReportStepName, Details [, ImageFilePath]

    EventStatus  Number or pre-defined constant  Status of the Test Results step:

    0 or micPass:

    1 or micFail:

    2 or micDone:

    3 or micWarning:

    Properties of Reporter object in QTP



     Reporter.Filter

    CurrentMode = Reporter.Filter       and       Reporter.Filter  = NewMode

    0 or rfEnableAll  Default. All reported events are displayed in the Test Results.

    1 or rfEnableErrorsAndWarnings  Only event with a warning or fail status are displayed in the Test Results.

    2 or rfEnableErrorsOnly  Only events with a fail status are displayed in the Test Results.

    3 or rfDisableAll  No events are displayed in the Test Results. 

    Reporter. ReportPath

    The following example uses the ReportPath property to retrieve the folder in which the results are stored and displays the folder in a message box.

    dim Path

    Path = Reporter.ReportPath  ‘ path where results are stored

    Reporter. RunStatus

    The following example uses the RunStatus property to retrieve the status of the run session at a specific point and exit the action if the test status is fail. If the test status is not fail, the test run continues.

    Reporter.RunStatus = micFail Then ExitAction

    Mercury Timer Object in QTP


    Mercury Timer object is a  internal timer object that measures the amount of time in milliseconds.

    Mercury Timer Methods

        Continue Method  - Continue counting
        Reset Method - Reset timer
        Start Method - Starts Timer
        Stop Method - Stops Timer

    Mercury Timer Property

        ElapsedTime Property


    Example - 


    MercuryTimers("Timer1").Start
    Wait 2
    MercuryTimers("Timer1").Stop 
    print  MercuryTimers("Timer1").ElapsedTime 

    Thus we can find the elapsed time in milliseconds using mercury timer object.


    DTSheet Object In QTP

    DTSheet is a sheet in the run-time Data Table in QTP. You can get reference to this object by using below statements.

    DataTable.AddSheet
    DataTable.GetSheet
    DataTable.GlobalSheet
    DataTable.LocalSheet

    DTSheet supports below methods :-

    AddParameter Method - Add new column to current sheet
    DeleteParameter Method - delete an existing column from the active sheet
    GetCurrentRow Method - get row number of active row from current sheet
    GetParameter Method - gets the name of column given it's index
    GetParameterCount Method - gets total number of columns in current sheet in datatable
    GetRowCount Method - gets total number of rows from sheet
    SetCurrentRow Method - Activate given row
    SetNextRow Method - Move to next row
    SetPrevRow Method - Move to previous row

    Associated Properties

    Name Property - get the name of current sheet.



    Dotnetfactory.createinstance in QTP

    In QTP, you can use dotnetfactory object to access .net objects. You must have .net framework installed in your system before you use createinstance method.

    It enables you to create an instance of a .NET object, and access its methods and properties.
    Description
    Createinstance method returns a COM interface for a .NET object.

    Syntax
    Set myobj = DotNetFactory.CreateInstance (TypeName [,Assembly] [,args])

    Here 
    Typename - any type name that .net framework provides example - System.Environment

    Example
    The following example uses the CreateInstance method to create a object of a system environment type

    Set obj = Dotnetfactory.CreateInstance("System.Environment")
    print obj.MachineName


    Set obj = Dotnetfactory.CreateInstance("System.Math")
    print cstr(obj.Abs(-12))      
        




    QTP Interview Questions asked in Oracle

    In Oracle there are many openings for QTP professionals.

    If you have 2/3/4 years of QTP experience , You can refer questions on this blog for QTP interview preparation in Oracle.

    In this blog you will find all top QTP interview questions and Their answers for Oracle Interview.
    In This blog we have tried to answer all qtp Interview Questions asked in Oracle interview.

    If you are a experienced guy looking for a QTP job and want to join Oracle as QTP automation tester, You must know all top qtp questions and answers listed on this blog.

    On left hand side of this page, you will find the list of top QTP interview questions asked in Oracle company to QTP Automation Testers.

    To know the answer to these questions you must click on those questions.

    Please go through all QTP Interview Questions before you face Oracle QTP interview. This will really help you in cracking the Oracle interview and getting a lucrative job as a QTP automation Tester in Oracle.


    If you have any doubt about any answer, You can get back to me at any point of time.

    I wish you get your dream QTP job in Oracle soon!!!!!!!

    Some sample QTP questions asked in Oracle are given below .


    1. If you wish to enter 1234567 in datatable then write it as '1234567
    2. Find the palindrome for string - if str1 = strreverse (str1) then -> Palindrome
    3. How to capture screenshot - obj.capturebitmap "s:\sd.png",true
    4. Difference between QFL and VBS files – Vbs is executable file. QFL is very specific to QTP and we need to necessarily associate it to Test unlike vbs file which can be included using executefile statement
    5. Difference between Eval and Execute and Executeglobal. Eval will compare while execute will assign value. Executeglobal is used to execute the execute the expression in global scope. These keywords are used to create/include the code at runtime. http://blogs.msdn.com/b/ericlippert/archive/2003/09/20/53058.aspx

    QTP Interview Questions asked in HCL

    In HCL there are many openings for QTP professionals.

    If you have 2/3/4 years of QTP experience , You can refer questions on this blog for QTP interview preparation in HCL.

    In this blog you will find all top QTP interview questions and Their answers for HCL Interview.

    In This blog we have tried to answer all qtp Interview Questions asked in HCL interview.

    If you are a experienced  guy looking for a  QTP job and want to join HCL as QTP automation tester, You must know all top qtp questions and answers listed on this blog.

    On left hand side of this page, you will find the list of top QTP interview questions asked in HCL company to QTP Automation Testers.

    To know the answer to these questions you must click on those questions.

    Please go through all QTP Interview Questions before you face HCL QTP interview. This will really help you in cracking the HCL interview and getting a lucrative job as a QTP automation Tester in HCL.

    If you have any doubt about any answer, You can get back to me at any point of time.

    I wish you get your dream QTP job in HCL soon!!!!!!!



    You may also like -
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial


    Some QTP interview Questions asked in HCL are given below.

    1.      Difference between Executefile and loadfunctionlibrary. With executefile, we can’t debug the statements. With loadfunctionlibrary, we can load multiple library files separated by comma and we can debug as well. If you want to debug, you can associate files with action.
    2.      Difference between execute and executefile – Same only difference is execute accepts string as argument while executefile uses file as argument.
    3.      Difference between invokeapplication and systemutil.run is that invokeapplication is used to launch only .exe application.
    4.      MercuryTimers
    a.      retTime = MercuryTimers.Timer(TimerName).ElapsedTime ……..Returns the total accumulated time in milliseconds since the timer started. The ElapsedTime property is the default property for the MercuryTimer object.
    b.      MercuryTimers("Timer1").Start 'Start measuring time using Timer1.                    Wait 1   MercuryTimers("Timer1").Stop 'After one second, stop Timer1.  'Two seconds later, restart Timer1 (which will continue to measure time from 'the time it stopped). Wait 2 MercuryTimers("Timer1").Continue
    What is registeruserfunc? You can use the RegisterUserFunc statement to instruct QuickTest to use your user-defined function as a method of a specified test object class for the duration of a test run, or until you unregister the method.

    You may also like -
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial
    Please provide your inputs / feedback via comment box below.

    QTP Interview Questions asked in Wipro

    In Wipro there are many openings for QTP professionals.

    If you have 2/3/4 years of QTP experience , You can refer questions on this blog for QTP interview preparation in Wipro.

    In this blog you will find all top QTP interview questions and Their answers for Wipro Interview.

    In This blog we have tried to answer all qtp Interview Questions asked in Wipro interview.

    If you are a experienced  guy looking for a  QTP job and want to join Wipro as QTP automation tester, You must know all top qtp questions and answers listed on this blog.

    On left hand side of this page, you will find the list of top QTP interview questions asked in Wipro company to QTP Automation Testers.

    To know the answer to these questions you must click on those questions.

    Please go through all QTP Interview Questions before you face Wipro QTP interview. This will really help you in cracking the Wipro interview and getting a lucrative job as a QTP automation Tester in Wipro.

    If you have any doubt about any answer, You can get back to me at any point of time.

    I wish you get your dream QTP job in Wipro soon!!!!!!!

    Here is the sample list of qtp interview questions  asked in Wipro.
    1. Explain keyword driven automation framework in QTP?
    2. How to load shared Object repository at runtime in QTP Test?
    3. Explain why and when we need recovery scenarios with examples.
    4. How to read an excel file in QTP?
    5. What is html DOM and how can we use it in QTP?
    6. How to append data to text file in QTP?
    7. How to find data type of variable?
    8. What is difference between early binding and late binding?
    9. How to return a value from sub?
    10. How to change the date format (mm-dd-yyyy) in QTP?
    More QTP questions asked in Wipro.

    1. How can we launch multiple instances of a web application?
    Set IE1=CreateObject("InternetExplorer.Application")
    IE1.Visible=True
    IE1.Navigate "http:\\Yahoomail.com"
    Set IE2=CreateObject("InternetExplorer.Application")
    IE2.Visible=True
    IE2.Navigate "http:\\Rediffmail.com"

    2. e_pwd = Crypt.Encrypt(pwd)
    Browser("dfgd").Dialog("pass").WinEdit("pwd").SetSecure e_pwd

    3. sheetcount = DataTable.GetSheetCount
    4. DataTable.Import ("C:\flights.xls")
    5. DataTable.ImportSheet "C:\name.xls" ,1 ,"name"

    QTP Interview Questions asked in Infosys

    In infosys there are many openings for QTP professionals.

    If you have 2/3/4 years of QTP experience , You can refer questions on this blog for QTP interview preparation in infosys.

    In this blog you will find all top QTP interview questions and Their answers for infosys Interview.

    In This blog we have tried to answer all qtp Interview Questions asked in infosys interview.

    If you are a experienced  guy looking for a  QTP job and want to join infosys as QTP automation tester, You must know all top qtp questions and answers listed on this blog.

    On left hand side of this page, you will find the list of top QTP interview questions asked in infosys company to QTP Automation Testers.

    To know the answer to these questions you must click on those questions.

    Please go through all QTP Interview Questions before you face infosys QTP interview. This will really help you in cracking the infosys interview and getting a lucrative job as a QTP automation Tester in infosys.

    If you have any doubt about any answer, You can get back to me at any point of time.

    I wish you get your dream QTP job in infosys soon!!!!!!!

    Description Object in QTP


    Description object is Used to create a Properties collection object in QTP.

    Description object has one method  - Create 

    It returns a properties collection object in which you can add a set of properties and values in order to specify the description of an object.We can add any number of properties to define the description object in QTP
    Syntax
    set Myobject = Description.Create
    Example
    Below example uses the Create method to return a Properties collection object named Myobject  

    set Myobject = Description.Create()
    Myobject ("Name").Value = "userName"
    Myobject ("Index").Value = "1"
    Browser("Myb").Page("myp").WebEdit(Myobject ).Set "sagar"

    Another Example - 
    In below example we are finding the all links from the page whose innertext property is in digits.
    Please note that value of the property is considered as regular expression by default . But if you don't want to  treat the value as regular expression, Then set it to False like this 

     '  objLinkDash("innertext").RegularExpression =False

            Set objLinkDash = Description.Create
            objLinkDash("micclass").Value = "Link"
            objLinkDash("innertext").Value = "\d*"
            objLinkDash("innertext").RegularExpression = True
           ' By Default it is considered as regular expression

             cnt = constobjParent.childobjects(objLinkDash).count
             Set childs =  constobjParent.childobjects(objLinkDash)

    Description object is used to create objects whose properties are changing at run time. 

    Datatable object in QTP

    Datatable is nothing but run-time Data Table in QTP. Datatable is used to store test data in QTP.
    In QTP Every test has one datatable in it. In Datatable there is one global sheet and one local sheet for each action in Test.

    Please note that changes made in run time datatable will last until you execution is going on. To save the run time data table you must use export method.

    Methods of Run time datatable in QTP :-

    1. AddSheet Method - Used to add new sheet to datatable
    2. DeleteSheet Method - Used to Delete existing sheet from datatable in QTP
    3. Export Method - Used to export all sheets from datatable to new excel workbook in QTP
    4. ExportSheet Method - Used to export existing sheet from datatable to new excel sheet in QTP
    5. GetCurrentRow Method - Gets the row number of current active row from datatable
    6. GetRowCount Method - gets the total number of rows from current active sheet from datatable
    7. GetSheet Method - Gets the reference to existing sheet in datatable.
    8. GetSheetCount Method - Gets the count of total number of sheets from datatable in QTP
    9. Import Method - loads the all sheets from external workbook to runtime datatable in QTP
    10. ImportSheet Method - loads the particular sheet from external workbook to runtime datatable in QTP
    11. SetCurrentRow Method - Sets the particular row active in current active sheet.
    12. SetNextRow Method - Used to move to next row in current active sheet in datatble in QTP
    13. SetPrevRow Method - Used to move to previous row in current active sheet in datatble in QTP

    Properties of Run time datatable in QTP :-

    1. GlobalSheet Property - Gets the reference of global sheet in datatable in QTP
    2. LocalSheet Property - Gets the reference of particular local sheet from datatable in QTP
    3. RawValue Property - The raw value is the actual string written in a cell before the cell has been computed, such as the actual text from a formula. 
    4. Value Property - Gets the value from cell - given sheet and active row and column name or index

    Crypt Object in QTP

    Crypt Object in QTP is used to Encrypt a strings.

    Syntax

    Crypt.Encrypt("abcd")


    Example

    In below example, value in pwd variable is encrypted using the Crypt.Encrypt method.
    Then this encrypted value is entered into editbox.

    pwd = "myvalue"
    pwd = Crypt.Encrypt(pwd)
    Browser("myb").WinEdit("pwd").SetSecure pwd

    Please note that to enter secure value you must use Setsecure method Else you can use Set method.

    Thus
    Crypt Object in QTP is used to Encrypt a strings.

    Types of License in QTP

    In QTP there are mainly 2 types of licenses.

    • Seat License
    • Concurrent License
    Seat license is installed for a single machine That means you can't use seat license on any other machine.
    This is used if there is only one person working on QTP and scope of the project is also small.

    Concurrent License is installed on the license server and multiple machine can access that license.
    This is used in large automation project where multiple people are working on the project.

    How to check which license your QTP is using ?

    Well - If you want to know what type of license your QTP is using you can see that very easily.

    Just go to help menu and select "about quick test professional" last sub menu. One window will appear with 2 buttons with names licenses and close. Click on licenses button and you will get to see license summary window.

    If you have a concurrent license installed then you will also get to see server name where this license is available. If it is seat license, then you will see category as permanent or demo.

    Sunday, 24 March 2013

    Types of Automation Frameworks in QTP

    Automation framework is designed to ease the process of test automation using QTP. Automation framework helps from scalability point of view. It is very easy to automate the test cases using automation framework rather than ad hoc approach.

    There are mainly 3 types of Automation Frameworks in QTP
    1. Record and Play Back
    2. Data Driven Framework
    3. Keyword Driven Framework
    4. Hybrid Framework

    Record and play back Framework  :
    In this Framework , User records the test steps in the application. This is very basic framework. Modular approach is not followed. Maintenance of the test scripts is time consuming and difficult.

    DATA Driven Framework :
    In data driven framework, importance is given to test data than multiple functionality of application. We design data driven framework to work with applications where we want to test same flow with different test data. Test data is usually stored in the excel sheet. Test steps are stored in QTP script library.

    Keyword Driven Framework  :
    In Keyword Driven Framework , Importance is given to functions than Test Data. when we have to test multiple functionality we can go for keyword frameworks. Each keyword is mapped to function in QTP library and application. Test data and test steps are stored in the excel file.

    Hybrid Framework -
    This is the combination of keyword and data driven frameworks.

    After analyzing the  application, you can decide what kind of framework best suits your needs and then you can design automation framework in QTP.

     You may also like below topics on the QTP frameworks.

    1. Keyword driven framework in QTP with example.
    2. How to calculate the ROI in QTP frameworks.

    QTP Interview Questions asked in CTS

    In CTS there are many openings for QTP professionals.

    If you have 2/3/4 years of QTP experience , You can refer questions on this blog for QTP interview preparation in CTS.

    In this blog you will find all top QTP interview questions and Their answers for CTS Interview.

    In This blog we have tried to answer all qtp Interview Questions asked in CTS interview.


    If you are a experienced  guy looking for a  QTP job and want to join CTS as QTP automation tester, You must know all top qtp questions and answers listed on this blog.


    On left hand side of this page, you will find the list of top QTP interview questions asked in CTS company to QTP Automation Testers.

    To know the answer to these questions you must click on those questions.

    Please go through all QTP Interview Questions before you face CTS QTP interview. This will really help you in cracking the CTS interview and getting a lucrative job as a QTP automation Tester in CTS.

    If you have any doubt about any answer, You can get back to me at any point of time.

    I wish you get your dream QTP job in CTS soon!!!!!!!





    Please find below Some QTP Interview Questions from CTS


    1. The following example uses the SetNextRow method to change the active row to the next row in the run-time Data Table. DataTable.SetNextRow


    2. Browser("Welcome:= Mercury").Page("Welcome:= Mercury").WebEdit(EditDesc).Set "MyName"


    3. DotNetFactory (System.Environment, System.DateTime, System.Collection)


    var_my= DotNetFactory.CreateInstance("System.Environment")
    msgbox var_my.CurrentDirectory
    Dim SystemDate , oDate
    Set SystemDate = Dotnetfactory.CreateInstance("System.DateTime")
    Set oDate = SystemDate.Parse("Fri, 9 Oct 2009")
    FormattedDate = oDate.Day & "/" & oDate.Month & "/" & oDate.Year
    msgbox FormattedDate

    The .NET SortedList class provides a hash table with automatically sorted key/value pairs.
    The following code creates a SortedList and populates it with some key/value pairs:Set objSortedList = Dotnetfactory.CreateInstance ( "System.Collections.Sortedlist" )


    4. How to create environment variable - Environment.Value("MyVariable")=10


    5. How to access Environment Variable - MyValue=Environment.Value("MyVariable")

    On left hand side of this page, you will find many such questions on QTP. Please read them all.

    You may also like -
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial
    Dear friend -  What do you think about this topic? Please express your thoughts via comment box.
    Please provide your inputs below.


    QTP Interview Questions asked in IBM.

    In IBM there are many openings for QTP professionals.

    If you have 2/3/4 years of QTP experience , You can refer questions on this blog for QTP interview preparation in IBM.

    In this blog you will find all top QTP interview questions and Their answers for IBM Interview.

    In This blog we have tried to answer all qtp Interview Questions asked in IBM interview.


    If you are a experienced  guy looking for a  QTP job and want to join IBM as QTP automation tester, You must know all top qtp questions and answers listed on this blog.


    On left hand side of this page, you will find the list of top QTP interview questions asked in IBM company to QTP Automation Testers.

    To know the answer to these questions you must click on those questions.

    Please go through all QTP Interview Questions before you face IBM QTP interview. This will really help you in cracking the IBM interview and getting a lucrative job as a QTP automation Tester in IBM.

    If you have any doubt about any answer, You can get back to me at any point of time.

    I wish you get your dream QTP job in IBM soon!!!!!!!

    Some QTP Interview Questions in IBM are given below.

    1. Extern.Declare micHwnd, "FindWindow", "user32.dll", "FindWindowA", micString, micString … Enables you to declare calls to external procedures from an external dynamic-link library (DLL).

    2. x=RandomNumber (0,100)

    3. ExitTest - Exits the entire QuickTest test or Quality Center business process test, regardless of the run-time iteration settings. The pass or fail status of the test remains as it was in the step prior to the ExitTest statement.

    4. SystemUtil.Run

    SystemUtil.Run ( FileName, Parameters, Path, Operation )

    FileName - The name of the file you want to run.

    Parameters – For executable file, use the Parameters argument to specify any parameters to be passed to the application.

    Path - The default directory of the application or file.

    Operation - The action to be performed. If this argument is blank (""), the open operation is performed.The following operations can be specified for the operation argument of the SystemUtil.Run method: Open – Opens files edit - Launches an editor and opens the document for editing. explore - Explores the folder specified by the FileName argument. find - Initiates a search starting from the specified folder path. print - Prints the document file specified by the FileName argument. SystemUtil.Run "D:\My Music\Breathe.mp3","","D:\My Music\Details","open"


    5. InvokeApplication "C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.yahoo.com"


    You may also like -
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial
    Dear friend -  What do you think about this topic? Please express your thoughts via comment box.

    QTP interview Questions asked in Capgemini

    In Capgemini there are many openings for QTP professionals.

    If you have 2/3/4 years of QTP experience , You can refer questions on this blog for QTP interview preparation in Capgemini.

    In this blog you will find all top QTP interview questions and Their answers for Capgemini Interview.

    In This blog we have tried to answer all qtp Interview Questions asked in Capgemini interview.


    If you are a experienced  guy looking for a  QTP job and want to join Capgemini as QTP automation tester, You must know all top qtp questions and answers listed on this blog.


    On left hand side of this page, you will find the list of top QTP interview questions asked in Capgemini company to QTP Automation Testers.


    http://qtp-interview-questions.blogspot.in/2013_03_01_archive.html

    To know the answer to these questions you must click on those questions.

    Please go through all QTP Interview Questions before you face Capgemini QTP interview. This will really help you in cracking the Capgemini interview and getting a lucrative job as a QTP automation Tester in Capgemini.

    If you have any doubt about any answer, You can get back to me at any point of time.

    I wish you get your dream QTP job in Capgemini soon!!!!!!!


    You may also like -
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial
    Dear friend -  What do you think about this topic? Please express your thoughts via comment box.

    QTP interview Questions asked in Polaris

    In polaris there are many openings for QTP professionals. 
    If you have 2/3/4 years of QTP experience , You can refer questions on this blog for QTP interview preparation in Polaris.


    In this blog you will find all top QTP interview questions and Their answers for Polaris Interview. 


    In This blog we have tried to answer all qtp Interview Questions asked in Polaris interview.

    If you are a
    experienced  guy looking for a  QTP job and want to join Polaris as QTP automation tester, You must know all top qtp questions and answers listed on this blog.


    You may also like -
    1. QTP Questions and Answers for Experienced guys
    2. Advanced QTP Questions and answers
    3. Advanced QTP Tutorial


    On left hand side of this page, you will find the list of top QTP interview questions asked in
    Polaris company to QTP Automation Testers.
    To know the answer to these questions you must click on those questions.
    Please go through all QTP Interview Questions before you face Polaris QTP interview. This will really help you in cracking the Polaris interview and getting a lucrative job as a QTP automation Tester in Polaris.
    If you have any doubt about any answer, You can get back to me at any point of time.
    I wish you get your dream QTP job in Polaris soon!!!!!!!

    Best QTP Books

    Everything About QTP

    Hello Friends,
    You can find QTP study material, Multiple choice questions (mcq), QTP question bank, QTP question papers, QTP notes, QTP questionnaire, scenario based QTP interview questions, QTP tutorial and QTP training on this site.

    If you are a fresher or experienced QTP professional with (1/2/3/4) years of experience, this blog is just for you.