Monday, 13 August 2012

QTP overview

Recording Modes in QTP
There are 3 ways of recording a qtp script- 
1. Normal mode is the default mode of recording. It recognizes the objects regardless of their location or position in a window.
2. Analog mode records exact mouse movements and keyboard operations. The recorded steps in this mode are not editable. The script is recorded in the form of a track.
3. Low Level records all parent level objects as window test objects and all other as WinObject test objects. This recording mode is useful when objects are not recognized by recording in normal mode. This mode captures all the mouse clicks with respect to locations on the screen. 


Synchronization In QTP:-
There are 3 ways of synchronization in qtp-
1. Using Wait() command in the script.
2. Setting default time for each qtp statement in File->setting->web->browsernavigation time out.
3. Using WaitProperty() command, you can implement this property by clicking on object to be synchronized and then selecting “Insert->synchronization point” while recording the script.
Explanation: - wait() command will stop qtp from executing next statement for the time specified in the command. Navigation time out will wait for specified time limit if object does not appears in the application and waitproperty() will allow the next statement to execute only if the specified object appears or maximum time limit elapse.


Checkpoints in QTP
There are 9 types of checkpoints in qtp-
1. Standard Checkpoint compares the object values (attributes) captured during recording to the object values produced during a run session. 
2. Image Checkpoint allows the users to check the properties of an image in the application. An image checkpoint can be created by inserting standard checkpoints. Implemented using standard check point option.
3. Bitmap Checkpoint we can check particular area of an image or web page as a bit map. Where as in image check point we cannot do it.
4. Table Checkpoint we can compare the content of a table recorded with the content of the table produced during the application execution. Table checkpoint can be implemented using standard checkpoints.
5. Accessibility Checkpoint recognizes area of a webpage that may not conform to the World Wide Web consortium (w3c). E.g. checks if an image include ALT properties, required by w3c web content accessibility guide line.
6. Text Checkpoint checks that a text is displayed in the appropriate place in an application or web page.
7. Page Checkpoint checks features of a web page such as load time; whether a page contains broken links, number of images e.t.c. Implemented using standard check point option
8. Database Checkpoints checks the values stored in a database.
9. XML Checkpoints can checks the content of an XML data files or documents that are part of a web application. XML check point option is supported for all add in environments.

Reusable Check points e.g. create a reusable bitmap check point to verify logo on all the pages of a website. 
Steps to create a reusable checkpoint-
a) Record a checkpoint (only checkpoint statement) and open ->resources->object repository, in the OR window open File->Export and replace local objects, and save as .tsr file.
b) Record another script where you want to reuse this checkpoint, right click on action under resource from left pane of page and select ‘associate repository with the action’, browse the reusable repository created in first step. Now, existing checkpoint option will be enabled for your use in your Acton.
Note: To implement an existing checkpoint on an object the parent window of the object should be open (recording mode). (I am not sure about this please confirm)


QTP – Parameters and Variables
Input and output parameters can be stored and called using 4 ways as shown below-
1.Action Variables - Steps to store and retrieve values
a) Open a new test and add one more action, Insert->Call to New Action..
b) Open keyword view, right click on action1 and select “Properties window”.
c) Open parameter tab and add two input parameters a, b and one output parameter c , all variable of type Number. Click ‘Ok’ to save.
d) Open ‘Action1’ in expert view and paste the following statements –
a1= parameter("a")
a2= parameter("b")
parameter("c") = a1+a2

e) Open ‘Action2’ in expert view and paste the following statements and run ‘Action2’ only-
runaction "action1", oneiteration, 2,2,c
msgbox c

2.Data Table Parameters - allows us to create a data driven test that runs several times using the data values from the data table.
Steps-
a) Record a script e.g. login screen of flight reservation sample application.
b) Open ‘keyword view’ and click on ‘Value’ next to the ‘Agent Name field’. 
c) Click on <#> symbol, select parameter radio button and click ‘Ok’ button.
d) Open ‘view->Data table’, data table will be displayed with a column having value entered during the script recoding.
e) Add values in table for parameterized and run the script. It will iterate the script with each of the value entered in the table.

3.Environment Variable Parameters- are of two types built in and user defined. Built in variables contain information about your system such as OS name, version, action name, result dir e.t.c.
E.g. this statement will display the OS name and result dir name
a= environment(“OS”) & environment(“ResultDir”)
msgbox (a)
User defined Variables are of two types Internal and External.
User defined Internal variables are defined with in a test and are accessible only to the test in which they are defined. 
Steps-
a) Open File->settings->and click on “Environment” tab
b) Select “User defined” from “Variable Type” drop down.
c) Click on “+” and add a new variable with value e.g. variable c with value 10
We can access this variable anywhere in the script e.g. 
msgbox(environment(“c”)) will display the value stored in internal variable. Also we can edit .xml file to add new variables and values.
User defined External variables are generated as .xml files and can be accessed in all the scripts using import option.
Steps-
a) Open File->settings->and click on “Environment” tab
b) Select “User defined” from “Variable Type” drop down.
c) Click on “+” and add a new variable with value e.g. variable c with value 10
d) Click on export button and save it. 
e) Open a new test and go to File->settings->and click on “Environment” tab.
f) Check “Load variable and values from external file” check box and browse the file saved in step d.
We can access this variable anywhere in the script e.g. 
msgbox(environment(“c”)) will display the value stored in external variable. 


4.Random Number Parameter inserts any random number within the specified limit.
Steps-
a) Open a new test window in keyword view mode.
b) Right click on ‘Action1’ and select ‘Action properties’.
c) Enter an input parameter in action properties window of type Number and click ‘Ok’ e.g. variable name “a”
d) Now right click on ‘Action1’ from left pane and select ‘’Action call Properties’.
e) Click on ‘Parameter values ‘tab, click on ‘value’ next to the parameter.
f) A <#> symbol will appear, clicking on it will open value configuration option window.
g) Select ‘Parameter’ option button, open dropdown list box and select ‘Random Number’.
h) Define a range in the subsequent window and click ‘Ok’ to save it.
Note: - we can also use a table and environment variable.
msgbox(parameter("a")) run to view value assigned to the variable.

Another method of creating random variable is 
i= RandomNumber(0, 1000)
Msgbox(i)

Tuesday, 7 August 2012

Inteview questions


1.       Ad Hoc Testing
2.       Assertion Testing
3.       Black Box Testing
4.       White Box Testing
5.       Gray Box Testing
6.       Unit Testing
7.       Parallel/Audit Testing
8.       Functional Testing
9.       Boundary Value Analysis
10.    Equivalence Partitioning
11.    Usability Testing
12.    Incremental Integration Testing
13.    Integration Testing
14.    System Testing
15.    End-to-End Testing
16.    Regression Testing
17.    Sanity Testing
18.    Performance Testing
19.    Load Testing
20.    Installation Testing
21.    Security/Penetration Testing
22.    Recovery/Error Testing
23.    Compatibility Testing
24.    Comparison Testing
25.    Acceptance Testing
26.    Alpha Testing
27.    Beta Testing
28.    User Acceptance Testing

QTP questions part 2


                                                     QTP Test 2
51. How many tabs are there in Test Settings (File->Settings) window
A) 7
B) 6
C) 5
D) 8
52. Identify the tabs in the Test Settings (File->Settings) window
A) Properties, Run, Resources, Parameters, Environment, Web, Recovery
B) Properties, Run, Resources, Parameters, Environment, WebSettings,Recovery
C) Properties, Run Options, Resources, Parameters, Environment, Web,Recovery
D) Properties, Run, Resources, Input Parameters, Environment, Web, Recovery
53. ‘Generate Script’ is in which tab of Test Settings (File->Settings)window
A) Properties
B) Web
C) Resources
D) Recovery
54. The following are the four main columns in the Keyword view
A) Item, Operation, Value, Comments
B) Item, Operation, Value, Documentation
C) Item, Operation, Property, Documentation
D) Number, Operation, Value, Documentation
55. For each object and method in an Expert View statement, acorresponding row exists in the Keyword View.
A) True
B) False
C) There is a problem with the statement.
D) None of above
56. You can work on one or several function libraries at the same time.
A) True
B) False
57. You can insert additional steps on the test objects captured in the Active screen after the recording session. 
A) True
B) False
58. The Active Screen enables you to parameterize object values andinsert checkpoints
A) True
B) False
59. A QTP user can increase or decrease the active screen informationsaved with the test.
A) True
B) False
60. The Information pane provides a list of…………. in the test:
A) Semantic errors
B) Syntax errors
C) Common errors
D) Logic errors
61. When we switch from Expert view to the Keyword view, QTPautomatically checks for syntax errors in the test and shows them in theinformation pane.
A) True
B) False
62. If the information pane is not open, QTP automatically opens it incase a syntax error is detected.
A) True
B) False
63. ………………… provides a list of the resources that arespecified in your test but cannot be found.
A) Missing pane
B) Missing Resources pane
C) Resources pane
D) Missing Items pane
64. Whenever you open a test or a function library, QTP automaticallychecks for the availability of specified resources.
A) True
B) False
65. The Data Table does not assists you in parameterizing your test.
A) True
B) False
66. Tabs in the Debug Viewer pane are:
A) Watch, Variables, Debug
B) Watch, Data, Command
C) Watch, Variables, Command
D) View, Variables, Command
67. …………… tab enables you to view the current value of anyvariable or VBScriptexpression.
A) Watch
B) VIew
C) Locate
D) Current
68. The …. tab displays the current value of all variables that havebeen recognized up to the last step performed in the run session.
A) View
B)Variables
C) Locate
D) Current
69. The ………tab enables you to run a line of script to set ormodify the current value of a variable or VBScript object in your testor function library.
A) View
B) Variables
C) Command
D) Current
70. Panes in QTP can have one of the following states—docked or floating.
A) True
B) False
71. Which of the following statement is True:
A) QuickTest enables you to open and work on one test at a time
B) QuickTest enables you to open and work on two tests at a time
C) QuickTest enables you to open and work on predefined number of testsat a time
D) QuickTest enables you to open and work on nine test at a time
72. Which of the following statement is True:
A) You can open and work on two function libraries simultaneously
B) You can open and work on multiple function libraries simultaneously
C) You can open and work on nine function libraries simultaneously
D) You can open and work on one function library at a time
73. You can open any function library, regardless of whether it isassociated with the currently open test.
A) True
B) False
74. You can work with multiple documents (test, component, orapplication area, function libraries) using the…… dialog box
A) Panes
B) Display
C) Show
D) Windows
75. Use of step generator

a.       To add wait property
b.       To insert a step in the script
c.       To insert step for an action
d.       Both b & c

 

QTP Questions


                            QTP Test 1

1. The toolbar enables you to view the details of an individual action or the entire test flow is

a.                 Testing toolbar
b.                 None of the above
c.                  Action toolbar
d.                 Test Pane

2. The key that is used to Start/End analog recording mode?

a.                 F3
b.                 SHIFT+ALT+F3
c.                  CTRL+SHIFT+F3
d.                 F10
3. To use a specific property to identify your object, but that property is not listed in the properties list. Then how do you identify that object?

a.                 Add the specific property to the list
b.                 Use the Default property
c.                  Use some other property to identify your object
4. The list of test objects and their properties and values are stored in the

a.                 Object Repository
b.                 Object Identification
5. To retrieve the current property value of the objects in your application during the run session.

a.                 GetVisibleText
b.                 GetROProperty
c.                  SetROProperty
d.                 GetTOProperty
6. Bitmap checkpoint is supported in VB environment.

a.                 True
b.                 False
7. What is the shortcut key that is used for a Standard Checkpoint?

a.                 F12
b.                 F2
c.                  F10
d.                 F7
8. To compares the values of the specified property during a run session with the values stored for the same test object property within the test.

a.                 Checkpoint
b.                 All the above
c.                  Output Value
d.                 Compare the object property
9. You will use the recording mode for an object not recognized by QuickTest.

a.                 Low-Level Recording Mode
b.                 Normal recording Mode
c.                  Analog Mode
10. The statement that calls the recorded analog file is

a.                 RunAnalog
b.                 CallAnalog
c.                  ExecuteAnalog
11. An action can be called by other tests or actions is

a.                 Call Action
b.                 Split Action
c.                  Reusable Action
12. You can replace the page in your Active Screen tab
a.                 False
b.                 True
13. QuickTest adds a checkpoint statement in the Expert View as
a.                 Check Checkpoint
b.                 Checkpoint
14. A Checkpoint checks that a text string is displayed within a defined area in a Windows application is

a.                 Accessibility
b.                 Text Area
c.                  Standard
d.                 Text
15. In ActiveX environment an “Accessibility checkpoint” is supported.

a.                 No
b.                 Yes
16. Can we get the execution time for an action in a Test.

a.                 Yes
b.                 No
17. The command used to retrieve data from excel sheet is

a.                 Set ab = Connection("srcfilepath ") , Set ws = ab.getdata(sheetid)
b.                 Set ab = CreateObject("srcfilepath ") , Set ws = ab.getsheet(sheetid)
c.                  Set ab = GetObject("srcfilepath") , Set ws = ab.worksheets(sheetid)
18. The method used to get data from HTML Table is

a.                 GetData(Row,Col)
b.                 GetRowValue(Rowid,Colname)
c.                  GetCellData (Row,Col)
19. The Command used to insert the transactions in test is,

a.                 StartTransaction(“Name”), EndTransaction(“Name”)
b.                 Services.StartTransaction "Name", Services.EndTransaction "Name"
c.                  StartTransaction.services "Name”, EndTransaction.services "Name”
20. A step in which one or more values are captured at a specific point in your test and stored for the duration of the run session is

a.                 Output Value
b.                 Checkpoints
c.                  Active Screen
21. QuickTest can detects an application crash and activate a defined recovery scenario to continue the run session.

a.                 True
b.                 false
22. In Batch Test process, the test list are saved in file format as,

a.                 *.mtb
b.                 *.mts
c.                  *.mbt
d.                 *.mtr
23. The command used to invoke other application from QTP,

a.                 InvokeApplication
b.                 SystemUtil.Run
c.                  Run
d.                 Both b & c
e.                 Both a & b
24. Can we add external library files in QTP?

a.                 No
b.                 Yes
25. The method that explicitly activates the recovery scenario mechanism is,

a.                 recovery.activate
b.                 enable
c.                  recovery.enable
d.                 activate
26. The method used for sending information to the test results.

a.                 Reporter.log()
b.                 Reporter.reportevent()
c.                  Reporter.msgbox()
d.                 Reporter.report()
27. To terminate an application that is not responding we use,

a.                 SystemUtil.terminate
b.                 SystemUtil.Stop
c.                  SystemUtil.CloseProcessByName
28. The recovery mechanism does not handle triggers that occur in the last step of a test

a.                 false
b.                 True
29. We can add Test object methods, function calls into the Test using

a.                 Function generator
b.                 Step generator
c.                  Object repository
30. The method that adds to the test while implementing Synchronization is

a.                 Synchronize
b.                 Wait
c.                  WaitProperty
d.                 Pause
31. The mechanism used to identify objects during run session is

a.                 Recovery scenario
b.                 Smart identification
c.                  Handling object
32. Post-recovery test run options specifies

a.                 how to continue the run session after QTP identify the event
b.                 errors while running
c.                  recovery scenario during a run session
33. The action that can be called multiple times by the test as well as by other tests is called

a.                 non-reusable action
b.                 Reusable action
c.                  External action
34. QuickTest supports virtual object for anolog or low-level recording.

a.                 False
b.                 True
35. The command used to connect with Database is

a.                 Createobject(“connectivity name”)
b.                 dbconnect(“connectivity name”)
c.                  open(“connectivity name”)
d.                 None of the above
36. The method used to retrieve the folders is

a.                 FileSystemObject.Getfolder()
b.                 FileSystemObject.selectfolder()
c.                  FileSystemObject.retrievefolder()
37. The method used to compare 2 XML files is:

a.                 XMLfile1.compare(XMLfile2)
b.                 XMLcompare(file1,file2)
c.                  compare(XMLfile1,XMLfile2)
38. Can we change name of checkpoint?

a.                 No
b.                 Yes
39. The QTP script files are stored in the extension of

a.                 *.mts
b.                 *.usr
c.                  *.mtr
d.                 *.vbs
40. The method used to register the user-defined function with test object is

a.                 setFunc()
b.                 RegisterUserFunc()
c.                  RegisterFunc()
41. The method used to open the specified URL in a browser is

a.                 openURL()
b.                 navigateURL()
c.                  navigate()
42. The 3 Parameter types available in data driver is

a.                 DataTable,Environment,Random number
b.                 DataTable,random number,unique
c.                  environment,string,numeric
43. The method added to the test while parameterizing is

a.                 get Data (variable, dtGlobalSheet)
b.                 get DataTable(variable, dtGlobalSheet)
c.                  Set Data(variable, dtGlobalSheet)
d.                 Set DataTable(variable, dtGlobalSheet)
44. The length of the array can be get by the method

a.                 length(array)
b.                 ubound(array)
c.                  count(array)
45. The method used to get the count value of list box or combo box os

a.                 GetItemsCount
b.                 GetCount
c.                  GetItemCount
46. Can we parameterize the checkpoints properties?

a.                 No
b.                 Yes
47. In data base check point we can not set the expected value from the test?

a.                 True
b.                 False
48. The checkpoint used to check the alt attribute exists for all relevant objects (such as images) is

a.                 DataBase CheckPoint
b.                 Accessibility checkpoint
c.                  Bitmap checkpoint
d.                 Standard checkpoint
49. The method used to continue the test execution after getting run-time error is

a.                 On Error Resume Next
b.                 On Error Raise Next
c.                  On Error Next

50. . ‘Browser navigation timeout’ is in which tab of Test Settings (File->Settings) window.
A) Properties
B) Resources
C) Web
D) Web Settings
                                                   

 Answer


 QTP Answer
  1. C
  2. B
  3. A
  4. A
  5. B
  6. A
  7. A
  8. A
  9. A
  10. A
  11. C
  12. B
  13. A
  14. B
  15. A
  16. A
  17. B
  18. C
  19. B
  20. A
  21. A
  22. A
  23. E
  24. B
  25. A
  26. B
  27. C
  28. B
  29. A
  30. C
  31. B
  32. A
  33. B
  34. A
  35. A
  36. A
  37. C
  38. A
  39. A
  40. B
  41. C
  42. A
  43. D
  44. B
  45. A
  46. B
  47. B
  48. B
  49. A
  50. A