Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is descriptive programming in QTP and what is
environment variable in QTP? where we store and what is its use?

Answer Posted / hari

'************************************************
LOCATE *****************************************

Environment.LoadFromFile "[QualityCenter] Subject\WSOP8012-
SEP 08 CL\WSOP Automation Framework\Library
Function\Environment.ini"

GUILocate=Environment("GUILocate")
LocateSheet=Environment("LocateSheet")
RateSheet=Environment("RateSheet")
ZipCode=Environment("ZipCode")


'************************************************Locate
Object Creation*********************************************

CheckStatus(GUILocate)
Set Main=CreateruntimeObject(LocateSheet,"Main")

If Window(Main).Exist(0) Then
Else
Set Main=Alternateobject
(LocateSheet, "Main")
End If
Set Text1=CreateruntimeObject(LocateSheet,"Text1")
Set Locate=CreateruntimeObject(LocateSheet,"Locate")
Set UCMain=CreateruntimeObject(LocateSheet,"UCMain")
Set Dialogbutton=CreateruntimeObject
(LocateSheet,"Dialogbutton")
Set Clearf =CreateruntimeObject(LocateSheet,"Clearf ")
Set LocTable =CreateruntimeObject(LocateSheet,"LocTable ")
Set DialogBox=CreateruntimeObject(LocateSheet,"DialogBox")
Set btnLoc=CreateruntimeObject(LocateSheet,"btnLoc")
Set Pg=CreateruntimeObject(LocateSheet,"Pg")
Set RateTab=CreateruntimeObject(RateSheet,"RateTab")
Set btnHelp=CreateruntimeObject(LocateSheet,"lblHelp")
Set HelpMain=CreateruntimeObject(LocateSheet,"HelpMain")
Set HelpPage=CreateruntimeObject(LocateSheet,"HelpPage")
Set lblHelpClose=CreateruntimeObject
(LocateSheet,"lblHelpClose")
Set Web=CreateruntimeObject(LocateSheet,"Web")
Set HelpWin=CreateruntimeObject(LocateSheet,"HelpWin")


Window(Main).Activate
var=Window(Main).Page(Pg).ActiveX
(UCMain).SwfButton(btnLoc).Exist
If var Then
Window(Main).Page
(Pg).ActiveX(UCMain).SwfButton(btnLoc).Click'click on the
Locate tab
else
Msgbox "Locate Screen is not opened for
GUI Testing"

ExitTest
End If


' //////////////////////////////////////////////////////////
///////////////////////// code starts
here ///////////////////////////////////////////////
////////////////////////////////

'-----------------------------------------------------------
------ Connection Database -------------------------------
-----------------------------------------------

Set conn= fgGetConnection

set recset=createobject
("ADODB.RECORDSET")

recset.CursorType = 3

qry="Select
ObjectType,Objval,Objroproperty,Expected from
[Locate_GUI$] where ObjectType is not null and
TestStatus='Y' "

recset.Open qry, conn

cntre=recset.RecordCount


'------------------------------------------------------
Function Calls ---------------------------------------------
-----------------------------------------------
Call LocateMenu()
Call TestSet()
Call FontCheck()
Call BusinessValidation()
Call LocateTable()
Call HelpWindowChecking()

'-----------------------------------------------------------
------ Fetch GUI Datas from Database ----------------------
--------------------------------------------------------
Public function LocateMenu()

var=Window(Main).Page(Pg).ActiveX(UCMain).SwfButton
(btnLoc).Exist

If var Then

Window(Main).Page(Pg).ActiveX
(UCMain).SwfButton(btnLoc).Click

Window(Main).ActiveX
(UCMain).SwfLabel(Clearf).Click'click on thed Rate button
of the menu

Call UpdateResult
("Locate_Menu","Passed")



else

Call UpdateResult
("Locate_Menu","Failed")

Window(Main).Page(Pg).ActiveX
(UCMain).SwfButton(btnLoc).Click

End If
End Function

Public function TestSet()

'-------------------
--------------------------------- Checking whether the
webelements are in the window ---------------------------
--------------------------------------------------------
For i=1 to cntre

objecttype= recset.Fields(0)

objeval= recset.Fields(1)

objpty= recset.Fields(2)

Expected= recset.Fields(3)

Select Case objecttype


Case "SwfEdit"


Actual= Window(Main).Page(Pg).ActiveX
(UCMain).SwfEdit("swfname:="&objeval).Getroproperty(objpty)


Case "SwfButton"


Actual= Window(Main).Page
(Pg).ActiveX(UCMain).SwfButton("swfname
path:="&objeval).Getroproperty(objpty)

Case "SwfLabel"


Actual= Window(Main).Page(Pg).ActiveX
(UCMain).SwfLabel("swfname:="&objeval).Getroproperty(objpty)


Case "SwfTable"


Actual= Window(Main).Page(Pg).ActiveX
(UCMain).swftable("swfname path:="&objeval).Exist

End Select


Call Compare(Expected,
Actual,objeval,objpty)

recset.movenext
Next

End Function
'-----------------------------------------------------------
---------- Comparison Function -------------------------
------------------------------------------------------------
---------------------------
'comparing the expected result & Acutal result

Function Compare(Expected,Actual,ObjectVal,Pty)

If Trim(Expected)=Trim
(Actual) Then


Call ResultupdateGUI
(conn,GUILocate,"Locate_Screen","Passed","Executed",ObjectVa
l,Pty)
Else


Call ResultupdateGUI
(conn,GUILocate,"Locate_Screen","Failed","Executed",ObjectVa
l,Pty)
end if
End Function



'-----------------------------------------------------------
--- Compare Tab Font Function -------------------------
----------------------------------------------------
'Clicking on other tab and clicking the Locate tab again
for checking the font validation
Function FontCheck()



wdth=Window(Main).Page(Pg).ActiveX(UCMain).SwfButton
(btnLoc).GetROProperty("Width")


var= Window(Main).Page(Pg).ActiveX(UCMain).SwfButton
(RateTab).Exist

If var Then

Window(Main).Page(Pg).ActiveX
(UCMain).SwfButton(RateTab).Click



var1=Window(Main).Page(Pg).ActiveX
(UCMain).SwfButton(btnLoc).Exist

If var1 Then


Window(Main).Page(Pg).ActiveX(UCMain).SwfButton
(btnLoc).Click


wdth1=Window(Main).Page(Pg).ActiveX
(UCMain).SwfButton(btnLoc).GetROProperty("Width")

If
wdth=wdth1 Then


call UpdateResult
("Locate_Tab_Font","Passed")

else


call UpdateResult
("Locate_Tab_Font","Failed")

End
If

End IF


End
IF
End Function


'-----------------------------------------------------------
------------- Result update on excel sheets ------------
--------------------------------------------------
'Update the excel sheet for functional related GUI
testcases.

public Function UpdateResult(Testset,Result)
Call Resultupdate
(conn,GUILocate,Testset,1,Result,"Executed")
END Function


'-----------------------------------------------------------
------------- Business Validation --------------------
------------------------------------------

Function BusinessValidation()
Window
(Main).ActiveX(UCMain).SwfEdit(Text1).Set ""
Window
(Main).ActiveX(UCMain).SwfButton(Locate).Click
wait(1)

var = Window(Main).Dialog(DialogBox).exist(0)
If var Then

Window(Main).Dialog(DialogBox).WinButton
(Dialogbutton).Click

Call UpdateResult
("Locate_Business_Validation","Passed")

Else

Call UpdateResult
("Locate_Business_Validation","Failed")
End
IF
End Function

'-----------------------------------------------------------
------------- Textbox Validation & web service ----------
----------------------------------------------------
'checking for the textbox setting value & webservice error
message

Function LocateTable()

i=1
'ZipCode=fgGetData
(conn, "L_Zipcode", GUILocate,i, "Locate_TestData") ' can
use the environment variable for this.
Window(Main).ActiveX(UCMain).SwfEdit
(Text1).Set ZipCode

val=Window(Main).ActiveX
(UCMain).SwfEdit(Text1).GetROProperty("Text")
If val=ZipCode Then

Call UpdateResult("Locate_Textbox_Set","Passed")
else

Call UpdateResult("Locate_Textbox_Set","Failed")
End If
Window(Main).ActiveX(UCMain).SwfButton
(Locate).Click
wait
(1)

var = Window(Main).Dialog(DialogBox).exist(0)

If var Then

Window(Main).Dialog
(DialogBox).WinButton(Dialogbutton).Click

Call UpdateResult
("Locate_WebService_Error","Passed")

else

Call
LocateCountRows()

' Call
TableHeader() 'need to complete

End IF
End Function



'**********************Count the Rows Displayed After
Entering the Zip Code on Find Location
Screen****'**************

Public Function LocateCountRows()
var=Window(Main).ActiveX
(UCMain).swftable(LocTable).RowCount
If var<4 Then
Call UpdateResult
("Locate_Table_Values","Passed")
else
Call UpdateResult
("Locate_Table_Values","Passed")
End If
End Function


'-----------------------------------------------------------
------------- Table values ----------------------------
----------------------------------
'checking for the Table header values.
Function TableHeader()
var=Window(Main).ActiveX(UCMain).swftable
(LocTable).GetCellData(0,0)

MsgBox var
End Function

'-----------------------------------------------------------
------------- Help Window ----------------------------
----------------------------------

Function HelpWindowChecking()
Window
(Main).Page(Pg).ActiveX(UCMain).SwfButton(btnLoc).Click
Window
(Main).Page(Pg).ActiveX(UCMain).SwfLabel(btnHelp).Click
var=Window
(Main).SwfWindow(HelpMain).Exist(1)
If var Then

Call UpdateResult
("Locate_HelpWindow_Exist","Passed")
else

Call UpdateResult
("Locate_HelpWindow_Exist","Failed")
End If

valText=Window
(Main).Window(HelpWin).WebElement(Web).Object.innertext
HelpText=fgGetData
(conn, "L_Text", GUILocate,1, "Locate_Help_Text_Data")
If Trim(valText)
=trim(HelpText) Then
Call
UpdateResult("Locate_Help_Text","Passed")
else
Call
UpdateResult("Locate_Help_Text","Failed")
End If

Window(Main).SwfWindow
(HelpMain).SwfLabel(lblHelpClose).Click
var1=Window(Main).SwfWindow
(HelpMain).Exist(1)
If var1 Then

Call UpdateResult
("Locate_Help_Close","Failed")
else

Call UpdateResult
("Locate_Help_Close","Passed")
End If
End Function

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which object is used to work with the excel sheets in the vbscript language and what statement is used to create this object?

957


Explain about scrrun.dll?

949


What is vbscript language used for and which earlier language is it modeled upon?

998


Explain different types of segment?

1028


How you can call vbscript functions?

1074


Explain about tristate constants?

1014


Hello Friends , I am the new joinner of this website. I am working with Sapient ,Gurgoan I would like to ask few qurries regarding the QTP Tool of (Testing) Currently working on QTP Tool . I would like to no learn VB Script can u name some Books which i get in market. And a small issue in QTP I had 2 users right i have to login and send the document from this user to second user right. when i am send this doc some contendId number generates right. now i am loging into second user and i have to search for that contentId right i found it now i dont want to accept the document so i had an opption of check out ok i have to click on check out my QTP Code is like this Browser(" ").Page(" ").WebTable(" ").ChildItem (3,5,"Image",0).click Browser(" ").Page(" ").Link("ChecK Out").Click i new this code is perfectly right but when i am run the script i have to click on that particular contentId and click on check out but now the Problem is started the error is the document has been already checked out remeber every time my content id changes means it is the new contentId which is not been used atleast once Please help me out in this issue i am in big trouble

2457


What is the use of the recordset object and which statement is used to create such an object?

969


please can you help me to get a code of flames using a visual basic 6

1776


how to increase the values in text box in a given text box increament by two values by clicking on button

2180


What are the 2 ways to pass a value to the function?

950


Which function allows you to instantiate an object given its programmatic identifier or progid?

1021


When does ‘on click of button’ event gets triggered in the vbscript language?

993


How strcomp function works?

1076


what is inner join? what is outer join? what is a constraint? tell me about rdbms? tell me about acid properties?

1905