QTP Interview Questions

Showing Questions 41 - 46 of 46 Questions
First | Prev | Next | Last Page
Sort by: 
 | 
Jump to Page:
  •  

    QTP Regular Expression

    What is the significance of regular expression in QTP?

    Star Read Best Answer

    Editorial / Best Answer

    priyankvyas  

    • Member Since Dec-2008 | May 6th, 2009


    Regular expression is always used to make our search globalize.

    To execute the test in QTP every object is searched in the object repository (OR). In real time applications some object's properties always keep changing, so at the time of execution script fails. To overcome it we use "regular expression" for that particular object's property. For example:

    1) Record a test where you are inserting one order and than faxing the same order.

    2) The order number that is generated during recording may 21 and "Fax Order window title" is generated and saved into OR as "Fax Order No. 21"

    3) Now execute the same test, the script will fail because this time order no is modified as 22 and accordingly "Fax Order window title" is modified as "Fax Order No. 22".

    4) This time the object "Fax Order No. 22" is not identified or you can understand object is not matched (find) into OR.

    5) To make this search better we modify the text property of object into OR as "Fax Order No.*" this will search all the occurrences of window that has text as "Fax Order No"

    6) We can also write it as "Fax Order No. [0-9]" because fax order no is a numerical value and this will search only numbers after "Fax Order No. "

    So this is the purpose of regular expression in QTP.

    aarati

    • Nov 9th, 2009

    Using RE we can make the QTP to recognize same object with its varying name.For example, a window having title as "Employee NO. 7"If I want to pass data to multiple Employee No. Windows, So I have to use RE as "Employee No..*" in Object Repository..

  •  

    Reusuable components in QTP

    How to create reusuable components in QTP?

    Star Read Best Answer

    Editorial / Best Answer

    md_vinodh  

    • Member Since Apr-2008 | Jun 10th, 2008


    Hi,

     If are you uasuing Test Script, please follow the below steps:
     
    1) Create the Test Script in Expert View
     2) Right click and select Action Properties
     3) Select the check box in 'Resuable Action'
     4)  Provide the  Action  name or  Script  Action name

     If u like to call the action in different location use the following steps:
     
     1) QTP have three function like ( Insert to New call, Insert to Copy and Insert to Existing )

     U can use any one function and call the ur action properties

    Let me know, if u have query

     
     

  •  

    How to write QTP results to a text file or an Excel file ?

    I need to write the QTP results to a text file or an Excel file as i don't want to see the results in QTP results window.Please Can anybody provide the exact code for itUrgent...............................Thanks in advanceUday

    Star Read Best Answer

    Editorial / Best Answer

    Answered by: srinivas Potnuru

    • Jun 6th, 2006


    Hi all,

    We actually have few functions to add the results to the Excel File instead in the QTP Results Window.

    Solution description: We will be using a seperate Sheet by name "Results" in which the Results of the Test will be appened.

    There are 2 functions

    1) initOutExcel(sTablePath)

             Description : This function is to initialize a particular Excel Where you want to update the Results of the QTP Tests.

    2) WriteResults(sTablePath,sStatus,sFunctionality,sDescription)

            Description : This function appends the Result of a  Test to the end of the existing results.

    You can modify the below functions to suite your requitrement.

    CODE:

    Function initOutExcel(sTablePath)

      Datatable.addSheet "Results"

      Datatable.importSheet sTablePath, "Results","Results"

      iParamCount = Datatable.getSheet("Results").getParameterCount

      if iParamCount = 0 Then

         Datatable.getSheet("Results").addParameter "S.No",""

        Datatable.getSheet("Results").addParameter "Status",""

        Datatable.getSheet("Results").addParameter "Functionality",""

        Datatable.getSheet("Results").addParameter "Description",""

      End If

       Datatable.ExportSheet sTablePath,"Results"

    End Function

    Function WriteResults(sTablePath,sStatus,sFunctionality,sDescription)

      Datatable.addSheet "Results"

      Datatable.importSheet sTablePath, "Results","Results"

      iRowCount = Datatable.getSheet("Results").getRowCount

      Datatable.getSheet("Results").setCurrentRow(iRowCount+1)

      Datatable("S.No","Results") = iRowCount+1

      Datatable("Status","Results") = sStatus

      Datatable("Description","Results") = sDescription

      Datatable("Functionality","Results") = sFunctionality

      Datatable.ExportSheet sTablePath,"Results"

    End Function

    hk

    • Feb 23rd, 2007

    Can somebocdy explain  how to  specify the parameters needed to call  these functions?

  •  

    Object name is changing while executing test in QTP

    when i am recording in QTP the object name of the text box is text1 and it is changing while i am executing. whenever i am opening the login window it is assigning new names If it is like this how can i test the application

    Star Read Best Answer

    Editorial / Best Answer

    b.sainarayanarao  

    • Member Since Oct-2007 | Oct 23rd, 2007


    go to Resources menu-Object Repository-select the particular text object in left window pane. In right window pane select attached text column field value, a browse icon ('<#>') becomes visible and  click on  it and  select  Regular  expression  checkbox (click on 'No' option in a appeared dialogbox) and  exactly in the place  of  1  write  as  [0-9]*  
    example: text 1           'before  replacement
                    text [0-9]*    'after replacement  is valid
                    text[0-9]*    'after replacement  is not valid because no space in between text and regular expression

    shreyas

    • Jun 27th, 2006

    Hi You can test the window by using regular expression.

  •  

    What is the method used to focus on particuler field.I need the script.I will give example.I flights application login page by default the focus is on username field. for this i will check the focus was there or not by using getroproprty method but if focue is not there which method i need to use.

    kallol raha

    • Jul 19th, 2006

    To explicitly set focus on a control use .object.focus

    sreepalgummalla

    • Jun 8th, 2006

    hi guyss.....What is the method used to focus on particuler fie...?getroproperty: retrives the pericula property.setroproperty: set the property to perticula object.... to focus to the perti...

  •  

    How To run Shared object repository files in QTP ?

    Star Read Best Answer

    Editorial / Best Answer

    dsharma  

    • Member Since Feb-2006 | Jul 3rd, 2006


    Click on Test->Settings

    Click on Resources Tab

    At the right-bottom change object repository type from per-action to shared.

    Once you have saved a test script with per-action type of object repository you cannot change it to shared.

    Deepak

    • Jul 11th, 2006

    I would like to know is there any function to be written to include 2 different Object repository. If yes can i have the script.

Showing Questions 41 - 46 of 46 Questions
First | Prev | Next | Last Page
Sort by: 
 | 
Jump to Page: