Reusable action:An action that can be called multiple times by the test with which it is stored(the local test) as well as by other tests....
External action: A reusable action stored in another test.....
External action: A reusable action stored in another test.....
I think it might be a Pagination ..rite !
This can be handled with a For loop ..
for ex:Searching a entity throughout multiple pages
for i = 0 to lastpage
<your search code>
Browser("ss").page("SSS").link("Reclinknext").click
next
This can be handled with a For loop ..
for ex:Searching a entity throughout multiple pages
for i = 0 to lastpage
<your search code>
Browser("ss").page("SSS").link("Reclinknext").click
next
If your test script has got only one Action there is not much of a difference in choosing the datasheets , if ur test script contains different action for different functionalities then the global & local data sheet comes into picture
Ya you can record remote application provided if accessing application through the local browser not through remoter like in case of citrix but still if you are unable to record then it advisable to install qtp and application on the same machine to maintain the same session.
For this to do , u have to use the "GETROproperty" of the link.sotre it in a string and compare it with the CASENUM.
Since i dont know the page name ,browser name , i will leave empty.
Code:
Dim st
st=Browser(" ").page(" ").webelement("LAKE IN THE HILLS VS.").getRoProperty("innertext")
if (instr(st,CASENUM) > 0) then
msgbox "PASSED"
else
msgbox "Failed"
end if
here I gave msgbox to display them, u convert them according to ur application.
Onething important here is the getRO property.
Since i dont know the page name ,browser name , i will leave empty.
Code:
Dim st
st=Browser(" ").page(" ").webelement("LAKE IN THE HILLS VS.").getRoProperty("innertext")
if (instr(st,CASENUM) > 0) then
msgbox "PASSED"
else
msgbox "Failed"
end if
here I gave msgbox to display them, u convert them according to ur application.
Onething important here is the getRO property.
HITHIS BELOW CODE IS FOR VALIDATING TODAYS DATEJUST COPY AND PASTE IN EXPERT VIEW. AND RUN.AS DATE CHAGES EVERY DAY IT GIVES THE CORRECT DATE.Function todaydate'Return current monthCurr_Month = Month(Now)a=len(Curr_Month)If a=1 ThenCurr_Month = "0"&Curr_MonthEnd If'Return current dateCurr_Day = Day(Now)b=len(Curr_Day)If b=1 ThenCurr_Day = "0"&Curr_DayEnd If'Return current yearCurr_Year =Year(Now)c=Len(Curr_Year)If c=4 ThenCurr_Year = Right (Curr_Year, 2)End If todaydate = Curr_Month&"/" & Curr_Day &"/" & Curr_YearEnd Function 'Function callmsgbox todaydateGOOD LUCKVIDYA
VBS file is visible in notepad only not in QTP. we can?add .vbs files in QTP, test menu->setting->Resource Tab.
To datadrive we have to parameterize.i.e. we have to make the constant value as parameter, so that in each iteraration(cycle) it takes a value that is supplied in run-time datatable. Through parameterization only we can drive a transaction(action) with different sets of data. You know running the script with the same set of data several times is not suggestable, & it's also of no use.
To get the text from the object we can use
getRoProperty.
Ex:
Window("Flight Reservation").WinEdit("Name:").GetROProperty("text")
To Close the Web application we can use
Browser("Google").Close
getRoProperty.
Ex:
Window("Flight Reservation").WinEdit("Name:").GetROProperty("text")
To Close the Web application we can use
Browser("Google").Close
To export the object repository [OR] follow the below navigation.
in the Menu bar select
Tools (option) >object repository .Then u can view
OR .and some more detalis about object repository which consists of
1.Logical name: the name that Quick Test assigns to the object
2.Class: The class of the object
3.Find:By clicking on this u can find a property or value of object
4.Replace:here u can modify a property or value of object
5.Add/Remove property:which lists the properties that can be used to
identify the object
6.object spy:using this u can view the properties of any object in an
open window
7.Enable smart identification:indicates whether or not Quick Test uses
smart identification to identify the object
during the test run if it is not able to
identify the object using the test object
description.
in the Menu bar select
Tools (option) >object repository .Then u can view
OR .and some more detalis about object repository which consists of
1.Logical name: the name that Quick Test assigns to the object
2.Class: The class of the object
3.Find:By clicking on this u can find a property or value of object
4.Replace:here u can modify a property or value of object
5.Add/Remove property:which lists the properties that can be used to
identify the object
6.object spy:using this u can view the properties of any object in an
open window
7.Enable smart identification:indicates whether or not Quick Test uses
smart identification to identify the object
during the test run if it is not able to
identify the object using the test object
description.
DataTable.ImportSheet(FileName, SheetSource, SheetDest) FileName (String): The full path of the Excel table from which you want to import a sheet. SheetSource (Variant): The name or index of the sheet in the file that you want to import. Index values begin with 1. SheetDest (Variant): The name or index of the sheet in the Data Table that you want to replace with the SheetSource. Index values begin with 1. Example The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table. DataTable.ImportSheet "C: ame.xls" ,1 ,"name"
There are four types of parameters: Test, action or component parameters enable you to use values passed from your test or component, or values from other actions in your test. Data Table parameters enable you to create a data-driven test (or action) that runs several times using the data you supply. In each repetition, or iteration, Quick Test uses a different value from the Data Table. Environment variable parameters enable you to use variable values from other sources during the run session. These may be values you supply, or values that Quick Test generates for you based on conditions and options you choose. Random number parameters enable you to insert random numbers as values in your test or component. For example, to check how your application handles small and large ticket orders, you can have Quick Test generate a random number and insert it in a number of tickets edit field.
i am giveing examples so that u can under sand easily.
1).example for recordcount
Set dbconn=createobject("adodb.connection")
dbconn.open "dsn=xxx"
Set objRecordset=createobject("ADODB.Recordset")
objRecordset.open "select * from logintable",dbconn,1,3
msgbox objRecordset.recordcount
2).for field names
For each x in objRecordset.fields
msgbox (x.name)
Next
1).example for recordcount
Set dbconn=createobject("adodb.connection")
dbconn.open "dsn=xxx"
Set objRecordset=createobject("ADODB.Recordset")
objRecordset.open "select * from logintable",dbconn,1,3
msgbox objRecordset.recordcount
2).for field names
For each x in objRecordset.fields
msgbox (x.name)
Next
Built-in-functions:
dim myleftname
myleftname = "Vinothkumar"
msgbox left(myleftname,6)
External Functions ;
This requires the user to add the library in the Test >> settings >> Resources and call this lib
ex: mylib.vbs
function hi()
dim myleftname
myleftname = "Vinothkumar"
msgbox left(myleftname,6)
End function
In QTP call like this;
hi
"call" command is optional.
dim myleftname
myleftname = "Vinothkumar"
msgbox left(myleftname,6)
External Functions ;
This requires the user to add the library in the Test >> settings >> Resources and call this lib
ex: mylib.vbs
function hi()
dim myleftname
myleftname = "Vinothkumar"
msgbox left(myleftname,6)
End function
In QTP call like this;
hi
"call" command is optional.
There are two types of environment variables
1)Builtin
2)User defined
1)Builtin
2)User defined
No comments:
Post a Comment