Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Keywords:
QTP, Quick Test, Quick Test Pro, QTP FAQ, QTP Tips
Introduction:
This document gives answer to some FAQ and also provides tips on certain aspects
of QTP.
Data Table
Usage:
DataTable("Column Name",dtGlobalSheet) for Global data sheet
DataTable("Column Name",dtLocalSheet) for Local data sheet
If we change any thing in the Data Table at Run-Time the data is changed only in the
run-time data table. The run-time data table is accessible only
through then test result. The run-time data table can also be exported using
DataTable.Export or DataTable.ExportSheet
code:
code:
Set xlApp=Createobject("Excel.Application")
set xlWorkBook=xlApp.workbooks.add
set xlWorkSheet=xlWorkbook.worksheets.add
xlWorkSheet.Range("A1:B10").interior.colorindex = 34 'Change the
color of the cells
xlWorkSheet.Range("A1:A10").value="text" 'Will set values of all
10 rows to "text"
xlWorkSheet.Cells(1,1).value="Text" 'Will set the value of first
row and first col
xlWorkbook.SaveAs "C:\Test.xls"
xlWorkBook.Close
Set xlWorkSheet=Nothing
Set xlWorkBook=Nothing
set xlApp=Nothing
SMART Identification
Smart Identification is nothing but an algorithm used by QTP when it is not able to
recognize one of the object. A very generic example as per the
QTP manual would be, A photograph of a 8 year old girl and boy and QTP records
identification properties of that girl when she was 8, now when
both are 10 years old then QTP would not be able to recognize the girl. But there is
something that is still the same, that is there is only one girl in
are able to recognize the objects that are dynamic or inconsistent in their
properties. When the script has been created, the SI should be enabled,
so that the script does not fail in case of small changes. But the developer of
the script should always check for the test results to verify if the SI
Descriptive Programming
Descriptive programming is nothing but a technique using which operations
can be performed on the AUT object which are not present in
C:\Tarun C backup\
Desktop\BOK\On Kshop\Descriptive Programming in QTP\Descriptiv
the OR. For more details refer to my BOK on DP
Recovery Scenarios
"object is disabled" or "object not found". A test case have more then one
scenario associated with it and also have the priority or order in which it
should be checked.
recovery function defined in library file or restart windows. You can have a
series of all the specified actions.
Post-recovery operation: Basically defined what need to be done after the
recovery action has been taken. It could be to repeat the step, move
QTP script but could occur in the world outside QTP, again the example would
be "out of paper", as this error is caused by printer device driver. "On
error resume next" should be used when you know if an error is expected and
don’t want to raise it, you may want to have different actions
depending upon the error that occurred. Use err.number & err.description to
get more details about the error.
function to include a file at run-time also. To associate a library file with your
script go to Test->Settings... and add your library file to resources
tab.
When to associate a library file with a test and when to use execute file?
When we associate a library file with the test, then all the functions within
that library are available to all the actions present in the test. But
when we use Executefile function to load a library file, then the function are
available in the action that called executefile. By associated a library to
runs because while loading the script on startup QTP executes all the code on
the global scope. We can use executefile in a library file associated
with the test to load dynamic files and they will be available to all the actions
in the test.
What is the difference between Test Objects and Run Time Objects ?
Test objects are basic and generic objects that QTP recognize. Run time
object means the actual object to which a test object maps.
associated with it while a function can't. A function is just lines of code with
some/none parameters and a single return value while an action can
pure VB Script, so this should be done in a function and not an action. Code
specific to QTP can also be put into an function using DP. Decision of
What is checkpoint?
Checkpoint is basically a point in the test which validates for truthfulness of a
specific things in the AUT. There are different types of
checkpoints depending on the type of data that needs to be tested in the AUT.
It can be text, image/bitmap, attributes, XML etc....
What's the difference between a checkpoint and output value?
Checkpoint only checks for the specific attribute of an object in AUT while
Output value can output those attributes value to a column in data
table.
chk_PassFail = Browser(...).Page(...).WebEdit(...).Check
(Checkpoint("Check1"))
if chk_PassFail then
MsgBox "Check Point passed"
else
MsgBox "Check Point failed"
end if
Environment
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "DRIVER={Microsoft ODBC for
Oracle};UID=<UID>;PWD=<PWD>"
objRecordset.CursorLocation = adUseClient
objRecordset.CursorType = adopenstatic
objRecordset.LockType = adlockoptimistic
ObjRecordset.Source="select field1,field2 from testTable"
ObjRecordset.ActiveConnection=ObjConnection
ObjRecordset.Open 'This will execute your Query
If ObjRecordset.recordcount>0 then
Field1 = ObjRecordset("Field1").Value
Field2 = ObjRecordset("Field2").Value
End if