Monday, 2 June 2014

Sample QTP Interview Question

QTP Question asked in the interview:

1. What mean by object repository ?
2.  What is the difference between Local and share object repository ?
3. What are the column present in the keyword view of QTP? 
4. Write the code for to create the excel object, add new sheet and save with the time stamp.
Ans:
Dim AppExcel
ss="C:\test" & Year(Now) & "_" & Month(Now) & "_" & Day(Now) & "_" & Hour(Now) & "_" & Minute(Now) & "_" & Second(Now) & ".xlsx"

Set AppExcel=createobject("Excel.Application")
  AppExcel.Application.Visible = True
  AppExcel.Workbooks.Add
  AppExcel.Cells(2,1).Value="Test Marks"

  AppExcel.Cells(2,2).Select

'Apply the font to Cell
  AppExcel.Range("B2").Font.Bold=True
  AppExcel.Range("B2").Font.Italic=True
  AppExcel.Range("B2").font.Underline=True

 'Apply the border to the cell
  AppExcel.Range("B2").Borders.linestyle=xlContinuous

  'Apply the border to the Cell with Color
  AppExcel.Range("B2").Borders.Color=vbRed
  AppExcel.Range("D2").Borders.Color=vbGreen

 'Fill the Cell with the Color
  AppExcel.Range("G2").Interior.ColorIndex=1

  'Toget the Color Index
   AppExcel.Range("H2").Value=AppExcel.Range("G2").Interior.colorIndex

   AppExcel.ActiveWorkbook.Saveas ss
   AppExcel.quit
   Set AppExcel=Nothing


5. What are the different types of framework in QTP?
6. Explain the different frameworks with the advantages and disadvantages.
7. Why framework is required and what are the parameters you consider for selecting the framework?
8. Explain Major difference between Modular and Keyword driven framework.
9. How object repository is used to find the object?
10. What is the object model in QTP?
11. What are the types of environment variable and how to use them?
12. How to import the Excel sheet into data table.
13. QTP Regular exp:

Below are the various regular expressions used in QTP.

Matching Any Single Character (.)  eg abc. Will match abc followed by any character.
Matching Any Single Character in a List ( [xy] ) e.g [ab] will match either a or b
Matching Any Single Character Not in a List ( [^xy] ) e.g 1[^23] will match all values between 11 to 19 except 12 and 13.
Matching Any Single Character within a Range ( [x-y] ) e.g : 1[1-3] will match 11,12, and 13.
Matching Any AlphaNumeric Character Including the Underscore ( \w )
Matching Any Non-AlphaNumeric Character (\W) will match any special character other than underscore. Please note case of W in this case.
Matching Zero or More Specific Characters ( * ) This matches zero or more occurrences of the preceding character. e.g ca* will match caa,caaaa,c and so on. Similarly c.* will match c, cs,caaa, and so on, since preceding character here is “.”.
Matching One or More Specific Characters ( + ) Only difference from * is it will match for minimum one character. e.g ta+r will match taar,tar but not tr as in above case.
Matching Zero or One Specific Character ( ? ) A question mark (?) instructs QTP to match zero or one occurrences of the preceding character. For example: te?r matches ter and tr, but nothing else
Matching One of Several Regular Expressions ( | )  e.g new|day will match either of new or day. If we write ne(w|d)ay, it will match neway or neday.
Matching the Beginning of a Line ( ^ ) This will match only if match is found at beginning of line.
Matching the End of a Line ( $ )  This will match only if match is found at end of line.
Matching a word at boundary(\b) e.g new\b will match testnew but not in knewit.
Matches a digit character(\d)  Matches a digit value.

Matching a non-digit character(\D) Matches a non digit value


Common Question asked in the interview:

1. What mean by Statement coverage and solve the given example.
2. What are the parameters considered during Test estimation?
3. What mean by load testing, Volume Testing, Stress testing?
4. What mean by configuration management?
5. What mean by verification and validation?


Verification
Validation
 (not the actual final product) In development phase to determine whether they meet the specified requirements for that phase.
At the end of the development process to determine whether it satisfies specified business requirements.
Ensure that work products meet their specified requirements.
The product fulfills its intended use when placed in its intended environment.
Building the product right?
Building the right product?
Plans, Requirement Specs, Design Specs, Code, Test Cases
The actual product/software.
Review, Walkthroughs, Inspections, Execution is not required
Testing, Execution is required
6. Explain the SDLC and STLC cycle.
7. What are the parameters that we consider while doing Load testing?
8. Explain Equivalence and boundary value testing with example.
9. What mean by User Acceptance testing and what it involve?
10. Explain test plan and what it involve?
11. What are the advantages of Agile Methodology? 

6 comments:

  1. 11) Does Low level recording capture mouse movements?
    No. Mouse movements are not captured.
    12) How does QTP identify an object?
    QTP has a predetermined set of properties that it learns/stores for every class of object it identifies. There are 3 aspects to this:
    • Mandatory properties: This is the list of properties for a certain class that QTP always stores. We could say that this is the object description. It also checks this in conjunction with the parent object to see if the description is sufficient to identify the object uniquely.
    • Assistive properties: In case the description of mandatory properties is insufficient to identify the Object a set of non-mandatory properties will be added to the description one after the other until there is enough data to identify the object.
    • Ordinal Identifier: If the assistive properties also do not result in unique identification of an object a special ordinal identifier is added by QTP, such as the object’s location on the page or in the source code.
    13) What is Smart identification?
    If the recorded description does not enable QTP to identify a specific object then QTP uses “Smart identification” mechanism. It uses the following additional properties to identify the object
    a) Base Filter Properties (primary) – The set of properties that cannot be changed without changing the object type
    b) Optional Filter Properties (secondary) – additional properties that help identify the object uniquely.
    14) What is Object Spy?
    Object Spy is an extremely helpful tool that QTP has to view the properties and operations of an object in the AUT. It shows all the properties of the object and the corresponding values. It also shows the object hierarchy. It also has a provision that lets the users add a certain object to the OR.
    15) What is an object repository?
    OR is like a warehouse where all the objects in a test are stored. OR has the list of Objects that QTP learned during the record process and the class to which they belong. It stores the set of properties that uniquely identifies the Object (description) and also names the object for the sake of identification in our test, based on its most prominent feature.
    16) What are the two types of repositories available, explain them?
    Local and shared repository – these are the two kinds of available repositories.
    Every action by default has a local repository of its own and has all the objects that are used within it.
    Alternately, the tester can have a common repository for multiple actions so that all of them can share the objects that it contains. The common repository is called a shared OR.
    17) An action has both shared and local OR associated to it and both have the same object in them. In the test which one will be considered?
    If a local OR and Shared OR have an object with the same name, the action will consider the object in its local OR.
    18) Can an action have 2 shared object repositories associated with them? In that case, if two of them contain the same object, which one will be considered?
    There can be more than one Shared OR’s associated to the same action. If Shared OR1 and Shared OR2 have one object named OBJ1 each and if the action calls for OBJ1 then the order in which the shared ORs were associated will be considered. That means, if Shared OR1 was first associated then the OBJ1 from Shared OR1 will be taken into account.
    19) Can the user toggle between using Local OR and shared OR for the same action?
    Yes, it is possible to switch between one or the other types of ORs at any time. To do so, the menu option is Test->Settings->Resources and choosing the options accordingly.
    20) Are Shared ORs read only?
    By default, shared ORs open as read only. To open them in order to edit them you will have to open them from Object Repository Manager.
    “ORM->File->Enable Editing”

    ReplyDelete
  2. 1) Different types of QTP test assets and their extensions:

    2) Technologies supported by QTP:
    Web, Java (Core and Advanced), .Net, WPF, SAP, Oracle, Siebel, PeopleSoft, Delphi, Power Builder, Stingray 1, Terminal Emulator, Flex, Web Services, Windows Mobile, VisualAge Smalltalk, Silverlight and mainframe terminal emulator
    3) Does QTP run in any environment?
    No, QTP works only in the windows environment.
    4) Explain the views in the QTP GUI?
    Keyword view: This view is a tabular representation of all the objects and the actions that are performed on them. Every row in the table is a step performed on the AUT and can be modified. Some of the most common columns displayed are: item, operation, value and documentation.
    Expert view: As the name indicates, this view is for more technical users who would want to tweak the source code as per their requirements.
    5) What is QTP’s model for test creation?
    a) Determine testing needs – Define testing environment, Analyse your application and plan actions
    b) Set up repositories – Local or Shared OR
    c) Define function libraries
    d) Generate test steps – Add steps, Add checkpoints
    e) Data drive your tests
    f) Run the tests
    6) What are the different kinds of test steps?
    5 types of steps:
    – Test Object ( Performs actions on a TO)
    – Functions
    – Utility (Steps to control run session. Eg: Reporter.report)
    – Comment
    – Programming logic (Loop, conditions…etc)
    7) What are the different ways to invoke an application using QTP?
    a) SystemUtil.Run
    SystemUtil.Run ( FileName, Parameters, Path, Operation )
    Example: SystemUtil.Run(“iexplorer.exe”,http://www.google.com)
    SystemUtil.Run(“test.txt”, “”,”C:\”,”1”)
    b) InvokeApplication
    Example: InvokeApplication “C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.google.com”
    c) Creating a shell object using VB Script
    Example: Create a “WScript.shell” object.
    Dim testshell
    Set testshell= CreateObject (“Wscript.shell”)
    testshell.run “%windir%\notepad “
    8) What are the different recording modes and how do they work?
    QTP provides 3 modes of recording:
    • Normal Recording mode – The default recording method is always the normal mode. This method uses the model of Test Objects and Runtime objects to learn and act on the AUT.
    • Analog recording mode – records the exact mouse and key strokes that the user performs in relation to either the screen or AUT window. The steps that are recorded using this method cannot be edited.
    The way this usually gets represented in a code is:
    Window/app.RunAnalog “Track1”
    One scenario in which this type of recording can be used is when we are trying
    to capture a signature.
    • Low Level recording mode – This mode records the co-ordinates in the application where the operation is performed, irrespective of whether QTP recognizes the specific Object or Operation.
    9) Which recording modes need more memory?
    Analog and Low-level recording modes
    10) Is it possible to switch between recording modes during a test creation?
    Yes, in the middle of recording, we can switch to Analog/Low-level mode, finish the task required and go back to normal recording. The switch to Analog mode is available only during recording and not during editing

    ReplyDelete
  3. 36. What is the extension of QTP local Repository? If it is .mtr then what is .bdb extension stands for?
    .bdb is the local OR. .mtr is a binary file that contains other information about checkpoints and all. To re-verify the .bdb is the OR, try to rename the file with the extension as .tsr and open it from ORM. The same objects in the OR will be displayed here. The same will not work if you try it on .mtr file.
    37. How do you capture tool tip using QTP?
    Tool Tip capture method varies depending on the type of object this tool tip appears for. It could be for links, images or any other web elements.
    For web elements use: Object.title property.
    For image: Image(“some name”).GetROProperty(“alt”)…..etc.

    38. How can you close the second opened browser?
    You can know which browser instance was opened after another can be known by using the “creation time” property. In simple terms, this is nothing but a counter for each browser instance that gets launched. For the first one, it is 0 and gets incremented from then on. To close the second opened browser, you can use the following code:
    Browser(“creationtime:=1″).Close
    39. How do know the number of browsers opened?
    To do this you will have to check how many child objects of the type ‘browser’ are present on the desktop. The following is the code that explains it:
    Set ObjectBrowser = Description.Create
    ObjectBrowser(“micclass”).Value = “Browser”
    Set BObj = Desktop.ChildObjects(ObjectBrowser)
    Msgbox Obj.Count
    40. What is synchronization point in QTP?
    It is a feature that QTP provides to make your test wait until a certain property on a certain object becomes an expected value before proceeding with the next steps.

    ReplyDelete
  4. 41. In website, protocol has been changed http: to https what you will do? Tell me your approach?
    Since the protocol change does not necessarily affect the UI change, except may be for a warning message about certificates, there are not many changes. All you need to do is provide the new URL and make sure you handle the security related pop-ups.

    42. Both Static and dynamic arrays are handled by VB script. Is it true?
    Yes. A static array is declared as Dim A(10). This means it’s an array of 11 items. If the tester needs to modify it to contain 20 items he can do so by using ‘redim’.
    redim A(19). There is a “Preserve” statement that can be used in conjunction with the redim statement. When preserve is used all the previous values are not erased.
    43. What are the factors on which script execution time is dependent?
    1. Network and computer speeds. The response time from the app, the database etc. This is true even if you are manually executing the test.
    2. It also depends on the wait statements you have included.
    3. Not loading the add-ins that your test does not use helps too.
    4. Descriptive programming steps take longer than regular ones to execute
    5. Capturing screenshots at run time through QTP also consumes time
    6. Disabling smart identification also speeds up the QTP script running time

    44. Explain process of smart Identification in QTP
    If the recorded description does not enable QTP to identify the specified object in a step, and a smart identification definition is defined (and enabled) for the object, QTP tries to identify the object using “Smart identification”.
    45. When to use shared and local object repository?
    The decision is completely up to you. Shared OR will make more sense when you have multiple scripts referring to the same objects.

    ReplyDelete
  5. 54. If the objects hierarchy is changing from build to build, then how you will handle that condition?
    In this case descriptive programming can be used instead of having an OR. Even while descriptive programming try to use regular expressions to identify the unique property of the objects.
    55. I have developed and executed a script successfully, and saved the same to QC. When I tried to execute the script from QC, the script is not executing. What are the possible reasons?”
    1) Firstly, QuickTest Add-In for Quality Center has to be installed.
    2) In the QTP Tools > Options >run tab you should have ‘Allow other Mercury products to run tests and components’ selected.
    3) Make sure you are running QTP as an Admin
    4) All the test resources have to be in the correct path

    ReplyDelete
  6. There are few question that also need to find proper answers. They are as below:

    56. 1.write a program How can you check the data in the web page content or web list box data are ascending or descending order.. ?
    57. . which one is the best descriptive programming or object repository ?
    58. . can you tell me most interesting thing about your project ?
    59. . tell me about your project manager’s good and bad things?
    60. write a function and in the argument pass one input and one output ?
    61. What is the memory size of QTP?
    21. how do we access a particula browser among the various browsers.
    22. How to close a paticular browser on the desktop.
    23. explain the genenic functions you have developed
    24. Explain your framework
    25. 1. If an Object is not able to identify by QTP then how you will handle it? (Extensibility, Virtual Object, SendKeys)
    26. Browser.Sync is giving false results? Do you agree with this? If yes, what is the work around
    27. QTP’s .Exist is returning False even though object is exist. What could be the reason?
    28. Is it possible to update Shared OR during Runtime? If yes, how?
    29. What is the difference between FireEvent and ReplayType 2?
    30. Index/Location/CreationTime and XPATH, which is efficient mechanism to identify an object?
    31. How to stop QTP Test Script execution during runtime?
    32. a=10
    b=10
    c=empty
    d=empty
    msgbox a=b=c=d
    expected output:false
    actual output:true
    can u explain this?

    33. inputstring=”aaaabbbbccc”
    output=a4b3c3
    kindly let me know who can do this script to get the above output
    34. x = “aaaabbbbccc”
    cta = 0
    ctb = 0
    ctc = 0
    ctd = 0
    For i = 1 To Len(x)
    y = Right(Left(x, i), 1)
    Select Case y
    Case “a”
    cta = cta + 1
    Case “b”
    ctb = ctb + 1
    Case “c”
    ctc = ctc + 1
    Case “d”
    ctd = ctd + 1
    End Select
    Next
    MsgBox “a” & cta & “b” & ctb & “c” & ctc & “d” & ctd
    OR
    nputstring=”aaaabbbbccc”
    For i = 1 to len(inputstring)
    Set RegEx =New RegExp
    Str = Left(inputstring,1)
    RegEx.Pattern = Left(inputstring,1)
    RegEx.IgnoreCase = True
    RegEx.Global = True
    If len(inputstring) = 0 Then
    Exit For
    End If
    Before = len(inputstring)
    inputstring= RegEx.Replace(inputstring,””)
    After = len(inputstring)
    StrDisplay = StrDisplay & Str & (Before-After)
    Next
    Print StrDisplay
    35. does qtp identify multiple browsers that are opened at same time.if yes how?

    ReplyDelete