Tuesday, August 19, 2008

How to call a function from a action to another action

' create a environment variable called my_var
'Action where to want to call the function i ,e ex: -Action2

environment("my_var")="login"
runaction "Action1",environment("my_var")

'Action1

If environment("my_var")="login" Then
Call func_login()
End If


Regards,

PavanKumar Nandagiri..............

Tuesday, August 5, 2008

To load the object repository

Dim objQTP
Dim QTP_OR
Set objQTP = CreateObject("QuickTest.Application")
Set QTP_OR = objQTP.Test.Actions("Action2").ObjectRepositories
If QTP_OR.Find("D:\pavan\Test1\new.tsr") = -1 Then
QTP_OR.Add "D:\pavan\Test1\new.tsr", 1
End If
Set QTP_OR = Nothing
Set objQTP = Nothing


Regards,

Pavankumar Nandagiri..............

To find the child objects & their class in the application

Dim oDesc
Set oDesc = Description.Create()
Set parent = Window("Text:=Flight Reservation")
Set children = parent. ChildObjects (oDesc)
co = children.Count
MsgBox co
k=0
For j = 1 to (co-1)
cln= children(j).GetROProperty("micclass")
Select Case(cln)
case("WinEdit")
Objpr = children(j).GetROProperty("attached text")
case("WinButton")
Objpr = children(j).GetROProperty("text")
case("WinComboBox")
Objpr = children(j).GetROProperty("attached text")
case("AciveX")
Objpr = children(j).GetROProperty("Progid")
case("WinObject")
Objpr = children(j).GetROProperty("text")
case("Static")
Objpr = children(j).GetROProperty("text")
End Select
If Objpr <> "" Then

msgbox cls & " " & Objpr
End If

Objpr = ""
Next
MsgBox k


Regards,

PavanKumar Nandagiri.....................

Deleting the dupliacte data from Excel sheet

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True

Set objWorkbook = objExcel.Workbooks.Open("D:\Qtp_ framewrk_Keyworddriven\16June_Final_Test_Scenarios_phpcollab.xls")

nor = objExcel.sheets(3).usedrange.rows.count

for i = 1 to nor
cd = objExcel.sheets(3).Cells(i, 1)
j = i+1
do Until objExcel.Cells(j, 1).Value = ""
cd1 = objExcel.sheets(3).Cells(j, 1)
if Ucase(trim(cd)) = Ucase(trim(cd1)) then
Set objRange = objExcel.Cells(j, 1).EntireRow
objRange.Delete
j = j-1
End If
j = j + 1
Loop
Next


Regards,

PavanKumar Nandagiri...........

Google Search

Google